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

Parser gets stuck #392

Open
Moddus opened this issue Apr 12, 2024 · 4 comments
Open

Parser gets stuck #392

Moddus opened this issue Apr 12, 2024 · 4 comments

Comments

@Moddus
Copy link

Moddus commented Apr 12, 2024

Commit of tree-sitter-scala you tested this on

70b4fe6

A code sample showing the error

Hi,

It looks like the the grammar on commit 70b4fe63c4 is causing an infinite loop e.g. running within tree-sitter-scala:

tree-sitter parse sample.scala --timeout 1000000

Please see attached the sample.scala:
sample.scala.txt

Could someone help explaining how this can be debugged?

Thanks for your time and suggestions

Show the error node

No error message as execution of tree-sitter is stuck.

What do you expect the tree to look like

No response

Where are you experiencing this error?

Running tree-sitter tool in CLI.

@eed3si9n
Copy link
Collaborator

Maybe try binary search to minimize the example, and/or git bisect to find out when this has occurred.
If you go back to earlier tags in https://github.com/tree-sitter/tree-sitter-scala/releases does the problem still persist?

@Moddus
Copy link
Author

Moddus commented Apr 12, 2024

Good points! I can confirm v0.20.2 works where v0.20.3 and v0.21.0 don't.

@ObserverOfTime
Copy link
Member

Parsing with v0.20.2 reveals that there's a } missing at the end of the file.
Adding it allows it to be parsed with master (though there's another error).

Bisecting points to ef639d4 and consequently to 045ce59.

@eed3si9n
Copy link
Collaborator

@ObserverOfTime Thanks!
So the relevant PR is #350 where _if_condition precedence became dynamic.

eed3si9n added a commit to eed3si9n/tree-sitter-scala that referenced this issue Apr 13, 2024
**Problem**
350 introduced a dynamic precedence to resolve
the conflict of Scala 2 and Scala 3 grammar for if-then.

**Solution**
This removes the dynamic precedence and replaces it
with prec.right around `then` side.

**Note**
There's a report of parser getting stuck tree-sitter#392 and and
I was hoping that removing dynamic precedence would
fix that, but it didn't seem to.
eed3si9n added a commit to eed3si9n/tree-sitter-scala that referenced this issue Jun 30, 2024
**Problem**
350 introduced a dynamic precedence to resolve
the conflict of Scala 2 and Scala 3 grammar for if-then.

**Solution**
This removes the dynamic precedence and replaces it
with prec.right around `then` side.

**Note**
There's a report of parser getting stuck tree-sitter#392 and and
I was hoping that removing dynamic precedence would
fix that, but it didn't seem to.
eed3si9n added a commit to eed3si9n/tree-sitter-scala that referenced this issue Jun 30, 2024
**Problem**
350 introduced a dynamic precedence to resolve
the conflict of Scala 2 and Scala 3 grammar for if-then.

**Solution**
This removes the dynamic precedence and replaces it
with prec.right around `then` side.

**Note**
There's a report of parser getting stuck tree-sitter#392 and and
I was hoping that removing dynamic precedence would
fix that, but it didn't seem to.
eed3si9n added a commit to eed3si9n/tree-sitter-scala that referenced this issue Jun 30, 2024
**Problem**
350 introduced a dynamic precedence to resolve
the conflict of Scala 2 and Scala 3 grammar for if-then.

**Solution**
This removes the dynamic precedence and replaces it
with prec.right around `then` side.

**Note**
There's a report of parser getting stuck tree-sitter#392 and and
I was hoping that removing dynamic precedence would
fix that, but it didn't seem to.
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

No branches or pull requests

3 participants