Debian Codegraph @

example/nolexer/parser/action.go

raw symbols SCIP
1 // Code generated by gocc; DO NOT EDIT.
2
3 package parser
4
5 import (
6 "fmt"
7 )
8
9 type action interface {
10 act()
11 String() string
12 }
13
14 type (
15 accept bool
16 shift int // value is next state index
17 reduce int // value is production index
18 )
19
20 func (this accept) act() {}
21 func (this shift) act() {}
22 func (this reduce) act() {}
23
24 func (this accept) Equal(that action) bool {
25 if _, ok := that.(accept); ok {
26 return true
27 }
28 return false
29 }
30
31 func (this reduce) Equal(that action) bool {
32 that1, ok := that.(reduce)
33 if !ok {
34 return false
35 }
36 return this == that1
37 }
38
39 func (this shift) Equal(that action) bool {
40 that1, ok := that.(shift)
41 if !ok {
42 return false
43 }
44 return this == that1
45 }
46
47 func (this accept) String() string { return "accept(0)" }
48 func (this shift) String() string { return fmt.Sprintf("shift:%d", this) }
49 func (this reduce) String() string {
50 return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String)
51 }