| 1 | package parserscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ |
| 2 | |
| 3 | import ( |
| 4 | "errorsscip-go gomod github.com/golang/go/src go1.24 errors/" |
| 5 | "strconvscip-go gomod github.com/golang/go/src go1.24 strconv/" |
| 6 | |
| 7 | errsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/ "github.com/goccmack/gocc/internal/frontend/errorsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/" |
| 8 | "github.com/goccmack/gocc/internal/frontend/tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/" |
| 9 | ) |
| 10 | |
| 11 | // ParserUTab |
| 12 | |
| 13 | type ParserUTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab# struct { |
| 14 | actTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#actTab. *ActionTabUscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ActionTabU# |
| 15 | canRecoverscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#canRecover. *CanRecoverscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/CanRecover# |
| 16 | gotoTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#gotoTab. *GotoTabUscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/GotoTabU# |
| 17 | prodTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#prodTab. *ProdTabUscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ProdTabU# |
| 18 | stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack. *stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack# |
| 19 | nextTokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#nextToken. *tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/.Tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/Token# |
| 20 | posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#pos. tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/.Positionscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/Position# |
| 21 | tokenMapscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#tokenMap. *tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/.TokenMapscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/TokenMap# |
| 22 | } |
| 23 | |
| 24 | func NewParserUTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/NewParserUTab().(tm *tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/.TokenMapscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/TokenMap#) *ParserUTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab# { |
| 25 | p := &ParserUTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#{ |
| 26 | actTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#actTab.: getActionTableUncompressedscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/getActionTableUncompressed().(), |
| 27 | canRecoverscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#canRecover.: getCanRecoverTableUncompressedscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/getCanRecoverTableUncompressed().(), |
| 28 | gotoTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#gotoTab.: getGotoTableUncompressedscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/getGotoTableUncompressed().(), |
| 29 | prodTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#prodTab.: getProductionsTableUncompressedscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/getProductionsTableUncompressed().(), |
| 30 | stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack.: NewStackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/NewStack().(), |
| 31 | tokenMapscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#tokenMap.: tm, |
| 32 | } |
| 33 | p.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..Pushscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#Push().(0, nil) //TODO: which attribute should be pushed here? |
| 34 | return p |
| 35 | } |
| 36 | |
| 37 | func (P *ParserUTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#) Resetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#Reset().() { |
| 38 | P.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..resetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#reset().() |
| 39 | P.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..Pushscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#Push().(0, nil) //TODO: which attribute should be pushed here? |
| 40 | } |
| 41 | |
| 42 | func (P *ParserUTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#) Errorscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#Error().(err error, scanner Scannerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/Scanner#) (recovered bool, errorAttrib *errsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/.Errorscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/Error#) { |
| 43 | errorAttrib = &errsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/.Errorscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/Error#{ |
| 44 | Errscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/Error#Err.: err, |
| 45 | ErrorTokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/Error#ErrorToken.: P.nextTokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#nextToken., |
| 46 | ErrorPosscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/Error#ErrorPos.: P.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#pos., |
| 47 | ErrorSymbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/Error#ErrorSymbols.: P.popNonRecoveryStatesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#popNonRecoveryStates().(), |
| 48 | ExpectedTokensscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/Error#ExpectedTokens.: make([]string, 0, 8), |
| 49 | } |
| 50 | for t, act := range P.actTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#actTab.[P.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..Topscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#Top().()] { |
| 51 | if act != nil { |
| 52 | errorAttrib.ExpectedTokensscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/Error#ExpectedTokens. = append(errorAttrib.ExpectedTokensscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/Error#ExpectedTokens., P.tokenMapscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#tokenMap..TokenStringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/TokenMap#TokenString().(tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/.Typescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/Type#(t))) |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | action := P.actTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#actTab.[P.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..Topscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#Top().()][P.tokenMapscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#tokenMap..Typescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/TokenMap#Type().("error")] |
| 57 | if action == nil { |
| 58 | return |
| 59 | } |
| 60 | P.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..Pushscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#Push().(Statescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/State#(action.(Shiftscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/Shift#)), errorAttrib) // action can only be shift |
| 61 | |
| 62 | for P.actTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#actTab.[P.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..Topscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#Top().()][P.nextTokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#nextToken..Typescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/Token#Type.] == nil && P.nextTokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#nextToken..Typescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/Token#Type. != tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/.EOFscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/EOF. { |
| 63 | P.nextTokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#nextToken., P.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#pos. = scanner.Scanscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/Scanner#Scan.() |
| 64 | } |
| 65 | |
| 66 | return |
| 67 | } |
| 68 | |
| 69 | func (P *ParserUTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#) popNonRecoveryStatesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#popNonRecoveryStates().() (removedAttribs []errsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/.ErrorSymbolscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/ErrorSymbol#) { |
| 70 | if rs, ok := P.firstRecoveryStatescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#firstRecoveryState().(); ok { |
| 71 | errorSymbols := P.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..PopNscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#PopN().(P.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..TopIndexscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#TopIndex().() - rs) |
| 72 | removedAttribs = make([]errsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/.ErrorSymbolscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/ErrorSymbol#, len(errorSymbols)) |
| 73 | for i, e := range errorSymbols { |
| 74 | removedAttribs[i] = e |
| 75 | } |
| 76 | } else { |
| 77 | removedAttribs = []errsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/.ErrorSymbolscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/ErrorSymbol#{} |
| 78 | } |
| 79 | return |
| 80 | } |
| 81 | |
| 82 | // recoveryState points to the highest state on the stack, which can recover |
| 83 | func (P *ParserUTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#) firstRecoveryStatescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#firstRecoveryState().() (recoveryState int, canRecover bool) { |
| 84 | recoveryState, canRecover = P.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..TopIndexscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#TopIndex().(), P.canRecoverscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#canRecover.[P.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..Topscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#Top().()] |
| 85 | for recoveryState > 0 && !canRecover { |
| 86 | recoveryState-- |
| 87 | canRecover = P.canRecoverscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#canRecover.[P.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..Peekscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#Peek().(recoveryState)] |
| 88 | } |
| 89 | return |
| 90 | } |
| 91 | |
| 92 | func (P *ParserUTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#) newErrorscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#newError().(err error) error { |
| 93 | errmsg := "Error: " + P.TokStringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#TokString().(P.nextTokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#nextToken.) + " @ " + P.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#pos..Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/Position#String().() |
| 94 | if err != nil { |
| 95 | errmsg += " " + err.Error() |
| 96 | } else { |
| 97 | errmsg += ", expected one of: " |
| 98 | actRow := P.actTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#actTab.[P.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..Topscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#Top().()] |
| 99 | i := 0 |
| 100 | for t, act := range actRow { |
| 101 | if act != nil { |
| 102 | errmsg += P.tokenMapscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#tokenMap..TokenStringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/TokenMap#TokenString().(tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/.Typescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/Type#(t)) |
| 103 | if i < len(actRow)-1 { |
| 104 | errmsg += " " |
| 105 | } |
| 106 | i++ |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | return errorsscip-go gomod github.com/golang/go/src go1.24 errors/.Newscip-go gomod github.com/golang/go/src go1.24 errors/New().(errmsg) |
| 111 | } |
| 112 | |
| 113 | func (P *ParserUTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#) TokStringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#TokString().(tok *tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/.Tokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/Token#) string { |
| 114 | msg := P.tokenMapscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#tokenMap..TokenStringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/TokenMap#TokenString().(tok.Typescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/Token#Type.) + "(" + strconvscip-go gomod github.com/golang/go/src go1.24 strconv/.Itoascip-go gomod github.com/golang/go/src go1.24 strconv/Itoa().(int(tok.Typescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/Token#Type.)) + ")" |
| 115 | msg += " " + string(tok.Litscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/Token#Lit.) |
| 116 | return msg |
| 117 | } |
| 118 | |
| 119 | func (this *ParserUTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#) Parsescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#Parse().(scanner Scannerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/Scanner#) (res interface{}, err error) { |
| 120 | this.Resetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#Reset().() |
| 121 | this.nextTokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#nextToken., this.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#pos. = scanner.Scanscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/Scanner#Scan.() |
| 122 | for acc := false; !acc; { |
| 123 | action := this.actTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#actTab.[this.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..Topscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#Top().()][this.nextTokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#nextToken..Typescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/Token#Type.] |
| 124 | if action == nil { |
| 125 | if recovered, errAttrib := this.Errorscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#Error().(nil, scanner); !recovered { |
| 126 | this.nextTokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#nextToken., this.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#pos. = errAttrib.ErrorTokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/Error#ErrorToken., errAttrib.ErrorPosscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/errors`/Error#ErrorPos. |
| 127 | return nil, this.newErrorscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#newError().(nil) |
| 128 | } |
| 129 | if action = this.actTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#actTab.[this.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..Topscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#Top().()][this.nextTokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#nextToken..Typescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/token`/Token#Type.]; action == nil { |
| 130 | panic("Error recover led to invalid action") |
| 131 | } |
| 132 | } |
| 133 | // fmt.Printf("S%d %s %s\n", this.stack.Top(), this.nextToken, action) |
| 134 | switch act := action.(type) { |
| 135 | case Acceptscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/Accept#: |
| 136 | res = this.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..PopNscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#PopN().(1)[0] |
| 137 | acc = true |
| 138 | case Shiftscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/Shift#: |
| 139 | this.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..Pushscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#Push().(Statescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/State#(act), this.nextTokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#nextToken.) |
| 140 | this.nextTokenscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#nextToken., this.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#pos. = scanner.Scanscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/Scanner#Scan.() |
| 141 | case Reducescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/Reduce#: |
| 142 | prod := this.prodTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#prodTab.[int(act)] |
| 143 | attrib, err := prod.ReduceFuncscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ProdTabUEntry#ReduceFunc.(this.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..PopNscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#PopN().(prod.NumSymbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ProdTabUEntry#NumSymbols.)) |
| 144 | if err != nil { |
| 145 | return nil, this.newErrorscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#newError().(err) |
| 146 | } else { |
| 147 | this.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..Pushscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#Push().(this.gotoTabscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#gotoTab.[this.stackscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ParserUTab#stack..Topscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/stack#Top().()][prod.HeadIndexscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/ProdTabUEntry#HeadIndex.], attrib) |
| 148 | } |
| 149 | default: |
| 150 | panic("unknown action: " + action.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/frontend/parser`/Action#String.()) |
| 151 | } |
| 152 | } |
| 153 | return res, nil |
| 154 | } |