-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Consider replacing nom with hand-written parsing rules for XPath #39602
Description
I'm not a big fan of nom because it is hard to debug and causes extremely cryptic compiler errors.
But the bigger problem is that noms parsing model relies on repeatedly trying parser functions and seeing if they succeed. That means that input is potentially parsed multiple times before the correct approach is found, and that is fundamentally incompatible with #39596. We would have to use something like a seperate pass over the Expr AST so prefixes are only resolved once. I'd prefer not to.
The parser in gecko (https://searchfox.org/firefox-main/source/dom/xslt/xpath/txExprLexer.cpp, https://searchfox.org/firefox-main/source/dom/xslt/xpath/txExprParser.cpp) does not look that bad.
nom is only used in two places, xpath and cookie, so it would be fairly easy to get rid of.