These are chat archives for opal/opal

20th
Jan 2019
Bernhard Weichel
@bwl21
Jan 20 14:49
I have a question wrt error reporting.

with opal 0.11 I get

SyntaxError at /
unexpected token tCOLON
Ruby    /Users/beweiche/.rvm/gems/ruby-2.4.1/gems/parser-2.3.3.1/lib/parser/diagnostic/engine.rb: in process, line 71
Web    GET localhost/

But no hint, which of my source files caused the error.

one can even see with http://opalrb.com/try/?code:foo%20%3A%20bar . the errors are reported in the browser console. But there is also no hint to the errornous position.
Elia Schito
@elia
Jan 20 21:06
@bwl21 It has been greatly improved on master, where the position inside the file is now visible if available, e.g. (see the last line where the filename is "-e":
⤑ bin/opal -e 'foo : bar'                                                              ~/C/opal
-e:1:5: error: unexpected token tCOLON
-e:1: foo : bar
-e:1:     ^    
Traceback (most recent call last):
    22: from bin/opal:4:in `<main>'
    21: from bin/opal:4:in `load'
    20: from /Users/elia/Code/opal/exe/opal:24:in `<top (required)>'
    19: from /Users/elia/Code/opal/lib/opal/cli.rb:66:in `run'
    18: from /Users/elia/Code/opal/lib/opal/cli.rb:78:in `builder'
    17: from /Users/elia/Code/opal/lib/opal/cli.rb:107:in `create_builder'
    16: from /Users/elia/Code/opal/lib/opal/cli.rb:144:in `evals_or_file'
    15: from /Users/elia/Code/opal/lib/opal/cli.rb:107:in `block in create_builder'
    14: from /Users/elia/Code/opal/lib/opal/builder.rb:95:in `build_str'
    13: from /Users/elia/Code/opal/lib/opal/builder_processors.rb:94:in `requires'
    12: from /Users/elia/Code/opal/lib/opal/builder_processors.rb:84:in `compiled'
    11: from /Users/elia/Code/opal/lib/opal/compiler.rb:173:in `compile'
    10: from /Users/elia/Code/opal/lib/opal/compiler.rb:187:in `parse'
     9: from /Users/elia/Code/opal/lib/opal/compiler.rb:232:in `re_raise_with_location'
     8: from /Users/elia/Code/opal/lib/opal/compiler.rb:187:in `block in parse'
     7: from /Users/elia/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/parser-2.5.3.0/lib/parser/base.rb:214:in `tokenize'
     6: from /Users/elia/Code/opal/lib/opal/parser/default_config.rb:32:in `parse'
     5: from /Users/elia/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/parser-2.5.3.0/lib/parser/base.rb:167:in `parse'
     4: from /Users/elia/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/racc/parser.rb:259:in `do_parse'
     3: from /Users/elia/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/racc/parser.rb:259:in `_racc_do_parse_c'
     2: from /Users/elia/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/parser-2.5.3.0/lib/parser/base.rb:262:in `on_error'
     1: from /Users/elia/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/parser-2.5.3.0/lib/parser/diagnostic/engine.rb:73:in `process'
-e:1:in `foo : bar': unexpected token tCOLON (Opal::SyntaxError)