Debian Codegraph @

selector/lexer/token.go

raw symbols SCIP
1 package lexerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/
2
3 import (
4 "fmtscip-go gomod github.com/golang/go/src go1.25 fmt/"
5 "slicesscip-go gomod github.com/golang/go/src go1.25 slices/"
6 )
7
8 type TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind# int
9
10 func TokenKindsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKinds().(tk ...TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind#) []TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind# {
11 return tk
12 }
13
14 const (
15 EOFscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/EOF. TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind# = iota
16 Symbolscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Symbol.
17 Commascip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Comma.
18 Colonscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Colon.
19 OpenBracketscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/OpenBracket. // [
20 CloseBracketscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/CloseBracket. // ]
21 OpenCurlyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/OpenCurly.
22 CloseCurlyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/CloseCurly.
23 OpenParenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/OpenParen.
24 CloseParenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/CloseParen.
25 Equalscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Equal. // ==
26 Equalsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Equals. // =
27 NotEqualscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/NotEqual. // !=
28 Andscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/And.
29 Orscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Or.
30 Likescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Like. // =~
31 NotLikescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/NotLike. // !~
32 Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/String.
33 Numberscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Number.
34 Boolscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Bool.
35 Plusscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Plus.
36 Incrementscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Increment.
37 IncrementByscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/IncrementBy.
38 Dashscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Dash.
39 Decrementscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Decrement.
40 DecrementByscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/DecrementBy.
41 Starscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Star.
42 Slashscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Slash.
43 Percentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Percent.
44 Dotscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Dot.
45 Spreadscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Spread. // ...
46 RecursiveDescentscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/RecursiveDescent. // ..
47 Dollarscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Dollar.
48 Variablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Variable.
49 GreaterThanscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/GreaterThan.
50 GreaterThanOrEqualscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/GreaterThanOrEqual.
51 LessThanscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/LessThan.
52 LessThanOrEqualscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/LessThanOrEqual.
53 Exclamationscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Exclamation.
54 Nullscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Null.
55 Ifscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/If.
56 Elsescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Else.
57 ElseIfscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/ElseIf.
58 Branchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Branch.
59 Mapscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Map.
60 Eachscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Each.
61 Filterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Filter.
62 Searchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Search.
63 RegexPatternscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/RegexPattern.
64 SortByscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/SortBy.
65 GroupByscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/GroupBy.
66 Reducescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Reduce.
67 MapValuesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/MapValues.
68 Anyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Any.
69 Allscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/All.
70 Countscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Count.
71 Ascscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Asc.
72 Descscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Desc.
73 QuestionMarkscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/QuestionMark.
74 DoubleQuestionMarkscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/DoubleQuestionMark.
75 Semicolonscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Semicolon.
76 )
77
78 type Tokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Tokens# []Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#
79
80 func (tt Tokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Tokens#) Splitscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Tokens#Split().(kind TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind#) []Tokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Tokens# {
81 var res []Tokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Tokens#
82 var cur Tokensscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Tokens#
83 for _, t := range tt {
84 if t.Kindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Kind. == kind {
85 if len(cur) > 0 {
86 res = append(res, cur)
87 }
88 cur = nil
89 continue
90 }
91 cur = append(cur, t)
92 }
93 if len(cur) > 0 {
94 res = append(res, cur)
95 }
96 return res
97 }
98
99 type Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token# struct {
100 Kindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Kind. TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind#
101 Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Value. string
102 Posscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Pos. int
103 Lenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Len. int
104 }
105
106 func NewTokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/NewToken().(kind TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind#, value string, pos int, len int) Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token# {
107 return Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#{
108 Kindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Kind.: kind,
109 Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Value.: value,
110 Posscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Pos.: pos,
111 Lenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Len.: len,
112 }
113 }
114
115 func (t Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#) IsKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#IsKind().(kind ...TokenKindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/TokenKind#) bool {
116 return slicesscip-go gomod github.com/golang/go/src go1.25 slices/.Containsscip-go gomod github.com/golang/go/src go1.25 slices/Contains().(kind, t.Kindscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/Token#Kind.)
117 }
118
119 type UnexpectedTokenErrorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/UnexpectedTokenError# struct {
120 Posscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/UnexpectedTokenError#Pos. int
121 Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/UnexpectedTokenError#Token. rune
122 }
123
124 func (e *UnexpectedTokenErrorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/UnexpectedTokenError#) Errorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/UnexpectedTokenError#Error().() string {
125 return fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25 fmt/Sprintf().("failed to tokenize: unexpected token: %s at position %d.", string(e.Tokenscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/UnexpectedTokenError#Token.), e.Posscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/UnexpectedTokenError#Pos.)
126 }
127
128 type UnexpectedEOFErrorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/UnexpectedEOFError# struct {
129 Posscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/UnexpectedEOFError#Pos. int
130 }
131
132 func (e *UnexpectedEOFErrorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/UnexpectedEOFError#) Errorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/UnexpectedEOFError#Error().() string {
133 return fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25 fmt/Sprintf().("failed to tokenize: unexpected EOF at position %d.", e.Posscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/lexer`/UnexpectedEOFError#Pos.)
134 }