Closed le0pard closed 4 weeks ago
@le0pard, thanks for the report. Please feel free to submit a PR to fix the underscores issue in variable names (and check it's compatible with previous Ruby versions), however the issue you're having here also relates to JS syncs in the module prologue.
/Users/leo/Downloads/sqlite_test/calc-ast-parser.rb:311: syntax error, unexpected '{', expecting `then' or ';' or '\n'
...f (functionList.includes(id)) {
This is now a valid Ruby syntax, but the syntax from JS.
For Ruby example please address this example file. It can be converted from JSON grammar format to Bison/Yacc format, but you need to use Ruby syntax when define extra functions, etc.
Parser generator for ruby generate code with
_1
and_2
, which is reserved in latest ruby versions:Added from ruby 2.7 - https://www.bigbinary.com/blog/ruby-2-7-introduces-numbered-parameters-as-default-block-parameters
Steps to reproduce
Ruby version:
Create
calc-ast.g
file with content:Generate parser:
Now try to use it:
With js parser all good:
P.S. Example in README for ruby incorrect, need to be
require 'CalcParser'
, notrequire 'CalcParser.php'
(not php)