Skip to content

Conversation

antoineB
Copy link
Contributor

Work in progress

Is it the right way to do it ?
Is it worth the trouble ?
Does it at complexity too much complexity to the grammar (N° of states, time, maintainability) ?

@antoineB
Copy link
Contributor Author

Maybe what is wanted is removing rules $.list and wrapped_in_parenthesis($._expression)

    _unwrapped_expression: $ => prec(1,
      choice(
        $.literal,
        alias(
          $._qualified_field,
          $.field,
        ),
        $.parameter,
        $.case,
        $.window_function,
        $.cast,
        alias($.implicit_cast, $.cast),
        $.exists,
        $.invocation,
        $.binary_expression,
        $.unary_expression,
        $.array,
        $.interval,
        $.between_expression,
      )
    ),

    _expression: $ => choice(
        $._unwrapped_expression_without_starting_subquery,
        $.subquery,
        wrapped_in_parenthesis($._expression),
        $.list
    ),

    function_declaration: $ => seq(
      $.identifier,
      $._type,
      optional(
        seq(
          ':=',
          choice(
            wrapped_in_parenthesis($.statement),
            wrapped_in_parenthesis($._unwrapped_expression_without_starting_subquery),
            $._unwrapped_expression_without_starting_subquery,
            $.list,
          ),
        ),
      ),
      ';',
    ),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant