From 7412055d5f11bcd82aa745ad7a2cc6ff4437f84b Mon Sep 17 00:00:00 2001 From: belerico Date: Tue, 21 Apr 2020 20:32:24 +0200 Subject: [PATCH] Fix grammar --- README.md | 2 +- py_asciimath/grammar/latex_grammar.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9f89ce5..45c6327 100644 --- a/README.md +++ b/README.md @@ -278,7 +278,7 @@ i: s -> exp_interm | s "_" s -> exp_under | s "^" s -> exp_super | s "_" s "^" s -> exp_under_super -s: l exp r -> exp_par +s: l exp? r -> exp_par | "\left" (l | "." | "\vert" | "\mid") start? "\right" (r | "." | "\vert" | "\mid") -> exp_par | "\begin{{matrix}}" row_mat ("\\" row_mat?)* "\end{{matrix}}" -> exp_mat | "{" i+ "}" -> exp diff --git a/py_asciimath/grammar/latex_grammar.py b/py_asciimath/grammar/latex_grammar.py index 3df61bf..707fd9a 100644 --- a/py_asciimath/grammar/latex_grammar.py +++ b/py_asciimath/grammar/latex_grammar.py @@ -24,7 +24,7 @@ | s "_" s -> exp_under | s "^" s -> exp_super | s "_" s "^" s -> exp_under_super - s: _l exp _r -> exp_par + s: _l exp? _r -> exp_par | "\\left" (_l | /\./ | /\\vert/ | /\\mid/) start? "\\right" (_r | /\./ | /\\vert/ | /\\mid/) -> exp_par | "\\begin{{matrix}}" row_mat (/\\\\/ row_mat?)* "\\end{{matrix}}" -> exp_mat | /\\sqrt/ "[" i+ "]" "{{" exp "}}" -> exp_binary