Skip to content
This repository has been archived by the owner on Dec 13, 2021. It is now read-only.

Reduce use of exceptions #7

Open
djcsdy opened this issue Jul 12, 2013 · 0 comments
Open

Reduce use of exceptions #7

djcsdy opened this issue Jul 12, 2013 · 0 comments
Milestone

Comments

@djcsdy
Copy link
Owner

djcsdy commented Jul 12, 2013

The parser throws exceptions to signal that a grammar production cannot be matched and that the parser must backtrack.

This is a non-exceptional situation: we expect it to happen many times when parsing any XPath expression. The majority of parse exceptions thrown will be caught and handled. The only case where a parse exception will not be caught is if the parser has exhausted all backtracking possibilities without yielding a match; in other words, if the XPath expression itself is invalid.

It’s impolite to throw exceptions in such non-exceptional situations, and it may also be hurting parsing performance. We should consider an alternative mechanism to trigger backtracking. I’m not sure exactly what yet.

(It’s possible that haxe-xpath also throws and catches exceptions in some other non-exceptional circumstances, and of course those should be cleaned up too.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant