Introduce a new syntax kind to represent missing base nodes

In the future, we only want to attach a source presence to tokens, not to nodes. All concreate nodes which are missing can be represented by creating the node and marking all tokens as missing, but if a syntax node carries a child, that has a base kind (like `Decl`), we can’t decide which concrete node to instantiate. Introduce `MissingDecl` etc. node for this purpose.

rdar://97908258
rdar://97775360
This commit is contained in:
Alex Hoppen
2022-08-01 16:22:47 +02:00
parent 5c29bd2968
commit e643fb14b5
4 changed files with 27 additions and 2 deletions

View File

@@ -12,6 +12,12 @@ COMMON_NODES = [
Node('UnknownStmt', kind='Stmt'),
Node('UnknownType', kind='Type'),
Node('UnknownPattern', kind='Pattern'),
Node('Missing', kind='Syntax'),
Node('MissingDecl', kind='Decl'),
Node('MissingExpr', kind='Expr'),
Node('MissingStmt', kind='Stmt'),
Node('MissingType', kind='Type'),
Node('MissingPattern', kind='Pattern'),
# code-block-item = (decl | stmt | expr) ';'?
Node('CodeBlockItem', kind='Syntax', omit_when_empty=True,