Debian Codegraph @

internal/parser/gen/golang/action.go

raw symbols SCIP
1 //Copyright 2013 Vastech SA (PTY) LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 package golangscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/parser/gen/golang`/
16
17 import (
18 "pathscip-go gomod github.com/golang/go/src go1.24 path/"
19
20 "github.com/goccmack/gocc/internal/ioscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/io`/"
21 )
22
23 func GenActionscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/parser/gen/golang`/GenAction().(outDir string) {
24 ioscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/io`/.WriteFileStringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/io`/WriteFileString().(pathscip-go gomod github.com/golang/go/src go1.24 path/.Joinscip-go gomod github.com/golang/go/src go1.24 path/Join().(outDir, "parser", "action.go"), actionSrcscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/parser/gen/golang`/actionSrc.[1:])
25 }
26
27 const actionSrcscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/parser/gen/golang`/actionSrc. = `
28 // Code generated by gocc; DO NOT EDIT.
29
30 package parser
31
32 import (
33 "fmt"
34 )
35
36 type action interface {
37 act()
38 String() string
39 }
40
41 type (
42 accept bool
43 shift int // value is next state index
44 reduce int // value is production index
45 )
46
47 func (this accept) act() {}
48 func (this shift) act() {}
49 func (this reduce) act() {}
50
51 func (this accept) Equal(that action) bool {
52 if _, ok := that.(accept); ok {
53 return true
54 }
55 return false
56 }
57
58 func (this reduce) Equal(that action) bool {
59 that1, ok := that.(reduce)
60 if !ok {
61 return false
62 }
63 return this == that1
64 }
65
66 func (this shift) Equal(that action) bool {
67 that1, ok := that.(shift)
68 if !ok {
69 return false
70 }
71 return this == that1
72 }
73
74 func (this accept) String() string { return "accept(0)" }
75 func (this shift) String() string { return fmt.Sprintf("shift:%d", this) }
76 func (this reduce) String() string {
77 return fmt.Sprintf("reduce:%d(%s)", this, productionsTable[this].String)
78 }
79 `