aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--example/input.txt2
-rw-r--r--src/elixir_math_parser.yrl1
3 files changed, 3 insertions, 2 deletions
diff --git a/README.md b/README.md
index 65f2454..ea7d98c 100644
--- a/README.md
+++ b/README.md
@@ -2,4 +2,4 @@
A math script parser in Elixir.
-Using leex, yecc and ratio.
+Using leex, yecc and a modified version of Ratio from hexpm.
diff --git a/example/input.txt b/example/input.txt
index 8cb02c5..32146f2 100644
--- a/example/input.txt
+++ b/example/input.txt
@@ -6,4 +6,4 @@ y = 2!
z = y/2
10 + 4(z / y)(x / 4)
-x^(0-y)
+x^(-y)
diff --git a/src/elixir_math_parser.yrl b/src/elixir_math_parser.yrl
index 006c768..f8de916 100644
--- a/src/elixir_math_parser.yrl
+++ b/src/elixir_math_parser.yrl
@@ -50,6 +50,7 @@ expr -> exprs '/' exprs : {div_op, '$1', '$3'}.
expr -> expr '!' : {factor_op, '$1'}.
expr -> exprs '^' exprs : {exp_op, '$1', '$3'}.
expr -> '(' exprs ')' : '$2'.
+expr -> '-' exprs : {sub_op, {int, 0, 0}, '$2'}.
Erlang code.