fix parser

This commit is contained in:
anlicheng 2025-06-11 23:56:00 +08:00
parent 39f05e2796
commit 737cc9fbab

View File

@ -20,13 +20,11 @@
parse(Input) when is_binary(Input) ->
Tokens = lexer(Input),
{ok, AST} = parser(Tokens),
lists:foreach(fun(E) ->
lager:debug("block: ~p", [E])
end, parse_ast(AST)),
case validate(AST) of
ok -> {ok, AST};
{error, Reason} -> {error, Reason}
try validate(AST) of
ok ->
{ok, AST}
catch throw:Reason ->
{error, Reason}
end.
parse_file(Filename) ->