Scala PackratParser ignores failure analyzer

I have a parser that was written using Scala RegexParsers - link

He had some serious performance issues when analyzing grammar with deeply nested expressions. So I created a version in which I mix the Scala PackratParsers link -

The Packrat version does not have the same performance and correctly analyzes the grammar. However, when I provide an incorrect grammar for testing, for example. this

An old (non-packet) parser used to correctly report an "Invalid rule" error message through the error parser combinator | failure("Invalid rule") | failure("Invalid rule") here is a link

When using packrat-parser, if I enable tracing, I see on the trace that the crash is created the same way as in the non-packet version, however PackratParser seems to ignore this and always returns failure: Base Failure instead.

Is there anything else in error handling when using PackratParsers that I need to understand?

+43
scala parsing parser-combinators
Mar 27 '15 at 12:40
source share
1 answer

It seems you need to use err("Invalid rule") instead of failure , as this ensures that no reverse lookup is performed.

+1
Jul 24 '15 at 1:17
source share



All Articles