1// RUN: clang-pseudo -grammar=cxx -source=%s --print-forest -print-statistics | FileCheck %s
2
3void foo() {
4 T* a; // a multiply expression or a pointer declaration?
5// CHECK: statement-seq~statement := <ambiguous>
6// CHECK-NEXT: ├─statement~expression-statement := expression ;
7// CHECK-NEXT: │ ├─expression~multiplicative-expression := multiplicative-expression * pm-expression
8// CHECK-NEXT: │ │ ├─multiplicative-expression~IDENTIFIER := tok[5]
9// CHECK-NEXT: │ │ ├─* := tok[6]
10// CHECK-NEXT: │ │ └─pm-expression~id-expression := unqualified-id #1
11// CHECK-NEXT: │ │ └─unqualified-id~IDENTIFIER := tok[7]
12// CHECK-NEXT: │ └─; := tok[8]
13// CHECK-NEXT: └─statement~simple-declaration := decl-specifier-seq init-declarator-list ;
14// CHECK-NEXT: ├─decl-specifier-seq~simple-type-specifier := <ambiguous>
15// CHECK-NEXT: │ ├─simple-type-specifier~IDENTIFIER := tok[5]
16// CHECK-NEXT: │ └─simple-type-specifier~IDENTIFIER := tok[5]
17// CHECK-NEXT: ├─init-declarator-list~ptr-declarator := ptr-operator ptr-declarator
18// CHECK-NEXT: │ ├─ptr-operator~* := tok[6]
19// CHECK-NEXT: │ └─ptr-declarator~id-expression =#1
20// CHECK-NEXT: └─; := tok[8]
21}
22
23// CHECK: 2 Ambiguous nodes:
24// CHECK-NEXT: 1 simple-type-specifier
25// CHECK-NEXT: 1 statement
26// CHECK-EMPTY:
27// CHECK-NEXT: 0 Opaque nodes:
28// CHECK-EMPTY:
29// CHECK-NEXT: Ambiguity: 0.20 misparses/token
30// CHECK-NEXT: Unparsed: 0.00%
31

source code of clang-tools-extra/pseudo/test/glr.cpp