lrama 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/test.yaml +17 -4
- data/.gitignore +1 -0
- data/Gemfile +2 -0
- data/README.md +29 -2
- data/Steepfile +9 -0
- data/lib/lrama/grammar.rb +34 -26
- data/lib/lrama/lexer.rb +58 -4
- data/lib/lrama/parser/token_scanner.rb +59 -0
- data/lib/lrama/parser.rb +12 -56
- data/lib/lrama/state/reduce.rb +35 -0
- data/lib/lrama/state/shift.rb +13 -0
- data/lib/lrama/state.rb +184 -0
- data/lib/lrama/states.rb +6 -238
- data/lib/lrama/states_reporter.rb +4 -4
- data/lib/lrama/version.rb +1 -1
- data/lib/lrama.rb +1 -0
- data/lrama.gemspec +1 -1
- data/rbs_collection.lock.yaml +26 -0
- data/rbs_collection.yaml +22 -0
- data/sample/calc.output +263 -0
- data/sample/calc.y +98 -0
- data/sig/lrama/bitmap.rbs +7 -0
- data/sig/lrama/report.rbs +15 -0
- data/sig/lrama/warning.rbs +16 -0
- data/template/bison/yacc.c +34 -32
- metadata +17 -4
data/sample/calc.output
ADDED
@@ -0,0 +1,263 @@
|
|
1
|
+
Grammar
|
2
|
+
|
3
|
+
0 $accept: list "end of file"
|
4
|
+
|
5
|
+
1 list: ε
|
6
|
+
2 | list LF
|
7
|
+
3 | list expr LF
|
8
|
+
|
9
|
+
4 expr: NUM
|
10
|
+
5 | expr '+' expr
|
11
|
+
6 | expr '-' expr
|
12
|
+
7 | expr '*' expr
|
13
|
+
8 | expr '/' expr
|
14
|
+
9 | '(' expr ')'
|
15
|
+
|
16
|
+
|
17
|
+
State 0
|
18
|
+
|
19
|
+
0 $accept: • list "end of file"
|
20
|
+
1 list: ε •
|
21
|
+
2 | • list LF
|
22
|
+
3 | • list expr LF
|
23
|
+
|
24
|
+
$default reduce using rule 1 (list)
|
25
|
+
|
26
|
+
list go to state 1
|
27
|
+
|
28
|
+
|
29
|
+
State 1
|
30
|
+
|
31
|
+
0 $accept: list • "end of file"
|
32
|
+
2 list: list • LF
|
33
|
+
3 | list • expr LF
|
34
|
+
4 expr: • NUM
|
35
|
+
5 | • expr '+' expr
|
36
|
+
6 | • expr '-' expr
|
37
|
+
7 | • expr '*' expr
|
38
|
+
8 | • expr '/' expr
|
39
|
+
9 | • '(' expr ')'
|
40
|
+
|
41
|
+
"end of file" shift, and go to state 2
|
42
|
+
LF shift, and go to state 3
|
43
|
+
NUM shift, and go to state 4
|
44
|
+
'(' shift, and go to state 5
|
45
|
+
|
46
|
+
expr go to state 6
|
47
|
+
|
48
|
+
|
49
|
+
State 2
|
50
|
+
|
51
|
+
0 $accept: list "end of file" •
|
52
|
+
|
53
|
+
$default accept
|
54
|
+
|
55
|
+
|
56
|
+
State 3
|
57
|
+
|
58
|
+
2 list: list LF •
|
59
|
+
|
60
|
+
$default reduce using rule 2 (list)
|
61
|
+
|
62
|
+
|
63
|
+
State 4
|
64
|
+
|
65
|
+
4 expr: NUM •
|
66
|
+
|
67
|
+
$default reduce using rule 4 (expr)
|
68
|
+
|
69
|
+
|
70
|
+
State 5
|
71
|
+
|
72
|
+
4 expr: • NUM
|
73
|
+
5 | • expr '+' expr
|
74
|
+
6 | • expr '-' expr
|
75
|
+
7 | • expr '*' expr
|
76
|
+
8 | • expr '/' expr
|
77
|
+
9 | • '(' expr ')'
|
78
|
+
9 | '(' • expr ')'
|
79
|
+
|
80
|
+
NUM shift, and go to state 4
|
81
|
+
'(' shift, and go to state 5
|
82
|
+
|
83
|
+
expr go to state 7
|
84
|
+
|
85
|
+
|
86
|
+
State 6
|
87
|
+
|
88
|
+
3 list: list expr • LF
|
89
|
+
5 expr: expr • '+' expr
|
90
|
+
6 | expr • '-' expr
|
91
|
+
7 | expr • '*' expr
|
92
|
+
8 | expr • '/' expr
|
93
|
+
|
94
|
+
LF shift, and go to state 8
|
95
|
+
'+' shift, and go to state 9
|
96
|
+
'-' shift, and go to state 10
|
97
|
+
'*' shift, and go to state 11
|
98
|
+
'/' shift, and go to state 12
|
99
|
+
|
100
|
+
|
101
|
+
State 7
|
102
|
+
|
103
|
+
5 expr: expr • '+' expr
|
104
|
+
6 | expr • '-' expr
|
105
|
+
7 | expr • '*' expr
|
106
|
+
8 | expr • '/' expr
|
107
|
+
9 | '(' expr • ')'
|
108
|
+
|
109
|
+
'+' shift, and go to state 9
|
110
|
+
'-' shift, and go to state 10
|
111
|
+
'*' shift, and go to state 11
|
112
|
+
'/' shift, and go to state 12
|
113
|
+
')' shift, and go to state 13
|
114
|
+
|
115
|
+
|
116
|
+
State 8
|
117
|
+
|
118
|
+
3 list: list expr LF •
|
119
|
+
|
120
|
+
$default reduce using rule 3 (list)
|
121
|
+
|
122
|
+
|
123
|
+
State 9
|
124
|
+
|
125
|
+
4 expr: • NUM
|
126
|
+
5 | • expr '+' expr
|
127
|
+
5 | expr '+' • expr
|
128
|
+
6 | • expr '-' expr
|
129
|
+
7 | • expr '*' expr
|
130
|
+
8 | • expr '/' expr
|
131
|
+
9 | • '(' expr ')'
|
132
|
+
|
133
|
+
NUM shift, and go to state 4
|
134
|
+
'(' shift, and go to state 5
|
135
|
+
|
136
|
+
expr go to state 14
|
137
|
+
|
138
|
+
|
139
|
+
State 10
|
140
|
+
|
141
|
+
4 expr: • NUM
|
142
|
+
5 | • expr '+' expr
|
143
|
+
6 | • expr '-' expr
|
144
|
+
6 | expr '-' • expr
|
145
|
+
7 | • expr '*' expr
|
146
|
+
8 | • expr '/' expr
|
147
|
+
9 | • '(' expr ')'
|
148
|
+
|
149
|
+
NUM shift, and go to state 4
|
150
|
+
'(' shift, and go to state 5
|
151
|
+
|
152
|
+
expr go to state 15
|
153
|
+
|
154
|
+
|
155
|
+
State 11
|
156
|
+
|
157
|
+
4 expr: • NUM
|
158
|
+
5 | • expr '+' expr
|
159
|
+
6 | • expr '-' expr
|
160
|
+
7 | • expr '*' expr
|
161
|
+
7 | expr '*' • expr
|
162
|
+
8 | • expr '/' expr
|
163
|
+
9 | • '(' expr ')'
|
164
|
+
|
165
|
+
NUM shift, and go to state 4
|
166
|
+
'(' shift, and go to state 5
|
167
|
+
|
168
|
+
expr go to state 16
|
169
|
+
|
170
|
+
|
171
|
+
State 12
|
172
|
+
|
173
|
+
4 expr: • NUM
|
174
|
+
5 | • expr '+' expr
|
175
|
+
6 | • expr '-' expr
|
176
|
+
7 | • expr '*' expr
|
177
|
+
8 | • expr '/' expr
|
178
|
+
8 | expr '/' • expr
|
179
|
+
9 | • '(' expr ')'
|
180
|
+
|
181
|
+
NUM shift, and go to state 4
|
182
|
+
'(' shift, and go to state 5
|
183
|
+
|
184
|
+
expr go to state 17
|
185
|
+
|
186
|
+
|
187
|
+
State 13
|
188
|
+
|
189
|
+
9 expr: '(' expr ')' •
|
190
|
+
|
191
|
+
$default reduce using rule 9 (expr)
|
192
|
+
|
193
|
+
|
194
|
+
State 14
|
195
|
+
|
196
|
+
5 expr: expr • '+' expr
|
197
|
+
5 | expr '+' expr • [LF, '+', '-', ')']
|
198
|
+
6 | expr • '-' expr
|
199
|
+
7 | expr • '*' expr
|
200
|
+
8 | expr • '/' expr
|
201
|
+
|
202
|
+
'*' shift, and go to state 11
|
203
|
+
'/' shift, and go to state 12
|
204
|
+
|
205
|
+
$default reduce using rule 5 (expr)
|
206
|
+
|
207
|
+
Conflict between rule 5 and token '+' resolved as reduce (%left '+').
|
208
|
+
Conflict between rule 5 and token '-' resolved as reduce (%left '-').
|
209
|
+
Conflict between rule 5 and token '*' resolved as shift ('+' < '*').
|
210
|
+
Conflict between rule 5 and token '/' resolved as shift ('+' < '/').
|
211
|
+
|
212
|
+
|
213
|
+
State 15
|
214
|
+
|
215
|
+
5 expr: expr • '+' expr
|
216
|
+
6 | expr • '-' expr
|
217
|
+
6 | expr '-' expr • [LF, '+', '-', ')']
|
218
|
+
7 | expr • '*' expr
|
219
|
+
8 | expr • '/' expr
|
220
|
+
|
221
|
+
'*' shift, and go to state 11
|
222
|
+
'/' shift, and go to state 12
|
223
|
+
|
224
|
+
$default reduce using rule 6 (expr)
|
225
|
+
|
226
|
+
Conflict between rule 6 and token '+' resolved as reduce (%left '+').
|
227
|
+
Conflict between rule 6 and token '-' resolved as reduce (%left '-').
|
228
|
+
Conflict between rule 6 and token '*' resolved as shift ('-' < '*').
|
229
|
+
Conflict between rule 6 and token '/' resolved as shift ('-' < '/').
|
230
|
+
|
231
|
+
|
232
|
+
State 16
|
233
|
+
|
234
|
+
5 expr: expr • '+' expr
|
235
|
+
6 | expr • '-' expr
|
236
|
+
7 | expr • '*' expr
|
237
|
+
7 | expr '*' expr • [LF, '+', '-', '*', '/', ')']
|
238
|
+
8 | expr • '/' expr
|
239
|
+
|
240
|
+
$default reduce using rule 7 (expr)
|
241
|
+
|
242
|
+
Conflict between rule 7 and token '+' resolved as reduce ('+' < '*').
|
243
|
+
Conflict between rule 7 and token '-' resolved as reduce ('-' < '*').
|
244
|
+
Conflict between rule 7 and token '*' resolved as reduce (%left '*').
|
245
|
+
Conflict between rule 7 and token '/' resolved as reduce (%left '/').
|
246
|
+
|
247
|
+
|
248
|
+
State 17
|
249
|
+
|
250
|
+
5 expr: expr • '+' expr
|
251
|
+
6 | expr • '-' expr
|
252
|
+
7 | expr • '*' expr
|
253
|
+
8 | expr • '/' expr
|
254
|
+
8 | expr '/' expr • [LF, '+', '-', '*', '/', ')']
|
255
|
+
|
256
|
+
$default reduce using rule 8 (expr)
|
257
|
+
|
258
|
+
Conflict between rule 8 and token '+' resolved as reduce ('+' < '/').
|
259
|
+
Conflict between rule 8 and token '-' resolved as reduce ('-' < '/').
|
260
|
+
Conflict between rule 8 and token '*' resolved as reduce (%left '*').
|
261
|
+
Conflict between rule 8 and token '/' resolved as reduce (%left '/').
|
262
|
+
|
263
|
+
|
data/sample/calc.y
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
/*
|
2
|
+
* How to build and run:
|
3
|
+
*
|
4
|
+
* $ lrama -d calc.y -o calc.c && gcc -Wall calc.c -o calc && ./calc
|
5
|
+
* 1
|
6
|
+
* => 1
|
7
|
+
* 1+2*3
|
8
|
+
* => 7
|
9
|
+
* (1+2)*3
|
10
|
+
* => 9
|
11
|
+
*
|
12
|
+
*/
|
13
|
+
|
14
|
+
%{
|
15
|
+
#include <stdio.h>
|
16
|
+
#include <stdlib.h>
|
17
|
+
#include <ctype.h>
|
18
|
+
|
19
|
+
#include "calc.h"
|
20
|
+
|
21
|
+
static int yylex(YYSTYPE *val, YYLTYPE *loc);
|
22
|
+
static int yyerror(YYLTYPE *loc, const char *str);
|
23
|
+
%}
|
24
|
+
|
25
|
+
%union {
|
26
|
+
int val;
|
27
|
+
}
|
28
|
+
%token LF
|
29
|
+
%token <val> NUM
|
30
|
+
%type <val> expr
|
31
|
+
%left '+' '-'
|
32
|
+
%left '*' '/'
|
33
|
+
|
34
|
+
%%
|
35
|
+
|
36
|
+
list : /* empty */
|
37
|
+
| list LF
|
38
|
+
| list expr LF { printf("=> %d\n", $2); }
|
39
|
+
;
|
40
|
+
expr : NUM
|
41
|
+
| expr '+' expr { $$ = $1 + $3; }
|
42
|
+
| expr '-' expr { $$ = $1 - $3; }
|
43
|
+
| expr '*' expr { $$ = $1 * $3; }
|
44
|
+
| expr '/' expr { $$ = $1 / $3; }
|
45
|
+
| '(' expr ')' { $$ = $2; }
|
46
|
+
;
|
47
|
+
|
48
|
+
%%
|
49
|
+
|
50
|
+
static int yylex(YYSTYPE *yylval, YYLTYPE *loc) {
|
51
|
+
int c = getchar();
|
52
|
+
int val;
|
53
|
+
|
54
|
+
switch (c) {
|
55
|
+
case ' ': case '\t':
|
56
|
+
return yylex(yylval, loc);
|
57
|
+
|
58
|
+
case '0': case '1': case '2': case '3': case '4':
|
59
|
+
case '5': case '6': case '7': case '8': case '9':
|
60
|
+
val = c - '0';
|
61
|
+
while (1) {
|
62
|
+
c = getchar();
|
63
|
+
if (isdigit(c)) {
|
64
|
+
val = val * 10 + (c - '0');
|
65
|
+
}
|
66
|
+
else {
|
67
|
+
ungetc(c, stdin);
|
68
|
+
break;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
yylval->val = val;
|
72
|
+
return NUM;
|
73
|
+
|
74
|
+
case '\n':
|
75
|
+
return LF;
|
76
|
+
|
77
|
+
case '+': case '-': case '*': case '/': case '(': case ')':
|
78
|
+
return c;
|
79
|
+
|
80
|
+
case EOF:
|
81
|
+
exit(0);
|
82
|
+
|
83
|
+
default:
|
84
|
+
fprintf(stderr, "unknown character: %c\n", c);
|
85
|
+
exit(1);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
static int yyerror(YYLTYPE *loc, const char *str) {
|
90
|
+
fprintf(stderr, "parse error: %s\n", str);
|
91
|
+
return 0;
|
92
|
+
}
|
93
|
+
|
94
|
+
int main() {
|
95
|
+
printf("Enter the formula:\n");
|
96
|
+
yyparse();
|
97
|
+
return 0;
|
98
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Lrama
|
2
|
+
class Report
|
3
|
+
module Profile
|
4
|
+
def self.report_profile: { -> void } -> StackProf::result
|
5
|
+
end
|
6
|
+
|
7
|
+
module Duration
|
8
|
+
self.@_report_duration_enabled: bool | nil
|
9
|
+
|
10
|
+
def self.enable: -> void
|
11
|
+
def self.enabled?: -> bool
|
12
|
+
def report_duration: [T] (_ToS method_name) { -> T } -> T
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Lrama
|
2
|
+
class Warning
|
3
|
+
interface _Appendable
|
4
|
+
def <<: (String message) -> self
|
5
|
+
end
|
6
|
+
|
7
|
+
@out: _Appendable
|
8
|
+
|
9
|
+
attr_reader errors: Array[String]
|
10
|
+
attr_reader warns: Array[String]
|
11
|
+
def initialize: (?_Appendable out) -> void
|
12
|
+
def error: (String message) -> void
|
13
|
+
def warn: (String message) -> void
|
14
|
+
def has_error?: -> bool
|
15
|
+
end
|
16
|
+
end
|
data/template/bison/yacc.c
CHANGED
@@ -114,7 +114,7 @@
|
|
114
114
|
#ifndef YYDEBUG
|
115
115
|
# define YYDEBUG 0
|
116
116
|
#endif
|
117
|
-
#if YYDEBUG
|
117
|
+
#if YYDEBUG && !defined(yydebug)
|
118
118
|
extern int yydebug;
|
119
119
|
#endif
|
120
120
|
<%-# b4_percent_code_get([[requires]]). %code is not supported -%>
|
@@ -731,7 +731,7 @@ do { \
|
|
731
731
|
|
732
732
|
/* Temporary convenience wrapper in case some people defined the
|
733
733
|
undocumented and private YY_LOCATION_PRINT macros. */
|
734
|
-
# define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc))
|
734
|
+
# define YYLOCATION_PRINT(File, Loc<%= output.user_args %>) YY_LOCATION_PRINT(File, *(Loc)<%= output.user_args %>)
|
735
735
|
|
736
736
|
# elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
|
737
737
|
|
@@ -767,11 +767,11 @@ yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
|
|
767
767
|
|
768
768
|
/* Temporary convenience wrapper in case some people defined the
|
769
769
|
undocumented and private YY_LOCATION_PRINT macros. */
|
770
|
-
# define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc))
|
770
|
+
# define YY_LOCATION_PRINT(File, Loc<%= output.user_args %>) YYLOCATION_PRINT(File, &(Loc)<%= output.user_args %>)
|
771
771
|
|
772
772
|
# else
|
773
773
|
|
774
|
-
# define YYLOCATION_PRINT(File, Loc) ((void) 0)
|
774
|
+
# define YYLOCATION_PRINT(File, Loc<%= output.user_args %>) ((void) 0)
|
775
775
|
/* Temporary convenience wrapper in case some people defined the
|
776
776
|
undocumented and private YY_LOCATION_PRINT macros. */
|
777
777
|
# define YY_LOCATION_PRINT YYLOCATION_PRINT
|
@@ -780,13 +780,13 @@ yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
|
|
780
780
|
# endif /* !defined YYLOCATION_PRINT */
|
781
781
|
|
782
782
|
|
783
|
-
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
|
783
|
+
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location<%= output.user_args %>) \
|
784
784
|
do { \
|
785
785
|
if (yydebug) \
|
786
786
|
{ \
|
787
787
|
YYFPRINTF (stderr, "%s ", Title); \
|
788
788
|
yy_symbol_print (stderr, \
|
789
|
-
Kind, Value, Location
|
789
|
+
Kind, Value, Location<%= output.user_args %>); \
|
790
790
|
YYFPRINTF (stderr, "\n"); \
|
791
791
|
} \
|
792
792
|
} while (0)
|
@@ -828,9 +828,9 @@ yy_symbol_print (FILE *yyo,
|
|
828
828
|
YYFPRINTF (yyo, "%s %s (",
|
829
829
|
yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
|
830
830
|
|
831
|
-
YYLOCATION_PRINT (yyo, yylocationp);
|
831
|
+
YYLOCATION_PRINT (yyo, yylocationp<%= output.user_args %>);
|
832
832
|
YYFPRINTF (yyo, ": ");
|
833
|
-
yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp
|
833
|
+
yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp<%= output.user_args %>);
|
834
834
|
YYFPRINTF (yyo, ")");
|
835
835
|
}
|
836
836
|
|
@@ -840,7 +840,7 @@ yy_symbol_print (FILE *yyo,
|
|
840
840
|
`------------------------------------------------------------------*/
|
841
841
|
|
842
842
|
static void
|
843
|
-
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
|
843
|
+
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop<%= output.user_formals %>)
|
844
844
|
{
|
845
845
|
YYFPRINTF (stderr, "Stack now");
|
846
846
|
for (; yybottom <= yytop; yybottom++)
|
@@ -851,10 +851,10 @@ yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
|
|
851
851
|
YYFPRINTF (stderr, "\n");
|
852
852
|
}
|
853
853
|
|
854
|
-
# define YY_STACK_PRINT(Bottom, Top)
|
854
|
+
# define YY_STACK_PRINT(Bottom, Top<%= output.user_args %>) \
|
855
855
|
do { \
|
856
856
|
if (yydebug) \
|
857
|
-
yy_stack_print ((Bottom), (Top));
|
857
|
+
yy_stack_print ((Bottom), (Top)<%= output.user_args %>); \
|
858
858
|
} while (0)
|
859
859
|
|
860
860
|
|
@@ -878,25 +878,27 @@ yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp,
|
|
878
878
|
yy_symbol_print (stderr,
|
879
879
|
YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
|
880
880
|
&yyvsp[(yyi + 1) - (yynrhs)],
|
881
|
-
&(yylsp[(yyi + 1) - (yynrhs)])
|
881
|
+
&(yylsp[(yyi + 1) - (yynrhs)])<%= output.user_args %>);
|
882
882
|
YYFPRINTF (stderr, "\n");
|
883
883
|
}
|
884
884
|
}
|
885
885
|
|
886
|
-
# define YY_REDUCE_PRINT(Rule)
|
886
|
+
# define YY_REDUCE_PRINT(Rule<%= output.user_args %>) \
|
887
887
|
do { \
|
888
888
|
if (yydebug) \
|
889
|
-
yy_reduce_print (yyssp, yyvsp, yylsp, Rule
|
889
|
+
yy_reduce_print (yyssp, yyvsp, yylsp, Rule<%= output.user_args %>); \
|
890
890
|
} while (0)
|
891
891
|
|
892
892
|
/* Nonzero means print parse trace. It is left uninitialized so that
|
893
893
|
multiple parsers can coexist. */
|
894
|
+
#ifndef yydebug
|
894
895
|
int yydebug;
|
896
|
+
#endif
|
895
897
|
#else /* !YYDEBUG */
|
896
898
|
# define YYDPRINTF(Args) ((void) 0)
|
897
|
-
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
|
898
|
-
# define YY_STACK_PRINT(Bottom, Top)
|
899
|
-
# define YY_REDUCE_PRINT(Rule)
|
899
|
+
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location<%= output.user_args %>)
|
900
|
+
# define YY_STACK_PRINT(Bottom, Top<%= output.user_args %>)
|
901
|
+
# define YY_REDUCE_PRINT(Rule<%= output.user_args %>)
|
900
902
|
#endif /* !YYDEBUG */
|
901
903
|
|
902
904
|
|
@@ -1110,7 +1112,7 @@ yy_syntax_error_arguments (const yypcontext_t *yyctx,
|
|
1110
1112
|
required number of bytes is too large to store. */
|
1111
1113
|
static int
|
1112
1114
|
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
1113
|
-
const yypcontext_t *yyctx)
|
1115
|
+
const yypcontext_t *yyctx<%= output.user_formals %>)
|
1114
1116
|
{
|
1115
1117
|
enum { YYARGS_MAX = 5 };
|
1116
1118
|
/* Internationalized format string. */
|
@@ -1200,7 +1202,7 @@ yydestruct (const char *yymsg,
|
|
1200
1202
|
<%= output.parse_param_use("yyvaluep", "yylocationp") %>
|
1201
1203
|
if (!yymsg)
|
1202
1204
|
yymsg = "Deleting";
|
1203
|
-
YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
|
1205
|
+
YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp<%= output.user_args %>);
|
1204
1206
|
|
1205
1207
|
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
1206
1208
|
YY_USE (yykind);
|
@@ -1227,11 +1229,11 @@ int yychar;
|
|
1227
1229
|
/* The semantic value of the lookahead symbol. */
|
1228
1230
|
/* Default value used for initialization, for pacifying older GCCs
|
1229
1231
|
or non-GCC compilers. */
|
1230
|
-
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
|
1232
|
+
YY_INITIAL_VALUE (static const YYSTYPE yyval_default;)
|
1231
1233
|
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
|
1232
1234
|
|
1233
1235
|
/* Location data for the lookahead symbol. */
|
1234
|
-
static YYLTYPE yyloc_default
|
1236
|
+
static const YYLTYPE yyloc_default
|
1235
1237
|
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
|
1236
1238
|
= { 1, 1, 1, 1 }
|
1237
1239
|
# endif
|
@@ -1322,7 +1324,7 @@ yysetstate:
|
|
1322
1324
|
YY_IGNORE_USELESS_CAST_BEGIN
|
1323
1325
|
*yyssp = YY_CAST (yy_state_t, yystate);
|
1324
1326
|
YY_IGNORE_USELESS_CAST_END
|
1325
|
-
YY_STACK_PRINT (yyss, yyssp);
|
1327
|
+
YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
|
1326
1328
|
|
1327
1329
|
if (yyss + yystacksize - 1 <= yyssp)
|
1328
1330
|
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
|
@@ -1440,7 +1442,7 @@ yybackup:
|
|
1440
1442
|
else
|
1441
1443
|
{
|
1442
1444
|
yytoken = YYTRANSLATE (yychar);
|
1443
|
-
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
1445
|
+
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc<%= output.user_args %>);
|
1444
1446
|
}
|
1445
1447
|
|
1446
1448
|
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
@@ -1463,7 +1465,7 @@ yybackup:
|
|
1463
1465
|
yyerrstatus--;
|
1464
1466
|
|
1465
1467
|
/* Shift the lookahead token. */
|
1466
|
-
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
|
1468
|
+
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc<%= output.user_args %>);
|
1467
1469
|
yystate = yyn;
|
1468
1470
|
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
1469
1471
|
*++yyvsp = yylval;
|
@@ -1505,7 +1507,7 @@ yyreduce:
|
|
1505
1507
|
/* Default location. */
|
1506
1508
|
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
|
1507
1509
|
yyerror_range[1] = yyloc;
|
1508
|
-
YY_REDUCE_PRINT (yyn);
|
1510
|
+
YY_REDUCE_PRINT (yyn<%= output.user_args %>);
|
1509
1511
|
switch (yyn)
|
1510
1512
|
{
|
1511
1513
|
<%= output.user_actions -%>
|
@@ -1523,7 +1525,7 @@ yyreduce:
|
|
1523
1525
|
case of YYERROR or YYBACKUP, subsequent parser actions might lead
|
1524
1526
|
to an incorrect destructor call or verbose syntax error message
|
1525
1527
|
before the lookahead is translated. */
|
1526
|
-
YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
|
1528
|
+
YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc<%= output.user_args %>);
|
1527
1529
|
|
1528
1530
|
YYPOPSTACK (yylen);
|
1529
1531
|
yylen = 0;
|
@@ -1561,7 +1563,7 @@ yyerrlab:
|
|
1561
1563
|
= {yyssp, yytoken, &yylloc};
|
1562
1564
|
char const *yymsgp = YY_("syntax error");
|
1563
1565
|
int yysyntax_error_status;
|
1564
|
-
yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
|
1566
|
+
yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx<%= output.user_args %>);
|
1565
1567
|
if (yysyntax_error_status == 0)
|
1566
1568
|
yymsgp = yymsg;
|
1567
1569
|
else if (yysyntax_error_status == -1)
|
@@ -1573,7 +1575,7 @@ yyerrlab:
|
|
1573
1575
|
if (yymsg)
|
1574
1576
|
{
|
1575
1577
|
yysyntax_error_status
|
1576
|
-
= yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
|
1578
|
+
= yysyntax_error (&yymsg_alloc, &yymsg, &yyctx<%= output.user_args %>);
|
1577
1579
|
yymsgp = yymsg;
|
1578
1580
|
}
|
1579
1581
|
else
|
@@ -1628,7 +1630,7 @@ yyerrorlab:
|
|
1628
1630
|
this YYERROR. */
|
1629
1631
|
YYPOPSTACK (yylen);
|
1630
1632
|
yylen = 0;
|
1631
|
-
YY_STACK_PRINT (yyss, yyssp);
|
1633
|
+
YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
|
1632
1634
|
yystate = *yyssp;
|
1633
1635
|
goto yyerrlab1;
|
1634
1636
|
|
@@ -1663,7 +1665,7 @@ yyerrlab1:
|
|
1663
1665
|
YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp<%= output.user_args %>);
|
1664
1666
|
YYPOPSTACK (1);
|
1665
1667
|
yystate = *yyssp;
|
1666
|
-
YY_STACK_PRINT (yyss, yyssp);
|
1668
|
+
YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
|
1667
1669
|
}
|
1668
1670
|
|
1669
1671
|
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
@@ -1675,7 +1677,7 @@ yyerrlab1:
|
|
1675
1677
|
YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);
|
1676
1678
|
|
1677
1679
|
/* Shift the error token. */
|
1678
|
-
YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
|
1680
|
+
YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp<%= output.user_args %>);
|
1679
1681
|
|
1680
1682
|
yystate = yyn;
|
1681
1683
|
goto yynewstate;
|
@@ -1721,7 +1723,7 @@ yyreturnlab:
|
|
1721
1723
|
/* Do not reclaim the symbols of the rule whose action triggered
|
1722
1724
|
this YYABORT or YYACCEPT. */
|
1723
1725
|
YYPOPSTACK (yylen);
|
1724
|
-
YY_STACK_PRINT (yyss, yyssp);
|
1726
|
+
YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
|
1725
1727
|
while (yyssp != yyss)
|
1726
1728
|
{
|
1727
1729
|
yydestruct ("Cleanup: popping",
|