Changes On Branch sebres-8-6-clock-speedup-bug-a1bd37b719
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch sebres-8-6-clock-speedup-bug-a1bd37b719 Excluding Merge-Ins

This is equivalent to a diff from acf0d6fd01 to b449a91f7b

2020-06-22
18:29
Merge branch 'iso-TZ-bug-21': closes gh-21 (bug [a1bd37b719], https://github.com/sebres/tclclockmod/... check-in: 4f064d306d user: sebres tags: sebres-8-6-clock-speedup-cr2
18:26
resolves more shift/reduce conflicts (since SP token is expected by few items only, otherwise silent... check-in: 35aea014ba user: sebres tags: sebres-8-6-clock-speedup-cr2
18:22
small amend to #21 allowing time without seconds part "hh:mm" as extended ISO time (with and without... Closed-Leaf check-in: b449a91f7b user: sebres tags: sebres-8-6-clock-speedup-bug-a1bd37b719
18:22
optimized ISO 8601 timestamp (with extended formats, T literal is optional now, more tests); decreas... check-in: 000e5124d6 user: sebres tags: sebres-8-6-clock-speedup-bug-a1bd37b719
18:21
added test-cases illustrating bug #21: literal may be mistakenly recognized as a time-zone (doesn't ... check-in: 67e152931d user: sebres tags: sebres-8-6-clock-speedup-bug-a1bd37b719
18:19
more tests time-zone independent check-in: acf0d6fd01 user: sebres tags: sebres-8-6-clock-speedup-cr2
18:17
close fork check-in: 371c68b040 user: sebres tags: sebres-8-6-clock-speedup-cr2

Changes to generic/tclDate.c.
192
193
194
195
196
197
198
199


200
201
202
203
204
205
206
207
208
209
    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

/* Value type.  */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED

union YYSTYPE







|
>
>
|
|
|







192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
    tSEC_UNIT = 266,
    tUNUMBER = 267,
    tZONE = 268,
    tZONEwO4 = 269,
    tZONEwO2 = 270,
    tEPOCH = 271,
    tDST = 272,
    tISOBAS8 = 273,
    tISOBAS6 = 274,
    tISOBASL = 275,
    tDAY_UNIT = 276,
    tNEXT = 277,
    SP = 278
  };
#endif

/* Value type.  */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED

union YYSTYPE
497
498
499
500
501
502
503
504
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

728
729
730
731
732
733
734
735
736
#  endif
# endif
#endif /* !YYCOPY_NEEDED */

/* 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
/* YYNSTATES -- Number of states.  */
#define YYNSTATES  106

/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
   by yylex, with out-of-bounds checking.  */
#define YYUNDEFTOK  2
#define YYMAXUTOK   276

#define YYTRANSLATE(YYX)                                                \
  ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
   as returned by yylex, without out-of-bounds checking.  */
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,
       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,     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
  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
static const yytype_uint16 yyrline[] =
{
       0,   167,   167,   168,   169,   172,   175,   178,   181,   184,
     187,   190,   193,   197,   200,   206,   212,   220,   224,   228,
     232,   236,   240,   246,   247,   250,   254,   258,   262,   266,
     270,   276,   280,   285,   290,   295,   300,   304,   309,   313,
     318,   325,   329,   335,   344,   352,   360,   369,   379,   393,
     398,   401,   404,   407,   410,   413,   416,   421,   424,   429,
     433,   437,   443,   446,   451,   469,   472

};
#endif

#if YYDEBUG || YYERROR_VERBOSE || 0
/* 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", YY_NULLPTR
};
#endif

# ifdef YYPRINT
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
   (internal) symbol number NUM (which must be that of a token).  */
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

#define YYPACT_NINF -17

#define yypact_value_is_default(Yystate) \
  (!!((Yystate) == (-17)))

#define YYTABLE_NINF -1

#define yytable_value_is_error(Yytable_value) \
  0

  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
     STATE-NUM.  */
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
};

  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
     Performed when YYTABLE does not 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
};

  /* 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
};

  /* 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

};

  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
     positive, shift that token.  If negative, reduce the rule whose
     number is the opposite.  If YYTABLE_NINF, syntax error.  */
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
};

  /* 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 on the 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
};


#define yyerrok         (yyerrstatus = 0)
#define yyclearin       (yychar = YYEMPTY)
#define YYEMPTY         (-2)
#define YYEOF           0







|


|

|

|

|




|












|
|


|


















|






|
|
|
|
|
|
|
>











|
|
>
|
|










|
>



|


|

|








|
|
|
|
|
|
|
|
|
|
|







|
|
|
|
>
|
|
|
|
<
|
|





|
>
|





|
|
>





|

|
<
|
<
<
|
|
|
>
>
|
|
>
|
>
|




|
<
<
|
<
|
|
>
>
|
|
|
>
|
>
|






|
|
|
|
|
|
|
|
|
>
|
<





<
|
|
<
|
|
|
>
>
>






|
|
|
|
>
|
|







499
500
501
502
503
504
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
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
#  endif
# endif
#endif /* !YYCOPY_NEEDED */

/* YYFINAL -- State number of the termination state.  */
#define YYFINAL  2
/* YYLAST -- Last index in YYTABLE.  */
#define YYLAST   121

/* YYNTOKENS -- Number of terminals.  */
#define YYNTOKENS  31
/* YYNNTS -- Number of nonterminals.  */
#define YYNNTS  23
/* YYNRULES -- Number of rules.  */
#define YYNRULES  73
/* YYNSTATES -- Number of states.  */
#define YYNSTATES  105

/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
   by yylex, with out-of-bounds checking.  */
#define YYUNDEFTOK  2
#define YYMAXUTOK   278

#define YYTRANSLATE(YYX)                                                \
  ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
   as returned by yylex, without out-of-bounds checking.  */
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,    30,    25,    26,    29,    27,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,    24,     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,    28,     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,     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,     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,    22,    23
};

#if YYDEBUG
  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
static const yytype_uint16 yyrline[] =
{
       0,   171,   171,   172,   173,   176,   179,   182,   185,   188,
     191,   194,   197,   201,   204,   209,   215,   221,   226,   230,
     234,   238,   242,   246,   252,   253,   256,   260,   264,   268,
     272,   276,   282,   288,   292,   297,   298,   303,   307,   312,
     316,   321,   328,   332,   338,   338,   340,   345,   350,   352,
     357,   359,   360,   368,   379,   393,   398,   401,   404,   407,
     410,   413,   416,   421,   424,   429,   433,   437,   443,   446,
     449,   454,   472,   475
};
#endif

#if YYDEBUG || YYERROR_VERBOSE || 0
/* 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",
  "tISOBAS8", "tISOBAS6", "tISOBASL", "tDAY_UNIT", "tNEXT", "SP", "':'",
  "','", "'-'", "'/'", "'T'", "'.'", "'+'", "$accept", "spec", "item",
  "iextime", "time", "zone", "comma", "day", "iexdate", "date", "ordMonth",
  "isosep", "isodate", "isotime", "iso", "trek", "relspec", "relunits",
  "sign", "unit", "INTNUM", "numitem", "o_merid", YY_NULLPTR
};
#endif

# ifdef YYPRINT
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
   (internal) symbol number NUM (which must be that of a token).  */
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,   277,   278,    58,    44,    45,    47,    84,    46,
      43
};
# endif

#define YYPACT_NINF -21

#define yypact_value_is_default(Yystate) \
  (!!((Yystate) == (-21)))

#define YYTABLE_NINF -69

#define yytable_value_is_error(Yytable_value) \
  0

  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
     STATE-NUM.  */
static const yytype_int8 yypact[] =
{
     -21,    66,   -21,   -20,   -21,     1,   -21,    -9,   -21,    86,
      18,    14,    14,   -21,   -21,   -21,    -4,   -21,    97,    12,
     -21,   -21,   -21,    30,   -21,   -21,   -21,   -21,   -21,   -21,
      13,   -21,   -21,   -21,    48,    27,   -21,    -7,   -21,    29,
     -21,   -20,   -21,   -21,   -21,    28,   -21,   -21,    47,    49,
      46,    50,   -21,    -9,    -9,   -21,   -21,   -21,   -21,    52,
     -21,    -7,   -21,   -21,   -21,   -21,   -21,    -1,   -21,    59,
      37,    -7,   -21,   -21,    53,    55,   -21,    44,    43,    57,
      45,   -21,   -21,   -21,   -21,    67,   -21,   -21,   -21,   -21,
      94,    -7,   -21,   -21,   -21,    87,    88,    90,    91,   -21,
     -21,   -21,   -21,   -21,   -21
};

  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
     Performed when YYTABLE does not specify something else to do.  Zero
     means the default is an error.  */
static const yytype_uint8 yydefact[] =
{
       2,     0,     1,    26,    20,     0,    67,     0,    65,    71,
      19,     0,     0,    40,    46,    47,     0,    66,     0,     0,
      63,    64,     3,    72,     5,     6,     9,    48,     7,     8,
      35,    11,    12,    10,    56,     0,    62,     0,    13,    24,
      27,    37,    68,    70,    69,     0,    28,    16,    39,     0,
       0,     0,    18,     0,     0,    53,    52,    31,    42,    68,
      60,     0,     4,    73,    17,    45,    44,     0,    55,    68,
       0,    23,    59,    25,     0,     0,    41,    15,     0,     0,
      33,    21,    22,    43,    61,     0,    49,    50,    51,    30,

      68,     0,    58,    38,    54,     0,     0,     0,     0,    29,
      57,    14,    36,    32,    34
};

  /* YYPGOTO[NTERM-NUM].  */
static const yytype_int8 yypgoto[] =
{
     -21,   -21,    85,    54,   -21,   -21,    70,   -21,   -21,   -21,
     -21,   -21,   -21,   -21,   -21,   -21,   -21,   -21,    -5,   -18,
      -6,   -21,   -21
};

  /* YYDEFGOTO[NTERM-NUM].  */
static const yytype_int8 yydefgoto[] =
{
      -1,     1,    22,    23,    24,    25,    40,    26,    27,    28,
      29,    67,    30,    88,    31,    32,    33,    34,    35,    36,
      37,    38,    64
};

  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
     positive, shift that token.  If negative, reduce the rule whose
     number is the opposite.  If YYTABLE_NINF, syntax error.  */
static const yytype_int8 yytable[] =
{
      60,    45,     6,    42,     8,    39,    53,    54,    55,    43,

      44,    85,    61,    41,    17,    56,     3,     4,    86,    72,


       5,     6,     7,     8,     9,    10,    11,    12,    13,    71,
      14,    15,    16,    17,    18,    52,    65,    63,    20,    69,
      20,    66,    21,    84,    21,    43,    44,    81,    82,    90,
      70,    68,    73,    92,    78,    43,    44,    75,    79,    76,
      83,    77,    80,    89,    91,    93,     2,    94,    95,    96,
       3,     4,    98,   100,     5,     6,     7,     8,     9,    10,
      11,    12,    13,    97,    14,    15,    16,    17,    18,    19,
      46,    49,    20,    47,    48,   -68,    21,   -68,    99,   101,
     102,    57,   103,   104,    62,    58,     6,   -68,     8,    59,
      49,    74,    50,    51,     0,    43,    44,     0,    17,     0,
       0,    87
};

static const yytype_int8 yycheck[] =
{
      18,     7,     9,    12,    11,    25,    11,    12,    12,    18,


      19,    12,    18,    12,    21,    19,     4,     5,    19,    37,

       8,     9,    10,    11,    12,    13,    14,    15,    16,    35,
      18,    19,    20,    21,    22,    17,    23,     7,    26,    12,
      26,    28,    30,    61,    30,    18,    19,    53,    54,    12,
      23,     3,    23,    71,     8,    18,    19,    29,    12,    12,
       8,    12,    12,     4,    70,    12,     0,    12,    24,    26,
       4,     5,    27,    91,     8,     9,    10,    11,    12,    13,
      14,    15,    16,    26,    18,    19,    20,    21,    22,    23,
       4,    24,    26,     7,     8,     9,    30,    11,     4,    12,
      12,     4,    12,    12,    19,     8,     9,    21,    11,    12,
      24,    41,    26,    27,    -1,    18,    19,    -1,    21,    -1,
      -1,    67
};

  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
     symbol of state STATE-NUM.  */
static const yytype_uint8 yystos[] =
{
       0,    32,     0,     4,     5,     8,     9,    10,    11,    12,
      13,    14,    15,    16,    18,    19,    20,    21,    22,    23,
      26,    30,    33,    34,    35,    36,    38,    39,    40,    41,
      43,    45,    46,    47,    48,    49,    50,    51,    52,    25,
      37,    12,    12,    18,    19,    51,     4,     7,     8,    24,
      26,    27,    17,    49,    49,    12,    19,     4,     8,    12,
      50,    51,    33,     7,    53,    23,    28,    42,     3,    12,
      23,    51,    50,    23,    37,    29,    12,    12,     8,    12,
      12,    51,    51,     8,    50,    12,    19,    34,    44,     4,
      12,    51,    50,    12,    12,    24,    26,    26,    27,     4,
      50,    12,    12,    12,    12

};

  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
static const yytype_uint8 yyr1[] =
{

       0,    31,    32,    32,    32,    33,    33,    33,    33,    33,
      33,    33,    33,    33,    34,    34,    35,    35,    36,    36,

      36,    36,    36,    36,    37,    37,    38,    38,    38,    38,
      38,    38,    39,    40,    40,    40,    40,    40,    40,    40,
      40,    40,    41,    41,    42,    42,    43,    43,    43,    44,
      44,    45,    45,    45,    46,    47,    47,    48,    48,    48,
      48,    48,    48,    49,    49,    50,    50,    50,    51,    51,
      51,    52,    53,    53
};

  /* YYR2[YYN] -- Number of symbols on the 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,     5,     3,     2,     2,     2,     1,
       1,     3,     3,     2,     1,     2,     1,     2,     2,     4,
       3,     2,     5,     3,     5,     1,     5,     2,     4,     2,
       1,     3,     2,     3,     1,     1,     1,     1,     1,     1,
       1,     3,     2,     2,     4,     2,     1,     4,     3,     2,
       2,     3,     1,     1,     1,     1,     1,     1,     1,     1,
       1,     1,     0,     1
};


#define yyerrok         (yyerrstatus = 0)
#define yyclearin       (yychar = YYEMPTY)
#define YYEMPTY         (-2)
#define YYEOF           0
1569
1570
1571
1572
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
	}

    break;

  case 14:

    {
	    yyHour = (yyvsp[-1].Number);
	    yyMinutes = 0;
	    yySeconds = 0;
	    yyMeridian = (yyvsp[0].Meridian);
	}

    break;

  case 15:

    {
	    yyHour = (yyvsp[-3].Number);
	    yyMinutes = (yyvsp[-1].Number);
	    yySeconds = 0;
	    yyMeridian = (yyvsp[0].Meridian);
	}

    break;

  case 16:

    {
	    yyHour = (yyvsp[-5].Number);
	    yyMinutes = (yyvsp[-3].Number);
	    yySeconds = (yyvsp[-1].Number);
	    yyMeridian = (yyvsp[0].Meridian);
	}

    break;

  case 17:

    {
	    yyTimezone = (yyvsp[-1].Number);
	    yyDSTmode = DSTon;
	}

    break;

  case 18:

    {
	    yyTimezone = (yyvsp[0].Number);
	    yyDSTmode = DSToff;
	}

    break;

  case 19:

    {
	    yyTimezone = (yyvsp[0].Number);
	    yyDSTmode = DSTon;
	}

    break;

  case 20:










    { /* GMT+0100, GMT-1000, etc. */
	    yyTimezone = (yyvsp[-2].Number) - (yyvsp[-1].Number)*((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60);
	    yyDSTmode = DSToff;
	}

    break;

  case 21:

    { /* GMT+1, GMT-10, etc. */
	    yyTimezone = (yyvsp[-2].Number) - (yyvsp[-1].Number)*((yyvsp[0].Number) * 60);
	    yyDSTmode = DSToff;
	}

    break;

  case 22:

    { /* +0100, -0100 */
	    yyTimezone = -(yyvsp[-1].Number)*((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60);
	    yyDSTmode = DSToff;
	}

    break;

  case 25:

    {
	    yyDayOrdinal = 1;
	    yyDayOfWeek = (yyvsp[0].Number);
	}

    break;

  case 26:

    {
	    yyDayOrdinal = 1;
	    yyDayOfWeek = (yyvsp[-1].Number);
	}

    break;

  case 27:

    {
	    yyDayOrdinal = (yyvsp[-1].Number);
	    yyDayOfWeek = (yyvsp[0].Number);
	}

    break;

  case 28:

    {
	    yyDayOrdinal = (yyvsp[-3].Number) * (yyvsp[-1].Number);
	    yyDayOfWeek = (yyvsp[0].Number);
	}

    break;

  case 29:

    {
	    yyDayOrdinal = (yyvsp[-2].Number) * (yyvsp[-1].Number);
	    yyDayOfWeek = (yyvsp[0].Number);
	}

    break;

  case 30:

    {
	    yyDayOrdinal = 2;
	    yyDayOfWeek = (yyvsp[0].Number);
	}

    break;

  case 31:











    {
	    yyMonth = (yyvsp[-2].Number);
	    yyDay = (yyvsp[0].Number);
	}

    break;

  case 32:

    {
	    yyMonth = (yyvsp[-4].Number);
	    yyDay = (yyvsp[-2].Number);
	    yyYear = (yyvsp[0].Number);
	}

    break;

  case 33:

    {
	    yyYear = (yyvsp[0].Number) / 10000;
	    yyMonth = ((yyvsp[0].Number) % 10000)/100;
	    yyDay = (yyvsp[0].Number) % 100;
	}

    break;

  case 34:

    {
	    yyDay = (yyvsp[-4].Number);
	    yyMonth = (yyvsp[-2].Number);
	    yyYear = (yyvsp[0].Number);
	}

    break;

  case 35:

    {
	    yyMonth = (yyvsp[-2].Number);
	    yyDay = (yyvsp[0].Number);
	    yyYear = (yyvsp[-4].Number);
	}

    break;

  case 36:

    {
	    yyMonth = (yyvsp[-1].Number);
	    yyDay = (yyvsp[0].Number);
	}

    break;

  case 37:

    {
	    yyMonth = (yyvsp[-3].Number);
	    yyDay = (yyvsp[-2].Number);
	    yyYear = (yyvsp[0].Number);
	}

    break;

  case 38:

    {
	    yyMonth = (yyvsp[0].Number);
	    yyDay = (yyvsp[-1].Number);
	}

    break;

  case 39:

    {
	    yyMonth = 1;
	    yyDay = 1;
	    yyYear = EPOCH;
	}

    break;

  case 40:

    {
	    yyMonth = (yyvsp[-1].Number);
	    yyDay = (yyvsp[-2].Number);
	    yyYear = (yyvsp[0].Number);
	}

    break;

  case 41:

    {
	    yyMonthOrdinalIncr = 1;
	    yyMonthOrdinal = (yyvsp[0].Number);
	}

    break;

  case 42:

    {
	    yyMonthOrdinalIncr = (yyvsp[-1].Number);
	    yyMonthOrdinal = (yyvsp[0].Number);
	}

    break;

  case 43:






    {

	    if ((yyvsp[-1].Number) != HOUR( 7)) YYABORT; /* T */



	    yyYear = (yyvsp[-2].Number) / 10000;
	    yyMonth = ((yyvsp[-2].Number) % 10000)/100;
	    yyDay = (yyvsp[-2].Number) % 100;







	    yyHour = (yyvsp[0].Number) / 10000;
	    yyMinutes = ((yyvsp[0].Number) % 10000)/100;
	    yySeconds = (yyvsp[0].Number) % 100;
	}

    break;

  case 44:

    {
	    yyYear = (yyvsp[-1].Number) / 10000;
	    yyMonth = ((yyvsp[-1].Number) % 10000)/100;
	    yyDay = (yyvsp[-1].Number) % 100;
	    yyHour = (yyvsp[0].Number) / 10000;
	    yyMinutes = ((yyvsp[0].Number) % 10000)/100;
	    yySeconds = (yyvsp[0].Number) % 100;
	}

    break;

  case 45:

    {
	    yyYear = (yyvsp[-6].Number) / 10000;
	    yyMonth = ((yyvsp[-6].Number) % 10000)/100;
	    yyDay = (yyvsp[-6].Number) % 100;
	    yyHour = (yyvsp[-4].Number);
	    yyMinutes = (yyvsp[-2].Number);
	    yySeconds = (yyvsp[0].Number);
	}

    break;

  case 46:

    {
	    if ((yyvsp[-5].Number) != HOUR( 7)) YYABORT; /* T */
	    yyYear = (yyvsp[-6].Number) / 10000;
	    yyMonth = ((yyvsp[-6].Number) % 10000)/100;
	    yyDay = (yyvsp[-6].Number) % 100;
	    yyHour = (yyvsp[-4].Number);
	    yyMinutes = (yyvsp[-2].Number);
	    yySeconds = (yyvsp[0].Number);
	}

    break;

  case 47:

    {
	    yyYear = (yyvsp[-2].Number) / 10000;
	    yyMonth = ((yyvsp[-2].Number) % 10000)/100;
	    yyDay = (yyvsp[-2].Number) % 100;
	    yyHour = (yyvsp[0].Number) / 10000;
	    yyMinutes = ((yyvsp[0].Number) % 10000)/100;
	    yySeconds = (yyvsp[0].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].Number)/1000 + 2323 - 377;
	    yyDay  = 1;
	    yyMonth = 1;
	    yyRelDay += (((yyvsp[-2].Number)%1000)*(365 + IsLeapYear(yyYear)))/1000;
	    yyRelSeconds += (yyvsp[0].Number) * 144 * 60;
	}

    break;

  case 49:

    {
	    yyRelSeconds *= -1;
	    yyRelMonth *= -1;
	    yyRelDay *= -1;
	}

    break;

  case 51:

    {
	    *yyRelPointer += (yyvsp[-3].Number) * (yyvsp[-1].Number) * (yyvsp[0].Number);
	}

    break;

  case 52:

    {
	    *yyRelPointer += (yyvsp[-2].Number) * (yyvsp[-1].Number) * (yyvsp[0].Number);
	}

    break;

  case 53:

    {
	    *yyRelPointer += (yyvsp[-1].Number) * (yyvsp[0].Number);
	}

    break;

  case 54:

    {
	    *yyRelPointer += (yyvsp[0].Number);
	}

    break;

  case 55:

    {
	    *yyRelPointer += (yyvsp[-1].Number) * (yyvsp[0].Number);
	}

    break;

  case 56:

    {
	    *yyRelPointer += (yyvsp[0].Number);
	}

    break;

  case 57:

    {
	    (yyval.Number) = -1;
	}

    break;

  case 58:

    {
	    (yyval.Number) =  1;
	}

    break;

  case 59:

    {
	    (yyval.Number) = (yyvsp[0].Number);
	    yyRelPointer = &yyRelSeconds;
	}

    break;

  case 60:

    {
	    (yyval.Number) = (yyvsp[0].Number);
	    yyRelPointer = &yyRelDay;
	}

    break;

  case 61:

    {
	    (yyval.Number) = (yyvsp[0].Number);
	    yyRelPointer = &yyRelMonth;
	}

    break;

  case 62:









    {
	    (yyval.Number) = (yyvsp[0].Number);
	}

    break;

  case 63:

    {
	    (yyval.Number) = (yyvsp[0].Number);
	}

    break;

  case 64:

    {
	    if ((info->flags & (CLF_TIME|CLF_HAVEDATE|CLF_RELCONV)) == (CLF_TIME|CLF_HAVEDATE)) {
		yyYear = (yyvsp[0].Number);
	    } else {
		yyIncrFlags(CLF_TIME);
		if (yyDigitCount <= 2) {
		    yyHour = (yyvsp[0].Number);
		    yyMinutes = 0;
		} else {
		    yyHour = (yyvsp[0].Number) / 100;
		    yyMinutes = (yyvsp[0].Number) % 100;
		}
		yySeconds = 0;
		yyMeridian = MER24;
	    }
	}

    break;

  case 65:

    {
	    (yyval.Meridian) = MER24;
	}

    break;

  case 66:

    {
	    (yyval.Meridian) = (yyvsp[0].Meridian);
	}

    break;








|
|
|
<







|
|

<







|
|
|








|
<







|
|








|






>
>
>
>
>
>
>
>
>







|








|








|








|








|








|








|








|








|
>
>
>
>
>
>
>
>
>
>








|









|
<
<
<
<
<
<
<
<
<
<









|
<
<
<
<
<
<
<
<
<
<








|









|








|









|









|








|








|

>
>
>
>
>
|
>
|
>
>
>
|
|
|
>
>
>
>
>
>
>







|

|










|

<
<
<
<
<
<
<
<
|
<
|
<
<
<
<
|
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
|




|
















|









|







|







|







|







|







|







|







|







|








|








|








|
>
>
>
>
>
>
>
>







|







|




















|







|







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
	}

    break;

  case 14:

    {
	    yyHour = (yyvsp[-4].Number);
	    yyMinutes = (yyvsp[-2].Number);
	    yySeconds = (yyvsp[0].Number);

	}

    break;

  case 15:

    {
	    yyHour = (yyvsp[-2].Number);
	    yyMinutes = (yyvsp[0].Number);
	    yySeconds = 0;

	}

    break;

  case 16:

    {
	    yyHour = (yyvsp[-1].Number);
	    yyMinutes = 0;
	    yySeconds = 0;
	    yyMeridian = (yyvsp[0].Meridian);
	}

    break;

  case 17:

    {
	    yyMeridian = (yyvsp[0].Meridian);

	}

    break;

  case 18:

    {
	    yyTimezone = (yyvsp[-1].Number);
	    yyDSTmode = DSTon;
	}

    break;

  case 19:

    {
	    yyTimezone = (yyvsp[0].Number);
	    yyDSTmode = DSToff;
	}

    break;

  case 20:

    {
	    yyTimezone = (yyvsp[0].Number);
	    yyDSTmode = DSTon;
	}

    break;

  case 21:

    { /* GMT+0100, GMT-1000, etc. */
	    yyTimezone = (yyvsp[-2].Number) - (yyvsp[-1].Number)*((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60);
	    yyDSTmode = DSToff;
	}

    break;

  case 22:

    { /* GMT+1, GMT-10, etc. */
	    yyTimezone = (yyvsp[-2].Number) - (yyvsp[-1].Number)*((yyvsp[0].Number) * 60);
	    yyDSTmode = DSToff;
	}

    break;

  case 23:

    { /* +0100, -0100 */
	    yyTimezone = -(yyvsp[-1].Number)*((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60);
	    yyDSTmode = DSToff;
	}

    break;

  case 26:

    {
	    yyDayOrdinal = 1;
	    yyDayOfWeek = (yyvsp[0].Number);
	}

    break;

  case 27:

    {
	    yyDayOrdinal = 1;
	    yyDayOfWeek = (yyvsp[-1].Number);
	}

    break;

  case 28:

    {
	    yyDayOrdinal = (yyvsp[-1].Number);
	    yyDayOfWeek = (yyvsp[0].Number);
	}

    break;

  case 29:

    {
	    yyDayOrdinal = (yyvsp[-3].Number) * (yyvsp[-1].Number);
	    yyDayOfWeek = (yyvsp[0].Number);
	}

    break;

  case 30:

    {
	    yyDayOrdinal = (yyvsp[-2].Number) * (yyvsp[-1].Number);
	    yyDayOfWeek = (yyvsp[0].Number);
	}

    break;

  case 31:

    {
	    yyDayOrdinal = 2;
	    yyDayOfWeek = (yyvsp[0].Number);
	}

    break;

  case 32:

    {
	    yyMonth = (yyvsp[-2].Number);
	    yyDay = (yyvsp[0].Number);
	    yyYear = (yyvsp[-4].Number);
	}

    break;

  case 33:

    {
	    yyMonth = (yyvsp[-2].Number);
	    yyDay = (yyvsp[0].Number);
	}

    break;

  case 34:

    {
	    yyMonth = (yyvsp[-4].Number);
	    yyDay = (yyvsp[-2].Number);
	    yyYear = (yyvsp[0].Number);
	}

    break;

  case 36:











    {
	    yyDay = (yyvsp[-4].Number);
	    yyMonth = (yyvsp[-2].Number);
	    yyYear = (yyvsp[0].Number);
	}

    break;

  case 37:











    {
	    yyMonth = (yyvsp[-1].Number);
	    yyDay = (yyvsp[0].Number);
	}

    break;

  case 38:

    {
	    yyMonth = (yyvsp[-3].Number);
	    yyDay = (yyvsp[-2].Number);
	    yyYear = (yyvsp[0].Number);
	}

    break;

  case 39:

    {
	    yyMonth = (yyvsp[0].Number);
	    yyDay = (yyvsp[-1].Number);
	}

    break;

  case 40:

    {
	    yyMonth = 1;
	    yyDay = 1;
	    yyYear = EPOCH;
	}

    break;

  case 41:

    {
	    yyMonth = (yyvsp[-1].Number);
	    yyDay = (yyvsp[-2].Number);
	    yyYear = (yyvsp[0].Number);
	}

    break;

  case 42:

    {
	    yyMonthOrdinalIncr = 1;
	    yyMonthOrdinal = (yyvsp[0].Number);
	}

    break;

  case 43:

    {
	    yyMonthOrdinalIncr = (yyvsp[-1].Number);
	    yyMonthOrdinal = (yyvsp[0].Number);
	}

    break;

  case 46:

    { /* YYYYMMDD */
	    yyYear = (yyvsp[0].Number) / 10000;
	    yyMonth = ((yyvsp[0].Number) % 10000)/100;
	    yyDay = (yyvsp[0].Number) % 100;
	}

    break;

  case 47:

    { /* YYMMDD */
	    yyYear = (yyvsp[0].Number) / 10000;
	    yyMonth = ((yyvsp[0].Number) % 10000)/100;
	    yyDay = (yyvsp[0].Number) % 100;
	}

    break;

  case 49:

    {
	    yyHour = (yyvsp[0].Number) / 10000;
	    yyMinutes = ((yyvsp[0].Number) % 10000)/100;
	    yySeconds = (yyvsp[0].Number) % 100;
	}

    break;

  case 52:

    { /* YYYYMMDDhhmmss */
	    yyYear = (yyvsp[-1].Number) / 10000;
	    yyMonth = ((yyvsp[-1].Number) % 10000)/100;
	    yyDay = (yyvsp[-1].Number) % 100;
	    yyHour = (yyvsp[0].Number) / 10000;
	    yyMinutes = ((yyvsp[0].Number) % 10000)/100;
	    yySeconds = (yyvsp[0].Number) % 100;
	}

    break;

  case 53:









    { /* YYYYMMDDhhmm */

	    if (yyDigitCount != 4) YYABORT; /* normally unreached */




	    yyYear = (yyvsp[-1].Number) / 10000;
	    yyMonth = ((yyvsp[-1].Number) % 10000)/100;
	    yyDay = (yyvsp[-1].Number) % 100;













	    yyHour = (yyvsp[0].Number) / 100;
	    yyMinutes = ((yyvsp[0].Number) % 100);
	    yySeconds = 0;
	}

    break;

  case 54:

    {
	    /*
	     * 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].Number)/1000 + 2323 - 377;
	    yyDay  = 1;
	    yyMonth = 1;
	    yyRelDay += (((yyvsp[-2].Number)%1000)*(365 + IsLeapYear(yyYear)))/1000;
	    yyRelSeconds += (yyvsp[0].Number) * 144 * 60;
	}

    break;

  case 55:

    {
	    yyRelSeconds *= -1;
	    yyRelMonth *= -1;
	    yyRelDay *= -1;
	}

    break;

  case 57:

    {
	    *yyRelPointer += (yyvsp[-3].Number) * (yyvsp[-1].Number) * (yyvsp[0].Number);
	}

    break;

  case 58:

    {
	    *yyRelPointer += (yyvsp[-2].Number) * (yyvsp[-1].Number) * (yyvsp[0].Number);
	}

    break;

  case 59:

    {
	    *yyRelPointer += (yyvsp[-1].Number) * (yyvsp[0].Number);
	}

    break;

  case 60:

    {
	    *yyRelPointer += (yyvsp[0].Number);
	}

    break;

  case 61:

    {
	    *yyRelPointer += (yyvsp[-1].Number) * (yyvsp[0].Number);
	}

    break;

  case 62:

    {
	    *yyRelPointer += (yyvsp[0].Number);
	}

    break;

  case 63:

    {
	    (yyval.Number) = -1;
	}

    break;

  case 64:

    {
	    (yyval.Number) =  1;
	}

    break;

  case 65:

    {
	    (yyval.Number) = (yyvsp[0].Number);
	    yyRelPointer = &yyRelSeconds;
	}

    break;

  case 66:

    {
	    (yyval.Number) = (yyvsp[0].Number);
	    yyRelPointer = &yyRelDay;
	}

    break;

  case 67:

    {
	    (yyval.Number) = (yyvsp[0].Number);
	    yyRelPointer = &yyRelMonth;
	}

    break;

  case 68:

    {
	    (yyval.Number) = (yyvsp[0].Number);
	}

    break;

  case 69:

    {
	    (yyval.Number) = (yyvsp[0].Number);
	}

    break;

  case 70:

    {
	    (yyval.Number) = (yyvsp[0].Number);
	}

    break;

  case 71:

    {
	    if ((info->flags & (CLF_TIME|CLF_HAVEDATE|CLF_RELCONV)) == (CLF_TIME|CLF_HAVEDATE)) {
		yyYear = (yyvsp[0].Number);
	    } else {
		yyIncrFlags(CLF_TIME);
		if (yyDigitCount <= 2) {
		    yyHour = (yyvsp[0].Number);
		    yyMinutes = 0;
		} else {
		    yyHour = (yyvsp[0].Number) / 100;
		    yyMinutes = (yyvsp[0].Number) % 100;
		}
		yySeconds = 0;
		yyMeridian = MER24;
	    }
	}

    break;

  case 72:

    {
	    (yyval.Meridian) = MER24;
	}

    break;

  case 73:

    {
	    (yyval.Meridian) = (yyvsp[0].Meridian);
	}

    break;

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
    YYLTYPE* location,
    DateInfo *info)
{
    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)))







>












>









|
|
<
>
>




<
<




>

>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
|
<
|
|
>
>
>
>
>
>
>
>
>
>














>
>
>
|





>
>
>
>







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
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
    YYLTYPE* location,
    DateInfo *info)
{
    register char c;
    register char *p;
    char buff[20];
    int Count;
    const char *tokStart;

    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;
	    }
	}
	tokStart = yyInput;

	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)))) {
		if (num >= 0) {
		    num *= 10; num += c - '0';

		}
	    }
	    yylvalPtr->Number = num;
	    yyDigitCount = p - yyInput;
	    yyInput = p;



	    /*
	     * A number with 6 or more digits is considered an ISO 8601 base.
	     */

	    location->last_column = yyInput - info->dateStart - 1;
	    if (yyDigitCount >= 6) {
		if (yyDigitCount == 14 || yyDigitCount == 12) {
		    /* long form of ISO 8601 (without separator), either
		     * YYYYMMDDhhmmss or YYYYMMDDhhmm, so reduce to date
		     * (8 chars is isodate) */
		    p = (char *)tokStart;
		    num = *p++ - '0';
		    do {
			num *= 10; num += *p++ - '0';
		    } while (p - tokStart < 8);
		    yylvalPtr->Number = num;
		    yyDigitCount = 8;
		    yyInput = p;
		    location->last_column = yyInput - info->dateStart - 1;
		    return tISOBASL;
		}
		if (num < 0) { /* overflow */

		    return tID;
		}
		if (yyDigitCount == 8) {
		    return tISOBAS8;
		}
		if (yyDigitCount == 6) {
		    return tISOBAS6;
		}
	    }
	    /* ignore spaces after digits (optional) */
	    yyInput = bypassSpaces(yyInput);
	    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 spaces to consider word boundaries (for instance
	     *	literal T in isodateTisotimeZ is not a TZ, but Z is UTC);
	     *	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 (isdigit(c)) { /* literal not a TZ  */
		    yyInput = tokStart;
		    return *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)))
Changes to generic/tclGetDate.y.
133
134
135
136
137
138
139
140


141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156


157
158
159
160
161
162
163
%token	tSEC_UNIT
%token	tUNUMBER
%token	tZONE
%token	tZONEwO4
%token	tZONEwO2
%token	tEPOCH
%token	tDST
%token	tISOBASE


%token	tDAY_UNIT
%token	tNEXT
%token	SP

%type	<Number>	tDAY
%type	<Number>	tDAYZONE
%type	<Number>	tMONTH
%type	<Number>	tMONTH_UNIT
%type	<Number>	tDST
%type	<Number>	tSEC_UNIT
%type	<Number>	tUNUMBER
%type	<Number>	INTNUM
%type	<Number>	tZONE
%type	<Number>	tZONEwO4
%type	<Number>	tZONEwO2
%type	<Number>	tISOBASE


%type	<Number>	tDAY_UNIT
%type	<Number>	unit
%type	<Number>	sign
%type	<Number>	tNEXT
%type	<Number>	tSTARDATE
%type	<Meridian>	tMERIDIAN
%type	<Meridian>	o_merid







|
>
>















|
>
>







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
%token	tSEC_UNIT
%token	tUNUMBER
%token	tZONE
%token	tZONEwO4
%token	tZONEwO2
%token	tEPOCH
%token	tDST
%token	tISOBAS8
%token	tISOBAS6
%token	tISOBASL
%token	tDAY_UNIT
%token	tNEXT
%token	SP

%type	<Number>	tDAY
%type	<Number>	tDAYZONE
%type	<Number>	tMONTH
%type	<Number>	tMONTH_UNIT
%type	<Number>	tDST
%type	<Number>	tSEC_UNIT
%type	<Number>	tUNUMBER
%type	<Number>	INTNUM
%type	<Number>	tZONE
%type	<Number>	tZONEwO4
%type	<Number>	tZONEwO2
%type	<Number>	tISOBAS8
%type	<Number>	tISOBAS6
%type	<Number>	tISOBASL
%type	<Number>	tDAY_UNIT
%type	<Number>	unit
%type	<Number>	sign
%type	<Number>	tNEXT
%type	<Number>	tSTARDATE
%type	<Meridian>	tMERIDIAN
%type	<Meridian>	o_merid
190
191
192
193
194
195
196
197
198
199











200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
	| iso {
	    yyIncrFlags(CLF_TIME|CLF_HAVEDATE);
	}
	| trek {
	    yyIncrFlags(CLF_TIME|CLF_HAVEDATE);
	    info->flags |= CLF_RELCONV;
	}
	| number
	;












time	: tUNUMBER tMERIDIAN {
	    yyHour = $1;
	    yyMinutes = 0;
	    yySeconds = 0;
	    yyMeridian = $2;
	}
	| tUNUMBER ':' tUNUMBER o_merid {
	    yyHour = $1;
	    yyMinutes = $3;
	    yySeconds = 0;
	    yyMeridian = $4;
	}
	| tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
	    yyHour = $1;
	    yyMinutes = $3;
	    yySeconds = $5;
	    yyMeridian = $6;
	}
	;

zone	: tZONE tDST {
	    yyTimezone = $1;
	    yyDSTmode = DSTon;
	}







|


>
>
>
>
>
>
>
>
>
>
>






|
<
<
<
|
<
<
<
<
<
<







194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221



222






223
224
225
226
227
228
229
	| iso {
	    yyIncrFlags(CLF_TIME|CLF_HAVEDATE);
	}
	| trek {
	    yyIncrFlags(CLF_TIME|CLF_HAVEDATE);
	    info->flags |= CLF_RELCONV;
	}
	| numitem
	;

iextime : tUNUMBER ':' tUNUMBER ':' tUNUMBER {
	    yyHour = $1;
	    yyMinutes = $3;
	    yySeconds = $5;
	}
	| tUNUMBER ':' tUNUMBER {
	    yyHour = $1;
	    yyMinutes = $3;
	    yySeconds = 0;
	}
	;
time	: tUNUMBER tMERIDIAN {
	    yyHour = $1;
	    yyMinutes = 0;
	    yySeconds = 0;
	    yyMeridian = $2;
	}
	| iextime o_merid {



	    yyMeridian = $2;






	}
	;

zone	: tZONE tDST {
	    yyTimezone = $1;
	    yyDSTmode = DSTon;
	}
269
270
271
272
273
274
275






276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
	}
	| tNEXT tDAY {
	    yyDayOrdinal = 2;
	    yyDayOfWeek = $2;
	}
	;







date	: tUNUMBER '/' tUNUMBER {
	    yyMonth = $1;
	    yyDay = $3;
	}
	| tUNUMBER '/' tUNUMBER '/' tUNUMBER {
	    yyMonth = $1;
	    yyDay = $3;
	    yyYear = $5;
	}
	| tISOBASE {
	    yyYear = $1 / 10000;
	    yyMonth = ($1 % 10000)/100;
	    yyDay = $1 % 100;
	}
	| tUNUMBER '-' tMONTH '-' tUNUMBER {
	    yyDay = $1;
	    yyMonth = $3;
	    yyYear = $5;
	}
	| tUNUMBER '-' tUNUMBER '-' tUNUMBER {
	    yyMonth = $3;
	    yyDay = $5;
	    yyYear = $1;
	}
	| tMONTH tUNUMBER {
	    yyMonth = $1;
	    yyDay = $2;
	}
	| tMONTH tUNUMBER comma tUNUMBER {
	    yyMonth = $1;
	    yyDay = $2;







>
>
>
>
>
>









|
<
<
<
<





<
<
<
<
<







275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297




298
299
300
301
302





303
304
305
306
307
308
309
	}
	| tNEXT tDAY {
	    yyDayOrdinal = 2;
	    yyDayOfWeek = $2;
	}
	;

iexdate	: tUNUMBER '-' tUNUMBER '-' tUNUMBER {
	    yyMonth = $3;
	    yyDay = $5;
	    yyYear = $1;
	}
	;
date	: tUNUMBER '/' tUNUMBER {
	    yyMonth = $1;
	    yyDay = $3;
	}
	| tUNUMBER '/' tUNUMBER '/' tUNUMBER {
	    yyMonth = $1;
	    yyDay = $3;
	    yyYear = $5;
	}
	| isodate




	| tUNUMBER '-' tMONTH '-' tUNUMBER {
	    yyDay = $1;
	    yyMonth = $3;
	    yyYear = $5;
	}





	| tMONTH tUNUMBER {
	    yyMonth = $1;
	    yyDay = $2;
	}
	| tMONTH tUNUMBER comma tUNUMBER {
	    yyMonth = $1;
	    yyDay = $2;
328
329
330
331
332
333
334


335

336



337
338
339




340
341
342
343



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
	}
	| tNEXT tUNUMBER tMONTH {
	    yyMonthOrdinalIncr = $2;
	    yyMonthOrdinal = $3;
	}
	;



iso	: tISOBASE tZONE tISOBASE {

	    if ($2 != HOUR( 7)) YYABORT; /* T */



	    yyYear = $1 / 10000;
	    yyMonth = ($1 % 10000)/100;
	    yyDay = $1 % 100;




	    yyHour = $3 / 10000;
	    yyMinutes = ($3 % 10000)/100;
	    yySeconds = $3 % 100;
	}



	| tISOBASE tISOBASE {
	    yyYear = $1 / 10000;
	    yyMonth = ($1 % 10000)/100;
	    yyDay = $1 % 100;
	    yyHour = $2 / 10000;
	    yyMinutes = ($2 % 10000)/100;
	    yySeconds = $2 % 100;
	}
	| tISOBASE SP tUNUMBER ':' tUNUMBER ':' tUNUMBER {
	    yyYear = $1 / 10000;
	    yyMonth = ($1 % 10000)/100;
	    yyDay = $1 % 100;
	    yyHour = $3;
	    yyMinutes = $5;
	    yySeconds = $7;
	}
	| tISOBASE tZONE tUNUMBER ':' tUNUMBER ':' tUNUMBER {
	    if ($2 != HOUR( 7)) YYABORT; /* T */
	    yyYear = $1 / 10000;
	    yyMonth = ($1 % 10000)/100;
	    yyDay = $1 % 100;
	    yyHour = $3;
	    yyMinutes = $5;
	    yySeconds = $7;
	}
	| tISOBASE SP tISOBASE {
	    yyYear = $1 / 10000;
	    yyMonth = ($1 % 10000)/100;
	    yyDay = $1 % 100;
	    yyHour = $3 / 10000;
	    yyMinutes = ($3 % 10000)/100;
	    yySeconds = $3 % 100;
	}
	;

trek	: tSTARDATE INTNUM '.' tUNUMBER {
	    /*
	     * Offset computed year by -377 so that the returned years will be
	     * in a range accessible with a 32 bit clock seconds value.







>
>
|
>
|
>
>
>



>
>
>
>
|
|
|

>
>
>
|







|
<
<
<
<
<
<
<
<
|



|
|
<
<
<
<
<
<
<
<
|







331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368








369
370
371
372
373
374








375
376
377
378
379
380
381
382
	}
	| tNEXT tUNUMBER tMONTH {
	    yyMonthOrdinalIncr = $2;
	    yyMonthOrdinal = $3;
	}
	;

isosep	: 'T'|SP
	;
isodate	: tISOBAS8 { /* YYYYMMDD */
	    yyYear = $1 / 10000;
	    yyMonth = ($1 % 10000)/100;
	    yyDay = $1 % 100;
	}
	| tISOBAS6 { /* YYMMDD */
	    yyYear = $1 / 10000;
	    yyMonth = ($1 % 10000)/100;
	    yyDay = $1 % 100;
	}
	| iexdate
	;
isotime	: tISOBAS6 {
	    yyHour = $1 / 10000;
	    yyMinutes = ($1 % 10000)/100;
	    yySeconds = $1 % 100;
	}
	| iextime
	;
iso	: isodate isosep isotime
	| tISOBASL tISOBAS6 { /* YYYYMMDDhhmmss */
	    yyYear = $1 / 10000;
	    yyMonth = ($1 % 10000)/100;
	    yyDay = $1 % 100;
	    yyHour = $2 / 10000;
	    yyMinutes = ($2 % 10000)/100;
	    yySeconds = $2 % 100;
	}
	| tISOBASL tUNUMBER { /* YYYYMMDDhhmm */








	    if (yyDigitCount != 4) YYABORT; /* normally unreached */
	    yyYear = $1 / 10000;
	    yyMonth = ($1 % 10000)/100;
	    yyDay = $1 % 100;
	    yyHour = $2 / 100;
	    yyMinutes = ($2 % 100);








	    yySeconds = 0;
	}
	;

trek	: tSTARDATE INTNUM '.' tUNUMBER {
	    /*
	     * Offset computed year by -377 so that the returned years will be
	     * in a range accessible with a 32 bit clock seconds value.
439
440
441
442
443
444
445
446



447
448
449
450
451
452
453
454
455
456
457
458
	    yyRelPointer = &yyRelMonth;
	}
	;

INTNUM	: tUNUMBER {
	    $$ = $1;
	}
	| tISOBASE {



	    $$ = $1;
	}
	;

number	: INTNUM {
	    if ((info->flags & (CLF_TIME|CLF_HAVEDATE|CLF_RELCONV)) == (CLF_TIME|CLF_HAVEDATE)) {
		yyYear = $1;
	    } else {
		yyIncrFlags(CLF_TIME);
		if (yyDigitCount <= 2) {
		    yyHour = $1;
		    yyMinutes = 0;







|
>
>
>




|







439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
	    yyRelPointer = &yyRelMonth;
	}
	;

INTNUM	: tUNUMBER {
	    $$ = $1;
	}
	| tISOBAS6 {
	    $$ = $1;
	}
	| tISOBAS8 {
	    $$ = $1;
	}
	;

numitem	: tUNUMBER {
	    if ((info->flags & (CLF_TIME|CLF_HAVEDATE|CLF_RELCONV)) == (CLF_TIME|CLF_HAVEDATE)) {
		yyYear = $1;
	    } else {
		yyIncrFlags(CLF_TIME);
		if (yyDigitCount <= 2) {
		    yyHour = $1;
		    yyMinutes = 0;
878
879
880
881
882
883
884

885
886
887
888
889
890
891
892
893
894
895
896

897
898
899
900
901
902
903
904
905
906
907
908


909
910
911
912
913
914
915
916
917
918

919












920
921

922
923
924
925










926
927
928
929
930
931
932
933
934
935
936
937
938
939



940
941
942
943
944
945




946
947
948
949
950
951
952
    YYLTYPE* location,
    DateInfo *info)
{
    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)))







>












>









|
|
<
>
>




<
<




>

>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
|
<
|
|
>
>
>
>
>
>
>
>
>
>














>
>
>
|





>
>
>
>







881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912

913
914
915
916
917
918


919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940

941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
    YYLTYPE* location,
    DateInfo *info)
{
    register char c;
    register char *p;
    char buff[20];
    int Count;
    const char *tokStart;

    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;
	    }
	}
	tokStart = yyInput;

	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)))) {
		if (num >= 0) {
		    num *= 10; num += c - '0';

		}
	    }
	    yylvalPtr->Number = num;
	    yyDigitCount = p - yyInput;
	    yyInput = p;



	    /*
	     * A number with 6 or more digits is considered an ISO 8601 base.
	     */

	    location->last_column = yyInput - info->dateStart - 1;
	    if (yyDigitCount >= 6) {
		if (yyDigitCount == 14 || yyDigitCount == 12) {
		    /* long form of ISO 8601 (without separator), either
		     * YYYYMMDDhhmmss or YYYYMMDDhhmm, so reduce to date
		     * (8 chars is isodate) */
		    p = (char *)tokStart;
		    num = *p++ - '0';
		    do {
			num *= 10; num += *p++ - '0';
		    } while (p - tokStart < 8);
		    yylvalPtr->Number = num;
		    yyDigitCount = 8;
		    yyInput = p;
		    location->last_column = yyInput - info->dateStart - 1;
		    return tISOBASL;
		}
		if (num < 0) { /* overflow */

		    return tID;
		}
		if (yyDigitCount == 8) {
		    return tISOBAS8;
		}
		if (yyDigitCount == 6) {
		    return tISOBAS6;
		}
	    }
	    /* ignore spaces after digits (optional) */
	    yyInput = bypassSpaces(yyInput);
	    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 spaces to consider word boundaries (for instance
	     *	literal T in isodateTisotimeZ is not a TZ, but Z is UTC);
	     *	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 (isdigit(c)) { /* literal not a TZ  */
		    yyInput = tokStart;
		    return *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)))
Changes to tests/clock.test.
36170
36171
36172
36173
36174
36175
36176

36177
36178
36179
36180
36181
36182
36183
36184
36185
36186
36187
36188
36189
36190
36191
36192












36193
36194
36195
36196





























36197
36198
36199

















36200
36201
36202
36203
36204
36205
36206
test clock-34.11.3 {clock scan tests: same century switch} {
    set times [clock scan "1/1/39" -gmt true]
} [clock scan "1/1/39" -format "%m/%d/%y" -gmt true]
test clock-34.12 {clock scan, relative times} {
    set time [clock scan "Oct 23, 1992 -1 day"  -gmt true]
    clock format $time -format {%b %d, %Y} -gmt true
} "Oct 22, 1992"

test clock-34.13 {clock scan, ISO 8601 base date format} {
    set time [clock scan "19921023" -gmt true]
    clock format $time -format {%b %d, %Y} -gmt true
} "Oct 23, 1992"
test clock-34.14 {clock scan, ISO 8601 expanded date format} {
    set time [clock scan "1992-10-23" -gmt true]
    clock format $time -format {%b %d, %Y} -gmt true
} "Oct 23, 1992"
test clock-34.15 {clock scan, DD-Mon-YYYY format} {
    set time [clock scan "23-Oct-1992" -gmt true]
    clock format $time -format {%b %d, %Y} -gmt true
} "Oct 23, 1992"
test clock-34.16 {clock scan, ISO 8601 point in time format} {
    set time [clock scan "19921023T235959" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 23:59:59"












test clock-34.17 {clock scan, ISO 8601 point in time format} {
    set time [clock scan "19921023 235959" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 23:59:59"





























test clock-34.18 {clock scan, ISO 8601 point in time format} {
    set time [clock scan "19921023T000000" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true

















} "Oct 23, 1992 00:00:00"

test clock-34.20.1 {clock scan tests (-TZ)} {
    set time [clock scan "31 Jan 14 23:59:59 -0100"]
    clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
} {Feb 01,2014 00:59:59 GMT}
test clock-34.20.2 {clock scan tests (+TZ)} {







>
















>
>
>
>
>
>
>
>
>
>
>
>




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







36170
36171
36172
36173
36174
36175
36176
36177
36178
36179
36180
36181
36182
36183
36184
36185
36186
36187
36188
36189
36190
36191
36192
36193
36194
36195
36196
36197
36198
36199
36200
36201
36202
36203
36204
36205
36206
36207
36208
36209
36210
36211
36212
36213
36214
36215
36216
36217
36218
36219
36220
36221
36222
36223
36224
36225
36226
36227
36228
36229
36230
36231
36232
36233
36234
36235
36236
36237
36238
36239
36240
36241
36242
36243
36244
36245
36246
36247
36248
36249
36250
36251
36252
36253
36254
36255
36256
36257
36258
36259
36260
36261
36262
36263
36264
36265
test clock-34.11.3 {clock scan tests: same century switch} {
    set times [clock scan "1/1/39" -gmt true]
} [clock scan "1/1/39" -format "%m/%d/%y" -gmt true]
test clock-34.12 {clock scan, relative times} {
    set time [clock scan "Oct 23, 1992 -1 day"  -gmt true]
    clock format $time -format {%b %d, %Y} -gmt true
} "Oct 22, 1992"

test clock-34.13 {clock scan, ISO 8601 base date format} {
    set time [clock scan "19921023" -gmt true]
    clock format $time -format {%b %d, %Y} -gmt true
} "Oct 23, 1992"
test clock-34.14 {clock scan, ISO 8601 expanded date format} {
    set time [clock scan "1992-10-23" -gmt true]
    clock format $time -format {%b %d, %Y} -gmt true
} "Oct 23, 1992"
test clock-34.15 {clock scan, DD-Mon-YYYY format} {
    set time [clock scan "23-Oct-1992" -gmt true]
    clock format $time -format {%b %d, %Y} -gmt true
} "Oct 23, 1992"
test clock-34.16 {clock scan, ISO 8601 point in time format} {
    set time [clock scan "19921023T235959" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 23:59:59"
test clock-34.16.1a {clock scan, ISO 8601 T literal optional (YYYYMMDDhhmmss)} {
    set time [clock scan "19921023235959" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 23:59:59"
test clock-34.16.1b {clock scan, ISO 8601 T literal optional (YYYYMMDDhhmm)} {
    set time [clock scan "199210232359" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 23:59:00"
test clock-34.16.2 {clock scan, ISO 8601 extended date time} {
    set time [clock scan "1992-10-23T23:59:59" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 23:59:59"
test clock-34.17 {clock scan, ISO 8601 point in time format} {
    set time [clock scan "19921023 235959" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 23:59:59"
test clock-34.17.2a {clock scan, ISO 8601 extended date time (YYYY-MM-DD hh:mm:ss)} {
    set time [clock scan "1992-10-23 23:59:59" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 23:59:59"
test clock-34.17.2b {clock scan, ISO 8601 extended date time (YYYY-MM-DDThh:mm:ss)} {
    set time [clock scan "1992-10-23T23:59:59" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 23:59:59"
test clock-34.17.2c {clock scan, ISO 8601 extended date time (YYYY-MM-DD hh:mm)} {
    set time [clock scan "1992-10-23 23:59" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 23:59:00"
test clock-34.17.2d {clock scan, ISO 8601 extended date time (YYYY-MM-DDThh:mm)} {
    set time [clock scan "1992-10-23T23:59" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 23:59:00"
test clock-34.17.3 {clock scan, TZ-word boundaries - Z is not TZ here } -body {
    set time [clock scan "1992-10-23Z23:59:59" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} -returnCodes error -match glob \
  -result {unable to convert date-time string*}
test clock-34.17.4 {clock scan, TZ-word boundaries - Z is TZ UTC here} {
    set time [clock scan "1992-10-23 Z 23:59:59" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 23:59:59"
test clock-34.17.5 {clock scan, ISO 8601 extended date time with UTC TZ} {
    set time [clock scan "1992-10-23T23:59:59Z" -timezone :America/Detroit]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 23:59:59"
test clock-34.18 {clock scan, ISO 8601 point in time format} {
    set time [clock scan "19921023T000000" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 00:00:00"
test clock-34.18.2 {clock scan, ISO 8601 extended date time} {
    set time [clock scan "1992-10-23T00:00:00" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 00:00:00"
test clock-34.18.3 {clock scan, TZ-word boundaries - Z is not TZ here } -body {
    set time [clock scan "1992-10-23Z00:00:00" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} -returnCodes error -match glob \
  -result {unable to convert date-time string*}
test clock-34.18.4 {clock scan, TZ-word boundaries - Z is TZ UTC here} {
    set time [clock scan "1992-10-23 Z 00:00:00" -gmt true]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 00:00:00"
test clock-34.18.5 {clock scan, ISO 8601 extended date time with UTC TZ} {
    set time [clock scan "1992-10-23T00:00:00Z" -timezone :America/Detroit]
    clock format $time -format {%b %d, %Y %H:%M:%S} -gmt true
} "Oct 23, 1992 00:00:00"

test clock-34.20.1 {clock scan tests (-TZ)} {
    set time [clock scan "31 Jan 14 23:59:59 -0100"]
    clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
} {Feb 01,2014 00:59:59 GMT}
test clock-34.20.2 {clock scan tests (+TZ)} {