mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Change return of SkipPastLikelyEnd to be last consumed token (#3493)
This approach means the parse subtree includes the full token range consumed. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
1addf10054
commit
6067ca3f49
@@ -30,6 +30,6 @@ var x: [i32;;
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExpr', text: ']', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: 'var', has_error: yes, subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ']', has_error: yes, subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ var x: [i32];
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: ';', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'ArrayExpr', text: ']', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: 'var', has_error: yes, subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ']', has_error: yes, subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
// CHECK:STDOUT: - filename: no_semi.carbon
|
||||
|
||||
@@ -26,6 +26,6 @@ var = (foo {})
|
||||
// CHECK:STDOUT: {kind: 'ExprOpenParen', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParenExpr', text: ')', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: 'var', has_error: yes, subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'VariableDecl', text: ')', has_error: yes, subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+5
-4
@@ -34,9 +34,10 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'StructLiteral', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'ForHeader', text: 'for', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'CodeBlockStart', text: '}', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '}', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'CodeBlock', text: '}', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ForStatement', text: 'for', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 14},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '}', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'ExprStatement', text: '}', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'CodeBlock', text: '}', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'ForStatement', text: 'for', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 15},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
Vendored
+1
-1
@@ -17,7 +17,7 @@ fn F();
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '(', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: 'fn', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ')', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'TuplePatternStart', text: '('},
|
||||
|
||||
Vendored
+1
-1
@@ -17,7 +17,7 @@ fn F();
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '(', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: 'fn', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ')', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'TuplePatternStart', text: '('},
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ fn F();
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '(', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: 'fn', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDecl', text: ')', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'TuplePatternStart', text: '('},
|
||||
|
||||
+3
-2
@@ -21,7 +21,8 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'TuplePatternStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'TuplePattern', text: ')', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'bar'},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', has_error: yes, subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'bar'},
|
||||
// CHECK:STDOUT: {kind: 'ExprStatement', text: 'bar', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -44,7 +44,7 @@ interface Bar[a: i32] {}
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'Bar'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceDecl', text: 'interface', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceDecl', text: '}', has_error: yes, subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceIntroducer', text: 'interface'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'Bar'},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamListStart', text: '['},
|
||||
@@ -52,6 +52,6 @@ interface Bar[a: i32] {}
|
||||
// CHECK:STDOUT: {kind: 'IntTypeLiteral', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'BindingPattern', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ImplicitParamList', text: ']', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceDecl', text: 'interface', has_error: yes, subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceDecl', text: '}', has_error: yes, subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -15,6 +15,6 @@ interface {
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceIntroducer', text: 'interface'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '{', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceDecl', text: 'interface', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceDecl', text: '}', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -19,9 +19,9 @@ interface Foo
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceIntroducer', text: 'interface'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'Bar'},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceDecl', text: 'interface', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceDecl', text: '}', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceIntroducer', text: 'interface'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierName', text: 'Foo'},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceDecl', text: 'interface', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'InterfaceDecl', text: 'Foo', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+5
-4
@@ -56,9 +56,10 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'd'},
|
||||
// CHECK:STDOUT: {kind: 'IfCondition', text: ')', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'CodeBlockStart', text: '}', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '}', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'CodeBlock', text: '}', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'IfStatement', text: 'if', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 31},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '}', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'ExprStatement', text: ')', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'CodeBlock', text: '}', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'IfStatement', text: 'if', subtree_size: 8},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 32},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -39,16 +39,16 @@ namespace
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'NamespaceStart', text: 'namespace'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '123', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'Namespace', text: 'namespace', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'Namespace', text: '123', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NamespaceStart', text: 'namespace'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '""', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'Namespace', text: 'namespace', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'Namespace', text: '""', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NamespaceStart', text: 'namespace'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: '+', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'Namespace', text: 'namespace', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'Namespace', text: '+', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NamespaceStart', text: 'namespace'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: 'bool', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'Namespace', text: 'namespace', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'Namespace', text: 'bool', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'NamespaceStart', text: 'namespace'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: 'namespace', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'Namespace', text: 'namespace', has_error: yes, subtree_size: 3},
|
||||
|
||||
@@ -33,6 +33,6 @@ class package.C {
|
||||
// CHECK:STDOUT: {kind: 'Namespace', text: ';', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ClassIntroducer', text: 'class'},
|
||||
// CHECK:STDOUT: {kind: 'InvalidParse', text: 'package', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'ClassDecl', text: 'class', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ClassDecl', text: '}', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -14,6 +14,6 @@ import Geometry
|
||||
// CHECK:STDOUT: {kind: 'FileStart', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'ImportIntroducer', text: 'import'},
|
||||
// CHECK:STDOUT: {kind: 'PackageName', text: 'Geometry'},
|
||||
// CHECK:STDOUT: {kind: 'ImportDirective', text: 'import', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ImportDirective', text: 'Geometry', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -73,6 +73,6 @@ library "NoSemi" api
|
||||
// CHECK:STDOUT: {kind: 'LibraryIntroducer', text: 'library'},
|
||||
// CHECK:STDOUT: {kind: 'LibraryName', text: '"NoSemi"'},
|
||||
// CHECK:STDOUT: {kind: 'PackageApi', text: 'api'},
|
||||
// CHECK:STDOUT: {kind: 'LibraryDirective', text: 'library', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'LibraryDirective', text: 'api', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -15,6 +15,6 @@ package Geometry api
|
||||
// CHECK:STDOUT: {kind: 'PackageIntroducer', text: 'package'},
|
||||
// CHECK:STDOUT: {kind: 'PackageName', text: 'Geometry'},
|
||||
// CHECK:STDOUT: {kind: 'PackageApi', text: 'api'},
|
||||
// CHECK:STDOUT: {kind: 'PackageDirective', text: 'package', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'PackageDirective', text: 'api', has_error: yes, subtree_size: 4},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
@@ -21,7 +21,7 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'ReturnStatementStart', text: 'return'},
|
||||
// CHECK:STDOUT: {kind: 'IdentifierNameExpr', text: 'x'},
|
||||
// CHECK:STDOUT: {kind: 'ReturnStatement', text: 'return', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ReturnStatement', text: 'x', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ fn F() {
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinitionStart', text: '{', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'ReturnStatementStart', text: 'return'},
|
||||
// CHECK:STDOUT: {kind: 'ReturnVarModifier', text: 'var'},
|
||||
// CHECK:STDOUT: {kind: 'ReturnStatement', text: 'return', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ReturnStatement', text: 'var', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
Reference in New Issue
Block a user