Debian Codegraph @

internal/parser/first/symbolset.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 firstscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/parser/first`/
16
17 import (
18 "fmtscip-go gomod github.com/golang/go/src go1.24 fmt/"
19 "sortscip-go gomod github.com/golang/go/src go1.24 sort/"
20 "stringsscip-go gomod github.com/golang/go/src go1.24 strings/"
21 )
22
23 /*
24 key: symbol string
25 */
26 type SymbolSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/parser/first`/SymbolSet# map[string]bool
27
28 func (this SymbolSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/parser/first`/SymbolSet#) AddSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/parser/first`/SymbolSet#AddSet().(that SymbolSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/parser/first`/SymbolSet#) {
29 for id := range that {
30 this[id] = true
31 }
32 }
33
34 func (this SymbolSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/parser/first`/SymbolSet#) Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/parser/first`/SymbolSet#Equal().(that SymbolSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/parser/first`/SymbolSet#) bool {
35 if len(this) != len(that) {
36 return false
37 }
38 for symbol := range this {
39 if _, contain := that[symbol]; !contain {
40 return false
41 }
42 }
43 return true
44 }
45
46 func (this SymbolSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/parser/first`/SymbolSet#) Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/parser/first`/SymbolSet#String().() string {
47 buf := new(stringsscip-go gomod github.com/golang/go/src go1.24 strings/.Builderscip-go gomod github.com/golang/go/src go1.24 strings/Builder#)
48 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(buf, "{\n")
49 keys := make([]string, 0, len(this))
50 for key := range this {
51 keys = append(keys, key)
52 }
53 sortscip-go gomod github.com/golang/go/src go1.24 sort/.Stringsscip-go gomod github.com/golang/go/src go1.24 sort/Strings().(keys)
54 for _, str := range keys {
55 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(buf, "\t%s\n", str)
56 }
57 fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.24 fmt/Fprintf().(buf, "}")
58 return buf.Stringscip-go gomod github.com/golang/go/src go1.24 strings/Builder#String().()
59 }