splparser
splparser copied to clipboard
The parsetree module should make accessing of erroneous ParseTreeNodes accessible.
A recent policy is that when parsing queries that do not match the documentation, we still continue to "accept" them by having a valid parser rule for them (within reason -- we shouldn't accept 'cat on the keyboard'-like garbage). BUT in addition to accepting them, we add set an "errror" flag on the relevant ParseTreeNode containing the erroneous part of the query to "true" i.e., p[0].error = true.
In order for this to be useful we need someway of indicating that the entire parse tree is from an erroneous query.
Viable options (not mutually exlusive) for this include:
- Propagate the error up to the root, and have it set an attribute as flag like "self.haserrors = True", and possibly keep a pointer to the erroneous children.
- Add a function to return true when a node or its subtree contains and error, and a function for printing out the error.