Debian Codegraph @

scanner/scanner.go

raw symbols SCIP
1 package scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/
2
3 import (
4 "errorsscip-go gomod github.com/golang/go/src go1.21.0 errors/"
5 "fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/"
6 "ioscip-go gomod github.com/golang/go/src go1.21.0 io/"
7 "strconvscip-go gomod github.com/golang/go/src go1.21.0 strconv/"
8 "stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/"
9
10 "github.com/goccy/go-yaml/tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/"
11 )
12
13 // IndentState state for indent
14 type IndentStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/IndentState# int
15
16 const (
17 // IndentStateEqual equals previous indent
18 IndentStateEqualscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/IndentStateEqual. IndentStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/IndentState# = iota
19 // IndentStateUp more indent than previous
20 IndentStateUpscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/IndentStateUp.
21 // IndentStateDown less indent than previous
22 IndentStateDownscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/IndentStateDown.
23 // IndentStateKeep uses not indent token
24 IndentStateKeepscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/IndentStateKeep.
25 )
26
27 // Scanner holds the scanner's internal state while processing a given text.
28 // It can be allocated as part of another data structure but must be initialized via Init before use.
29 type Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner# struct {
30 sourcescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#source. []rune
31 sourcePosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#sourcePos. int
32 sourceSizescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#sourceSize. int
33 // line number. This number starts from 1.
34 linescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#line. int
35 // column number. This number starts from 1.
36 columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column. int
37 // offset represents the offset from the beginning of the source.
38 offsetscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#offset. int
39 // lastDelimColumn is the last column needed to compare indent is retained.
40 lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. int
41 // indentNum indicates the number of spaces used for indentation.
42 indentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentNum. int
43 // prevLineIndentNum indicates the number of spaces used for indentation at previous line.
44 prevLineIndentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#prevLineIndentNum. int
45 // indentLevel indicates the level of indent depth. This value does not match the column value.
46 indentLevelscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentLevel. int
47 isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. bool
48 isAnchorscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isAnchor. bool
49 isAliasscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isAlias. bool
50 isDirectivescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isDirective. bool
51 startedFlowSequenceNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowSequenceNum. int
52 startedFlowMapNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowMapNum. int
53 indentStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentState. IndentStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/IndentState#
54 savedPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#savedPos. *tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Positionscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#
55 }
56
57 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().() *tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Positionscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position# {
58 return &tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Positionscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#{
59 Linescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#Line.: s.linescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#line.,
60 Columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#Column.: s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column.,
61 Offsetscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#Offset.: s.offsetscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#offset.,
62 IndentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#IndentNum.: s.indentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentNum.,
63 IndentLevelscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#IndentLevel.: s.indentLevelscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentLevel.,
64 }
65 }
66
67 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) bufferedTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#bufferedToken().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) *tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Token# {
68 if s.savedPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#savedPos. != nil {
69 tk := ctx.bufferedTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#bufferedToken().(s.savedPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#savedPos.)
70 s.savedPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#savedPos. = nil
71 return tk
72 }
73 line := s.linescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#line.
74 column := s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column. - len(ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.)
75 level := s.indentLevelscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentLevel.
76 if ctx.isMultiLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#isMultiLine().() {
77 line -= s.newLineCountscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#newLineCount().(ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.)
78 column = stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.Indexscip-go gomod github.com/golang/go/src go1.21.0 strings/Index().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), string(ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.)) + 1
79 // Since we are in a literal, folded or raw folded
80 // we can use the indent level from the last token.
81 last := ctx.lastTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#lastToken().()
82 if last != nil { // The last token should never be nil here.
83 level = last.Positionscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Token#Position..IndentLevelscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#IndentLevel. + 1
84 }
85 }
86 return ctx.bufferedTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#bufferedToken().(&tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Positionscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#{
87 Linescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#Line.: line,
88 Columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#Column.: column,
89 Offsetscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#Offset.: s.offsetscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#offset. - len(ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.),
90 IndentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#IndentNum.: s.indentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentNum.,
91 IndentLevelscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#IndentLevel.: level,
92 })
93 }
94
95 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#, num int) {
96 s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column. += num
97 s.offsetscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#offset. += num
98 s.progressscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progress().(ctx, num)
99 }
100
101 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) progressOnlyscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressOnly().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#, num int) {
102 s.offsetscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#offset. += num
103 s.progressscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progress().(ctx, num)
104 }
105
106 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) progressLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressLine().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) {
107 s.prevLineIndentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#prevLineIndentNum. = s.indentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentNum.
108 s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column. = 1
109 s.linescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#line.++
110 s.offsetscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#offset.++
111 s.indentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentNum. = 0
112 s.isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. = true
113 s.isAnchorscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isAnchor. = false
114 s.isAliasscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isAlias. = false
115 s.isDirectivescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isDirective. = false
116 s.progressscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progress().(ctx, 1)
117 }
118
119 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) progressscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progress().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#, num int) {
120 ctx.progressscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#progress().(num)
121 s.sourcePosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#sourcePos. += num
122 }
123
124 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) isNewLineCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isNewLineChar().(c rune) bool {
125 if c == '\n' {
126 return true
127 }
128 if c == '\r' {
129 return true
130 }
131 return false
132 }
133
134 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) newLineCountscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#newLineCount().(src []rune) int {
135 size := len(src)
136 cnt := 0
137 for i := 0; i < size; i++ {
138 c := src[i]
139 switch c {
140 case '\r':
141 if i+1 < size && src[i+1] == '\n' {
142 i++
143 }
144 cnt++
145 case '\n':
146 cnt++
147 }
148 }
149 return cnt
150 }
151
152 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) updateIndentLevelscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#updateIndentLevel().() {
153 if s.prevLineIndentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#prevLineIndentNum. < s.indentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentNum. {
154 s.indentLevelscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentLevel.++
155 } else if s.prevLineIndentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#prevLineIndentNum. > s.indentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentNum. {
156 if s.indentLevelscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentLevel. > 0 {
157 s.indentLevelscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentLevel.--
158 }
159 }
160 }
161
162 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) updateIndentStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#updateIndentState().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) {
163 if s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. == 0 {
164 return
165 }
166
167 if s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. < s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column. {
168 s.indentStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentState. = IndentStateUpscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/IndentStateUp.
169 } else {
170 // If lastDelimColumn and s.column are the same,
171 // treat as Down state since it is the same column as delimiter.
172 s.indentStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentState. = IndentStateDownscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/IndentStateDown.
173 }
174 }
175
176 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) updateIndentscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#updateIndent().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#, c rune) {
177 if s.isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. && s.isNewLineCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isNewLineChar().(c) {
178 return
179 }
180 if s.isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. && c == ' ' {
181 s.indentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentNum.++
182 return
183 }
184 if s.isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. && c == '\t' {
185 // found tab indent.
186 // In this case, scanTab returns error.
187 return
188 }
189 if !s.isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. {
190 s.indentStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentState. = IndentStateKeepscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/IndentStateKeep.
191 return
192 }
193 s.updateIndentLevelscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#updateIndentLevel().()
194 s.updateIndentStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#updateIndentState().(ctx)
195 s.isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. = false
196 }
197
198 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) isChangedToIndentStateDownscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isChangedToIndentStateDown().() bool {
199 return s.indentStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentState. == IndentStateDownscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/IndentStateDown.
200 }
201
202 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) isChangedToIndentStateUpscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isChangedToIndentStateUp().() bool {
203 return s.indentStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentState. == IndentStateUpscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/IndentStateUp.
204 }
205
206 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) {
207 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(s.bufferedTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#bufferedToken().(ctx))
208 }
209
210 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) breakMultiLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#breakMultiLine().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) {
211 ctx.breakMultiLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#breakMultiLine().()
212 }
213
214 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanSingleQuotescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanSingleQuote().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) (*tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Token#, error) {
215 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().('\'')
216 srcpos := s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()
217 startIndex := ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx. + 1
218 src := ctx.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.
219 size := len(src)
220 value := []rune{}
221 isFirstLineChar := false
222 isNewLine := false
223
224 for idx := startIndex; idx < size; idx++ {
225 if !isNewLine {
226 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
227 } else {
228 isNewLine = false
229 }
230 c := src[idx]
231 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
232 if s.isNewLineCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isNewLineChar().(c) {
233 notSpaceIdx := -1
234 for i := len(value) - 1; i >= 0; i-- {
235 if value[i] == ' ' {
236 continue
237 }
238 notSpaceIdx = i
239 break
240 }
241 if len(value) > notSpaceIdx {
242 value = value[:notSpaceIdx+1]
243 }
244 if isFirstLineChar {
245 value = append(value, '\n')
246 } else {
247 value = append(value, ' ')
248 }
249 isFirstLineChar = true
250 isNewLine = true
251 s.progressLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressLine().(ctx)
252 if idx+1 < size {
253 if err := s.validateDocumentSeparatorMarkerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#validateDocumentSeparatorMarker().(ctx, src[idx+1:]); err != nil {
254 return nil, err
255 }
256 }
257 continue
258 } else if isFirstLineChar && c == ' ' {
259 continue
260 } else if isFirstLineChar && c == '\t' {
261 if s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. >= s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column. {
262 return nil, ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
263 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(
264 "tab character cannot be used for indentation in single-quoted text",
265 string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().(),
266 ),
267 )
268 }
269 continue
270 } else if c != '\'' {
271 value = append(value, c)
272 isFirstLineChar = false
273 continue
274 } else if idx+1 < len(ctx.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.) && ctx.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.[idx+1] == '\'' {
275 // '' handle as ' character
276 value = append(value, c)
277 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
278 idx++
279 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
280 continue
281 }
282 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
283 return tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.SingleQuotescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/SingleQuote().(string(value), string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), srcpos), nil
284 }
285 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
286 return nil, ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
287 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(
288 "could not find end character of single-quoted text",
289 string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), srcpos,
290 ),
291 )
292 }
293
294 func hexToIntscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/hexToInt().(b rune) int {
295 if b >= 'A' && b <= 'F' {
296 return int(b) - 'A' + 10
297 }
298 if b >= 'a' && b <= 'f' {
299 return int(b) - 'a' + 10
300 }
301 return int(b) - '0'
302 }
303
304 func hexRunesToIntscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/hexRunesToInt().(b []rune) int {
305 sum := 0
306 for i := 0; i < len(b); i++ {
307 sum += hexToIntscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/hexToInt().(b[i]) << (uint(len(b)-i-1) * 4)
308 }
309 return sum
310 }
311
312 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanDoubleQuotescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanDoubleQuote().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) (*tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Token#, error) {
313 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().('"')
314 srcpos := s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()
315 startIndex := ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx. + 1
316 src := ctx.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.
317 size := len(src)
318 value := []rune{}
319 isFirstLineChar := false
320 isNewLine := false
321
322 for idx := startIndex; idx < size; idx++ {
323 if !isNewLine {
324 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
325 } else {
326 isNewLine = false
327 }
328 c := src[idx]
329 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
330 if s.isNewLineCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isNewLineChar().(c) {
331 notSpaceIdx := -1
332 for i := len(value) - 1; i >= 0; i-- {
333 if value[i] == ' ' {
334 continue
335 }
336 notSpaceIdx = i
337 break
338 }
339 if len(value) > notSpaceIdx {
340 value = value[:notSpaceIdx+1]
341 }
342 if isFirstLineChar {
343 value = append(value, '\n')
344 } else {
345 value = append(value, ' ')
346 }
347 isFirstLineChar = true
348 isNewLine = true
349 s.progressLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressLine().(ctx)
350 if idx+1 < size {
351 if err := s.validateDocumentSeparatorMarkerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#validateDocumentSeparatorMarker().(ctx, src[idx+1:]); err != nil {
352 return nil, err
353 }
354 }
355 continue
356 } else if isFirstLineChar && c == ' ' {
357 continue
358 } else if isFirstLineChar && c == '\t' {
359 if s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. >= s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column. {
360 return nil, ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
361 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(
362 "tab character cannot be used for indentation in double-quoted text",
363 string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().(),
364 ),
365 )
366 }
367 continue
368 } else if c == '\\' {
369 isFirstLineChar = false
370 if idx+1 >= size {
371 value = append(value, c)
372 continue
373 }
374 nextChar := src[idx+1]
375 progress := 0
376 switch nextChar {
377 case '0':
378 progress = 1
379 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
380 value = append(value, 0x00)
381 case 'a':
382 progress = 1
383 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
384 value = append(value, 0x07)
385 case 'b':
386 progress = 1
387 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
388 value = append(value, 0x08)
389 case 't':
390 progress = 1
391 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
392 value = append(value, 0x09)
393 case 'n':
394 progress = 1
395 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
396 value = append(value, 0x0A)
397 case 'v':
398 progress = 1
399 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
400 value = append(value, 0x0B)
401 case 'f':
402 progress = 1
403 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
404 value = append(value, 0x0C)
405 case 'r':
406 progress = 1
407 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
408 value = append(value, 0x0D)
409 case 'e':
410 progress = 1
411 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
412 value = append(value, 0x1B)
413 case ' ':
414 progress = 1
415 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
416 value = append(value, 0x20)
417 case '"':
418 progress = 1
419 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
420 value = append(value, 0x22)
421 case '/':
422 progress = 1
423 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
424 value = append(value, 0x2F)
425 case '\\':
426 progress = 1
427 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
428 value = append(value, 0x5C)
429 case 'N':
430 progress = 1
431 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
432 value = append(value, 0x85)
433 case '_':
434 progress = 1
435 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
436 value = append(value, 0xA0)
437 case 'L':
438 progress = 1
439 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
440 value = append(value, 0x2028)
441 case 'P':
442 progress = 1
443 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
444 value = append(value, 0x2029)
445 case 'x':
446 if idx+3 >= size {
447 progress = 1
448 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
449 value = append(value, nextChar)
450 } else {
451 progress = 3
452 codeNum := hexRunesToIntscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/hexRunesToInt().(src[idx+2 : idx+progress+1])
453 value = append(value, rune(codeNum))
454 }
455 case 'u':
456 // \u0000 style must have 5 characters at least.
457 if idx+5 >= size {
458 return nil, ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
459 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(
460 "not enough length for escaped UTF-16 character",
461 string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().(),
462 ),
463 )
464 }
465 progress = 5
466 codeNum := hexRunesToIntscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/hexRunesToInt().(src[idx+2 : idx+6])
467
468 // handle surrogate pairs.
469 if codeNum >= 0xD800 && codeNum <= 0xDBFF {
470 high := codeNum
471
472 // \u0000\u0000 style must have 11 characters at least.
473 if idx+11 >= size {
474 return nil, ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
475 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(
476 "not enough length for escaped UTF-16 surrogate pair",
477 string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().(),
478 ),
479 )
480 }
481
482 if src[idx+6] != '\\' || src[idx+7] != 'u' {
483 return nil, ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
484 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(
485 "found unexpected character after high surrogate for UTF-16 surrogate pair",
486 string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().(),
487 ),
488 )
489 }
490
491 low := hexRunesToIntscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/hexRunesToInt().(src[idx+8 : idx+12])
492 if low < 0xDC00 || low > 0xDFFF {
493 return nil, ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
494 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(
495 "found unexpected low surrogate after high surrogate",
496 string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().(),
497 ),
498 )
499 }
500 codeNum = ((high - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000
501 progress += 6
502 }
503 value = append(value, rune(codeNum))
504 case 'U':
505 // \U00000000 style must have 9 characters at least.
506 if idx+9 >= size {
507 return nil, ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
508 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(
509 "not enough length for escaped UTF-32 character",
510 string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().(),
511 ),
512 )
513 }
514 progress = 9
515 codeNum := hexRunesToIntscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/hexRunesToInt().(src[idx+2 : idx+10])
516 value = append(value, rune(codeNum))
517 case '\n':
518 isFirstLineChar = true
519 isNewLine = true
520 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
521 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
522 s.progressLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressLine().(ctx)
523 idx++
524 continue
525 case '\r':
526 isFirstLineChar = true
527 isNewLine = true
528 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
529 s.progressLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressLine().(ctx)
530 progress = 1
531 // Skip \n after \r in CRLF sequences
532 if idx+2 < size && src[idx+2] == '\n' {
533 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().('\n')
534 progress = 2
535 }
536 case '\t':
537 progress = 1
538 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(nextChar)
539 value = append(value, nextChar)
540 default:
541 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
542 return nil, ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
543 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(
544 fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Sprintf().("found unknown escape character %q", nextChar),
545 string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().(),
546 ),
547 )
548 }
549 idx += progress
550 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, progress)
551 continue
552 } else if c == '\t' {
553 var (
554 foundNotSpaceChar bool
555 progress int
556 )
557 for i := idx + 1; i < size; i++ {
558 if src[i] == ' ' || src[i] == '\t' {
559 progress++
560 continue
561 }
562 if s.isNewLineCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isNewLineChar().(src[i]) {
563 break
564 }
565 foundNotSpaceChar = true
566 }
567 if foundNotSpaceChar {
568 value = append(value, c)
569 if src[idx+1] != '"' {
570 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
571 }
572 } else {
573 idx += progress
574 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, progress)
575 }
576 continue
577 } else if c != '"' {
578 value = append(value, c)
579 isFirstLineChar = false
580 continue
581 }
582 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
583 return tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.DoubleQuotescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/DoubleQuote().(string(value), string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), srcpos), nil
584 }
585 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
586 return nil, ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
587 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(
588 "could not find end character of double-quoted text",
589 string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), srcpos,
590 ),
591 )
592 }
593
594 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) validateDocumentSeparatorMarkerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#validateDocumentSeparatorMarker().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#, src []rune) error {
595 if s.foundDocumentSeparatorMarkerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#foundDocumentSeparatorMarker().(src) {
596 return ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
597 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().("found unexpected document separator", string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()),
598 )
599 }
600 return nil
601 }
602
603 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) foundDocumentSeparatorMarkerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#foundDocumentSeparatorMarker().(src []rune) bool {
604 if len(src) < 3 {
605 return false
606 }
607 var marker string
608 if len(src) == 3 {
609 marker = string(src)
610 } else {
611 marker = stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.TrimRightFuncscip-go gomod github.com/golang/go/src go1.21.0 strings/TrimRightFunc().(string(src[:4]), func(r rune) bool {
612 return r == ' ' || r == '\t' || r == '\n' || r == '\r'
613 })
614 }
615 return marker == "---" || marker == "..."
616 }
617
618 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanQuotescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanQuote().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#, ch rune) (bool, error) {
619 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() {
620 return false, nil
621 }
622 if ch == '\'' {
623 tk, err := s.scanSingleQuotescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanSingleQuote().(ctx)
624 if err != nil {
625 return false, err
626 }
627 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tk)
628 } else {
629 tk, err := s.scanDoubleQuotescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanDoubleQuote().(ctx)
630 if err != nil {
631 return false, err
632 }
633 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tk)
634 }
635 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
636 return true, nil
637 }
638
639 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanWhiteSpacescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanWhiteSpace().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
640 if ctx.isMultiLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#isMultiLine().() {
641 return false
642 }
643 if !s.isAnchorscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isAnchor. && !s.isDirectivescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isDirective. && !s.isAliasscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isAlias. && !s.isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. {
644 return false
645 }
646
647 if s.isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. {
648 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
649 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(' ')
650 return true
651 }
652 if s.isDirectivescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isDirective. {
653 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
654 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
655 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(' ')
656 return true
657 }
658
659 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
660 s.isAnchorscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isAnchor. = false
661 s.isAliasscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isAlias. = false
662 return true
663 }
664
665 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) isMergeKeyscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isMergeKey().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
666 if ctx.repeatNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#repeatNum().('<') != 2 {
667 return false
668 }
669 src := ctx.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.
670 size := len(src)
671 for idx := ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx. + 2; idx < size; idx++ {
672 c := src[idx]
673 if c == ' ' {
674 continue
675 }
676 if c != ':' {
677 return false
678 }
679 if idx+1 < size {
680 nc := src[idx+1]
681 if nc == ' ' || s.isNewLineCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isNewLineChar().(nc) {
682 return true
683 }
684 }
685 }
686 return false
687 }
688
689 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanTagscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanTag().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) (bool, error) {
690 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() || s.isDirectivescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isDirective. {
691 return false, nil
692 }
693
694 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().('!')
695 s.progressscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progress().(ctx, 1) // skip '!' character
696
697 var progress int
698 for idx, c := range ctx.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.[ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.:] {
699 progress = idx + 1
700 switch c {
701 case ' ':
702 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
703 value := ctx.sourcescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#source().(ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.-1, ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.+idx)
704 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Tagscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Tag().(value, string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
705 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, len([]rune(value)))
706 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
707 return true, nil
708 case ',':
709 if s.startedFlowSequenceNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowSequenceNum. > 0 || s.startedFlowMapNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowMapNum. > 0 {
710 value := ctx.sourcescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#source().(ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.-1, ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.+idx)
711 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Tagscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Tag().(value, string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
712 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, len([]rune(value))-1) // progress column before collect-entry for scanning it at scanFlowEntry function.
713 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
714 return true, nil
715 } else {
716 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
717 }
718 case '\n', '\r':
719 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
720 value := ctx.sourcescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#source().(ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.-1, ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.+idx)
721 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Tagscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Tag().(value, string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
722 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, len([]rune(value))-1) // progress column before new-line-char for scanning new-line-char at scanNewLine function.
723 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
724 return true, nil
725 case '{', '}':
726 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
727 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, progress)
728 invalidTk := tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Sprintf().("found invalid tag character %q", c), string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().())
729 return false, ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(invalidTk)
730 default:
731 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
732 }
733 }
734 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, progress)
735 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
736 return true, nil
737 }
738
739 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanCommentscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanComment().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
740 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() {
741 c := ctx.previousCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#previousChar().()
742 if c != ' ' && c != '\t' && !s.isNewLineCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isNewLineChar().(c) {
743 return false
744 }
745 }
746
747 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
748 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().('#')
749 s.progressscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progress().(ctx, 1) // skip '#' character
750
751 for idx, c := range ctx.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.[ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.:] {
752 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
753 if !s.isNewLineCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isNewLineChar().(c) {
754 continue
755 }
756 if ctx.previousCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#previousChar().() == '\\' {
757 continue
758 }
759 value := ctx.sourcescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#source().(ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx., ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.+idx)
760 progress := len([]rune(value))
761 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Commentscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Comment().(value, string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
762 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, progress)
763 s.progressLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressLine().(ctx)
764 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
765 return true
766 }
767 // document ends with comment.
768 value := string(ctx.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.[ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.:])
769 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Commentscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Comment().(value, string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
770 progress := len([]rune(value))
771 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, progress)
772 s.progressLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressLine().(ctx)
773 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
774 return true
775 }
776
777 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanMultiLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanMultiLine().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#, c rune) error {
778 state := ctx.getMultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#getMultiLineState().()
779 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
780 if ctx.isEOSscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#isEOS().() {
781 if s.isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. && c == ' ' {
782 state.addIndentscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#addIndent().(ctx, s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column.)
783 } else {
784 ctx.addBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addBuf().(c)
785 }
786 state.updateIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#updateIndentColumn().(s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column.)
787 if err := state.validateIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#validateIndentColumn().(); err != nil {
788 invalidTk := tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(err.Error(), string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().())
789 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
790 return ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(invalidTk)
791 }
792 value := ctx.bufferedSrcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#bufferedSrc().()
793 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Stringscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/String().(string(value), string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
794 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
795 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
796 } else if s.isNewLineCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isNewLineChar().(c) {
797 ctx.addBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addBuf().(c)
798 state.updateSpaceOnlyIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#updateSpaceOnlyIndentColumn().(s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column. - 1)
799 state.updateNewLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#updateNewLineState().()
800 s.progressLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressLine().(ctx)
801 if ctx.nextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#next().() {
802 if s.foundDocumentSeparatorMarkerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#foundDocumentSeparatorMarker().(ctx.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.[ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.:]) {
803 value := ctx.bufferedSrcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#bufferedSrc().()
804 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Stringscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/String().(string(value), string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
805 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
806 s.breakMultiLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#breakMultiLine().(ctx)
807 }
808 }
809 } else if s.isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. && c == ' ' {
810 state.addIndentscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#addIndent().(ctx, s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column.)
811 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
812 } else if s.isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. && c == '\t' && state.isIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#isIndentColumn().(s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column.) {
813 err := ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
814 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(
815 "found a tab character where an indentation space is expected",
816 string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().(),
817 ),
818 )
819 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
820 return err
821 } else if c == '\t' && !state.isIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#isIndentColumn().(s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column.) {
822 ctx.addBufWithTabscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addBufWithTab().(c)
823 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
824 } else {
825 if err := state.validateIndentAfterSpaceOnlyscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#validateIndentAfterSpaceOnly().(s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column.); err != nil {
826 invalidTk := tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(err.Error(), string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().())
827 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
828 return ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(invalidTk)
829 }
830 state.updateIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#updateIndentColumn().(s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column.)
831 if err := state.validateIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#validateIndentColumn().(); err != nil {
832 invalidTk := tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(err.Error(), string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().())
833 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
834 return ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(invalidTk)
835 }
836 if col := state.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#lastDelimColumn().(); col > 0 {
837 s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. = col
838 }
839 state.updateNewLineInFoldedscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#updateNewLineInFolded().(ctx, s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column.)
840 ctx.addBufWithTabscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addBufWithTab().(c)
841 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
842 }
843 return nil
844 }
845
846 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanNewLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanNewLine().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#, c rune) {
847 if len(ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.) > 0 && s.savedPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#savedPos. == nil {
848 bufLen := len(ctx.bufferedSrcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#bufferedSrc().())
849 s.savedPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#savedPos. = s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()
850 s.savedPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#savedPos..Columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#Column. -= bufLen
851 s.savedPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#savedPos..Offsetscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#Offset. -= bufLen
852 }
853
854 // if the following case, origin buffer has unnecessary two spaces.
855 // So, `removeRightSpaceFromOriginBuf` remove them, also fix column number too.
856 // ---
857 // a:[space][space]
858 // b: c
859 ctx.removeRightSpaceFromBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#removeRightSpaceFromBuf().()
860
861 // There is no problem that we ignore CR which followed by LF and normalize it to LF, because of following YAML1.2 spec.
862 // > Line breaks inside scalar content must be normalized by the YAML processor. Each such line break must be parsed into a single line feed character.
863 // > Outside scalar content, YAML allows any line break to be used to terminate lines.
864 // > -- https://yaml.org/spec/1.2/spec.html
865 if c == '\r' && ctx.nextCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#nextChar().() == '\n' {
866 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().('\r')
867 s.progressscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progress().(ctx, 1)
868 s.offsetscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#offset.++
869 c = '\n'
870 }
871
872 if ctx.isEOSscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#isEOS().() {
873 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
874 } else if s.isAnchorscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isAnchor. || s.isAliasscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isAlias. || s.isDirectivescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isDirective. {
875 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
876 }
877 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() && s.isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. {
878 if ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.[len(ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.)-1] == ' ' {
879 ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.[len(ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.)-1] = '\n'
880 } else {
881 ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf. = append(ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf., '\n')
882 }
883 } else {
884 ctx.addBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addBuf().(' ')
885 }
886 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
887 s.progressLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressLine().(ctx)
888 }
889
890 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) isFlowModescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFlowMode().() bool {
891 if s.startedFlowSequenceNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowSequenceNum. > 0 {
892 return true
893 }
894 if s.startedFlowMapNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowMapNum. > 0 {
895 return true
896 }
897 return false
898 }
899
900 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanFlowMapStartscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanFlowMapStart().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
901 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() && !s.isFlowModescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFlowMode().() {
902 return false
903 }
904
905 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
906 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().('{')
907 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.MappingStartscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/MappingStart().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
908 s.startedFlowMapNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowMapNum.++
909 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
910 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
911 return true
912 }
913
914 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanFlowMapEndscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanFlowMapEnd().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
915 if s.startedFlowMapNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowMapNum. <= 0 {
916 return false
917 }
918
919 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
920 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().('}')
921 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.MappingEndscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/MappingEnd().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
922 s.startedFlowMapNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowMapNum.--
923 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
924 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
925 return true
926 }
927
928 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanFlowArrayStartscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanFlowArrayStart().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
929 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() && !s.isFlowModescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFlowMode().() {
930 return false
931 }
932
933 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
934 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().('[')
935 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.SequenceStartscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/SequenceStart().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
936 s.startedFlowSequenceNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowSequenceNum.++
937 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
938 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
939 return true
940 }
941
942 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanFlowArrayEndscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanFlowArrayEnd().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
943 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() && s.startedFlowSequenceNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowSequenceNum. <= 0 {
944 return false
945 }
946
947 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
948 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(']')
949 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.SequenceEndscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/SequenceEnd().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
950 s.startedFlowSequenceNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowSequenceNum.--
951 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
952 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
953 return true
954 }
955
956 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanFlowEntryscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanFlowEntry().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#, c rune) bool {
957 if s.startedFlowSequenceNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowSequenceNum. <= 0 && s.startedFlowMapNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowMapNum. <= 0 {
958 return false
959 }
960
961 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
962 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
963 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.CollectEntryscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/CollectEntry().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
964 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
965 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
966 return true
967 }
968
969 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanMapDelimscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanMapDelim().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) (bool, error) {
970 nc := ctx.nextCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#nextChar().()
971 if s.isDirectivescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isDirective. || s.isAnchorscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isAnchor. || s.isAliasscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isAlias. {
972 return false, nil
973 }
974 if s.startedFlowMapNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowMapNum. <= 0 && nc != ' ' && nc != '\t' && !s.isNewLineCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isNewLineChar().(nc) && !ctx.isNextEOSscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#isNextEOS().() {
975 return false, nil
976 }
977 if s.startedFlowMapNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowMapNum. > 0 && nc == '/' {
978 // like http://
979 return false, nil
980 }
981 if s.startedFlowMapNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowMapNum. > 0 {
982 tk := ctx.lastTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#lastToken().()
983 if tk != nil && tk.Typescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Token#Type. == tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.MappingValueTypescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/MappingValueType. {
984 return false, nil
985 }
986 }
987
988 if stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.21.0 strings/HasPrefix().(stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.TrimPrefixscip-go gomod github.com/golang/go/src go1.21.0 strings/TrimPrefix().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), " "), "\t") && !stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.21.0 strings/HasPrefix().(string(ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.), "\t") {
989 invalidTk := tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().("tab character cannot use as a map key directly", string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().())
990 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
991 return false, ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(invalidTk)
992 }
993
994 // mapping value
995 tk := s.bufferedTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#bufferedToken().(ctx)
996 if tk != nil {
997 s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. = tk.Positionscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Token#Position..Columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#Column.
998 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tk)
999 } else if tk := ctx.lastTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#lastToken().(); tk != nil {
1000 // If the map key is quote, the buffer does not exist because it has already been cut into tokens.
1001 // Therefore, we need to check the last token.
1002 if tk.Indicatorscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Token#Indicator. == tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.QuotedScalarIndicatorscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/QuotedScalarIndicator. {
1003 s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. = tk.Positionscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Token#Position..Columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#Column.
1004 }
1005 }
1006 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.MappingValuescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/MappingValue().(s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
1007 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
1008 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
1009 return true, nil
1010 }
1011
1012 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanDocumentStartscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanDocumentStart().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
1013 if s.indentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentNum. != 0 {
1014 return false
1015 }
1016 if s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column. != 1 {
1017 return false
1018 }
1019 if ctx.repeatNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#repeatNum().('-') != 3 {
1020 return false
1021 }
1022 if ctx.sizescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#size. > ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.+3 {
1023 c := ctx.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.[ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.+3]
1024 if c != ' ' && c != '\t' && c != '\n' && c != '\r' {
1025 return false
1026 }
1027 }
1028
1029 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
1030 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.DocumentHeaderscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/DocumentHeader().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.)+"---", s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
1031 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 3)
1032 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
1033 s.clearStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#clearState().()
1034 return true
1035 }
1036
1037 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanDocumentEndscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanDocumentEnd().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
1038 if s.indentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentNum. != 0 {
1039 return false
1040 }
1041 if s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column. != 1 {
1042 return false
1043 }
1044 if ctx.repeatNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#repeatNum().('.') != 3 {
1045 return false
1046 }
1047
1048 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
1049 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.DocumentEndscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/DocumentEnd().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.)+"...", s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
1050 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 3)
1051 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
1052 return true
1053 }
1054
1055 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanMergeKeyscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanMergeKey().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
1056 if !s.isMergeKeyscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isMergeKey().(ctx) {
1057 return false
1058 }
1059
1060 s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. = s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column.
1061 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.MergeKeyscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/MergeKey().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.)+"<<", s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
1062 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 2)
1063 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
1064 return true
1065 }
1066
1067 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanRawFoldedCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanRawFoldedChar().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
1068 if !ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() {
1069 return false
1070 }
1071 if !s.isChangedToIndentStateUpscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isChangedToIndentStateUp().() {
1072 return false
1073 }
1074
1075 ctx.setRawFoldedscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#setRawFolded().(s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column.)
1076 ctx.addBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addBuf().('-')
1077 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().('-')
1078 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
1079 return true
1080 }
1081
1082 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanSequencescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanSequence().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) (bool, error) {
1083 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() {
1084 return false, nil
1085 }
1086
1087 nc := ctx.nextCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#nextChar().()
1088 if nc != 0 && nc != ' ' && nc != '\t' && !s.isNewLineCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isNewLineChar().(nc) {
1089 return false, nil
1090 }
1091
1092 if stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.21.0 strings/HasPrefix().(stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.TrimPrefixscip-go gomod github.com/golang/go/src go1.21.0 strings/TrimPrefix().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), " "), "\t") {
1093 invalidTk := tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().("tab character cannot use as a sequence delimiter", string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().())
1094 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
1095 return false, ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(invalidTk)
1096 }
1097
1098 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
1099 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().('-')
1100 tk := tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.SequenceEntryscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/SequenceEntry().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().())
1101 s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. = tk.Positionscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Token#Position..Columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#Column.
1102 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tk)
1103 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
1104 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
1105 return true, nil
1106 }
1107
1108 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanMultiLineHeaderscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanMultiLineHeader().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) (bool, error) {
1109 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() {
1110 return false, nil
1111 }
1112
1113 if err := s.scanMultiLineHeaderOptionscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanMultiLineHeaderOption().(ctx); err != nil {
1114 return false, err
1115 }
1116 s.progressLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressLine().(ctx)
1117 return true, nil
1118 }
1119
1120 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) validateMultiLineHeaderOptionscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#validateMultiLineHeaderOption().(opt string) error {
1121 if len(opt) == 0 {
1122 return nil
1123 }
1124 orgOpt := opt
1125 opt = stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.TrimPrefixscip-go gomod github.com/golang/go/src go1.21.0 strings/TrimPrefix().(opt, "-")
1126 opt = stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.TrimPrefixscip-go gomod github.com/golang/go/src go1.21.0 strings/TrimPrefix().(opt, "+")
1127 opt = stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.TrimSuffixscip-go gomod github.com/golang/go/src go1.21.0 strings/TrimSuffix().(opt, "-")
1128 opt = stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.TrimSuffixscip-go gomod github.com/golang/go/src go1.21.0 strings/TrimSuffix().(opt, "+")
1129 if len(opt) == 0 {
1130 return nil
1131 }
1132 if opt == "0" {
1133 return fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Errorf().("invalid header option: %q", orgOpt)
1134 }
1135 i, err := strconvscip-go gomod github.com/golang/go/src go1.21.0 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.21.0 strconv/ParseInt().(opt, 10, 64)
1136 if err != nil {
1137 return fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Errorf().("invalid header option: %q", orgOpt)
1138 }
1139 if i > 9 {
1140 return fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Errorf().("invalid header option: %q", orgOpt)
1141 }
1142 return nil
1143 }
1144
1145 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanMultiLineHeaderOptionscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanMultiLineHeaderOption().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) error {
1146 header := ctx.currentCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#currentChar().()
1147 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(header)
1148 s.progressscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progress().(ctx, 1) // skip '|' or '>' character
1149
1150 var progress int
1151 for idx, c := range ctx.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.[ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.:] {
1152 progress = idx
1153 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
1154 if s.isNewLineCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isNewLineChar().(c) {
1155 break
1156 }
1157 }
1158 value := stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.TrimRightscip-go gomod github.com/golang/go/src go1.21.0 strings/TrimRight().(ctx.sourcescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#source().(ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx., ctx.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.+progress), " ")
1159 commentValueIndex := stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.Indexscip-go gomod github.com/golang/go/src go1.21.0 strings/Index().(value, "#")
1160 opt := value
1161 if commentValueIndex > 0 {
1162 opt = value[:commentValueIndex]
1163 }
1164 opt = stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.TrimRightFuncscip-go gomod github.com/golang/go/src go1.21.0 strings/TrimRightFunc().(opt, func(r rune) bool {
1165 return r == ' ' || r == '\t'
1166 })
1167 if len(opt) != 0 {
1168 if err := s.validateMultiLineHeaderOptionscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#validateMultiLineHeaderOption().(opt); err != nil {
1169 invalidTk := tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(err.Error(), string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().())
1170 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, progress)
1171 return ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(invalidTk)
1172 }
1173 }
1174 if s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column. == 1 {
1175 s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. = 1
1176 }
1177
1178 commentIndex := stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.Indexscip-go gomod github.com/golang/go/src go1.21.0 strings/Index().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), "#")
1179 headerBuf := string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.)
1180 if commentIndex > 0 {
1181 headerBuf = headerBuf[:commentIndex]
1182 }
1183 switch header {
1184 case '|':
1185 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Literalscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Literal().("|"+opt, headerBuf, s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
1186 ctx.setLiteralscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#setLiteral().(s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn., opt)
1187 case '>':
1188 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Foldedscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Folded().(">"+opt, headerBuf, s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
1189 ctx.setFoldedscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#setFolded().(s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn., opt)
1190 }
1191 if commentIndex > 0 {
1192 comment := string(value[commentValueIndex+1:])
1193 s.offsetscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#offset. += len(headerBuf)
1194 s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column. += len(headerBuf)
1195 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Commentscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Comment().(comment, string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.[len(headerBuf):]), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
1196 }
1197 s.indentStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentState. = IndentStateKeepscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/IndentStateKeep.
1198 ctx.resetBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#resetBuffer().()
1199 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, progress)
1200 return nil
1201 }
1202
1203 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanMapKeyscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanMapKey().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
1204 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() {
1205 return false
1206 }
1207
1208 nc := ctx.nextCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#nextChar().()
1209 if nc != ' ' && nc != '\t' {
1210 return false
1211 }
1212
1213 tk := tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.MappingKeyscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/MappingKey().(s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().())
1214 s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. = tk.Positionscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Token#Position..Columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#Column.
1215 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tk)
1216 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
1217 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
1218 return true
1219 }
1220
1221 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanDirectivescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanDirective().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
1222 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() {
1223 return false
1224 }
1225 if s.indentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentNum. != 0 {
1226 return false
1227 }
1228
1229 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
1230 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().('%')
1231 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Directivescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Directive().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
1232 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
1233 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
1234 s.isDirectivescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isDirective. = true
1235 return true
1236 }
1237
1238 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanAnchorscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanAnchor().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
1239 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() {
1240 return false
1241 }
1242
1243 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
1244 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().('&')
1245 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Anchorscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Anchor().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
1246 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
1247 s.isAnchorscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isAnchor. = true
1248 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
1249 return true
1250 }
1251
1252 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanAliasscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanAlias().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bool {
1253 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() {
1254 return false
1255 }
1256
1257 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
1258 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().('*')
1259 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Aliasscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Alias().(string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
1260 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
1261 s.isAliasscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isAlias. = true
1262 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
1263 return true
1264 }
1265
1266 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanReservedCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanReservedChar().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#, c rune) error {
1267 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() {
1268 return nil
1269 }
1270
1271 ctx.addBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addBuf().(c)
1272 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
1273 err := ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
1274 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(
1275 fmtscip-go gomod github.com/golang/go/src go1.21.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21.0 fmt/Sprintf().("%q is a reserved character", c),
1276 string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().(),
1277 ),
1278 )
1279 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
1280 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
1281 return err
1282 }
1283
1284 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanTabscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanTab().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#, c rune) error {
1285 if s.startedFlowSequenceNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowSequenceNum. > 0 || s.startedFlowMapNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#startedFlowMapNum. > 0 {
1286 // tabs character is allowed in flow mode.
1287 return nil
1288 }
1289
1290 if !s.isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. {
1291 return nil
1292 }
1293
1294 ctx.addBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addBuf().(c)
1295 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
1296 err := ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
1297 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().("found character '\t' that cannot start any token",
1298 string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().(),
1299 ),
1300 )
1301 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
1302 ctx.clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().()
1303 return err
1304 }
1305
1306 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) scanscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scan().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) error {
1307 for ctx.nextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#next().() {
1308 c := ctx.currentCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#currentChar().()
1309 // First, change the IndentState.
1310 // If the target character is the first character in a line, IndentState is Up/Down/Equal state.
1311 // The second and subsequent letters are Keep.
1312 s.updateIndentscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#updateIndent().(ctx, c)
1313
1314 // If IndentState is down, tokens are split, so the buffer accumulated until that point needs to be cutted as a token.
1315 if s.isChangedToIndentStateDownscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isChangedToIndentStateDown().() {
1316 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
1317 }
1318 if ctx.isMultiLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#isMultiLine().() {
1319 if s.isChangedToIndentStateDownscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isChangedToIndentStateDown().() {
1320 if tk := ctx.lastTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#lastToken().(); tk != nil {
1321 // If literal/folded content is empty, no string token is added.
1322 // Therefore, add an empty string token.
1323 // But if literal/folded token column is 1, it is invalid at down state.
1324 if tk.Positionscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Token#Position..Columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Position#Column. == 1 {
1325 return ErrInvalidTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ErrInvalidToken().(
1326 tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Invalidscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Invalid().(
1327 "could not find multi-line content",
1328 string(ctx.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().(),
1329 ),
1330 )
1331 }
1332 if tk.Typescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Token#Type. != tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.StringTypescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/StringType. {
1333 ctx.addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Stringscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/String().("", "", s.posscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#pos().()))
1334 }
1335 }
1336 s.breakMultiLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#breakMultiLine().(ctx)
1337 } else {
1338 if err := s.scanMultiLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanMultiLine().(ctx, c); err != nil {
1339 return err
1340 }
1341 continue
1342 }
1343 }
1344 switch c {
1345 case '{':
1346 if s.scanFlowMapStartscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanFlowMapStart().(ctx) {
1347 continue
1348 }
1349 case '}':
1350 if s.scanFlowMapEndscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanFlowMapEnd().(ctx) {
1351 continue
1352 }
1353 case '.':
1354 if s.scanDocumentEndscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanDocumentEnd().(ctx) {
1355 continue
1356 }
1357 case '<':
1358 if s.scanMergeKeyscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanMergeKey().(ctx) {
1359 continue
1360 }
1361 case '-':
1362 if s.scanDocumentStartscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanDocumentStart().(ctx) {
1363 continue
1364 }
1365 if s.scanRawFoldedCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanRawFoldedChar().(ctx) {
1366 continue
1367 }
1368 scanned, err := s.scanSequencescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanSequence().(ctx)
1369 if err != nil {
1370 return err
1371 }
1372 if scanned {
1373 continue
1374 }
1375 case '[':
1376 if s.scanFlowArrayStartscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanFlowArrayStart().(ctx) {
1377 continue
1378 }
1379 case ']':
1380 if s.scanFlowArrayEndscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanFlowArrayEnd().(ctx) {
1381 continue
1382 }
1383 case ',':
1384 if s.scanFlowEntryscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanFlowEntry().(ctx, c) {
1385 continue
1386 }
1387 case ':':
1388 scanned, err := s.scanMapDelimscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanMapDelim().(ctx)
1389 if err != nil {
1390 return err
1391 }
1392 if scanned {
1393 continue
1394 }
1395 case '|', '>':
1396 scanned, err := s.scanMultiLineHeaderscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanMultiLineHeader().(ctx)
1397 if err != nil {
1398 return err
1399 }
1400 if scanned {
1401 continue
1402 }
1403 case '!':
1404 scanned, err := s.scanTagscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanTag().(ctx)
1405 if err != nil {
1406 return err
1407 }
1408 if scanned {
1409 continue
1410 }
1411 case '%':
1412 if s.scanDirectivescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanDirective().(ctx) {
1413 continue
1414 }
1415 case '?':
1416 if s.scanMapKeyscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanMapKey().(ctx) {
1417 continue
1418 }
1419 case '&':
1420 if s.scanAnchorscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanAnchor().(ctx) {
1421 continue
1422 }
1423 case '*':
1424 if s.scanAliasscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanAlias().(ctx) {
1425 continue
1426 }
1427 case '#':
1428 if s.scanCommentscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanComment().(ctx) {
1429 continue
1430 }
1431 case '\'', '"':
1432 scanned, err := s.scanQuotescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanQuote().(ctx, c)
1433 if err != nil {
1434 return err
1435 }
1436 if scanned {
1437 continue
1438 }
1439 case '\r', '\n':
1440 s.scanNewLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanNewLine().(ctx, c)
1441 continue
1442 case ' ':
1443 if s.scanWhiteSpacescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanWhiteSpace().(ctx) {
1444 continue
1445 }
1446 case '@', '`':
1447 if err := s.scanReservedCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanReservedChar().(ctx, c); err != nil {
1448 return err
1449 }
1450 case '\t':
1451 if ctx.existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() && s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. == 0 {
1452 // tab indent for plain text (yaml-test-suite's spec-example-7-12-plain-lines).
1453 s.indentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentNum.++
1454 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
1455 s.progressOnlyscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressOnly().(ctx, 1)
1456 continue
1457 }
1458 if s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. < s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column. {
1459 s.indentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentNum.++
1460 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
1461 s.progressOnlyscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressOnly().(ctx, 1)
1462 continue
1463 }
1464 if err := s.scanTabscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scanTab().(ctx, c); err != nil {
1465 return err
1466 }
1467 }
1468 ctx.addBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addBuf().(c)
1469 ctx.addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(c)
1470 s.progressColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#progressColumn().(ctx, 1)
1471 }
1472 s.addBufferedTokenIfExistsscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#addBufferedTokenIfExists().(ctx)
1473 return nil
1474 }
1475
1476 // Init prepares the scanner s to tokenize the text src by setting the scanner at the beginning of src.
1477 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) Initscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#Init().(text string) {
1478 src := []rune(text)
1479 s.sourcescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#source. = src
1480 s.sourcePosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#sourcePos. = 0
1481 s.sourceSizescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#sourceSize. = len(src)
1482 s.linescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#line. = 1
1483 s.columnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#column. = 1
1484 s.offsetscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#offset. = 1
1485 s.isFirstCharAtLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#isFirstCharAtLine. = true
1486 s.clearStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#clearState().()
1487 }
1488
1489 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) clearStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#clearState().() {
1490 s.prevLineIndentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#prevLineIndentNum. = 0
1491 s.lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#lastDelimColumn. = 0
1492 s.indentLevelscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentLevel. = 0
1493 s.indentNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#indentNum. = 0
1494 }
1495
1496 // Scan scans the next token and returns the token collection. The source end is indicated by io.EOF.
1497 func (s *Scannerscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#) Scanscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#Scan().() (tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Tokensscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Tokens#, error) {
1498 if s.sourcePosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#sourcePos. >= s.sourceSizescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#sourceSize. {
1499 return nil, ioscip-go gomod github.com/golang/go/src go1.21.0 io/.EOFscip-go gomod github.com/golang/go/src go1.21.0 io/EOF.
1500 }
1501 ctx := newContextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/newContext().(s.sourcescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#source.[s.sourcePosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#sourcePos.:])
1502 defer ctx.releasescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#release().()
1503
1504 var tokens tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Tokensscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Tokens#
1505 err := s.scanscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Scanner#scan().(ctx)
1506 tokens = append(tokens, ctx.tokensscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#tokens....)
1507
1508 if err != nil {
1509 var invalidTokenErr *InvalidTokenErrorscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/InvalidTokenError#
1510 if errorsscip-go gomod github.com/golang/go/src go1.21.0 errors/.Asscip-go gomod github.com/golang/go/src go1.21.0 errors/As().(err, &invalidTokenErr) {
1511 tokens = append(tokens, invalidTokenErr.Tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/InvalidTokenError#Token.)
1512 }
1513 return tokens, err
1514 }
1515 return tokens, nil
1516 }