config/lang: fix shift/reduce conflict

This commit is contained in:
Mitchell Hashimoto 2015-02-26 14:33:56 -08:00
parent 07b78fdf84
commit 9ddcaf15eb
3 changed files with 40 additions and 40 deletions

View File

@ -27,6 +27,8 @@ import (
%type <node> expr interpolation literal literalModeTop literalModeValue
%type <nodeList> args
%left ARITH_OP
%%
top:

View File

@ -50,7 +50,7 @@ const parserEofCode = 1
const parserErrCode = 2
const parserMaxDepth = 200
//line lang.y:159
//line lang.y:161
//line yacctab:1
var parserExca = []int{
@ -76,7 +76,7 @@ var parserAct = []int{
var parserPact = []int{
-2, -1000, -2, -1000, -1000, -1000, -1000, -3, -1000, 3,
-2, -1000, -1000, 10, -1000, -3, -3, -8, -4, -8,
-2, -1000, -1000, 10, -1000, -3, -3, -1000, -4, -8,
-1000, -3, -8,
}
var parserPgo = []int{
@ -344,7 +344,7 @@ parserdefault:
switch parsernt {
case 1:
//line lang.y:33
//line lang.y:35
{
parserResult = &ast.LiteralNode{
Value: "",
@ -353,7 +353,7 @@ parserdefault:
}
}
case 2:
//line lang.y:41
//line lang.y:43
{
parserResult = parserS[parserpt-0].node
@ -375,12 +375,12 @@ parserdefault:
}
}
case 3:
//line lang.y:64
//line lang.y:66
{
parserVAL.node = parserS[parserpt-0].node
}
case 4:
//line lang.y:68
//line lang.y:70
{
var result []ast.Node
if c, ok := parserS[parserpt-1].node.(*ast.Concat); ok {
@ -395,27 +395,27 @@ parserdefault:
}
}
case 5:
//line lang.y:84
//line lang.y:86
{
parserVAL.node = parserS[parserpt-0].node
}
case 6:
//line lang.y:88
//line lang.y:90
{
parserVAL.node = parserS[parserpt-0].node
}
case 7:
//line lang.y:94
//line lang.y:96
{
parserVAL.node = parserS[parserpt-1].node
}
case 8:
//line lang.y:100
//line lang.y:102
{
parserVAL.node = parserS[parserpt-0].node
}
case 9:
//line lang.y:104
//line lang.y:106
{
parserVAL.node = &ast.LiteralNode{
Value: parserS[parserpt-0].token.Value.(int),
@ -424,7 +424,7 @@ parserdefault:
}
}
case 10:
//line lang.y:112
//line lang.y:114
{
parserVAL.node = &ast.LiteralNode{
Value: parserS[parserpt-0].token.Value.(float64),
@ -433,7 +433,7 @@ parserdefault:
}
}
case 11:
//line lang.y:120
//line lang.y:122
{
parserVAL.node = &ast.Arithmetic{
Op: parserS[parserpt-1].token.Value.(ast.ArithmeticOp),
@ -442,32 +442,32 @@ parserdefault:
}
}
case 12:
//line lang.y:128
//line lang.y:130
{
parserVAL.node = &ast.VariableAccess{Name: parserS[parserpt-0].token.Value.(string), Posx: parserS[parserpt-0].token.Pos}
}
case 13:
//line lang.y:132
//line lang.y:134
{
parserVAL.node = &ast.Call{Func: parserS[parserpt-3].token.Value.(string), Args: parserS[parserpt-1].nodeList, Posx: parserS[parserpt-3].token.Pos}
}
case 14:
//line lang.y:137
//line lang.y:139
{
parserVAL.nodeList = nil
}
case 15:
//line lang.y:141
//line lang.y:143
{
parserVAL.nodeList = append(parserS[parserpt-2].nodeList, parserS[parserpt-0].node)
}
case 16:
//line lang.y:145
//line lang.y:147
{
parserVAL.nodeList = append(parserVAL.nodeList, parserS[parserpt-0].node)
}
case 17:
//line lang.y:151
//line lang.y:153
{
parserVAL.node = &ast.LiteralNode{
Value: parserS[parserpt-0].token.Value.(string),

View File

@ -5,7 +5,7 @@ state 0
PROGRAM_BRACKET_LEFT shift 7
STRING shift 6
. reduce 1 (src line 32)
. reduce 1 (src line 34)
interpolation goto 5
literal goto 4
@ -26,7 +26,7 @@ state 2
PROGRAM_BRACKET_LEFT shift 7
STRING shift 6
. reduce 2 (src line 40)
. reduce 2 (src line 42)
interpolation goto 5
literal goto 4
@ -35,25 +35,25 @@ state 2
state 3
literalModeTop: literalModeValue. (3)
. reduce 3 (src line 62)
. reduce 3 (src line 64)
state 4
literalModeValue: literal. (5)
. reduce 5 (src line 82)
. reduce 5 (src line 84)
state 5
literalModeValue: interpolation. (6)
. reduce 6 (src line 87)
. reduce 6 (src line 89)
state 6
literal: STRING. (17)
. reduce 17 (src line 149)
. reduce 17 (src line 151)
state 7
@ -75,7 +75,7 @@ state 7
state 8
literalModeTop: literalModeTop literalModeValue. (4)
. reduce 4 (src line 67)
. reduce 4 (src line 69)
state 9
@ -93,7 +93,7 @@ state 10
PROGRAM_BRACKET_LEFT shift 7
STRING shift 6
. reduce 8 (src line 98)
. reduce 8 (src line 100)
interpolation goto 5
literal goto 4
@ -102,13 +102,13 @@ state 10
state 11
expr: INTEGER. (9)
. reduce 9 (src line 103)
. reduce 9 (src line 105)
state 12
expr: FLOAT. (10)
. reduce 10 (src line 111)
. reduce 10 (src line 113)
state 13
@ -116,13 +116,13 @@ state 13
expr: IDENTIFIER.PAREN_LEFT args PAREN_RIGHT
PAREN_LEFT shift 16
. reduce 12 (src line 127)
. reduce 12 (src line 129)
state 14
interpolation: PROGRAM_BRACKET_LEFT expr PROGRAM_BRACKET_RIGHT. (7)
. reduce 7 (src line 92)
. reduce 7 (src line 94)
state 15
@ -150,7 +150,7 @@ state 16
INTEGER shift 11
FLOAT shift 12
STRING shift 6
. reduce 14 (src line 136)
. reduce 14 (src line 138)
expr goto 19
interpolation goto 5
@ -159,13 +159,11 @@ state 16
literalModeValue goto 3
args goto 18
17: shift/reduce conflict (shift 15(0), red'n 11(0)) on ARITH_OP
state 17
expr: expr.ARITH_OP expr
expr: expr ARITH_OP expr. (11)
ARITH_OP shift 15
. reduce 11 (src line 119)
. reduce 11 (src line 121)
state 18
@ -182,13 +180,13 @@ state 19
args: expr. (16)
ARITH_OP shift 15
. reduce 16 (src line 144)
. reduce 16 (src line 146)
state 20
expr: IDENTIFIER PAREN_LEFT args PAREN_RIGHT. (13)
. reduce 13 (src line 131)
. reduce 13 (src line 133)
state 21
@ -212,16 +210,16 @@ state 22
args: args COMMA expr. (15)
ARITH_OP shift 15
. reduce 15 (src line 140)
. reduce 15 (src line 142)
15 terminals, 8 nonterminals
18 grammar rules, 23/2000 states
1 shift/reduce, 0 reduce/reduce conflicts reported
0 shift/reduce, 0 reduce/reduce conflicts reported
57 working sets used
memory: parser 30/30000
18 extra closures
34 shift entries, 1 exceptions
33 shift entries, 1 exceptions
13 goto entries
19 entries saved by goto default
Optimizer space used: output 26/30000