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

30 lines
909 B
Plaintext

_ := expr
expr := id
id := IDENTIFIER
# RUN: clang-pseudo -grammar %s -print-graph | FileCheck %s --check-prefix=GRAPH
# GRAPH: States:
# GRPAH-NEXT: State 0
# GRPAH-NEXT: _ := • expr
# GRPAH-NEXT: expr := • id
# GRPAH-NEXT: id := • IDENTIFIER
# GRPAH-NEXT: State 1
# GRPAH-NEXT: _ := expr •
# GRPAH-NEXT: State 2
# GRPAH-NEXT: expr := id •
# GRPAH-NEXT: State 3
# GRPAH-NEXT: id := IDENTIFIER •
# RUN: clang-pseudo -grammar %s -print-table | FileCheck %s --check-prefix=TABLE
# TABLE: LRTable:
# TABLE-NEXT: State 0
# TABLE-NEXT: 'IDENTIFIER': shift state 3
# TABLE-NEXT: 'expr': go to state 1
# TABLE-NEXT: 'id': go to state 2
# TABLE-NEXT: State 1
# TABLE-NEXT: 'EOF': accept
# TABLE-NEXT: State 2
# TABLE-NEXT: 'EOF': reduce by rule 1 'expr := id'
# TABLE-NEXT: State 3
# TABLE-NEXT: 'EOF': reduce by rule 2 'id := IDENTIFIER'