Skip to content

Commit f4b8895

Browse files
kddnewtontenderlove
authored andcommitted
Clean up lambda output from exyacc.rb
The `lambda_body` grammar rule has a `"}"`, which is throwing off the `exyacc.rb` regular expressions. This changes the regular expression to account for `"}"` as well, which makes the output of `ruby sample/exyacc.rb < parse.y` change by the following diff: ```diff 632,634d631 < ", &@3); < $$ = $2; < } ``` Which makes it closer to a valid EBNF.
1 parent 62bc4a9 commit f4b8895

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sample/exyacc.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
grammar = source[sbeg, send-sbeg]
99
grammar.sub!(/.*\n/, "")
1010
grammar.gsub!(/'\{'/, "'\001'")
11-
grammar.gsub!(/'\}'/, "'\002'")
11+
grammar.gsub!(/["']\}["']/, "'\002'")
1212
grammar.gsub!(%r{\*/}, "\003\003")
1313
grammar.gsub!(%r{/\*[^\003]*\003\003}, '')
1414
while grammar.gsub!(/\{[^{}]*\}/, ''); end

0 commit comments

Comments
 (0)