fix: bug in parsing not returning errors
This commit is contained in:
parent
6edee4b073
commit
0ae33a44ff
1 changed files with 14 additions and 10 deletions
|
@ -19,12 +19,14 @@ defmodule Gcode.Parser do
|
|||
ok(program) <- hydrate(tokens) do
|
||||
ok(program)
|
||||
else
|
||||
{:error, reason} ->
|
||||
{:parse_error, reason}
|
||||
error(reason) ->
|
||||
error({:parse_error, reason})
|
||||
|
||||
{:error, {message, unexpected, _, {line, _}, col}} ->
|
||||
{:parse_error,
|
||||
"Unexpected #{inspect(unexpected)} at line: #{line}:#{col + 1}. #{message}."}
|
||||
error({message, unexpected, _, {line, _}, col}) ->
|
||||
error(
|
||||
{:parse_error,
|
||||
"Unexpected #{inspect(unexpected)} at line: #{line}:#{col + 1}. #{message}."}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -38,12 +40,14 @@ defmodule Gcode.Parser do
|
|||
ok(program) <- hydrate(tokens) do
|
||||
ok(program)
|
||||
else
|
||||
{:error, reason} ->
|
||||
{:parse_error, reason}
|
||||
error(reason) ->
|
||||
error({:parse_error, reason})
|
||||
|
||||
{:error, {message, unexpected, _, {line, _}, col}} ->
|
||||
{:parse_error,
|
||||
"Unexpected #{inspect(unexpected)} at line: #{line}:#{col + 1}. #{message}."}
|
||||
error({message, unexpected, _, {line, _}, col}) ->
|
||||
error(
|
||||
{:parse_error,
|
||||
"Unexpected #{inspect(unexpected)} at line: #{line}:#{col + 1}. #{message}."}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue