We insert those when there are failures, even if no text was actually skipped. Then we detect the precense of those during parsing (using a recursive cursor search) to check the validity/rank different parse results. Example:
|
- UsingDeconstruction (Rule): # 46..49 " {}" |
|
- OpenBrace (Token): "{" # 47..48 |
|
- SKIPPED (Token): "" # 48..48 |
|
- CloseBrace (Token): "}" # 48..49 |
This has a few issues:
- The empty
SKIPPED token is confusing to see in the output, since nothing is actually skipped, and the returning tree is complete (regardless of errors).
- Its presence will prevent us from creating AST nodes for such trees, when it is actually valid.
- There are multiple places in parser where it creates a cursor to recursively assert some condition for all children of the current node. This incurs a big performance hit, which increases non-linearly with large trees.
Maybe we can store that info (a boolean flag?) on the parse result instead? That would eliminate the above issues, and keep the tree intact.
Possibly related to #507
We insert those when there are failures, even if no text was actually skipped. Then we detect the precense of those during parsing (using a recursive cursor search) to check the validity/rank different parse results. Example:
slang/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_empty/generated/0.8.13-failure.yml
Lines 22 to 25 in 7a3c1fb
This has a few issues:
SKIPPEDtoken is confusing to see in the output, since nothing is actually skipped, and the returning tree is complete (regardless of errors).Maybe we can store that info (a boolean flag?) on the parse result instead? That would eliminate the above issues, and keep the tree intact.
Possibly related to #507