Skip to content

Strange behavior due to missing semicolon #6

@yoshinari-nomura

Description

@yoshinari-nomura

Hi, I started working with tree-sitter-openscad yesterday.
I noticed some strange behavior.

Create the test as follows:

cargo install tree-sitter-cli
git clone [email protected]:openscad/tree-sitter-openscad.git
cd tree-sitter-openscad
echo 'test("AB")' > test-ab.scad
echo 'test("ABC")' > test-abc.scad

tree-sitter parse test-ab.scad shows:

(source_file [0, 0] - [1, 0]
  (ERROR [0, 0] - [0, 10]
    (module_call [0, 0] - [0, 10]
      name: (identifier [0, 0] - [0, 4])
      arguments: (arguments [0, 4] - [0, 10]
        (string [0, 5] - [0, 9])))))
test-ab.scad	Parse:    0.14 ms	    77 bytes/ms	(ERROR [0, 0] - [0, 10])

tree-sitter parse test-abc.scad shows:

(source_file [0, 0] - [1, 0]
  (transform_chain [0, 0] - [0, 11]
    (module_call [0, 0] - [0, 11]
      name: (identifier [0, 0] - [0, 4])
      arguments: (arguments [0, 4] - [0, 11]
        (string [0, 5] - [0, 10])))))
test-abc.scad	Parse:    0.12 ms	    98 bytes/ms	(MISSING ";" [0, 11] - [0, 11])

Why are the two different?
I don't know which behavior should be desired.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions