Skip to content

Issue OUTDENT with extra spaces before brackets #301

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

Merged
merged 1 commit into from
Jun 11, 2023

Conversation

susliko
Copy link
Collaborator

@susliko susliko commented Jun 10, 2023

Problem

{ x =>
  if (a) b.c }

is not parsed because OUTDENT token is not emitted in a presense of space characters before the closing bracket

Solution

Reorder space-handling and outdent-ing logic in external scanner

@susliko susliko force-pushed the extra-spaces-before-outdents branch 2 times, most recently from 91cca9b to 16974b4 Compare June 10, 2023 20:58
Problem
-------
```scala
{ x =>
  if (a) b.c }
```
is not parsed because OUTDENT token is not emitted in a presense of
space characters before the closing bracket

Solution
-------
Reorder space-handling and outdent-ing logic in external scanner
@@ -2,7 +2,7 @@

# This is an integration test to generally check the quality of parsing.

SCALA_SCALA_LIBRARY_EXPECTED=99
SCALA_SCALA_LIBRARY_EXPECTED=100
Copy link
Collaborator

Choose a reason for hiding this comment

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

💯🎉

@@ -109,6 +109,16 @@ bool tree_sitter_scala_external_scanner_scan(void *payload, TSLexer *lexer,
int indentation_size = 0;
LOG("scanner was called at column: %d\n", lexer->get_column(lexer));

while (iswspace(lexer->lookahead)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

LGTM. Thanks!

@eed3si9n eed3si9n merged commit 199cf06 into tree-sitter:master Jun 11, 2023
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