natalie-lang / natalie_parser

NatalieParser is a zero-dependency, from-scratch, hand-written recursive descent parser for the Ruby Programming Language.
MIT License
63 stars 8 forks source link

Parse issue with || on a different line after each/do #50

Closed nanobowers closed 1 year ago

nanobowers commented 1 year ago
[1,2,3].each do
  |x| puts x
end

The |x| on the next line is confusing the parser.

08:21 $ ruby -I lib:ext -r natalie_parser -e 'p NatalieParser.parse(File.read("../temp_natalie_parser_tests/each_nextline.rb"))'
-e:1:in `parse': (string)#2: syntax error, unexpected '|' (expected: 'expression') (SyntaxError)
  |x| puts x
  ^ here, expected 'expression'
        from -e:1:in `<main>'
seven1m commented 1 year ago

Archiving this repo in favor of YARP...