mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
factor the handling of m4 escaping
The conversion from @ to @@ and so forth is coded is too many different places. Factor, a bit. * src/scan-code.l: Instead of duplicating the logic of obstack_escape, use it. It sure is less efficient, but the cost is negligible. This allows to factor rules that are alike. And to factor some start-condition clauses. * tests/input.at (Stray $ or @): New. * NEWS: Document it.
This commit is contained in:
@@ -1371,6 +1371,36 @@ m4_popdef([AT_TEST])
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## -------------- ##
|
||||
## Stray $ or @. ##
|
||||
## -------------- ##
|
||||
|
||||
AT_SETUP([[Stray $ or @]])
|
||||
|
||||
AT_DATA_GRAMMAR([[input.y]],
|
||||
[[%token TOK
|
||||
%destructor { $%; @%; } <*>;
|
||||
%initial-action { $%; @%; };
|
||||
%printer { $%; @%; } <*>;
|
||||
%%
|
||||
exp: TOK { $%; @%; };
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input.y]], 0, [],
|
||||
[[input.y:10.19: warning: stray '$'
|
||||
input.y:10.23: warning: stray '@'
|
||||
input.y:11.19: warning: stray '$'
|
||||
input.y:11.23: warning: stray '@'
|
||||
input.y:12.19: warning: stray '$'
|
||||
input.y:12.23: warning: stray '@'
|
||||
input.y:14.19: warning: stray '$'
|
||||
input.y:14.23: warning: stray '@'
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
|
||||
## ---------------- ##
|
||||
## Code injection. ##
|
||||
## ---------------- ##
|
||||
|
||||
Reference in New Issue
Block a user