Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parsing of 'with' inside streaming operator. #1504

Commits on Oct 12, 2022

  1. Fix parsing of 'with' inside streaming operator.

    The stream expression has an expression followed by
    an optional 'with' '[' array_range_expression ']'
    (LRM 11.4.14)
    
    There are a few other cases where an expression can
    be trailed with 'with',
    
    with_constraint_block: there we expect an
    identifier list in parenthesis after 'with'
    similar with array methods with predicate
    with '(' ...)
    Since the parser with one look-ahead can't see beyond
    the 'with', it runs into a shift/reduce conflict
    as it does not know if '(' or '[' is to follow.
    
    Disambiguate that in the lexer by creating a
    separate token TK_with__followed_by_bracket which is
    a TK_with, where the lexer already looked ahead and
    knows that it will be followed by '['.
    
    After seeing the '[', everything but the "with" is put
    back into the stream to be processed separately.
    
    Changed lexer and parser as well as associated unit tests including formatter.
    
    Fixing #693
    
    Signed-off-by: Henner Zeller <[email protected]>
    hzeller committed Oct 12, 2022
    Configuration menu
    Copy the full SHA
    4cb5360 View commit details
    Browse the repository at this point in the history