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