- Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathgetdate.c
2264 lines (2009 loc) · 57.9 KB
/
getdate.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
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
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
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
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
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
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
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
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* A Bison parser, made from getdate.y
by GNU bison 1.35. */
#defineYYBISON 1 /* Identify Bison output. */
# definetAGO 257
# definetDAY 258
# definetDAY_UNIT 259
# definetDAYZONE 260
# definetDST 261
# definetHOUR_UNIT 262
# definetID 263
# definetMERIDIAN 264
# definetMINUTE_UNIT 265
# definetMONTH 266
# definetMONTH_UNIT 267
# definetSEC_UNIT 268
# definetSNUMBER 269
# definetUNUMBER 270
# definetYEAR_UNIT 271
# definetZONE 272
#line 1 "getdate.y"
/*
** Originally written by Steven M. Bellovin <smb@research.att.com> while
** at the University of North Carolina at Chapel Hill. Later tweaked by
** a couple of people on Usenet. Completely overhauled by Rich $alz
** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
**
** This grammar has 13 shift/reduce conflicts.
**
** This code is in the public domain and has no copyright.
*/
#include"config.h"
#include"../src/setup.h"
#ifdefHAVE_CONFIG_H
# ifdefFORCE_ALLOCA_H
# include<alloca.h>
# endif
#endif
/* Since the code of getdate.y is not included in the Emacs executable
itself, there is no need to #define static in this file. Even if
the code were included in the Emacs executable, it probably
wouldn't do any harm to #undef it here; this will only cause
problems if we try to write to a static variable, which I don't
think this code needs to do. */
#ifdefemacs
# undef static
#endif
#ifdefHAVE_STDIO_H
#include<stdio.h>
#endif
#ifdefHAVE_CTYPE_H
#include<ctype.h>
#endif
#ifdefHAVE_STRING_H
#include<string.h>
#endif
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
# defineIN_CTYPE_DOMAIN(c) 1
#else
# defineIN_CTYPE_DOMAIN(c) isascii(c)
#endif
#defineISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
#defineISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
#defineISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
#defineISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
/* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
- Its arg may be any int or unsigned int; it need not be an unsigned char.
- It's guaranteed to evaluate its argument exactly once.
- It's typically faster.
Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
it's important to use the locale's definition of `digit' even when the
host does not conform to Posix. */
#defineISDIGIT(c) ((unsigned) (c) - '0' <= 9)
#include"../src/getdate.h"
#if defined (STDC_HEADERS) || defined (USG)
# include<string.h>
#endif
/* Some old versions of bison generate parsers that use bcopy.
That loses on systems that don't provide the function, so we have
to redefine it here. */
#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
# definebcopy(from, to, len) memcpy ((to), (from), (len))
#endif
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
yacc generated parsers in the same program. Note that these are only
the variables produced by yacc. If other parser generators (bison,
byacc, etc) produce additional global names that conflict at link time,
then those parser generators need to be fixed instead of adding those
names to this list. */
#defineyymaxdepth gd_maxdepth
#defineyyparse gd_parse
#defineyylex gd_lex
#defineyyerror gd_error
#defineyylval gd_lval
#defineyychar gd_char
#defineyydebug gd_debug
#defineyypact gd_pact
#defineyyr1 gd_r1
#defineyyr2 gd_r2
#defineyydef gd_def
#defineyychk gd_chk
#defineyypgo gd_pgo
#defineyyact gd_act
#defineyyexca gd_exca
#defineyyerrflag gd_errflag
#defineyynerrs gd_nerrs
#defineyyps gd_ps
#defineyypv gd_pv
#defineyys gd_s
#defineyy_yys gd_yys
#defineyystate gd_state
#defineyytmp gd_tmp
#defineyyv gd_v
#defineyy_yyv gd_yyv
#defineyyval gd_val
#defineyylloc gd_lloc
#defineyyreds gd_reds /* With YYDEBUG defined */
#defineyytoks gd_toks /* With YYDEBUG defined */
#defineyylhs gd_yylhs
#defineyylen gd_yylen
#defineyydefred gd_yydefred
#defineyydgoto gd_yydgoto
#defineyysindex gd_yysindex
#defineyyrindex gd_yyrindex
#defineyygindex gd_yygindex
#defineyytable gd_yytable
#defineyycheck gd_yycheck
staticintyylex (void);
staticintyyerror (char*s);
externintyyparse (void);
#defineEPOCH 1970
#defineHOUR(x) ((x) * 60)
#defineMAX_BUFF_LEN 128 /* size of buffer to read the date into */
/*
** An entry in the lexical lookup table.
*/
typedefstruct_TABLE {
constchar*name;
inttype;
intvalue;
} TABLE;
/*
** Meridian: am, pm, or 24-hour style.
*/
typedefenum_MERIDIAN {
MERam, MERpm, MER24
} MERIDIAN;
/*
** Global variables. We could get rid of most of these by using a good
** union as the yacc stack. (This routine was originally written before
** yacc had the %union construct.) Maybe someday; right now we only use
** the %union very rarely.
*/
staticconstchar*yyInput;
staticintyyDayOrdinal;
staticintyyDayNumber;
staticintyyHaveDate;
staticintyyHaveDay;
staticintyyHaveRel;
staticintyyHaveTime;
staticintyyHaveZone;
staticintyyTimezone;
staticintyyDay;
staticintyyHour;
staticintyyMinutes;
staticintyyMonth;
staticintyySeconds;
staticintyyYear;
staticMERIDIANyyMeridian;
staticintyyRelDay;
staticintyyRelHour;
staticintyyRelMinutes;
staticintyyRelMonth;
staticintyyRelSeconds;
staticintyyRelYear;
#line 183 "getdate.y"
#ifndefYYSTYPE
typedefunion {
intNumber;
enum_MERIDIANMeridian;
} yystype;
# defineYYSTYPE yystype
# defineYYSTYPE_IS_TRIVIAL 1
#endif
#ifndefYYDEBUG
# defineYYDEBUG 0
#endif
#defineYYFINAL 61
#defineYYFLAG -32768
#defineYYNTBASE 22
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
#defineYYTRANSLATE(x) ((unsigned)(x) <= 272 ? yytranslate[x] : 32)
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
staticconstcharyytranslate[] =
{
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, 2, 20, 2, 2, 21, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 19, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 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, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18
};
#ifYYDEBUG
staticconstshortyyprhs[] =
{
0, 0, 1, 4, 6, 8, 10, 12, 14, 16,
19, 24, 29, 36, 43, 45, 47, 50, 52, 55,
58, 62, 68, 72, 76, 79, 84, 87, 91, 94,
96, 99, 102, 104, 107, 110, 112, 115, 118, 120,
123, 126, 128, 131, 134, 136, 139, 142, 144, 146,
147
};
staticconstshortyyrhs[] =
{
-1, 22, 23, 0, 24, 0, 25, 0, 27, 0,
26, 0, 28, 0, 30, 0, 16, 10, 0, 16,
19, 16, 31, 0, 16, 19, 16, 15, 0, 16,
19, 16, 19, 16, 31, 0, 16, 19, 16, 19,
16, 15, 0, 18, 0, 6, 0, 18, 7, 0,
4, 0, 4, 20, 0, 16, 4, 0, 16, 21,
16, 0, 16, 21, 16, 21, 16, 0, 16, 15,
15, 0, 16, 12, 15, 0, 12, 16, 0, 12,
16, 20, 16, 0, 16, 12, 0, 16, 12, 16,
0, 29, 3, 0, 29, 0, 16, 17, 0, 15,
17, 0, 17, 0, 16, 13, 0, 15, 13, 0,
13, 0, 16, 5, 0, 15, 5, 0, 5, 0,
16, 8, 0, 15, 8, 0, 8, 0, 16, 11,
0, 15, 11, 0, 11, 0, 16, 14, 0, 15,
14, 0, 14, 0, 16, 0, 0, 10, 0
};
#endif
#ifYYDEBUG
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
staticconstshortyyrline[] =
{
0, 199, 200, 203, 206, 209, 212, 215, 218, 221,
227, 233, 242, 248, 260, 263, 266, 272, 276, 280,
286, 290, 308, 314, 320, 324, 329, 333, 340, 348,
351, 354, 357, 360, 363, 366, 369, 372, 375, 378,
381, 384, 387, 390, 393, 396, 399, 402, 407, 440,
444
};
#endif
#if (YYDEBUG) || defined YYERROR_VERBOSE
/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
staticconstchar*constyytname[] =
{
"$", "error", "$undefined.", "tAGO", "tDAY", "tDAY_UNIT", "tDAYZONE",
"tDST", "tHOUR_UNIT", "tID", "tMERIDIAN", "tMINUTE_UNIT", "tMONTH",
"tMONTH_UNIT", "tSEC_UNIT", "tSNUMBER", "tUNUMBER", "tYEAR_UNIT",
"tZONE", "':'", "','", "'/'", "spec", "item", "time", "zone", "day",
"date", "rel", "relunit", "number", "o_merid", 0
};
#endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
staticconstshortyyr1[] =
{
0, 22, 22, 23, 23, 23, 23, 23, 23, 24,
24, 24, 24, 24, 25, 25, 25, 26, 26, 26,
27, 27, 27, 27, 27, 27, 27, 27, 28, 28,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 30, 31,
31
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
staticconstshortyyr2[] =
{
0, 0, 2, 1, 1, 1, 1, 1, 1, 2,
4, 4, 6, 6, 1, 1, 2, 1, 2, 2,
3, 5, 3, 3, 2, 4, 2, 3, 2, 1,
2, 2, 1, 2, 2, 1, 2, 2, 1, 2,
2, 1, 2, 2, 1, 2, 2, 1, 1, 0,
1
};
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
doesn't specify something else to do. Zero means the default is an
error. */
staticconstshortyydefact[] =
{
1, 0, 17, 38, 15, 41, 44, 0, 35, 47,
0, 48, 32, 14, 2, 3, 4, 6, 5, 7,
29, 8, 18, 24, 37, 40, 43, 34, 46, 31,
19, 36, 39, 9, 42, 26, 33, 45, 0, 30,
0, 0, 16, 28, 0, 23, 27, 22, 49, 20,
25, 50, 11, 0, 10, 0, 49, 21, 13, 12,
0, 0
};
staticconstshortyydefgoto[] =
{
1, 14, 15, 16, 17, 18, 19, 20, 21, 54
};
staticconstshortyypact[] =
{
-32768, 0, -19,-32768,-32768,-32768,-32768, -13,-32768,-32768,
30, 15,-32768, 14,-32768,-32768,-32768,-32768,-32768,-32768,
19,-32768,-32768, 4,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768, -6,-32768,-32768, 16,-32768,
17, 23,-32768,-32768, 24,-32768,-32768,-32768, 27, 28,
-32768,-32768,-32768, 29,-32768, 32, -8,-32768,-32768,-32768,
50,-32768
};
staticconstshortyypgoto[] =
{
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -5
};
#defineYYLAST 51
staticconstshortyytable[] =
{
60, 22, 51, 23, 2, 3, 4, 58, 5, 45,
46, 6, 7, 8, 9, 10, 11, 12, 13, 30,
31, 42, 43, 32, 44, 33, 34, 35, 36, 37,
38, 47, 39, 48, 40, 24, 41, 51, 25, 49,
50, 26, 52, 27, 28, 56, 53, 29, 57, 55,
61, 59
};
staticconstshortyycheck[] =
{
0, 20, 10, 16, 4, 5, 6, 15, 8, 15,
16, 11, 12, 13, 14, 15, 16, 17, 18, 4,
5, 7, 3, 8, 20, 10, 11, 12, 13, 14,
15, 15, 17, 16, 19, 5, 21, 10, 8, 16,
16, 11, 15, 13, 14, 16, 19, 17, 16, 21,
0, 56
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/share/bison/bison.simple"
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* This is the parser code that is written into each bison parser when
the %semantic_parser declaration is not specified in the grammar.
It was written by Richard Stallman by simplifying the hairy parser
used when %semantic_parser is specified. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
/* The parser invokes alloca or malloc; define the necessary symbols. */
# ifYYSTACK_USE_ALLOCA
# defineYYSTACK_ALLOC alloca
# else
# ifndefYYSTACK_USE_ALLOCA
# if defined (alloca) || defined (_ALLOCA_H)
# defineYYSTACK_ALLOC alloca
# else
# ifdef__GNUC__
# defineYYSTACK_ALLOC __builtin_alloca
# endif
# endif
# endif
# endif
# ifdefYYSTACK_ALLOC
/* Pacify GCC's `empty if-body' warning. */
# defineYYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# else
# if defined (__STDC__) || defined (__cplusplus)
# include<stdlib.h>/* INFRINGES ON USER NAME SPACE */
# defineYYSIZE_T size_t
# endif
# defineYYSTACK_ALLOC malloc
# defineYYSTACK_FREE free
# endif
#endif/* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
#if (! defined (yyoverflow) \
&& (! defined (__cplusplus) \
|| (YYLTYPE_IS_TRIVIAL&&YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
unionyyalloc
{
shortyyss;
YYSTYPEyyvs;
# ifYYLSP_NEEDED
YYLTYPEyyls;
# endif
};
/* The size of the maximum gap between one aligned stack and the next. */
# defineYYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# ifYYLSP_NEEDED
# defineYYSTACK_BYTES(N) \
((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAX)
# else
# defineYYSTACK_BYTES(N) \
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAX)
# endif
/* Copy COUNT objects from FROM to TO. The source and destination do
not overlap. */
# ifndefYYCOPY
# if1<__GNUC__
# defineYYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
# defineYYCOPY(To, From, Count) \
do \
{ \
register YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
while (0)
# endif
# endif
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# defineYYSTACK_RELOCATE(Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#endif
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# defineYYSIZE_T __SIZE_TYPE__
#endif
#if ! defined (YYSIZE_T) && defined (size_t)
# defineYYSIZE_T size_t
#endif
#if ! defined (YYSIZE_T)
# if defined (__STDC__) || defined (__cplusplus)
# include<stddef.h>/* INFRINGES ON USER NAME SPACE */
# defineYYSIZE_T size_t
# endif
#endif
#if ! defined (YYSIZE_T)
# defineYYSIZE_T unsigned int
#endif
#defineyyerrok (yyerrstatus = 0)
#defineyyclearin (yychar = YYEMPTY)
#defineYYEMPTY -2
#defineYYEOF 0
#defineYYACCEPT goto yyacceptlab
#defineYYABORT goto yyabortlab
#defineYYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
#defineYYFAIL goto yyerrlab
#defineYYRECOVERING() (!!yyerrstatus)
#defineYYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ \
yychar = (Token); \
yylval = (Value); \
yychar1 = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ \
yyerror ("syntax error: cannot back up"); \
YYERROR; \
} \
while (0)
#defineYYTERROR 1
#defineYYERRCODE 256
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
are run).
When YYLLOC_DEFAULT is run, CURRENT is set the location of the
first token. By default, to implement support for ranges, extend
its range to the last symbol. */
#ifndefYYLLOC_DEFAULT
# defineYYLLOC_DEFAULT(Current, Rhs, N) \
Current.last_line = Rhs[N].last_line; \
Current.last_column = Rhs[N].last_column;
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
#ifYYPURE
# ifYYLSP_NEEDED
# ifdefYYLEX_PARAM
# defineYYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
# else
# defineYYLEX yylex (&yylval, &yylloc)
# endif
# else/* !YYLSP_NEEDED */
# ifdefYYLEX_PARAM
# defineYYLEX yylex (&yylval, YYLEX_PARAM)
# else
# defineYYLEX yylex (&yylval)
# endif
# endif/* !YYLSP_NEEDED */
#else/* !YYPURE */
# defineYYLEX yylex ()
#endif/* !YYPURE */
/* Enable debugging if requested. */
#ifYYDEBUG
# ifndefYYFPRINTF
# include<stdio.h>/* INFRINGES ON USER NAME SPACE */
# defineYYFPRINTF fprintf
# endif
# defineYYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
intyydebug;
#else/* !YYDEBUG */
# defineYYDPRINTF(Args)
#endif/* !YYDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndefYYINITDEPTH
# defineYYINITDEPTH 200
#endif
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if
SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
#ifYYMAXDEPTH==0
# undef YYMAXDEPTH
#endif
#ifndefYYMAXDEPTH
# defineYYMAXDEPTH 10000
#endif
#ifdefYYERROR_VERBOSE
# ifndefyystrlen
# if defined (__GLIBC__) && defined (_STRING_H)
# defineyystrlen strlen
# else
/* Return the length of YYSTR. */
staticYYSIZE_T
# if defined (__STDC__) || defined (__cplusplus)
yystrlen (constchar*yystr)
# else
yystrlen (yystr)
constchar*yystr;
# endif
{
register constchar*yys=yystr;
while (*yys++!='\0')
continue;
returnyys-yystr-1;
}
# endif
# endif
# ifndefyystpcpy
# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
# defineyystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
staticchar*
# if defined (__STDC__) || defined (__cplusplus)
yystpcpy (char*yydest, constchar*yysrc)
# else
yystpcpy (yydest, yysrc)
char*yydest;
constchar*yysrc;
# endif
{
register char*yyd=yydest;
register constchar*yys=yysrc;
while ((*yyd++=*yys++) !='\0')
continue;
returnyyd-1;
}
# endif
# endif
#endif
#line 315 "/usr/share/bison/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
It should actually point to an object.
Grammar actions can access the variable by casting it
to the proper pointer type. */
#ifdefYYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
# defineYYPARSE_PARAM_ARG void *YYPARSE_PARAM
# defineYYPARSE_PARAM_DECL
# else
# defineYYPARSE_PARAM_ARG YYPARSE_PARAM
# defineYYPARSE_PARAM_DECL void *YYPARSE_PARAM;
# endif
#else/* !YYPARSE_PARAM */
# defineYYPARSE_PARAM_ARG
# defineYYPARSE_PARAM_DECL
#endif/* !YYPARSE_PARAM */
/* Prevent warning if -Wstrict-prototypes. */
#ifdef__GNUC__
# ifdefYYPARSE_PARAM
intyyparse (void*);
# else
intyyparse (void);
# endif
#endif
/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
variables are global, or local to YYPARSE. */
#defineYY_DECL_NON_LSP_VARIABLES \
/* The lookahead symbol. */ \
int yychar; \
\
/* The semantic value of the lookahead symbol. */ \
YYSTYPEyylval; \
\
/* Number of parse errors so far. */ \
intyynerrs;
#ifYYLSP_NEEDED
# defineYY_DECL_VARIABLES \
YY_DECL_NON_LSP_VARIABLES \
\
/* Location data for the lookahead symbol. */ \
YYLTYPEyylloc;
#else
# defineYY_DECL_VARIABLES \
YY_DECL_NON_LSP_VARIABLES
#endif
/* If nonreentrant, generate the variables here. */
#if !YYPURE
YY_DECL_VARIABLES
#endif/* !YYPURE */
int
yyparse (YYPARSE_PARAM_ARG)
YYPARSE_PARAM_DECL
{
/* If reentrant, generate the variables here. */
#ifYYPURE
YY_DECL_VARIABLES
#endif/* !YYPURE */
register intyystate;
register intyyn;
intyyresult;
/* Number of tokens to shift before error messages enabled. */
intyyerrstatus;
/* Lookahead token as an internal (translated) token number. */
intyychar1=0;
/* Three stacks and their tools:
`yyss': related to states,
`yyvs': related to semantic values,
`yyls': related to locations.
Refer to the stacks thru separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
shortyyssa[YYINITDEPTH];
short*yyss=yyssa;
register short*yyssp;
/* The semantic value stack. */
YYSTYPEyyvsa[YYINITDEPTH];
YYSTYPE*yyvs=yyvsa;
register YYSTYPE*yyvsp;
#ifYYLSP_NEEDED
/* The location stack. */
YYLTYPEyylsa[YYINITDEPTH];
YYLTYPE*yyls=yylsa;
YYLTYPE*yylsp;
#endif
#ifYYLSP_NEEDED
# defineYYPOPSTACK (yyvsp--, yyssp--, yylsp--)
#else
# defineYYPOPSTACK (yyvsp--, yyssp--)
#endif
YYSIZE_Tyystacksize=YYINITDEPTH;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPEyyval;
#ifYYLSP_NEEDED
YYLTYPEyyloc;
#endif
/* When reducing, the number of symbols on the RHS of the reduced
rule. */
intyylen;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate=0;
yyerrstatus=0;
yynerrs=0;
yychar=YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
yyssp=yyss;
yyvsp=yyvs;
#ifYYLSP_NEEDED
yylsp=yyls;
#endif
goto yysetstate;
/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate. |
`------------------------------------------------------------*/
yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. so pushing a state here evens the stacks.
*/
yyssp++;
yysetstate:
*yyssp=yystate;
if (yyssp >= yyss+yystacksize-1)
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_Tyysize=yyssp-yyss+1;
#ifdefyyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
YYSTYPE*yyvs1=yyvs;
short*yyss1=yyss;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. */
# ifYYLSP_NEEDED
YYLTYPE*yyls1=yyls;
/* This used to be a conditional around just the two extra args,
but that might be undefined if yyoverflow is a macro. */
yyoverflow ("parser stack overflow",
&yyss1, yysize*sizeof (*yyssp),
&yyvs1, yysize*sizeof (*yyvsp),
&yyls1, yysize*sizeof (*yylsp),
&yystacksize);
yyls=yyls1;
# else
yyoverflow ("parser stack overflow",
&yyss1, yysize*sizeof (*yyssp),
&yyvs1, yysize*sizeof (*yyvsp),
&yystacksize);
# endif
yyss=yyss1;
yyvs=yyvs1;
}
#else/* no yyoverflow */
# ifndefYYSTACK_RELOCATE
goto yyoverflowlab;
# else
/* Extend the stack our own way. */
if (yystacksize >= YYMAXDEPTH)
goto yyoverflowlab;
yystacksize *= 2;
if (yystacksize>YYMAXDEPTH)
yystacksize=YYMAXDEPTH;
{
short*yyss1=yyss;
unionyyalloc*yyptr=
(unionyyalloc*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyoverflowlab;
YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs);
# ifYYLSP_NEEDED
YYSTACK_RELOCATE (yyls);
# endif
# undef YYSTACK_RELOCATE
if (yyss1!=yyssa)
YYSTACK_FREE (yyss1);
}
# endif
#endif/* no yyoverflow */
yyssp=yyss+yysize-1;
yyvsp=yyvs+yysize-1;
#ifYYLSP_NEEDED
yylsp=yyls+yysize-1;
#endif
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
if (yyssp >= yyss+yystacksize-1)
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
goto yybackup;
/*-----------.
| yybackup. |
`-----------*/
yybackup:
/* Do appropriate processing given the current state. */
/* Read a lookahead token if we need one and don't already have one. */
/* yyresume: */
/* First try to decide what to do without reference to lookahead token. */
yyn=yypact[yystate];
if (yyn==YYFLAG)
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* yychar is either YYEMPTY or YYEOF
or a valid token in external form. */
if (yychar==YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar=YYLEX;
}
/* Convert token to internal form (in yychar1) for indexing tables with */
if (yychar <= 0) /* This means end of input. */
{
yychar1=0;
yychar=YYEOF; /* Don't call YYLEX any more */
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else
{
yychar1=YYTRANSLATE (yychar);
#ifYYDEBUG
/* We have to keep this `#if YYDEBUG', since we use variables
which are defined only if `YYDEBUG' is set. */
if (yydebug)
{
YYFPRINTF (stderr, "Next token is %d (%s",
yychar, yytname[yychar1]);
/* Give the individual parser a way to print the precise
meaning of a token, for further debugging info. */
# ifdefYYPRINT
YYPRINT (stderr, yychar, yylval);
# endif
YYFPRINTF (stderr, ")\n");
}