}
%syntax_error {
- int n = sizeof(tokennames) / sizeof(tokennames[0]);
- int l = strlen("Expecting ");
- int c = 0;
int i;
- for (i = 0; i < n; i++)
- {
+ for (i = 0; i < sizeof(tokennames) / sizeof(tokennames[0]); i++)
if (yy_find_shift_action(yypParser, (YYCODETYPE)i) < YYNSTATE + YYNRULE)
- l += strlen(tokennames[i]) + 4;
- }
-
- s->error = malloc(l);
-
- if (s->error)
- {
- s->erroff = s->off;
- strcpy(s->error, "Expecting ");
-
- for (i = 0; i < n; i++)
- {
- if (yy_find_shift_action(yypParser, (YYCODETYPE)i) < YYNSTATE + YYNRULE)
- {
- if (c++)
- strcat(s->error, " or ");
-
- strcat(s->error, tokennames[i]);
- }
- }
- }
+ s->error_code |= (1 << i);
+
+ s->error_pos = s->off;
}
path(A) ::= T_ROOT segments(B). { A = alloc_op(T_ROOT, 0, NULL, B); }
path(A) ::= T_THIS segments(B). { A = alloc_op(T_THIS, 0, NULL, B); }
+path(A) ::= T_ROOT(B). { A = B; }
+path(A) ::= T_THIS(B). { A = B; }
segments(A) ::= segments(B) segment(C). { A = append_op(B, C); }
segments(A) ::= segment(B). { A = B; }