diff options
| author | William Hergès <william@herges.fr> | 2025-11-08 22:53:41 +0100 |
|---|---|---|
| committer | William Hergès <william@herges.fr> | 2025-11-08 22:53:41 +0100 |
| commit | c7a26d3c6125caa9239cec9bf08db935d98e19c1 (patch) | |
| tree | 77222ae3903da80d619d7a33d307d0d46c4eb9bb /lib/main.ex | |
| parent | f52f066e7cf6b4c96e452a8f7e803d7f1895e9a1 (diff) | |
feat(syntax): eval statement
Diffstat (limited to 'lib/main.ex')
| -rw-r--r-- | lib/main.ex | 14 |
1 files changed, 8 insertions, 6 deletions
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 |
