These are chat archives for opal/opal

Jan 2019
Bernhard Weichel
Jan 20 2019 14:49 UTC
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- in process, line 71
Web    GET localhost/

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

one can even see with . the errors are reported in the browser console. But there is also no hint to the errornous position.
Elia Schito
Jan 20 2019 21:06 UTC
@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- `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- `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- `on_error'
     1: from /Users/elia/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/parser- `process'
-e:1:in `foo : bar': unexpected token tCOLON (Opal::SyntaxError)