Menu

#751 '=' token not allowed inside parentheses for normal/quirk function calls in N of String * N

open
nobody
None
compiler
2014-11-24
2014-11-18
dkl
No

The following currently triggers parser errors, but should probably work:

type a as zstring * iif(1 = 1, 1, 1)
type b as zstring * len(str(1 = 1))

I think it's related to the special handling of '=' vs. parentheses in the N expression of STRING * N. Normal parentheses are handled and '=' is allowed inside them, but the parentheses of iif() and other such "functions" are handled differently.

Discussion

  • Matthew

    Matthew - 2014-11-24

    It also happens with >:

    dim i as integer<iif(1 > 0, 32, 32)>
    

    The simplest solution might be to ditch the parser.options flags, and pass down a flags parameter through cExpression() -> cBoolExpression() -> cLogExpression() -> cLogOrExpression() -> cLogAndExpression() -> cRelExpression().

     
  • Matthew

    Matthew - 2014-11-24

    Actually the lexer uses fbGetGtInParensOnly( ) to prevent mis-parsing '>=' in e.g. a as integer<32>=1..
    So the above suggestion would require either:

    • taking the flag all the way through the expression parser into the lexer
    • perhaps to disallow '>=' as well, and allow the integer<> parsing to detect the '>=', take the '>', and push the '=' back as the next token - would that be possible?
     

Log in to post a comment.

MongoDB Logo MongoDB