alpaca icon indicating copy to clipboard operation
alpaca copied to clipboard

return scanner errors intead of crashing

Open Licenser opened this issue 7 years ago • 0 comments

It would be nice to return scanner error instead of crashing.

For example:

The following (broken) code:

module example

export add/2

let add x y = y * x + \1

let run () = add 2 1.0

let run () = add 2.0 1

causes the compiler crash with:

Error: {badmatch,{error,{5,alpaca_scan,{user,"Unexpected token: \\"}},5}}
[{alpaca_ast_gen,parse_module,1,
                 [{file,"/Users/heinz/Projects/Other/alptest/_build/default/plugins/alpaca/src/alpaca_ast_gen.erl"},
                  {line,80}]},
 {alpaca_ast_gen,'-make_modules/1-lc$^0/1-0-',1,
                 [{file,"/Users/heinz/Projects/Other/alptest/_build/default/plugins/alpaca/src/alpaca_ast_gen.erl"},
                  {line,63}]},
 {alpaca_ast_gen,make_modules,1,
                 [{file,"/Users/heinz/Projects/Other/alptest/_build/default/plugins/alpaca/src/alpaca_ast_gen.erl"},
                  {line,63}]},
 {alpaca,compile_phase_1,2,
         [{file,"/Users/heinz/Projects/Other/alptest/_build/default/plugins/alpaca/src/alpaca.erl"},
          {line,66}]},
 {rebar_prv_alpaca_compile,compile_apps,4,
                           [{file,"/Users/heinz/Projects/Other/alptest/_checkouts/rebar_prv_alpaca/src/rebar_prv_alpaca_compile.erl"},
                            {line,59}]},
 {rebar_prv_alpaca_compile,do,1,
                           [{file,"/Users/heinz/Projects/Other/alptest/_checkouts/rebar_prv_alpaca/src/rebar_prv_alpaca_compile.erl"},
                            {line,37}]},
 {rebar_core,do,2,
             [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_core.erl"},
              {line,153}]},
 {rebar_hooks,run_provider_hooks_,6,
              [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_hooks.erl"},
               {line,49}]}]

Licenser avatar Jun 12 '17 01:06 Licenser