Item10386: OP_where parses successfully even when the closing bracket is missing
Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Engine
Component:
Branches:
OP_where parses successfully even when the closing ] is missing
Which may lead to ambiguity if there is anything following it?
--
SvenDowideit - 21 Feb 2011
There is no risk of ambiguity. The parser is a simple-stack-based parser, where brackets are parsed bvy a stack push and recursive call of the parser until either (1) the matching bracket or (2) the end of the string is hit. If the EOS is hit earlier, it forces a stack flush of however levels remain open.So it will parse "A[B" and "A[B[C" successfully (and correctly).
It would be easy to modify this behaviour to report an error, but the error handling through the
SEARCH macro is so crap that I chose to be lenient. The language definition requires the closing braces, even if the implementation does not.
--
CrawfordCurrie - 22 Feb 2011
I think you have just confirmed that. yes, there is ambiguity
for the user. i realise there is only one way the parser will deal with it - the point is that like all code, if what the parser does due to missing syntax is not what the user intended, then we've created an ambiguous situation.
--
SvenDowideit - 22 Feb 2011
In the grand scheme of things, I think we can live with this.
--
CrawfordCurrie - 15 Mar 2011