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 #693 #697

Closed
wants to merge 4 commits into from
Closed

fix parsing of 'with' inside streaming operator #693 #697

wants to merge 4 commits into from

Commits on Mar 11, 2021

  1. Work in progress: fix #693

    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.
    
    TODO:
      [ ] Extend what can be between 'with' and '[' to
          include arbitrary whitespace (including: comments)
      [ ] Make formatter work; currently
          {<< {unpacked_arr with [i*4 +: 4]}};
          is formatted
          {<<{unpacked_arrwith[i*4+:4]}};
    
    Signed-off-by: Henner Zeller <h.zeller@acm.org>
    hzeller committed Mar 11, 2021
    Configuration menu
    Copy the full SHA
    d572c2a View commit details
    Browse the repository at this point in the history

Commits on Mar 12, 2021

  1. Extend notion of whitespace between 'with' and '[' to comments.

    Signed-off-by: Henner Zeller <h.zeller@acm.org>
    hzeller committed Mar 12, 2021
    Configuration menu
    Copy the full SHA
    14776bf View commit details
    Browse the repository at this point in the history

Commits on Mar 15, 2021

  1. Leave space around the 'with' keyword inside streaming ops.

    There was a special case for streaming operators that
    reduced spaces around the various components. However, for
    'with', we need to special-special case that to actually
    keep a space around.
    
    Signed-off-by: Henner Zeller <h.zeller@acm.org>
    hzeller committed Mar 15, 2021
    Configuration menu
    Copy the full SHA
    c9a6f17 View commit details
    Browse the repository at this point in the history
  2. Add lexer unit test. Extend parser unit test.

    Signed-off-by: Henner Zeller <h.zeller@acm.org>
    hzeller committed Mar 15, 2021
    Configuration menu
    Copy the full SHA
    3f2c80d View commit details
    Browse the repository at this point in the history