Differences From Artifact [dfa9d24738]:
- File generic/tclDate.c — part of check-in [5371ea9f5f] at 2018-05-29 17:12:28 on branch sebres-8-6-clock-speedup-cr2 — try to fix GMT+0000, etc. **still wrong**, because of "GMT+1" and because of longest match "00:00 GMT +1000 days" (in this case "days" == "1 day")... % clock scan "+1000 days" -base 100000000 -gmt 1 186364800 % clock scan "00:00 GMT +1000 days" -base 100000000 -gmt 1 100015200 % clock format [clock scan "GMT+10"] Thu Sep 14 19:54:16 CEST 2017 % clock format [clock scan "GMT+1000"] Thu Sep 14 10:04:20 CEST 2017 % clock format [clock scan "GMT+10"] Thu Sep 14 19:54:23 CEST 2017 % clock format [clock scan "GMT-1000"] Fri Sep 15 06:04:39 CEST 2017 % (user: sebres size: 73924)
To Artifact [5d2c58749b]:
- File generic/tclDate.c — part of check-in [27ca927b8f] at 2018-05-29 17:14:36 on branch sebres-8-6-clock-speedup-cr2 — FreeScan: rewritten lexer rules and some tokens for better space recognition; fewer conflicts (shift/reduce, reduce/reduce); differentiate between TZ like "GMT+1" and relative offsets "GMT +1 day", etc.; test-cases extended for new cases. (user: sebres size: 78459)
| ︙ | ︙ | |||
95 96 97 98 99 100 101 102 103 104 105 106 107 108 | * doesn't like that, and complains. Tell it to shut up. */ #ifdef _MSC_VER #pragma warning( disable : 4102 ) #endif /* _MSC_VER */ /* * yyparse will accept a 'struct DateInfo' as its parameter; that's where the * parsed fields will be returned. */ #include "tclDate.h" | > > > > | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | * doesn't like that, and complains. Tell it to shut up. */ #ifdef _MSC_VER #pragma warning( disable : 4102 ) #endif /* _MSC_VER */ #if 0 #define YYDEBUG 1 #endif /* * yyparse will accept a 'struct DateInfo' as its parameter; that's where the * parsed fields will be returned. */ #include "tclDate.h" |
| ︙ | ︙ | |||
175 176 177 178 179 180 181 |
tDAYZONE = 260,
tID = 261,
tMERIDIAN = 262,
tMONTH = 263,
tMONTH_UNIT = 264,
tSTARDATE = 265,
tSEC_UNIT = 266,
| | | | > | | | | | > | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
tDAYZONE = 260,
tID = 261,
tMERIDIAN = 262,
tMONTH = 263,
tMONTH_UNIT = 264,
tSTARDATE = 265,
tSEC_UNIT = 266,
tUNUMBER = 267,
tZONE = 268,
tZONEwO4 = 269,
tZONEwO2 = 270,
tEPOCH = 271,
tDST = 272,
tISOBASE = 273,
tDAY_UNIT = 274,
tNEXT = 275,
SP = 276
};
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
|
| ︙ | ︙ | |||
451 452 453 454 455 456 457 |
while (YYID (0))
#endif
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
| | | | | | | | | | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
while (YYID (0))
#endif
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 116
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 28
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 18
/* YYNRULES -- Number of rules. */
#define YYNRULES 66
/* YYNRULES -- Number of states. */
#define YYNSTATES 106
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 276
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 27, 23, 25, 26, 24, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 22, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
| ︙ | ︙ | |||
499 500 501 502 503 504 505 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
| | | | | | | | > | | | | | | | | > > | | | | | > | | | > | | | | | | | > | | | | | | | < | | | > | | > | | > | | | | | | > | > | | | | < > | | | | | | | | | > | | > | | | | | | | > > | > | | > | < | | | | > > | > | | > | < | | | > | | | > > | | < | 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21
};
#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
YYRHS. */
static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 4, 7, 11, 13, 15, 17, 19,
21, 23, 25, 27, 29, 32, 37, 44, 47, 49,
51, 55, 59, 62, 64, 67, 69, 72, 75, 80,
84, 87, 91, 97, 99, 105, 111, 114, 119, 122,
124, 128, 131, 135, 139, 142, 150, 158, 162, 167,
170, 172, 177, 181, 184, 187, 191, 193, 195, 197,
199, 201, 203, 205, 207, 209, 210
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
29, 0, -1, -1, 29, 30, -1, 29, 21, 30,
-1, 31, -1, 32, -1, 35, -1, 36, -1, 34,
-1, 39, -1, 37, -1, 38, -1, 44, -1, 12,
7, -1, 12, 22, 12, 45, -1, 12, 22, 12,
22, 12, 45, -1, 13, 17, -1, 13, -1, 5,
-1, 14, 41, 43, -1, 15, 41, 43, -1, 41,
43, -1, 23, -1, 23, 21, -1, 4, -1, 4,
33, -1, 12, 4, -1, 41, 21, 12, 4, -1,
41, 12, 4, -1, 20, 4, -1, 12, 24, 12,
-1, 12, 24, 12, 24, 12, -1, 18, -1, 12,
25, 8, 25, 12, -1, 12, 25, 12, 25, 12,
-1, 8, 12, -1, 8, 12, 33, 12, -1, 12,
8, -1, 16, -1, 12, 8, 12, -1, 20, 8,
-1, 20, 12, 8, -1, 18, 13, 18, -1, 18,
18, -1, 18, 21, 12, 22, 12, 22, 12, -1,
18, 13, 12, 22, 12, 22, 12, -1, 18, 21,
18, -1, 10, 43, 26, 12, -1, 40, 3, -1,
40, -1, 41, 21, 43, 42, -1, 41, 43, 42,
-1, 43, 42, -1, 20, 42, -1, 20, 43, 42,
-1, 42, -1, 25, -1, 27, -1, 11, -1, 19,
-1, 9, -1, 12, -1, 18, -1, 43, -1, -1,
7, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 160, 160, 161, 162, 165, 168, 171, 174, 177,
180, 183, 187, 192, 195, 201, 207, 215, 219, 223,
227, 231, 235, 241, 242, 245, 249, 253, 257, 261,
265, 271, 275, 280, 285, 290, 295, 299, 304, 308,
313, 320, 324, 330, 339, 347, 355, 364, 374, 388,
393, 396, 399, 402, 405, 408, 411, 416, 419, 424,
428, 432, 438, 441, 446, 464, 467
};
#endif
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
"$end", "error", "$undefined", "tAGO", "tDAY", "tDAYZONE", "tID",
"tMERIDIAN", "tMONTH", "tMONTH_UNIT", "tSTARDATE", "tSEC_UNIT",
"tUNUMBER", "tZONE", "tZONEwO4", "tZONEwO2", "tEPOCH", "tDST",
"tISOBASE", "tDAY_UNIT", "tNEXT", "SP", "':'", "','", "'/'", "'-'",
"'.'", "'+'", "$accept", "spec", "item", "time", "zone", "comma", "day",
"date", "ordMonth", "iso", "trek", "relspec", "relunits", "sign", "unit",
"INTNUM", "number", "o_merid", 0
};
#endif
# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
token YYLEX-NUM. */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 58, 44, 47, 45, 46, 43
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
0, 28, 29, 29, 29, 30, 30, 30, 30, 30,
30, 30, 30, 30, 31, 31, 31, 32, 32, 32,
32, 32, 32, 33, 33, 34, 34, 34, 34, 34,
34, 35, 35, 35, 35, 35, 35, 35, 35, 35,
35, 36, 36, 37, 37, 37, 37, 37, 38, 39,
39, 40, 40, 40, 40, 40, 40, 41, 41, 42,
42, 42, 43, 43, 44, 45, 45
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 0, 2, 3, 1, 1, 1, 1, 1,
1, 1, 1, 1, 2, 4, 6, 2, 1, 1,
3, 3, 2, 1, 2, 1, 2, 2, 4, 3,
2, 3, 5, 1, 5, 5, 2, 4, 2, 1,
3, 2, 3, 3, 2, 7, 7, 3, 4, 2,
1, 4, 3, 2, 2, 3, 1, 1, 1, 1,
1, 1, 1, 1, 1, 0, 1
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
2, 0, 1, 25, 19, 0, 61, 0, 59, 62,
18, 0, 0, 39, 33, 60, 0, 0, 57, 58,
3, 5, 6, 9, 7, 8, 11, 12, 10, 50,
0, 56, 64, 13, 23, 26, 36, 62, 63, 0,
27, 14, 38, 0, 0, 0, 17, 0, 0, 0,
44, 0, 30, 41, 62, 54, 0, 4, 49, 62,
0, 22, 53, 24, 0, 0, 40, 65, 31, 0,
0, 20, 21, 0, 43, 0, 47, 42, 55, 29,
62, 0, 52, 37, 48, 66, 0, 15, 0, 0,
0, 0, 0, 28, 51, 65, 32, 34, 35, 0,
0, 16, 0, 0, 46, 45
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
-1, 1, 20, 21, 22, 35, 23, 24, 25, 26,
27, 28, 29, 30, 31, 32, 33, 87
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
#define YYPACT_NINF -17
static const yytype_int8 yypact[] =
{
-17, 48, -17, -9, -17, 34, -17, 19, -17, -2,
30, -10, -10, -17, 8, -17, 0, 72, -17, -17,
-17, -17, -17, -17, -17, -17, -17, -17, -17, 52,
18, -17, 16, -17, 49, -17, -9, -17, -17, 25,
-17, -17, 59, 60, 62, -5, -17, 19, 19, 20,
-17, 31, -17, -17, 70, -17, 16, -17, -17, 75,
32, 16, -17, -17, 77, 81, -17, 6, 71, 69,
73, -17, -17, 74, -17, 78, -17, -17, -17, -17,
97, 16, -17, -17, -17, -17, 90, -17, 91, 92,
93, 94, 95, -17, -17, 101, -17, -17, -17, 87,
88, -17, 99, 100, -17, -17
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
-17, -17, 96, -17, -17, 79, -17, -17, -17, -17,
-17, -17, -17, 22, -16, -6, -17, 21
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says.
If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
55, 39, 40, 69, 52, 41, 42, 70, 53, 6,
56, 8, 54, 85, 34, 18, 62, 19, 38, 15,
43, 49, 44, 45, 61, 6, 50, 8, 86, 51,
59, 37, 73, 47, 48, 15, 38, 38, 74, 60,
78, 71, 72, 75, 80, 82, 36, 46, 2, 76,
38, 65, 3, 4, 81, 58, 5, 6, 7, 8,
9, 10, 11, 12, 13, 94, 14, 15, 16, 17,
63, 66, 67, 18, 68, 19, 3, 4, 77, 79,
5, 6, 7, 8, 9, 10, 11, 12, 13, 83,
14, 15, 16, 84, 89, 88, 91, 18, 90, 19,
92, 93, 95, 96, 97, 98, 99, 100, 85, 102,
103, 104, 105, 57, 0, 64, 101
};
static const yytype_int8 yycheck[] =
{
16, 7, 4, 8, 4, 7, 8, 12, 8, 9,
16, 11, 12, 7, 23, 25, 32, 27, 18, 19,
22, 13, 24, 25, 30, 9, 18, 11, 22, 21,
12, 12, 12, 11, 12, 19, 18, 18, 18, 21,
56, 47, 48, 12, 12, 61, 12, 17, 0, 18,
18, 26, 4, 5, 60, 3, 8, 9, 10, 11,
12, 13, 14, 15, 16, 81, 18, 19, 20, 21,
21, 12, 12, 25, 12, 27, 4, 5, 8, 4,
8, 9, 10, 11, 12, 13, 14, 15, 16, 12,
18, 19, 20, 12, 25, 24, 22, 25, 25, 27,
22, 4, 12, 12, 12, 12, 12, 12, 7, 22,
22, 12, 12, 17, -1, 36, 95
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 29, 0, 4, 5, 8, 9, 10, 11, 12,
13, 14, 15, 16, 18, 19, 20, 21, 25, 27,
30, 31, 32, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 23, 33, 12, 12, 18, 43,
4, 7, 8, 22, 24, 25, 17, 41, 41, 13,
18, 21, 4, 8, 12, 42, 43, 30, 3, 12,
21, 43, 42, 21, 33, 26, 12, 12, 12, 8,
12, 43, 43, 12, 18, 12, 18, 8, 42, 4,
12, 43, 42, 12, 12, 7, 22, 45, 24, 25,
25, 22, 22, 4, 42, 12, 12, 12, 12, 12,
12, 45, 22, 22, 12, 12
};
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2)
#define YYEOF 0
|
| ︙ | ︙ | |||
1547 1548 1549 1550 1551 1552 1553 |
yyval = yyvsp[1-yylen];
/* Default location. */
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
| | | | | | | | | | | | | | | < < < < < < < < < > > > > > > > > > > > > > > > > > | | | > > > > > > > > | | | | | | | | | | | | | | | < < < < < < < < < < < < < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > | | | | | | | | | | > > > > > > > > > > > > > > | | | 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 |
yyval = yyvsp[1-yylen];
/* Default location. */
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
case 5:
{
yyHaveTime++;
;}
break;
case 6:
{
yyHaveZone++;
;}
break;
case 7:
{
yyHaveDate++;
;}
break;
case 8:
{
yyHaveOrdinalMonth++;
;}
break;
case 9:
{
yyHaveDay++;
;}
break;
case 10:
{
yyHaveRel++;
;}
break;
case 11:
{
yyHaveTime++;
yyHaveDate++;
;}
break;
case 12:
{
yyHaveTime++;
yyHaveDate++;
yyHaveRel++;
;}
break;
case 14:
{
yyHour = (yyvsp[(1) - (2)].Number);
yyMinutes = 0;
yySeconds = 0;
yyMeridian = (yyvsp[(2) - (2)].Meridian);
;}
break;
case 15:
{
yyHour = (yyvsp[(1) - (4)].Number);
yyMinutes = (yyvsp[(3) - (4)].Number);
yySeconds = 0;
yyMeridian = (yyvsp[(4) - (4)].Meridian);
;}
break;
case 16:
{
yyHour = (yyvsp[(1) - (6)].Number);
yyMinutes = (yyvsp[(3) - (6)].Number);
yySeconds = (yyvsp[(5) - (6)].Number);
yyMeridian = (yyvsp[(6) - (6)].Meridian);
;}
break;
case 17:
{
yyTimezone = (yyvsp[(1) - (2)].Number);
yyDSTmode = DSTon;
;}
break;
case 18:
{
yyTimezone = (yyvsp[(1) - (1)].Number);
yyDSTmode = DSToff;
;}
break;
case 19:
{
yyTimezone = (yyvsp[(1) - (1)].Number);
yyDSTmode = DSTon;
;}
break;
case 20:
{ /* GMT+0100, GMT-1000, etc. */
yyTimezone = (yyvsp[(1) - (3)].Number) - (yyvsp[(2) - (3)].Number)*((yyvsp[(3) - (3)].Number) % 100 + ((yyvsp[(3) - (3)].Number) / 100) * 60);
yyDSTmode = DSToff;
;}
break;
case 21:
{ /* GMT+1, GMT-10, etc. */
yyTimezone = (yyvsp[(1) - (3)].Number) - (yyvsp[(2) - (3)].Number)*((yyvsp[(3) - (3)].Number) * 60);
yyDSTmode = DSToff;
;}
break;
case 22:
{ /* +0100, -0100 */
yyTimezone = -(yyvsp[(1) - (2)].Number)*((yyvsp[(2) - (2)].Number) % 100 + ((yyvsp[(2) - (2)].Number) / 100) * 60);
yyDSTmode = DSToff;
;}
break;
case 25:
{
yyDayOrdinal = 1;
yyDayNumber = (yyvsp[(1) - (1)].Number);
;}
break;
case 26:
{
yyDayOrdinal = 1;
yyDayNumber = (yyvsp[(1) - (2)].Number);
;}
break;
case 27:
{
yyDayOrdinal = (yyvsp[(1) - (2)].Number);
yyDayNumber = (yyvsp[(2) - (2)].Number);
;}
break;
case 28:
{
yyDayOrdinal = (yyvsp[(1) - (4)].Number) * (yyvsp[(3) - (4)].Number);
yyDayNumber = (yyvsp[(4) - (4)].Number);
;}
break;
case 29:
{
yyDayOrdinal = (yyvsp[(1) - (3)].Number) * (yyvsp[(2) - (3)].Number);
yyDayNumber = (yyvsp[(3) - (3)].Number);
;}
break;
case 30:
{
yyDayOrdinal = 2;
yyDayNumber = (yyvsp[(2) - (2)].Number);
;}
break;
case 31:
{
yyMonth = (yyvsp[(1) - (3)].Number);
yyDay = (yyvsp[(3) - (3)].Number);
;}
break;
case 32:
{
yyMonth = (yyvsp[(1) - (5)].Number);
yyDay = (yyvsp[(3) - (5)].Number);
yyYear = (yyvsp[(5) - (5)].Number);
;}
break;
case 33:
{
yyYear = (yyvsp[(1) - (1)].Number) / 10000;
yyMonth = ((yyvsp[(1) - (1)].Number) % 10000)/100;
yyDay = (yyvsp[(1) - (1)].Number) % 100;
;}
break;
case 34:
{
yyDay = (yyvsp[(1) - (5)].Number);
yyMonth = (yyvsp[(3) - (5)].Number);
yyYear = (yyvsp[(5) - (5)].Number);
;}
break;
case 35:
{
yyMonth = (yyvsp[(3) - (5)].Number);
yyDay = (yyvsp[(5) - (5)].Number);
yyYear = (yyvsp[(1) - (5)].Number);
;}
break;
case 36:
{
yyMonth = (yyvsp[(1) - (2)].Number);
yyDay = (yyvsp[(2) - (2)].Number);
;}
break;
case 37:
{
yyMonth = (yyvsp[(1) - (4)].Number);
yyDay = (yyvsp[(2) - (4)].Number);
yyYear = (yyvsp[(4) - (4)].Number);
;}
break;
case 38:
{
yyMonth = (yyvsp[(2) - (2)].Number);
yyDay = (yyvsp[(1) - (2)].Number);
;}
break;
case 39:
{
yyMonth = 1;
yyDay = 1;
yyYear = EPOCH;
;}
break;
case 40:
{
yyMonth = (yyvsp[(2) - (3)].Number);
yyDay = (yyvsp[(1) - (3)].Number);
yyYear = (yyvsp[(3) - (3)].Number);
;}
break;
case 41:
{
yyMonthOrdinalIncr = 1;
yyMonthOrdinal = (yyvsp[(2) - (2)].Number);
;}
break;
case 42:
{
yyMonthOrdinalIncr = (yyvsp[(2) - (3)].Number);
yyMonthOrdinal = (yyvsp[(3) - (3)].Number);
;}
break;
case 43:
{
if ((yyvsp[(2) - (3)].Number) != HOUR( 7)) YYABORT; /* T */
yyYear = (yyvsp[(1) - (3)].Number) / 10000;
yyMonth = ((yyvsp[(1) - (3)].Number) % 10000)/100;
yyDay = (yyvsp[(1) - (3)].Number) % 100;
yyHour = (yyvsp[(3) - (3)].Number) / 10000;
yyMinutes = ((yyvsp[(3) - (3)].Number) % 10000)/100;
yySeconds = (yyvsp[(3) - (3)].Number) % 100;
;}
break;
case 44:
{
yyYear = (yyvsp[(1) - (2)].Number) / 10000;
yyMonth = ((yyvsp[(1) - (2)].Number) % 10000)/100;
yyDay = (yyvsp[(1) - (2)].Number) % 100;
yyHour = (yyvsp[(2) - (2)].Number) / 10000;
yyMinutes = ((yyvsp[(2) - (2)].Number) % 10000)/100;
yySeconds = (yyvsp[(2) - (2)].Number) % 100;
;}
break;
case 45:
{
yyYear = (yyvsp[(1) - (7)].Number) / 10000;
yyMonth = ((yyvsp[(1) - (7)].Number) % 10000)/100;
yyDay = (yyvsp[(1) - (7)].Number) % 100;
yyHour = (yyvsp[(3) - (7)].Number);
yyMinutes = (yyvsp[(5) - (7)].Number);
yySeconds = (yyvsp[(7) - (7)].Number);
;}
break;
case 46:
{
if ((yyvsp[(2) - (7)].Number) != HOUR( 7)) YYABORT; /* T */
yyYear = (yyvsp[(1) - (7)].Number) / 10000;
yyMonth = ((yyvsp[(1) - (7)].Number) % 10000)/100;
yyDay = (yyvsp[(1) - (7)].Number) % 100;
yyHour = (yyvsp[(3) - (7)].Number);
yyMinutes = (yyvsp[(5) - (7)].Number);
yySeconds = (yyvsp[(7) - (7)].Number);
;}
break;
case 47:
{
yyYear = (yyvsp[(1) - (3)].Number) / 10000;
yyMonth = ((yyvsp[(1) - (3)].Number) % 10000)/100;
yyDay = (yyvsp[(1) - (3)].Number) % 100;
yyHour = (yyvsp[(3) - (3)].Number) / 10000;
yyMinutes = ((yyvsp[(3) - (3)].Number) % 10000)/100;
yySeconds = (yyvsp[(3) - (3)].Number) % 100;
;}
break;
case 48:
{
/*
* Offset computed year by -377 so that the returned years will be
* in a range accessible with a 32 bit clock seconds value.
*/
yyYear = (yyvsp[(2) - (4)].Number)/1000 + 2323 - 377;
yyDay = 1;
yyMonth = 1;
yyRelDay += (((yyvsp[(2) - (4)].Number)%1000)*(365 + IsLeapYear(yyYear)))/1000;
yyRelSeconds += (yyvsp[(4) - (4)].Number) * 144 * 60;
;}
break;
case 49:
{
yyRelSeconds *= -1;
yyRelMonth *= -1;
yyRelDay *= -1;
;}
break;
case 51:
{
*yyRelPointer += (yyvsp[(1) - (4)].Number) * (yyvsp[(3) - (4)].Number) * (yyvsp[(4) - (4)].Number);
;}
break;
case 52:
{
*yyRelPointer += (yyvsp[(1) - (3)].Number) * (yyvsp[(2) - (3)].Number) * (yyvsp[(3) - (3)].Number);
;}
break;
case 53:
{
*yyRelPointer += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
;}
break;
case 54:
{
*yyRelPointer += (yyvsp[(2) - (2)].Number);
;}
break;
case 55:
{
*yyRelPointer += (yyvsp[(2) - (3)].Number) * (yyvsp[(3) - (3)].Number);
;}
break;
case 56:
{
*yyRelPointer += (yyvsp[(1) - (1)].Number);
;}
break;
case 57:
{
(yyval.Number) = -1;
;}
break;
case 58:
{
(yyval.Number) = 1;
;}
break;
case 59:
{
(yyval.Number) = (yyvsp[(1) - (1)].Number);
yyRelPointer = &yyRelSeconds;
;}
break;
case 60:
{
(yyval.Number) = (yyvsp[(1) - (1)].Number);
yyRelPointer = &yyRelDay;
;}
break;
case 61:
{
(yyval.Number) = (yyvsp[(1) - (1)].Number);
yyRelPointer = &yyRelMonth;
;}
break;
case 62:
{
(yyval.Number) = (yyvsp[(1) - (1)].Number)
;}
break;
case 63:
{
(yyval.Number) = (yyvsp[(1) - (1)].Number)
;}
break;
case 64:
{
if (yyHaveTime && yyHaveDate && !yyHaveRel) {
yyYear = (yyvsp[(1) - (1)].Number);
} else {
yyHaveTime++;
if (yyDigitCount <= 2) {
yyHour = (yyvsp[(1) - (1)].Number);
yyMinutes = 0;
} else {
yyHour = (yyvsp[(1) - (1)].Number) / 100;
yyMinutes = (yyvsp[(1) - (1)].Number) % 100;
}
yySeconds = 0;
yyMeridian = MER24;
}
;}
break;
case 65:
{
(yyval.Meridian) = MER24;
;}
break;
case 66:
{
(yyval.Meridian) = (yyvsp[(1) - (1)].Meridian);
;}
break;
|
| ︙ | ︙ | |||
2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 |
{ "v", tZONE, HOUR( 9) },
{ "w", tZONE, HOUR( 10) },
{ "x", tZONE, HOUR( 11) },
{ "y", tZONE, HOUR( 12) },
{ "z", tZONE, HOUR( 0) },
{ NULL, 0, 0 }
};
/*
* Dump error messages in the bit bucket.
*/
static void
TclDateerror(
| > > > > > > > > > > > > | 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 |
{ "v", tZONE, HOUR( 9) },
{ "w", tZONE, HOUR( 10) },
{ "x", tZONE, HOUR( 11) },
{ "y", tZONE, HOUR( 12) },
{ "z", tZONE, HOUR( 0) },
{ NULL, 0, 0 }
};
static inline const char *
bypassSpaces(
register const char *s)
{
if (isspace(UCHAR(*s))) {
do {
s++;
} while (isspace(UCHAR(*s)));
}
return s;
}
/*
* Dump error messages in the bit bucket.
*/
static void
TclDateerror(
|
| ︙ | ︙ | |||
2483 2484 2485 2486 2487 2488 2489 |
/*
* Make it lowercase.
*/
Tcl_UtfToLower(buff);
| | | | 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 |
/*
* Make it lowercase.
*/
Tcl_UtfToLower(buff);
if (*buff == 'a' && (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0)) {
yylvalPtr->Meridian = MERam;
return tMERIDIAN;
}
if (*buff == 'p' && (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0)) {
yylvalPtr->Meridian = MERpm;
return tMERIDIAN;
}
/*
* See if we have an abbreviation for a month.
*/
|
| ︙ | ︙ | |||
2604 2605 2606 2607 2608 2609 2610 |
register char c;
register char *p;
char buff[20];
int Count;
location->first_column = yyInput - info->dateStart;
for ( ; ; ) {
| > | > > | > > > > | | < | > | < | | | > > > | > | > > > > > > > > > > > > > > > > > > > > > > > | 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 |
register char c;
register char *p;
char buff[20];
int Count;
location->first_column = yyInput - info->dateStart;
for ( ; ; ) {
if (isspace(UCHAR(*yyInput))) {
yyInput = bypassSpaces(yyInput);
/* ignore space at end of text and before some words */
c = *yyInput;
if (c != '\0' && !isalpha(UCHAR(c))) {
return SP;
}
}
if (isdigit(UCHAR(c = *yyInput))) { /* INTL: digit */
/*
* Convert the string into a number; count the number of digits.
*/
register int num = c - '0';
p = (char *)yyInput;
while (isdigit(UCHAR(c = *(++p)))) {
num *= 10;
num += c - '0';
};
yylvalPtr->Number = num;
yyDigitCount = p - yyInput;
yyInput = p;
/* ignore spaces after digits (optional) */
yyInput = bypassSpaces(yyInput);
/*
* A number with 6 or more digits is considered an ISO 8601 base.
*/
if (yyDigitCount >= 6) {
location->last_column = yyInput - info->dateStart - 1;
return tISOBASE;
} else {
location->last_column = yyInput - info->dateStart - 1;
return tUNUMBER;
}
}
if (!(c & 0x80) && isalpha(UCHAR(c))) { /* INTL: ISO only. */
int ret;
for (p = buff; isalpha(UCHAR(c = *yyInput++)) /* INTL: ISO only. */
|| c == '.'; ) {
if (p < &buff[sizeof buff - 1]) {
*p++ = c;
}
}
*p = '\0';
yyInput--;
location->last_column = yyInput - info->dateStart - 1;
ret = LookupWord(yylvalPtr, buff);
/*
* lookahead for +/- digit, to differentiate between "GMT+1000 day" and "GMT +1000 day",
* bypass spaces after token (but ignore by TZ+OFFS), because should
* recognize next SP token, if TZ only.
*/
if (ret == tZONE || ret == tDAYZONE) {
c = *yyInput;
if ((c == '+' || c == '-') && isdigit(UCHAR(*(yyInput+1)))) {
if ( !isdigit(UCHAR(*(yyInput+2)))
|| !isdigit(UCHAR(*(yyInput+3)))) {
/* GMT+1, GMT-10, etc. */
return tZONEwO2;
}
if ( isdigit(UCHAR(*(yyInput+4)))
&& !isdigit(UCHAR(*(yyInput+5)))) {
/* GMT+1000, etc. */
return tZONEwO4;
}
}
}
yyInput = bypassSpaces(yyInput);
return ret;
}
if (c != '(') {
location->last_column = yyInput - info->dateStart;
return *yyInput++;
}
Count = 0;
do {
|
| ︙ | ︙ | |||
2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 |
int
TclClockFreeScan(
Tcl_Interp *interp, /* Tcl interpreter */
DateInfo *info) /* Input and result parameters */
{
int status;
/*
* yyInput = stringToParse;
*
* ClockInitDateInfo(info) should be executed to pre-init info;
*/
yyDSTmode = DSTmaybe;
info->messages = Tcl_NewObj();
info->separatrix = "";
Tcl_IncrRefCount(info->messages);
info->dateStart = yyInput;
status = yyparse(info);
if (status == 1) {
Tcl_SetObjResult(interp, info->messages);
Tcl_DecrRefCount(info->messages);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "PARSE", NULL);
return TCL_ERROR;
} else if (status == 2) {
| > > > > > > > > > > | 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 |
int
TclClockFreeScan(
Tcl_Interp *interp, /* Tcl interpreter */
DateInfo *info) /* Input and result parameters */
{
int status;
#if YYDEBUG
/* enable debugging if compiled with YYDEBUG */
yydebug = 1;
#endif
/*
* yyInput = stringToParse;
*
* ClockInitDateInfo(info) should be executed to pre-init info;
*/
yyDSTmode = DSTmaybe;
info->messages = Tcl_NewObj();
info->separatrix = "";
Tcl_IncrRefCount(info->messages);
info->dateStart = yyInput;
/* ignore spaces at begin */
yyInput = bypassSpaces(yyInput);
/* parse */
status = yyparse(info);
if (status == 1) {
Tcl_SetObjResult(interp, info->messages);
Tcl_DecrRefCount(info->messages);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "PARSE", NULL);
return TCL_ERROR;
} else if (status == 2) {
|
| ︙ | ︙ |