8000 major behavior changes to layouting by alaviss · Pull Request #53 · alaviss/tree-sitter-nim · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

major behavior changes to layouting #53

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
Oct 21, 2023
Merged

major behavior changes to layouting #53

merged 1 commit into from
Oct 21, 2023

Conversation

alaviss
Copy link
Owner
@alaviss alaviss commented Oct 21, 2023
  • Layouts are ended when it is detected that such event happens
    regardless of whether it is correct to do so. This allows for
    stronger error recovery as the parser can reliably detect where
    a layout ends.

  • Layouts now terminates at the end of each statements or blocks, rather
    than collecting up to the next statement.

  • Layout termination now plays a lot nicer in recovery scenarios by
    issuing a forced change to the scanner state. This makes the parser
    respects layout termination during recovery, resulting in much better
    syntax tree on errors.

  • The body of an indented statement list is now optional. While this
    construct cannot be generated by normal means as the scanner must see
    content to even start a block, they can happen due to errors within
    the block. Allowing the block to be empty in this case gives
    tree-sitter a safe avenue to rollback instead of rolling back the
    entire large structure, which can be seen in keywords break AST #42

Fixes #42
Fixes #45

@alaviss alaviss force-pushed the layout-updates branch 3 times, most recently from cd7d014 to 1c6a537 Compare October 21, 2023 15:52
* Layouts are ended when it is detected that such event happens
  regardless of whether it is correct to do so. This allows for
  stronger error recovery as the parser can reliably detect where
  a layout ends.

* Layouts now terminates at the end of each statements or blocks, rather
  than collecting up to the next statement.

* Layout termination now plays a lot nicer in recovery scenarios by
  issuing a forced change to the scanner state. This makes the parser
  respects layout termination during recovery, resulting in much better
  syntax tree on errors.

* The body of an indented statement list is now optional. While this
  construct cannot be generated by normal means as the scanner must see
  content to even start a block, they can happen due to errors within
  the block. Allowing the block to be empty in this case gives
  tree-sitter a safe avenue to rollback instead of rolling back the
  entire large structure, which can be seen in
  #42

Fixes #42
Fixes #45
@alaviss alaviss enabled auto-merge October 21, 2023 15:54
@alaviss alaviss merged commit 9cda851 into main Oct 21, 2023
@alaviss alaviss deleted the layout-updates branch October 21, 2023 16:02
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.

nodes reaching on the next line keywords break AST
1 participant
0