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

alternative implementation using binary_expression #171

Merged
merged 1 commit into from
Jun 29, 2023
Merged

Conversation

DerekStride
Copy link
Owner

Alternative to #170 that uses the binary_expression node.

➜ tree-sitter-sql tree-sitter parse tmp/json.sql
(program [0, 0] - [7, 0]
  (statement [0, 0] - [6, 10]
    (select [0, 0] - [5, 35]
      (keyword_select [0, 0] - [0, 6])
      (select_expression [1, 4] - [5, 35]
        (term [1, 4] - [1, 29]
          value: (binary_expression [1, 4] - [1, 20]
            left: (literal [1, 4] - [1, 10])
            right: (literal [1, 13] - [1, 20]))
          (keyword_as [1, 21] - [1, 23])
          alias: (identifier [1, 24] - [1, 29]))
        (term [2, 4] - [2, 32]
          value: (binary_expression [2, 4] - [2, 32]
            left: (binary_expression [2, 4] - [2, 21]
              left: (literal [2, 4] - [2, 10])
              right: (literal [2, 12] - [2, 21]))
            right: (literal [2, 26] - [2, 32])))
        (term [3, 4] - [3, 46]
          value: (binary_expression [3, 4] - [3, 33]
            left: (binary_expression [3, 4] - [3, 21]
              left: (literal [3, 4] - [3, 10])
              right: (literal [3, 12] - [3, 21]))
            right: (literal [3, 26] - [3, 33]))
          (keyword_as [3, 34] - [3, 36])
          alias: (identifier [3, 37] - [3, 46]))
        (term [4, 4] - [4, 21]
          value: (binary_expression [4, 4] - [4, 21]
            left: (literal [4, 4] - [4, 10])
            right: (literal [4, 14] - [4, 21])))
        (term [5, 4] - [5, 35]
          value: (binary_expression [5, 4] - [5, 27]
            left: (literal [5, 4] - [5, 10])
            right: (literal [5, 15] - [5, 27]))
          (keyword_as [5, 28] - [5, 30])
          alias: (identifier [5, 31] - [5, 35]))))
    (from [6, 0] - [6, 10]
      (keyword_from [6, 0] - [6, 4])
      (relation [6, 5] - [6, 10]
        (object_reference [6, 5] - [6, 10]
          name: (identifier [6, 5] - [6, 10]))))))

@DerekStride DerekStride mentioned this pull request Jun 29, 2023
Copy link
Collaborator

@dmfay dmfay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@DerekStride DerekStride merged commit e238bc9 into dmf/json Jun 29, 2023
@DerekStride DerekStride deleted the ds/json branch June 29, 2023 18:28
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.

2 participants