mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Improve parsing of invalid expressions. (#2726)
This addresses crashes for infix operator expressions, but the approach should more generally yield balanced parsed trees.
This commit is contained in:
+7
-5
@@ -17,10 +17,11 @@
|
||||
// CHECK:STDOUT: {kind: 'CodeBlock', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IfStatement', text: 'if', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'IfConditionStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'IfCondition', text: ')', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'InvalidExpression', text: ')', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'IfCondition', text: ')', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'CodeBlockStart', text: '{'},
|
||||
// CHECK:STDOUT: {kind: 'CodeBlock', text: '}', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IfStatement', text: 'if', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'IfStatement', text: 'if', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'IfConditionStart', text: '('},
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'b'},
|
||||
// CHECK:STDOUT: {kind: 'IfCondition', text: ')', has_error: yes, subtree_size: 3},
|
||||
@@ -31,9 +32,10 @@
|
||||
// CHECK:STDOUT: {kind: 'NameReference', text: 'd'},
|
||||
// CHECK:STDOUT: {kind: 'IfCondition', text: ')', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'CodeBlockStart', text: '}', has_error: yes},
|
||||
// CHECK:STDOUT: {kind: 'CodeBlock', text: '}', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'IfStatement', text: 'if', subtree_size: 6},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDefinition', text: '}', subtree_size: 29},
|
||||
// CHECK:STDOUT: {kind: 'InvalidExpression', 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: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user