[libSyntax] Allow adding garbage nodes in between any two children of a syntax node

When the source code is invalid, this allows us to represent tokens that could not be used to form a valid syntax tree with more fidelity.

This commit does not start using GarbageNodes yet, it just sets everything up for them.
This commit is contained in:
Alex Hoppen
2022-08-02 11:58:11 +02:00
parent 38648ec209
commit c2695f0ffc
23 changed files with 905 additions and 201 deletions

View File

@@ -57,4 +57,10 @@ COMMON_NODES = [
Child('RightBrace', kind='RightBraceToken',
requires_leading_newline=True),
]),
Node('GarbageNodes', kind='SyntaxCollection', element='Syntax',
description='''
A collection of syntax nodes that occurred in the source code but
could not be used to form a valid syntax tree.
'''),
]