| 1 |
// RUN: clang-pseudo -grammar=cxx -source=%s --start-symbol=statement-seq --print-forest | FileCheck %s |
| 2 |
|
| 3 |
// Verify the else should belong to the nested if statement |
| 4 |
if (true) if (true) {} else {} |
| 5 |
|
| 6 |
// CHECK: statement-seq~selection-statement := IF ( condition ) statement |
| 7 |
// CHECK-NEXT: ├─IF |
| 8 |
// CHECK-NEXT: ├─( |
| 9 |
// CHECK-NEXT: ├─condition~TRUE |
| 10 |
// CHECK-NEXT: ├─) |
| 11 |
// CHECK-NEXT: └─statement~selection-statement |
| 12 |
// CHECK-NEXT: ├─IF |
| 13 |
// CHECK-NEXT: ├─( |
| 14 |
// CHECK-NEXT: ├─condition~TRUE |
| 15 |
// CHECK-NEXT: ├─) |
| 16 |
// CHECK-NEXT: ├─statement~compound-statement := { } |
| 17 |
// CHECK-NEXT: │ ├─{ |
| 18 |
// CHECK-NEXT: │ └─} |
| 19 |
// CHECK-NEXT: ├─ELSE |
| 20 |
// CHECK-NEXT: └─statement~compound-statement := { } |
| 21 |
// CHECK-NEXT: ├─{ |
| 22 |
// CHECK-NEXT: └─} |