llvm-project/clang-tools-extra/pseudo/test/lr-build-conflicts.test

48 lines
1.6 KiB
Plaintext

_ := expr
expr := expr - expr # S/R conflict at state 4 on '-' token
expr := IDENTIFIER
# RUN: clang-pseudo -grammar %s -print-graph | FileCheck %s --check-prefix=GRAPH
# GRAPH: States
# GRAPH-NEXT: State 0
# GRAPH-NEXT: _ := • expr
# GRAPH-NEXT: expr := • expr - expr
# GRAPH-NEXT: expr := • IDENTIFIER
# GRAPH-NEXT: State 1
# GRAPH-NEXT: _ := expr •
# GRAPH-NEXT: expr := expr • - expr
# GRAPH-NEXT: State 2
# GRAPH-NEXT: expr := IDENTIFIER •
# GRAPH-NEXT: State 3
# GRAPH-NEXT: expr := • expr - expr
# GRAPH-NEXT: expr := expr - • expr
# GRAPH-NEXT: expr := • IDENTIFIER
# GRAPH-NEXT: State 4
# GRAPH-NEXT: expr := expr - expr •
# GRAPH-NEXT: expr := expr • - expr
# GRAPH-NEXT: 0 ->[expr] 1
# GRAPH-NEXT: 0 ->[IDENTIFIER] 2
# GRAPH-NEXT: 1 ->[-] 3
# GRAPH-NEXT: 3 ->[expr] 4
# GRAPH-NEXT: 3 ->[IDENTIFIER] 2
# GRAPH-NEXT: 4 ->[-] 3
# RUN: clang-pseudo -grammar %s -print-table | FileCheck %s --check-prefix=TABLE
# TABLE: LRTable:
# TABLE-NEXT: State 0
# TABLE-NEXT: 'IDENTIFIER': shift state 2
# TABLE-NEXT: 'expr': go to state 1
# TABLE-NEXT: State 1
# TABLE-NEXT: 'EOF': accept
# TABLE-NEXT: '-': shift state 3
# TABLE-NEXT: State 2
# TABLE-NEXT: 'EOF': reduce by rule 1 'expr := IDENTIFIER'
# TABLE-NEXT: '-': reduce by rule 1 'expr := IDENTIFIER'
# TABLE-NEXT: State 3
# TABLE-NEXT: 'IDENTIFIER': shift state 2
# TABLE-NEXT: 'expr': go to state 4
# TABLE-NEXT: State 4
# TABLE-NEXT: 'EOF': reduce by rule 2 'expr := expr - expr'
# TABLE-NEXT: '-': shift state 3
# TABLE-NEXT: '-': reduce by rule 2 'expr := expr - expr'