aboutsummaryrefslogtreecommitdiff
path: root/grammar/parsing_table_test.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2022-05-09 23:52:56 +0900
committerRyo Nihei <nihei.dev@gmail.com>2022-05-10 23:14:52 +0900
commit054307b6c99ab962cfa9bcb4c4d50f3aea5406ea (patch)
tree73aea74559c64f3bcb55f3a39b2399714b616174 /grammar/parsing_table_test.go
parentChange the default suffix of a grammar file from .vr to .vartan (diff)
downloadcotia-054307b6c99ab962cfa9bcb4c4d50f3aea5406ea.tar.gz
cotia-054307b6c99ab962cfa9bcb4c4d50f3aea5406ea.tar.xz
Make the identifier format strict
Diffstat (limited to 'grammar/parsing_table_test.go')
-rw-r--r--grammar/parsing_table_test.go62
1 files changed, 31 insertions, 31 deletions
diff --git a/grammar/parsing_table_test.go b/grammar/parsing_table_test.go
index 522ec1c..4ce8455 100644
--- a/grammar/parsing_table_test.go
+++ b/grammar/parsing_table_test.go
@@ -18,9 +18,9 @@ func TestGenLALRParsingTable(t *testing.T) {
src := `
#name test;
-S: L eq R | R;
-L: ref R | id;
-R: L;
+s: l eq r | r;
+l: ref r | id;
+r: l;
eq: '=';
ref: '*';
id: "[A-Za-z0-9_]+";
@@ -89,35 +89,35 @@ id: "[A-Za-z0-9_]+";
expectedKernels := map[int][]*lrItem{
0: {
- withLookAhead(genLR0Item("S'", 0, "S"), symbolEOF),
+ withLookAhead(genLR0Item("s'", 0, "s"), symbolEOF),
},
1: {
- withLookAhead(genLR0Item("S'", 1, "S"), symbolEOF),
+ withLookAhead(genLR0Item("s'", 1, "s"), symbolEOF),
},
2: {
- withLookAhead(genLR0Item("S", 1, "L", "eq", "R"), symbolEOF),
- withLookAhead(genLR0Item("R", 1, "L"), symbolEOF),
+ withLookAhead(genLR0Item("s", 1, "l", "eq", "r"), symbolEOF),
+ withLookAhead(genLR0Item("r", 1, "l"), symbolEOF),
},
3: {
- withLookAhead(genLR0Item("S", 1, "R"), symbolEOF),
+ withLookAhead(genLR0Item("s", 1, "r"), symbolEOF),
},
4: {
- withLookAhead(genLR0Item("L", 1, "ref", "R"), genSym("eq"), symbolEOF),
+ withLookAhead(genLR0Item("l", 1, "ref", "r"), genSym("eq"), symbolEOF),
},
5: {
- withLookAhead(genLR0Item("L", 1, "id"), genSym("eq"), symbolEOF),
+ withLookAhead(genLR0Item("l", 1, "id"), genSym("eq"), symbolEOF),
},
6: {
- withLookAhead(genLR0Item("S", 2, "L", "eq", "R"), symbolEOF),
+ withLookAhead(genLR0Item("s", 2, "l", "eq", "r"), symbolEOF),
},
7: {
- withLookAhead(genLR0Item("L", 2, "ref", "R"), genSym("eq"), symbolEOF),
+ withLookAhead(genLR0Item("l", 2, "ref", "r"), genSym("eq"), symbolEOF),
},
8: {
- withLookAhead(genLR0Item("R", 1, "L"), genSym("eq"), symbolEOF),
+ withLookAhead(genLR0Item("r", 1, "l"), genSym("eq"), symbolEOF),
},
9: {
- withLookAhead(genLR0Item("S", 3, "L", "eq", "R"), symbolEOF),
+ withLookAhead(genLR0Item("s", 3, "l", "eq", "r"), symbolEOF),
},
}
@@ -135,9 +135,9 @@ id: "[A-Za-z0-9_]+";
},
},
goTos: map[symbol][]*lrItem{
- genSym("S"): expectedKernels[1],
- genSym("L"): expectedKernels[2],
- genSym("R"): expectedKernels[3],
+ genSym("s"): expectedKernels[1],
+ genSym("l"): expectedKernels[2],
+ genSym("r"): expectedKernels[3],
},
},
{
@@ -145,7 +145,7 @@ id: "[A-Za-z0-9_]+";
acts: map[symbol]testActionEntry{
symbolEOF: {
ty: ActionTypeReduce,
- production: genProd("S'", "S"),
+ production: genProd("s'", "s"),
},
},
},
@@ -158,7 +158,7 @@ id: "[A-Za-z0-9_]+";
},
symbolEOF: {
ty: ActionTypeReduce,
- production: genProd("R", "L"),
+ production: genProd("r", "l"),
},
},
},
@@ -167,7 +167,7 @@ id: "[A-Za-z0-9_]+";
acts: map[symbol]testActionEntry{
symbolEOF: {
ty: ActionTypeReduce,
- production: genProd("S", "R"),
+ production: genProd("s", "r"),
},
},
},
@@ -184,8 +184,8 @@ id: "[A-Za-z0-9_]+";
},
},
goTos: map[symbol][]*lrItem{
- genSym("R"): expectedKernels[7],
- genSym("L"): expectedKernels[8],
+ genSym("r"): expectedKernels[7],
+ genSym("l"): expectedKernels[8],
},
},
{
@@ -193,11 +193,11 @@ id: "[A-Za-z0-9_]+";
acts: map[symbol]testActionEntry{
genSym("eq"): {
ty: ActionTypeReduce,
- production: genProd("L", "id"),
+ production: genProd("l", "id"),
},
symbolEOF: {
ty: ActionTypeReduce,
- production: genProd("L", "id"),
+ production: genProd("l", "id"),
},
},
},
@@ -214,8 +214,8 @@ id: "[A-Za-z0-9_]+";
},
},
goTos: map[symbol][]*lrItem{
- genSym("L"): expectedKernels[8],
- genSym("R"): expectedKernels[9],
+ genSym("l"): expectedKernels[8],
+ genSym("r"): expectedKernels[9],
},
},
{
@@ -223,11 +223,11 @@ id: "[A-Za-z0-9_]+";
acts: map[symbol]testActionEntry{
genSym("eq"): {
ty: ActionTypeReduce,
- production: genProd("L", "ref", "R"),
+ production: genProd("l", "ref", "r"),
},
symbolEOF: {
ty: ActionTypeReduce,
- production: genProd("L", "ref", "R"),
+ production: genProd("l", "ref", "r"),
},
},
},
@@ -236,11 +236,11 @@ id: "[A-Za-z0-9_]+";
acts: map[symbol]testActionEntry{
genSym("eq"): {
ty: ActionTypeReduce,
- production: genProd("R", "L"),
+ production: genProd("r", "l"),
},
symbolEOF: {
ty: ActionTypeReduce,
- production: genProd("R", "L"),
+ production: genProd("r", "l"),
},
},
},
@@ -249,7 +249,7 @@ id: "[A-Za-z0-9_]+";
acts: map[symbol]testActionEntry{
symbolEOF: {
ty: ActionTypeReduce,
- production: genProd("S", "L", "eq", "R"),
+ production: genProd("s", "l", "eq", "r"),
},
},
},