Skip to content

Add node fields - #96

Merged
maxbrunsfeld merged 1 commit into
masterfrom
node-fields
Jul 10, 2019
Merged

maxbrunsfeld merged 1 commit into
masterfrom
node-fields

Conversation

@maxbrunsfeld

@maxbrunsfeld maxbrunsfeld commented Feb 12, 2019 •

Copy link
Copy Markdown
Contributor

Depends on tree-sitter/tree-sitter#271

This PR adds named fields to most node types:

(program [0, 0] - [20, 0]
  (if_statement [6, 0] - [12, 1]
    condition: (identifier [6, 4] - [6, 5])
    consequence: (statement_block [6, 7] - [12, 1]
      (while_statement [7, 2] - [11, 3]
        condition: (binary_expression [7, 9] - [7, 18]
          left: (binary_expression [7, 9] - [7, 14]
            left: (identifier [7, 9] - [7, 10])
            right: (identifier [7, 13] - [7, 14]))
          right: (identifier [7, 17] - [7, 18]))
        body: (statement_block [7, 20] - [11, 3]
          (do_statement [8, 4] - [10, 16]
            body: (statement_block [8, 7] - [10, 5]
              (expression_statement [9, 6] - [9, 14]
                expression: (call_expression [9, 6] - [9, 13]
                  function: (member_expression [9, 6] - [9, 11]
                    object: (call_expression [9, 6] - [9, 9]
                      function: (identifier [9, 6] - [9, 7])
                      arguments: (arguments [9, 7] - [9, 9]))
                    property: (property_identifier [9, 10] - [9, 11]))
                  arguments: (arguments [9, 11] - [9, 13]))))
            condition: (identifier [10, 13] - [10, 14]))))))
  (lexical_declaration [14, 0] - [19, 1]
    (variable_declarator [14, 6] - [19, 1]
      id: (identifier [14, 6] - [14, 7])
      value: (object [14, 10] - [19, 1]
        entry: (pair [15, 2] - [15, 6]
          key: (property_identifier [15, 2] - [15, 3])
          value: (number [15, 5] - [15, 6]))
        entry: (pair [16, 2] - [16, 6]
          key: (property_identifier [16, 2] - [16, 3])
          value: (number [16, 5] - [16, 6]))
        entry: (pair [17, 2] - [17, 6]
          key: (property_identifier [17, 2] - [17, 3])
          value: (number [17, 5] - [17, 6]))
        entry: (pair [18, 2] - [18, 6]
          key: (property_identifier [18, 2] - [18, 3])
          value: (number [18, 5] - [18, 6]))))))

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