From c7a26d3c6125caa9239cec9bf08db935d98e19c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Sat, 8 Nov 2025 22:53:41 +0100 Subject: feat(syntax): eval statement --- lib/main.ex | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/main.ex') diff --git a/lib/main.ex b/lib/main.ex index f1f0a20..ad657ca 100644 --- a/lib/main.ex +++ b/lib/main.ex @@ -7,9 +7,10 @@ defmodule ElixirMathParser.Main do def process_parse({:ok, tree}) do IO.puts("\nParse tree") IO.inspect(tree, pretty: true) - state = ElixirMathParser.process_tree(tree) - IO.puts("\nFinal state") - IO.inspect(state, pretty: true) + case ElixirMathParser.process_tree(tree) do + {:ok, _} -> :ok + {:error, reason} -> reason + end end def main(args) do @@ -20,9 +21,10 @@ defmodule ElixirMathParser.Main do {:ok, tokens, line} = :elixir_math_parser_lexer.string(String.to_charlist(text)) IO.puts("Parsed #{filename}, stopped at line #{line}") - IO.puts("\nTokens:") - IO.inspect(tokens, pretty: true) - process_parse(:elixir_math_parser.parse(tokens)) + res = process_parse(:elixir_math_parser.parse(tokens)) + if res != :ok do + IO.puts(res) + end end end -- cgit v1.2.3