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

Reduce use of exceptions #7

@djcsdy

Description

@djcsdy

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.)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions