aboutsummaryrefslogtreecommitdiff
path: root/lib/main.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/main.ex')
-rw-r--r--lib/main.ex14
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