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

wip: Add a the rule _expression_without_subquery. #206

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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