Generic MathML Errors using Parser Lookahead (some endpoints updated) #386
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
Generic MathML Parser Error update:
generic_mathml.rs
parser:<mi>
,<mn>
,<msup>
,<msub>
,<msqrt>
,<mfrac>
,<mrow>
,<munder>
,<mover>
,<msubsup>
,<mtext>
,<mstyle>
,<mspace>
,<mo>
./mathml/ast-graph
endpoint now shows these errors.First Order ODE Parser Error update:
ParseError
messages using thecontext
combinator, removing the previous macro usage.interpreted_mathml.rs
, which doesn't encounter those errors at the math_expression level./pmml/equations-to-amr
and/latex/equations-to-amr
are passing on these errors. fromskema-rs
Notes
Lookahead Algorithm:
math_expression
, instead of usingalt
for multiple branches of parsers, the following steps were adopted:cut
because of the lookahead knowledge.Error
instead of aFailure
.Failure
cuts the execution, but returning anError
allows the parent combinator to continue using parsers on the remaining input.many0
and other combinators to work as expected. When we run out of things (like math expressions) formany0
to match (encountered a close tag), we return anError
, allowing the parent combinator to continue. But, as long as we know there is an expression to match (open tag), we can guarantee that if the internal parser (for<mi>
,<mo>
, etc.) fails, it was due to bad input.Testing
cargo test
andcargo clippy
passing.