mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
* src/parse-gram.y (directives, directive, gram)
(grammar_directives, precedence_directives, precedence_directive): Rename as... (declarations, declaration, grammar, grammar_declaration) (precedence_declaration, precedence_declarator): these. (symbol_declaration): New.
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
|||||||
|
2002-06-14 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* src/parse-gram.y (directives, directive, gram)
|
||||||
|
(grammar_directives, precedence_directives, precedence_directive):
|
||||||
|
Rename as...
|
||||||
|
(declarations, declaration, grammar, grammar_declaration)
|
||||||
|
(precedence_declaration, precedence_declarator): these.
|
||||||
|
(symbol_declaration): New.
|
||||||
|
|
||||||
|
|
||||||
2002-06-14 Akim Demaille <akim@epita.fr>
|
2002-06-14 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/files.c (action_obstack): Remove, unused.
|
* src/files.c (action_obstack): Remove, unused.
|
||||||
|
|||||||
425
src/parse-gram.c
425
src/parse-gram.c
@@ -124,12 +124,12 @@ typedef struct yyltype
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define YYFINAL 94
|
#define YYFINAL 95
|
||||||
#define YYFLAG -32768
|
#define YYFLAG -32768
|
||||||
#define YYNTBASE 41
|
#define YYNTBASE 41
|
||||||
|
|
||||||
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
|
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
|
||||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 293 ? yytranslate[x] : 68)
|
#define YYTRANSLATE(x) ((unsigned)(x) <= 293 ? yytranslate[x] : 69)
|
||||||
|
|
||||||
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
|
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
|
||||||
static const char yytranslate[] =
|
static const char yytranslate[] =
|
||||||
@@ -171,32 +171,32 @@ static const short yyprhs[] =
|
|||||||
{
|
{
|
||||||
0, 0, 1, 7, 8, 11, 13, 15, 17, 21,
|
0, 0, 1, 7, 8, 11, 13, 15, 17, 21,
|
||||||
23, 25, 28, 32, 34, 38, 40, 44, 46, 49,
|
23, 25, 28, 32, 34, 38, 40, 44, 46, 49,
|
||||||
51, 53, 55, 57, 58, 62, 65, 66, 70, 71,
|
51, 53, 55, 57, 59, 62, 66, 67, 71, 72,
|
||||||
76, 80, 81, 86, 88, 90, 92, 93, 95, 97,
|
76, 77, 82, 83, 88, 90, 92, 94, 95, 97,
|
||||||
100, 102, 105, 107, 109, 112, 115, 119, 121, 124,
|
99, 102, 104, 107, 109, 111, 114, 117, 121, 123,
|
||||||
126, 129, 130, 136, 138, 142, 143, 146, 149, 153,
|
126, 128, 131, 132, 138, 140, 144, 145, 148, 151,
|
||||||
155, 157, 159, 161, 163, 165, 166, 169, 170
|
155, 157, 159, 161, 163, 165, 167, 168, 171, 172
|
||||||
};
|
};
|
||||||
static const short yyrhs[] =
|
static const short yyrhs[] =
|
||||||
{
|
{
|
||||||
-1, 42, 43, 37, 57, 66, 0, 0, 43, 44,
|
-1, 42, 43, 37, 58, 67, 0, 0, 43, 44,
|
||||||
0, 45, 0, 38, 0, 26, 0, 22, 65, 65,
|
0, 45, 0, 38, 0, 26, 0, 22, 66, 66,
|
||||||
0, 24, 0, 18, 0, 11, 6, 0, 20, 32,
|
0, 24, 0, 18, 0, 11, 6, 0, 20, 32,
|
||||||
65, 0, 27, 0, 21, 32, 65, 0, 28, 0,
|
66, 0, 27, 0, 21, 32, 66, 0, 28, 0,
|
||||||
19, 32, 65, 0, 23, 0, 29, 65, 0, 30,
|
19, 32, 66, 0, 23, 0, 29, 66, 0, 30,
|
||||||
0, 17, 0, 25, 0, 49, 0, 0, 8, 46,
|
0, 17, 0, 25, 0, 50, 0, 46, 0, 12,
|
||||||
56, 0, 12, 62, 0, 0, 7, 47, 56, 0,
|
63, 0, 10, 40, 68, 0, 0, 8, 47, 57,
|
||||||
0, 9, 31, 48, 53, 0, 10, 40, 67, 0,
|
0, 0, 7, 48, 57, 0, 0, 9, 31, 49,
|
||||||
0, 51, 52, 50, 54, 0, 13, 0, 14, 0,
|
54, 0, 0, 52, 53, 51, 55, 0, 13, 0,
|
||||||
15, 0, 0, 31, 0, 36, 0, 53, 36, 0,
|
14, 0, 15, 0, 0, 31, 0, 36, 0, 54,
|
||||||
62, 0, 54, 62, 0, 31, 0, 36, 0, 36,
|
36, 0, 63, 0, 55, 63, 0, 31, 0, 36,
|
||||||
6, 0, 36, 64, 0, 36, 6, 64, 0, 55,
|
0, 36, 6, 0, 36, 65, 0, 36, 6, 65,
|
||||||
0, 56, 55, 0, 58, 0, 57, 58, 0, 0,
|
0, 56, 0, 57, 56, 0, 59, 0, 58, 59,
|
||||||
36, 34, 59, 60, 33, 0, 61, 0, 60, 35,
|
0, 0, 36, 34, 60, 61, 33, 0, 62, 0,
|
||||||
61, 0, 0, 61, 62, 0, 61, 63, 0, 61,
|
61, 35, 62, 0, 0, 62, 63, 0, 62, 64,
|
||||||
16, 62, 0, 36, 0, 64, 0, 5, 0, 40,
|
0, 62, 16, 63, 0, 36, 0, 65, 0, 5,
|
||||||
0, 4, 0, 4, 0, 0, 37, 39, 0, 0,
|
0, 40, 0, 4, 0, 4, 0, 0, 37, 39,
|
||||||
33, 0
|
0, 0, 33, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -205,13 +205,13 @@ static const short yyrhs[] =
|
|||||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||||
static const short yyrline[] =
|
static const short yyrline[] =
|
||||||
{
|
{
|
||||||
0, 132, 132, 140, 142, 145, 147, 151, 152, 153,
|
0, 134, 134, 147, 149, 152, 154, 155, 156, 157,
|
||||||
154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
|
158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
|
||||||
164, 165, 168, 170, 170, 175, 179, 179, 184, 184,
|
168, 169, 172, 174, 175, 179, 187, 187, 193, 193,
|
||||||
188, 196, 196, 203, 205, 206, 209, 211, 215, 217,
|
198, 198, 204, 204, 211, 213, 214, 217, 219, 223,
|
||||||
221, 227, 236, 241, 246, 252, 258, 268, 271, 275,
|
225, 229, 235, 243, 248, 253, 259, 265, 275, 278,
|
||||||
277, 280, 280, 285, 287, 290, 293, 295, 297, 301,
|
287, 289, 292, 292, 297, 299, 302, 305, 307, 309,
|
||||||
303, 304, 307, 313, 322, 330, 335, 341, 343
|
313, 315, 316, 319, 325, 334, 342, 347, 353, 355
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -229,12 +229,13 @@ static const char *const yytname[] =
|
|||||||
"\"%pure-parser\"", "\"%defines\"", "\"%yacc\"", "\"%debug\"",
|
"\"%pure-parser\"", "\"%defines\"", "\"%yacc\"", "\"%debug\"",
|
||||||
"\"%locations\"", "\"%no-lines\"", "\"%skeleton\"", "\"%token-table\"",
|
"\"%locations\"", "\"%no-lines\"", "\"%skeleton\"", "\"%token-table\"",
|
||||||
"TYPE", "\"=\"", "\";\"", "\":\"", "\"|\"", "\"identifier\"", "\"%%\"",
|
"TYPE", "\"=\"", "\";\"", "\":\"", "\"|\"", "\"identifier\"", "\"%%\"",
|
||||||
"PROLOGUE", "EPILOGUE", "BRACED_CODE", "input", "@1", "directives",
|
"PROLOGUE", "EPILOGUE", "BRACED_CODE", "input", "@1", "declarations",
|
||||||
"directive", "grammar_directives", "@2", "@3", "@4",
|
"declaration", "grammar_declaration", "symbol_declaration", "@2", "@3",
|
||||||
"precedence_directives", "@5", "precedence_directive", "type.opt",
|
"@4", "precedence_declaration", "@5", "precedence_declarator",
|
||||||
"nterms_to_type.1", "terms_to_prec.1", "symbol_def", "symbol_defs.1",
|
"type.opt", "nterms_to_type.1", "terms_to_prec.1", "symbol_def",
|
||||||
"gram", "rules", "@6", "rhses.1", "rhs", "symbol", "action",
|
"symbol_defs.1", "grammar", "rules", "@6", "rhses.1", "rhs", "symbol",
|
||||||
"string_as_id", "string_content", "epilogue.opt", "semi_colon_opt", 0
|
"action", "string_as_id", "string_content", "epilogue.opt",
|
||||||
|
"semi_colon_opt", 0
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -243,11 +244,11 @@ static const short yyr1[] =
|
|||||||
{
|
{
|
||||||
0, 42, 41, 43, 43, 44, 44, 44, 44, 44,
|
0, 42, 41, 43, 43, 44, 44, 44, 44, 44,
|
||||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||||
44, 44, 45, 46, 45, 45, 47, 45, 48, 45,
|
44, 44, 45, 45, 45, 45, 47, 46, 48, 46,
|
||||||
45, 50, 49, 51, 51, 51, 52, 52, 53, 53,
|
49, 46, 51, 50, 52, 52, 52, 53, 53, 54,
|
||||||
54, 54, 55, 55, 55, 55, 55, 56, 56, 57,
|
54, 55, 55, 56, 56, 56, 56, 56, 57, 57,
|
||||||
57, 59, 58, 60, 60, 61, 61, 61, 61, 62,
|
58, 58, 60, 59, 61, 61, 62, 62, 62, 62,
|
||||||
62, 62, 63, 64, 65, 66, 66, 67, 67
|
63, 63, 63, 64, 65, 66, 67, 67, 68, 68
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||||
@@ -255,11 +256,11 @@ static const short yyr2[] =
|
|||||||
{
|
{
|
||||||
0, 0, 5, 0, 2, 1, 1, 1, 3, 1,
|
0, 0, 5, 0, 2, 1, 1, 1, 3, 1,
|
||||||
1, 2, 3, 1, 3, 1, 3, 1, 2, 1,
|
1, 2, 3, 1, 3, 1, 3, 1, 2, 1,
|
||||||
1, 1, 1, 0, 3, 2, 0, 3, 0, 4,
|
1, 1, 1, 1, 2, 3, 0, 3, 0, 3,
|
||||||
3, 0, 4, 1, 1, 1, 0, 1, 1, 2,
|
0, 4, 0, 4, 1, 1, 1, 0, 1, 1,
|
||||||
1, 2, 1, 1, 2, 2, 3, 1, 2, 1,
|
2, 1, 2, 1, 1, 2, 2, 3, 1, 2,
|
||||||
2, 0, 5, 1, 3, 0, 2, 2, 3, 1,
|
1, 2, 0, 5, 1, 3, 0, 2, 2, 3,
|
||||||
1, 1, 1, 1, 1, 0, 2, 0, 1
|
1, 1, 1, 1, 1, 1, 0, 2, 0, 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
||||||
@@ -267,80 +268,72 @@ static const short yyr2[] =
|
|||||||
error. */
|
error. */
|
||||||
static const short yydefact[] =
|
static const short yydefact[] =
|
||||||
{
|
{
|
||||||
1, 3, 0, 26, 23, 0, 0, 0, 0, 33,
|
1, 3, 0, 28, 26, 0, 0, 0, 0, 34,
|
||||||
34, 35, 20, 10, 0, 0, 0, 0, 17, 9,
|
35, 36, 20, 10, 0, 0, 0, 0, 17, 9,
|
||||||
21, 7, 13, 15, 0, 19, 0, 6, 4, 5,
|
21, 7, 13, 15, 0, 19, 0, 6, 4, 5,
|
||||||
22, 36, 0, 0, 28, 67, 11, 63, 61, 59,
|
23, 22, 37, 0, 0, 30, 68, 11, 64, 62,
|
||||||
25, 60, 0, 0, 0, 64, 0, 18, 0, 65,
|
60, 24, 61, 0, 0, 0, 65, 0, 18, 0,
|
||||||
49, 37, 31, 42, 43, 47, 27, 24, 0, 68,
|
66, 50, 38, 32, 43, 44, 48, 29, 27, 0,
|
||||||
30, 16, 12, 14, 8, 51, 0, 50, 2, 0,
|
69, 25, 16, 12, 14, 8, 52, 0, 51, 2,
|
||||||
44, 45, 48, 38, 29, 55, 66, 32, 40, 46,
|
0, 45, 46, 49, 39, 31, 56, 67, 33, 41,
|
||||||
39, 0, 53, 41, 52, 55, 0, 62, 56, 57,
|
47, 40, 0, 54, 42, 53, 56, 0, 63, 57,
|
||||||
54, 58, 0, 0, 0
|
58, 55, 59, 0, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
static const short yydefgoto[] =
|
static const short yydefgoto[] =
|
||||||
{
|
{
|
||||||
92, 1, 2, 28, 29, 33, 32, 58, 30, 69,
|
93, 1, 2, 28, 29, 30, 34, 33, 59, 31,
|
||||||
31, 52, 74, 77, 55, 56, 49, 50, 75, 81,
|
70, 32, 53, 75, 78, 56, 57, 50, 51, 76,
|
||||||
82, 88, 89, 41, 46, 68, 60
|
82, 83, 89, 90, 42, 47, 69, 61
|
||||||
};
|
};
|
||||||
|
|
||||||
static const short yypact[] =
|
static const short yypact[] =
|
||||||
{
|
{
|
||||||
-32768,-32768, 72,-32768,-32768, -22, -29, 8, -1,-32768,
|
-32768,-32768, 31,-32768,-32768, -22, -29, 8, -1,-32768,
|
||||||
-32768,-32768,-32768,-32768, -16, -14, -11, 22,-32768,-32768,
|
-32768,-32768,-32768,-32768, -16, -14, -11, 19,-32768,-32768,
|
||||||
-32768,-32768,-32768,-32768, 22,-32768, -6,-32768,-32768,-32768,
|
-32768,-32768,-32768,-32768, 19,-32768, -9,-32768,-32768,-32768,
|
||||||
-32768, 0, -24, -24,-32768, 1,-32768,-32768,-32768,-32768,
|
-32768,-32768, 0, -24, -24,-32768, 1,-32768,-32768,-32768,
|
||||||
-32768,-32768, 22, 22, 22,-32768, 22,-32768, -2, -17,
|
-32768,-32768,-32768, 19, 19, 19,-32768, 19,-32768, -2,
|
||||||
-32768,-32768,-32768,-32768, 4,-32768, -24, -24, 2,-32768,
|
-17,-32768,-32768,-32768,-32768, 4,-32768, -24, -24, 11,
|
||||||
-32768,-32768,-32768,-32768,-32768,-32768, 3,-32768,-32768, -1,
|
-32768,-32768,-32768,-32768,-32768,-32768,-32768, 24,-32768,-32768,
|
||||||
32,-32768,-32768,-32768, 5,-32768,-32768, -1,-32768,-32768,
|
-1, 32,-32768,-32768,-32768, 28,-32768,-32768, -1,-32768,
|
||||||
-32768, -18, -3,-32768,-32768,-32768, -1,-32768,-32768,-32768,
|
-32768,-32768, -18, -3,-32768,-32768,-32768, -1,-32768,-32768,
|
||||||
-3,-32768, 39, 40,-32768
|
-32768, -3,-32768, 65, 66,-32768
|
||||||
};
|
};
|
||||||
|
|
||||||
static const short yypgoto[] =
|
static const short yypgoto[] =
|
||||||
{
|
{
|
||||||
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
|
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
|
||||||
-32768,-32768,-32768,-32768, -28, 10,-32768, -5,-32768,-32768,
|
-32768,-32768,-32768,-32768,-32768, -28, 33,-32768, 21,-32768,
|
||||||
-40, -8,-32768, -48, -19,-32768,-32768
|
-32768, -13, -8,-32768, -49, -19,-32768,-32768
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define YYLAST 110
|
#define YYLAST 79
|
||||||
|
|
||||||
|
|
||||||
static const short yytable[] =
|
static const short yytable[] =
|
||||||
{
|
{
|
||||||
40, 37, 38, 37, 38, 47, 71, 53, 37, 34,
|
41, 38, 39, 38, 39, 48, 72, 54, 38, 35,
|
||||||
70, 35, 54, 86, 36, 84, 42, 85, 43, 48,
|
71, 36, 55, 87, 37, 85, 43, 86, 44, 49,
|
||||||
66, 44, 79, 61, 62, 63, 45, 64, 72, 72,
|
67, 45, 80, 46, 62, 63, 64, 49, 65, 73,
|
||||||
48, 51, 65, 39, 59, 39, 37, 87, 73, 93,
|
73, 52, 66, 40, 60, 40, 38, 88, 3, 4,
|
||||||
94, 80, 76, 57, 67, 90, 0, 0, 0, 0,
|
5, 6, 7, 8, 9, 10, 11, 74, 12, 13,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
|
||||||
0, 78, 0, 0, 0, 0, 0, 0, 0, 83,
|
24, 25, 79, 77, 81, 94, 95, 58, 26, 27,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 91, 3,
|
84, 68, 0, 91, 0, 0, 0, 0, 0, 92
|
||||||
4, 5, 6, 7, 8, 9, 10, 11, 0, 12,
|
|
||||||
13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
|
|
||||||
23, 24, 25, 0, 0, 0, 0, 0, 0, 26,
|
|
||||||
27
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const short yycheck[] =
|
static const short yycheck[] =
|
||||||
{
|
{
|
||||||
8, 4, 5, 4, 5, 24, 54, 31, 4, 31,
|
8, 4, 5, 4, 5, 24, 55, 31, 4, 31,
|
||||||
6, 40, 36, 16, 6, 33, 32, 35, 32, 36,
|
6, 40, 36, 16, 6, 33, 32, 35, 32, 36,
|
||||||
37, 32, 70, 42, 43, 44, 4, 46, 56, 57,
|
37, 32, 71, 4, 43, 44, 45, 36, 47, 57,
|
||||||
36, 31, 34, 36, 33, 36, 4, 40, 36, 0,
|
58, 31, 34, 36, 33, 36, 4, 40, 7, 8,
|
||||||
0, 36, 39, 33, 49, 85, -1, -1, -1, -1,
|
9, 10, 11, 12, 13, 14, 15, 36, 17, 18,
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
|
||||||
-1, 69, -1, -1, -1, -1, -1, -1, -1, 77,
|
29, 30, 70, 39, 36, 0, 0, 34, 37, 38,
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, 86, 7,
|
78, 50, -1, 86, -1, -1, -1, -1, -1, 87
|
||||||
8, 9, 10, 11, 12, 13, 14, 15, -1, 17,
|
|
||||||
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
|
|
||||||
28, 29, 30, -1, -1, -1, -1, -1, -1, 37,
|
|
||||||
38
|
|
||||||
};
|
};
|
||||||
#define YYPURE 1
|
#define YYPURE 1
|
||||||
|
|
||||||
@@ -1052,209 +1045,207 @@ yyreduce:
|
|||||||
switch (yyn) {
|
switch (yyn) {
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
#line 132 "parse-gram.y"
|
#line 134 "parse-gram.y"
|
||||||
{ LOCATION_RESET (yylloc); }
|
{ LOCATION_RESET (yylloc); }
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
#line 134 "parse-gram.y"
|
#line 136 "parse-gram.y"
|
||||||
{
|
{
|
||||||
yycontrol->errcode = 0;
|
yycontrol->errcode = 0;
|
||||||
epilogue_set (yyvsp[0].string, yylsp[0]);
|
epilogue_set (yyvsp[0].string, yylsp[0]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
#line 148 "parse-gram.y"
|
#line 154 "parse-gram.y"
|
||||||
{
|
{ prologue_augment (yyvsp[0].string, yylsp[0]); }
|
||||||
prologue_augment (yyvsp[0].string, yylsp[0]);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
#line 151 "parse-gram.y"
|
#line 155 "parse-gram.y"
|
||||||
{ debug_flag = 1; }
|
{ debug_flag = 1; }
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
#line 152 "parse-gram.y"
|
#line 156 "parse-gram.y"
|
||||||
{ muscle_insert (yyvsp[-1].string, yyvsp[0].string); }
|
{ muscle_insert (yyvsp[-1].string, yyvsp[0].string); }
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
#line 153 "parse-gram.y"
|
#line 157 "parse-gram.y"
|
||||||
{ defines_flag = 1; }
|
{ defines_flag = 1; }
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
#line 154 "parse-gram.y"
|
#line 158 "parse-gram.y"
|
||||||
{ error_verbose = 1; }
|
{ error_verbose = 1; }
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
#line 155 "parse-gram.y"
|
#line 159 "parse-gram.y"
|
||||||
{ expected_conflicts = yyvsp[0].integer; }
|
{ expected_conflicts = yyvsp[0].integer; }
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
#line 156 "parse-gram.y"
|
#line 160 "parse-gram.y"
|
||||||
{ spec_file_prefix = yyvsp[0].string; }
|
{ spec_file_prefix = yyvsp[0].string; }
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
#line 157 "parse-gram.y"
|
#line 161 "parse-gram.y"
|
||||||
{ locations_flag = 1; }
|
{ locations_flag = 1; }
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
#line 158 "parse-gram.y"
|
#line 162 "parse-gram.y"
|
||||||
{ spec_name_prefix = yyvsp[0].string; }
|
{ spec_name_prefix = yyvsp[0].string; }
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
#line 159 "parse-gram.y"
|
#line 163 "parse-gram.y"
|
||||||
{ no_lines_flag = 1; }
|
{ no_lines_flag = 1; }
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
#line 160 "parse-gram.y"
|
#line 164 "parse-gram.y"
|
||||||
{ spec_outfile = yyvsp[0].string; }
|
{ spec_outfile = yyvsp[0].string; }
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
#line 161 "parse-gram.y"
|
#line 165 "parse-gram.y"
|
||||||
{ pure_parser = 1; }
|
{ pure_parser = 1; }
|
||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
#line 162 "parse-gram.y"
|
#line 166 "parse-gram.y"
|
||||||
{ skeleton = yyvsp[0].string; }
|
{ skeleton = yyvsp[0].string; }
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
#line 163 "parse-gram.y"
|
#line 167 "parse-gram.y"
|
||||||
{ token_table_flag = 1; }
|
{ token_table_flag = 1; }
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
#line 164 "parse-gram.y"
|
#line 168 "parse-gram.y"
|
||||||
{ report_flag = 1; }
|
{ report_flag = 1; }
|
||||||
break;
|
break;
|
||||||
case 21:
|
case 21:
|
||||||
#line 165 "parse-gram.y"
|
#line 169 "parse-gram.y"
|
||||||
{ yacc_flag = 1; }
|
{ yacc_flag = 1; }
|
||||||
break;
|
break;
|
||||||
case 23:
|
|
||||||
#line 170 "parse-gram.y"
|
|
||||||
{ current_class = nterm_sym; }
|
|
||||||
break;
|
|
||||||
case 24:
|
case 24:
|
||||||
#line 171 "parse-gram.y"
|
|
||||||
{
|
|
||||||
current_class = unknown_sym;
|
|
||||||
current_type = NULL;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 25:
|
|
||||||
#line 176 "parse-gram.y"
|
#line 176 "parse-gram.y"
|
||||||
{
|
{
|
||||||
grammar_start_symbol_set (yyvsp[0].symbol);
|
grammar_start_symbol_set (yyvsp[0].symbol);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 26:
|
case 25:
|
||||||
#line 179 "parse-gram.y"
|
|
||||||
{ current_class = token_sym; }
|
|
||||||
break;
|
|
||||||
case 27:
|
|
||||||
#line 180 "parse-gram.y"
|
#line 180 "parse-gram.y"
|
||||||
{
|
|
||||||
current_class = unknown_sym;
|
|
||||||
current_type = NULL;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 28:
|
|
||||||
#line 184 "parse-gram.y"
|
|
||||||
{current_type = yyvsp[0].string; }
|
|
||||||
break;
|
|
||||||
case 29:
|
|
||||||
#line 185 "parse-gram.y"
|
|
||||||
{
|
|
||||||
current_type = NULL;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 30:
|
|
||||||
#line 189 "parse-gram.y"
|
|
||||||
{
|
{
|
||||||
typed = 1;
|
typed = 1;
|
||||||
MUSCLE_INSERT_INT ("stype_line", yylsp[-1].first_line);
|
MUSCLE_INSERT_INT ("stype_line", yylsp[-1].first_line);
|
||||||
muscle_insert ("stype", yyvsp[-1].string);
|
muscle_insert ("stype", yyvsp[-1].string);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 31:
|
case 26:
|
||||||
|
#line 188 "parse-gram.y"
|
||||||
|
{ current_class = nterm_sym; }
|
||||||
|
break;
|
||||||
|
case 27:
|
||||||
|
#line 189 "parse-gram.y"
|
||||||
|
{
|
||||||
|
current_class = unknown_sym;
|
||||||
|
current_type = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 28:
|
||||||
|
#line 193 "parse-gram.y"
|
||||||
|
{ current_class = token_sym; }
|
||||||
|
break;
|
||||||
|
case 29:
|
||||||
|
#line 194 "parse-gram.y"
|
||||||
|
{
|
||||||
|
current_class = unknown_sym;
|
||||||
|
current_type = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 30:
|
||||||
#line 198 "parse-gram.y"
|
#line 198 "parse-gram.y"
|
||||||
{ current_assoc = yyvsp[-1].assoc; ++current_prec; }
|
{current_type = yyvsp[0].string; }
|
||||||
|
break;
|
||||||
|
case 31:
|
||||||
|
#line 199 "parse-gram.y"
|
||||||
|
{
|
||||||
|
current_type = NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
#line 200 "parse-gram.y"
|
#line 206 "parse-gram.y"
|
||||||
{ current_assoc = non_assoc; current_type = NULL; }
|
{ current_assoc = yyvsp[-1].assoc; ++current_prec; }
|
||||||
break;
|
break;
|
||||||
case 33:
|
case 33:
|
||||||
#line 204 "parse-gram.y"
|
#line 208 "parse-gram.y"
|
||||||
{ yyval.assoc = left_assoc; }
|
{ current_assoc = non_assoc; current_type = NULL; }
|
||||||
break;
|
break;
|
||||||
case 34:
|
case 34:
|
||||||
#line 205 "parse-gram.y"
|
#line 212 "parse-gram.y"
|
||||||
{ yyval.assoc = right_assoc; }
|
{ yyval.assoc = left_assoc; }
|
||||||
break;
|
break;
|
||||||
case 35:
|
case 35:
|
||||||
#line 206 "parse-gram.y"
|
#line 213 "parse-gram.y"
|
||||||
{ yyval.assoc = non_assoc; }
|
{ yyval.assoc = right_assoc; }
|
||||||
break;
|
break;
|
||||||
case 36:
|
case 36:
|
||||||
#line 210 "parse-gram.y"
|
#line 214 "parse-gram.y"
|
||||||
{ current_type = NULL;}
|
{ yyval.assoc = non_assoc; }
|
||||||
break;
|
break;
|
||||||
case 37:
|
case 37:
|
||||||
#line 211 "parse-gram.y"
|
#line 218 "parse-gram.y"
|
||||||
{ current_type = yyvsp[0].string; }
|
{ current_type = NULL;}
|
||||||
break;
|
break;
|
||||||
case 38:
|
case 38:
|
||||||
#line 216 "parse-gram.y"
|
#line 219 "parse-gram.y"
|
||||||
{ symbol_type_set (yyvsp[0].symbol, current_type); }
|
{ current_type = yyvsp[0].string; }
|
||||||
break;
|
break;
|
||||||
case 39:
|
case 39:
|
||||||
#line 217 "parse-gram.y"
|
#line 224 "parse-gram.y"
|
||||||
{ symbol_type_set (yyvsp[0].symbol, current_type); }
|
{ symbol_type_set (yyvsp[0].symbol, current_type); }
|
||||||
break;
|
break;
|
||||||
case 40:
|
case 40:
|
||||||
#line 223 "parse-gram.y"
|
#line 225 "parse-gram.y"
|
||||||
{
|
{ symbol_type_set (yyvsp[0].symbol, current_type); }
|
||||||
symbol_type_set (yyvsp[0].symbol, current_type);
|
|
||||||
symbol_precedence_set (yyvsp[0].symbol, current_prec, current_assoc);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 41:
|
case 41:
|
||||||
#line 228 "parse-gram.y"
|
#line 231 "parse-gram.y"
|
||||||
{
|
{
|
||||||
symbol_type_set (yyvsp[0].symbol, current_type);
|
symbol_type_set (yyvsp[0].symbol, current_type);
|
||||||
symbol_precedence_set (yyvsp[0].symbol, current_prec, current_assoc);
|
symbol_precedence_set (yyvsp[0].symbol, current_prec, current_assoc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 42:
|
case 42:
|
||||||
#line 238 "parse-gram.y"
|
#line 236 "parse-gram.y"
|
||||||
|
{
|
||||||
|
symbol_type_set (yyvsp[0].symbol, current_type);
|
||||||
|
symbol_precedence_set (yyvsp[0].symbol, current_prec, current_assoc);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 43:
|
||||||
|
#line 245 "parse-gram.y"
|
||||||
{
|
{
|
||||||
current_type = yyvsp[0].string;
|
current_type = yyvsp[0].string;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 43:
|
case 44:
|
||||||
#line 242 "parse-gram.y"
|
#line 249 "parse-gram.y"
|
||||||
{
|
{
|
||||||
symbol_class_set (yyvsp[0].symbol, current_class);
|
symbol_class_set (yyvsp[0].symbol, current_class);
|
||||||
symbol_type_set (yyvsp[0].symbol, current_type);
|
symbol_type_set (yyvsp[0].symbol, current_type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 44:
|
case 45:
|
||||||
#line 247 "parse-gram.y"
|
#line 254 "parse-gram.y"
|
||||||
{
|
{
|
||||||
symbol_class_set (yyvsp[-1].symbol, current_class);
|
symbol_class_set (yyvsp[-1].symbol, current_class);
|
||||||
symbol_type_set (yyvsp[-1].symbol, current_type);
|
symbol_type_set (yyvsp[-1].symbol, current_type);
|
||||||
symbol_user_token_number_set (yyvsp[-1].symbol, yyvsp[0].integer);
|
symbol_user_token_number_set (yyvsp[-1].symbol, yyvsp[0].integer);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 45:
|
case 46:
|
||||||
#line 253 "parse-gram.y"
|
#line 260 "parse-gram.y"
|
||||||
{
|
{
|
||||||
symbol_class_set (yyvsp[-1].symbol, current_class);
|
symbol_class_set (yyvsp[-1].symbol, current_class);
|
||||||
symbol_type_set (yyvsp[-1].symbol, current_type);
|
symbol_type_set (yyvsp[-1].symbol, current_type);
|
||||||
symbol_make_alias (yyvsp[-1].symbol, yyvsp[0].symbol);
|
symbol_make_alias (yyvsp[-1].symbol, yyvsp[0].symbol);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 46:
|
case 47:
|
||||||
#line 259 "parse-gram.y"
|
#line 266 "parse-gram.y"
|
||||||
{
|
{
|
||||||
symbol_class_set (yyvsp[-2].symbol, current_class);
|
symbol_class_set (yyvsp[-2].symbol, current_class);
|
||||||
symbol_type_set (yyvsp[-2].symbol, current_type);
|
symbol_type_set (yyvsp[-2].symbol, current_type);
|
||||||
@@ -1262,84 +1253,84 @@ case 46:
|
|||||||
symbol_make_alias (yyvsp[-2].symbol, yyvsp[0].symbol);
|
symbol_make_alias (yyvsp[-2].symbol, yyvsp[0].symbol);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 47:
|
|
||||||
#line 270 "parse-gram.y"
|
|
||||||
{;}
|
|
||||||
break;
|
|
||||||
case 48:
|
case 48:
|
||||||
#line 272 "parse-gram.y"
|
#line 277 "parse-gram.y"
|
||||||
{;}
|
{;}
|
||||||
break;
|
break;
|
||||||
case 51:
|
case 49:
|
||||||
#line 281 "parse-gram.y"
|
#line 279 "parse-gram.y"
|
||||||
{ current_lhs = yyvsp[-1].symbol; }
|
{;}
|
||||||
break;
|
break;
|
||||||
case 52:
|
case 52:
|
||||||
#line 282 "parse-gram.y"
|
#line 293 "parse-gram.y"
|
||||||
{;}
|
{ current_lhs = yyvsp[-1].symbol; }
|
||||||
break;
|
break;
|
||||||
case 53:
|
case 53:
|
||||||
#line 286 "parse-gram.y"
|
#line 294 "parse-gram.y"
|
||||||
{ grammar_rule_end (); }
|
{;}
|
||||||
break;
|
break;
|
||||||
case 54:
|
case 54:
|
||||||
#line 287 "parse-gram.y"
|
#line 298 "parse-gram.y"
|
||||||
{ grammar_rule_end (); }
|
{ grammar_rule_end (); }
|
||||||
break;
|
break;
|
||||||
case 55:
|
case 55:
|
||||||
#line 292 "parse-gram.y"
|
#line 299 "parse-gram.y"
|
||||||
{ grammar_rule_begin (current_lhs); }
|
{ grammar_rule_end (); }
|
||||||
break;
|
break;
|
||||||
case 56:
|
case 56:
|
||||||
#line 294 "parse-gram.y"
|
#line 304 "parse-gram.y"
|
||||||
{ grammar_current_rule_symbol_append (yyvsp[0].symbol); }
|
{ grammar_rule_begin (current_lhs); }
|
||||||
break;
|
break;
|
||||||
case 57:
|
case 57:
|
||||||
#line 296 "parse-gram.y"
|
#line 306 "parse-gram.y"
|
||||||
{ grammar_current_rule_action_append (yyvsp[0].string, yylsp[0].first_line); }
|
{ grammar_current_rule_symbol_append (yyvsp[0].symbol); }
|
||||||
break;
|
break;
|
||||||
case 58:
|
case 58:
|
||||||
#line 298 "parse-gram.y"
|
#line 308 "parse-gram.y"
|
||||||
{ grammar_current_rule_prec_set (yyvsp[0].symbol); }
|
{ grammar_current_rule_action_append (yyvsp[0].string, yylsp[0].first_line); }
|
||||||
break;
|
break;
|
||||||
case 59:
|
case 59:
|
||||||
#line 302 "parse-gram.y"
|
#line 310 "parse-gram.y"
|
||||||
{ yyval.symbol = yyvsp[0].symbol; }
|
{ grammar_current_rule_prec_set (yyvsp[0].symbol); }
|
||||||
break;
|
break;
|
||||||
case 60:
|
case 60:
|
||||||
#line 303 "parse-gram.y"
|
#line 314 "parse-gram.y"
|
||||||
{ yyval.symbol = yyvsp[0].symbol; }
|
{ yyval.symbol = yyvsp[0].symbol; }
|
||||||
break;
|
break;
|
||||||
case 61:
|
case 61:
|
||||||
#line 304 "parse-gram.y"
|
#line 315 "parse-gram.y"
|
||||||
{ yyval.symbol = getsym (yyvsp[0].string); }
|
{ yyval.symbol = yyvsp[0].symbol; }
|
||||||
break;
|
break;
|
||||||
case 62:
|
case 62:
|
||||||
#line 309 "parse-gram.y"
|
#line 316 "parse-gram.y"
|
||||||
{ yyval.string = yyvsp[0].string; }
|
{ yyval.symbol = getsym (yyvsp[0].string); }
|
||||||
break;
|
break;
|
||||||
case 63:
|
case 63:
|
||||||
#line 315 "parse-gram.y"
|
#line 321 "parse-gram.y"
|
||||||
|
{ yyval.string = yyvsp[0].string; }
|
||||||
|
break;
|
||||||
|
case 64:
|
||||||
|
#line 327 "parse-gram.y"
|
||||||
{
|
{
|
||||||
yyval.symbol = getsym (yyvsp[0].string);
|
yyval.symbol = getsym (yyvsp[0].string);
|
||||||
symbol_class_set (yyval.symbol, token_sym);
|
symbol_class_set (yyval.symbol, token_sym);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 64:
|
case 65:
|
||||||
#line 324 "parse-gram.y"
|
#line 336 "parse-gram.y"
|
||||||
{
|
{
|
||||||
yyval.string = yyvsp[0].string + 1;
|
yyval.string = yyvsp[0].string + 1;
|
||||||
yyval.string[strlen (yyval.string) - 1] = '\0';
|
yyval.string[strlen (yyval.string) - 1] = '\0';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 65:
|
case 66:
|
||||||
#line 332 "parse-gram.y"
|
#line 344 "parse-gram.y"
|
||||||
{
|
{
|
||||||
yyval.string = xstrdup ("");
|
yyval.string = xstrdup ("");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 66:
|
case 67:
|
||||||
#line 336 "parse-gram.y"
|
#line 348 "parse-gram.y"
|
||||||
{
|
{
|
||||||
yyval.string = yyvsp[0].string;
|
yyval.string = yyvsp[0].string;
|
||||||
}
|
}
|
||||||
@@ -1577,7 +1568,7 @@ yyreturn:
|
|||||||
#endif
|
#endif
|
||||||
return yyresult;
|
return yyresult;
|
||||||
}
|
}
|
||||||
#line 345 "parse-gram.y"
|
#line 357 "parse-gram.y"
|
||||||
|
|
||||||
/*------------------------------------------------------------------.
|
/*------------------------------------------------------------------.
|
||||||
| When debugging the parser, display tokens' locations and values. |
|
| When debugging the parser, display tokens' locations and values. |
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef BISON_Y_TAB_H
|
#ifndef BISON_PARSE_GRAM_H
|
||||||
# define BISON_Y_TAB_H
|
# define BISON_PARSE_GRAM_H
|
||||||
|
|
||||||
#ifndef YYSTYPE
|
#ifndef YYSTYPE
|
||||||
typedef union
|
typedef union
|
||||||
@@ -67,4 +67,4 @@ typedef struct yyltype
|
|||||||
# define BRACED_CODE 293
|
# define BRACED_CODE 293
|
||||||
|
|
||||||
|
|
||||||
#endif /* not BISON_Y_TAB_H */
|
#endif /* not BISON_PARSE_GRAM_H */
|
||||||
|
|||||||
@@ -85,11 +85,11 @@ int current_prec = 0;
|
|||||||
|
|
||||||
%token PERCENT_TOKEN "%token"
|
%token PERCENT_TOKEN "%token"
|
||||||
%token PERCENT_NTERM "%nterm"
|
%token PERCENT_NTERM "%nterm"
|
||||||
%token PERCENT_TYPE "%type"
|
%token PERCENT_TYPE "%type"
|
||||||
%token PERCENT_UNION "%union"
|
%token PERCENT_UNION "%union"
|
||||||
%token PERCENT_EXPECT "%expect"
|
%token PERCENT_EXPECT "%expect"
|
||||||
%token PERCENT_START "%start"
|
%token PERCENT_START "%start"
|
||||||
%token PERCENT_LEFT "%left"
|
%token PERCENT_LEFT "%left"
|
||||||
%token PERCENT_RIGHT "%right"
|
%token PERCENT_RIGHT "%right"
|
||||||
%token PERCENT_NONASSOC "%nonassoc"
|
%token PERCENT_NONASSOC "%nonassoc"
|
||||||
%token PERCENT_PREC "%prec"
|
%token PERCENT_PREC "%prec"
|
||||||
@@ -123,31 +123,35 @@ int current_prec = 0;
|
|||||||
%token PROLOGUE EPILOGUE
|
%token PROLOGUE EPILOGUE
|
||||||
%token BRACED_CODE
|
%token BRACED_CODE
|
||||||
|
|
||||||
%type <string> CHARACTER TYPE STRING string_content
|
%type <string> CHARACTER TYPE STRING string_content
|
||||||
BRACED_CODE PROLOGUE EPILOGUE epilogue.opt action
|
BRACED_CODE PROLOGUE EPILOGUE epilogue.opt action
|
||||||
%type <integer> INT
|
%type <integer> INT
|
||||||
%type <symbol> ID symbol string_as_id
|
%type <symbol> ID symbol string_as_id
|
||||||
%type <assoc> precedence_directive
|
%type <assoc> precedence_declarator
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
input: { LOCATION_RESET (yylloc); }
|
input: { LOCATION_RESET (yylloc); }
|
||||||
directives "%%" gram epilogue.opt
|
declarations "%%" grammar epilogue.opt
|
||||||
{
|
{
|
||||||
yycontrol->errcode = 0;
|
yycontrol->errcode = 0;
|
||||||
epilogue_set ($5, @5);
|
epilogue_set ($5, @5);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
directives:
|
|
||||||
|
/*------------------------------------.
|
||||||
|
| Declarations: before the first %%. |
|
||||||
|
`------------------------------------*/
|
||||||
|
|
||||||
|
declarations:
|
||||||
/* Nothing */
|
/* Nothing */
|
||||||
| directives directive
|
| declarations declaration
|
||||||
;
|
;
|
||||||
|
|
||||||
directive:
|
declaration:
|
||||||
grammar_directives
|
grammar_declaration
|
||||||
| PROLOGUE
|
| PROLOGUE { prologue_augment ($1, @1); }
|
||||||
{
|
|
||||||
prologue_augment ($1, @1);
|
|
||||||
}
|
|
||||||
| "%debug" { debug_flag = 1; }
|
| "%debug" { debug_flag = 1; }
|
||||||
| "%define" string_content string_content { muscle_insert ($2, $3); }
|
| "%define" string_content string_content { muscle_insert ($2, $3); }
|
||||||
| "%defines" { defines_flag = 1; }
|
| "%defines" { defines_flag = 1; }
|
||||||
@@ -165,17 +169,27 @@ directive:
|
|||||||
| "%yacc" { yacc_flag = 1; }
|
| "%yacc" { yacc_flag = 1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
grammar_directives:
|
grammar_declaration:
|
||||||
precedence_directives
|
precedence_declaration
|
||||||
| "%nterm" { current_class = nterm_sym; } symbol_defs.1
|
| symbol_declaration
|
||||||
{
|
|
||||||
current_class = unknown_sym;
|
|
||||||
current_type = NULL;
|
|
||||||
}
|
|
||||||
| "%start" symbol
|
| "%start" symbol
|
||||||
{
|
{
|
||||||
grammar_start_symbol_set ($2);
|
grammar_start_symbol_set ($2);
|
||||||
}
|
}
|
||||||
|
| "%union" BRACED_CODE semi_colon_opt
|
||||||
|
{
|
||||||
|
typed = 1;
|
||||||
|
MUSCLE_INSERT_INT ("stype_line", @2.first_line);
|
||||||
|
muscle_insert ("stype", $2);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
symbol_declaration:
|
||||||
|
"%nterm" { current_class = nterm_sym; } symbol_defs.1
|
||||||
|
{
|
||||||
|
current_class = unknown_sym;
|
||||||
|
current_type = NULL;
|
||||||
|
}
|
||||||
| "%token" { current_class = token_sym; } symbol_defs.1
|
| "%token" { current_class = token_sym; } symbol_defs.1
|
||||||
{
|
{
|
||||||
current_class = unknown_sym;
|
current_class = unknown_sym;
|
||||||
@@ -185,22 +199,16 @@ grammar_directives:
|
|||||||
{
|
{
|
||||||
current_type = NULL;
|
current_type = NULL;
|
||||||
}
|
}
|
||||||
| "%union" BRACED_CODE semi_colon_opt
|
|
||||||
{
|
|
||||||
typed = 1;
|
|
||||||
MUSCLE_INSERT_INT ("stype_line", @2.first_line);
|
|
||||||
muscle_insert ("stype", $2);
|
|
||||||
}
|
|
||||||
;
|
;
|
||||||
|
|
||||||
precedence_directives:
|
precedence_declaration:
|
||||||
precedence_directive type.opt
|
precedence_declarator type.opt
|
||||||
{ current_assoc = $1; ++current_prec; }
|
{ current_assoc = $1; ++current_prec; }
|
||||||
terms_to_prec.1
|
terms_to_prec.1
|
||||||
{ current_assoc = non_assoc; current_type = NULL; }
|
{ current_assoc = non_assoc; current_type = NULL; }
|
||||||
;
|
;
|
||||||
|
|
||||||
precedence_directive:
|
precedence_declarator:
|
||||||
"%left" { $$ = left_assoc; }
|
"%left" { $$ = left_assoc; }
|
||||||
| "%right" { $$ = right_assoc; }
|
| "%right" { $$ = right_assoc; }
|
||||||
| "%nonassoc" { $$ = non_assoc; }
|
| "%nonassoc" { $$ = non_assoc; }
|
||||||
@@ -231,7 +239,6 @@ terms_to_prec.1:
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
/* One token definition. */
|
/* One token definition. */
|
||||||
symbol_def:
|
symbol_def:
|
||||||
TYPE
|
TYPE
|
||||||
@@ -272,9 +279,14 @@ symbol_defs.1:
|
|||||||
{;}
|
{;}
|
||||||
;
|
;
|
||||||
|
|
||||||
gram:
|
|
||||||
|
/*------------------------------------------.
|
||||||
|
| The grammar section: between the two %%. |
|
||||||
|
`------------------------------------------*/
|
||||||
|
|
||||||
|
grammar:
|
||||||
rules
|
rules
|
||||||
| gram rules
|
| grammar rules
|
||||||
;
|
;
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
|
|||||||
Reference in New Issue
Block a user