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

Craft recoverWhile rules for each statement, expression, type #38

Open
7 of 12 tasks
obiwan87 opened this issue May 14, 2024 · 0 comments
Open
7 of 12 tasks

Craft recoverWhile rules for each statement, expression, type #38

obiwan87 opened this issue May 14, 2024 · 0 comments
Assignees

Comments

@obiwan87
Copy link
Owner

obiwan87 commented May 14, 2024

When typing code, it is normal that the syntax/grammar enters a non-correct state. For example, think of the following snippets

  • selecting an identifier x.<missing>
  • writing an if block "if "
  • etc.

In IntellIJ, when a parse error is encountered, the parser stops and the rest of the text will not be parsed. This leads to

  • semantic highlighting not working or flickering colors
  • errors being reported in an unexpected location
  • pollution of Psi-Tree makes with DUMMY-Block + Error

It is therefore necessary to define rules for the parser, that tell it how to recover from incomplete statements and expressions, such that the error will be contained in a small region of the code.

Write recover rules for the following statements, expressions and types:

  • package declaration statement
  • variable declaration statement
  • variable initialization statement
  • assignment statement
  • if statement
  • for statement (probably need to merge rules for "for" and "for ... in ..."
  • binary expressions
  • selector expression
  • argument list
  • parameter list
  • proc, enum, struct, union, bit_field
  • ...
@obiwan87 obiwan87 self-assigned this Aug 25, 2024
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

1 participant