| 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 | "strconvscip-go gomod github.com/golang/go/src go1.21.0 strconv/" |
| 6 | "stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/" |
| 7 | "syncscip-go gomod github.com/golang/go/src go1.21.0 sync/" |
| 8 | |
| 9 | "github.com/goccy/go-yaml/tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/" |
| 10 | ) |
| 11 | |
| 12 | // Context context at scanning |
| 13 | type Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context# struct { |
| 14 | idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx. int |
| 15 | sizescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#size. int |
| 16 | notSpaceCharPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#notSpaceCharPos. int |
| 17 | notSpaceOrgCharPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#notSpaceOrgCharPos. int |
| 18 | srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src. []rune |
| 19 | bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf. []rune |
| 20 | obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf. []rune |
| 21 | tokensscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#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# |
| 22 | mstatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#mstate. *MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState# |
| 23 | } |
| 24 | |
| 25 | type MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState# struct { |
| 26 | optscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#opt. string |
| 27 | firstLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#firstLineIndentColumn. int |
| 28 | prevLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#prevLineIndentColumn. int |
| 29 | lineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#lineIndentColumn. int |
| 30 | lastNotSpaceOnlyLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#lastNotSpaceOnlyLineIndentColumn. int |
| 31 | spaceOnlyIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#spaceOnlyIndentColumn. int |
| 32 | foldedNewLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#foldedNewLine. bool |
| 33 | isRawFoldedscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#isRawFolded. bool |
| 34 | isLiteralscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#isLiteral. bool |
| 35 | isFoldedscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#isFolded. bool |
| 36 | } |
| 37 | |
| 38 | var ( |
| 39 | ctxPoolscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ctxPool. = syncscip-go gomod github.com/golang/go/src go1.21.0 sync/.Poolscip-go gomod github.com/golang/go/src go1.21.0 sync/Pool#{ |
| 40 | Newscip-go gomod github.com/golang/go/src go1.21.0 sync/Pool#New.: func() interface{} { |
| 41 | return createContextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/createContext().() |
| 42 | }, |
| 43 | } |
| 44 | ) |
| 45 | |
| 46 | func createContextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/createContext().() *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context# { |
| 47 | return &Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#{ |
| 48 | idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.: 0, |
| 49 | tokensscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#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#{}, |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | func newContextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/newContext().(src []rune) *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context# { |
| 54 | ctx, _ := ctxPoolscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ctxPool..Getscip-go gomod github.com/golang/go/src go1.21.0 sync/Pool#Get().().(*Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) |
| 55 | ctx.resetscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#reset().(src) |
| 56 | return ctx |
| 57 | } |
| 58 | |
| 59 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) releasescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#release().() { |
| 60 | ctxPoolscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/ctxPool..Putscip-go gomod github.com/golang/go/src go1.21.0 sync/Pool#Put().(c) |
| 61 | } |
| 62 | |
| 63 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) clearscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#clear().() { |
| 64 | c.resetBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#resetBuffer().() |
| 65 | c.mstatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#mstate. = nil |
| 66 | } |
| 67 | |
| 68 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) resetscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#reset().(src []rune) { |
| 69 | c.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx. = 0 |
| 70 | c.sizescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#size. = len(src) |
| 71 | c.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src. = src |
| 72 | c.tokensscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#tokens. = c.tokensscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#tokens.[:0] |
| 73 | c.resetBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#resetBuffer().() |
| 74 | c.mstatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#mstate. = nil |
| 75 | } |
| 76 | |
| 77 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) resetBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#resetBuffer().() { |
| 78 | c.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf. = c.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.[:0] |
| 79 | c.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf. = c.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.[:0] |
| 80 | c.notSpaceCharPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#notSpaceCharPos. = 0 |
| 81 | c.notSpaceOrgCharPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#notSpaceOrgCharPos. = 0 |
| 82 | } |
| 83 | |
| 84 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) breakMultiLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#breakMultiLine().() { |
| 85 | c.mstatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#mstate. = nil |
| 86 | } |
| 87 | |
| 88 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) getMultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#getMultiLineState().() *MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState# { |
| 89 | return c.mstatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#mstate. |
| 90 | } |
| 91 | |
| 92 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) setLiteralscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#setLiteral().(lastDelimColumn int, opt string) { |
| 93 | mstate := &MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#{ |
| 94 | isLiteralscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#isLiteral.: true, |
| 95 | optscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#opt.: opt, |
| 96 | } |
| 97 | indent := firstLineIndentColumnByOptscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/firstLineIndentColumnByOpt().(opt) |
| 98 | if indent > 0 { |
| 99 | mstate.firstLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#firstLineIndentColumn. = lastDelimColumn + indent |
| 100 | } |
| 101 | c.mstatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#mstate. = mstate |
| 102 | } |
| 103 | |
| 104 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) setFoldedscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#setFolded().(lastDelimColumn int, opt string) { |
| 105 | mstate := &MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#{ |
| 106 | isFoldedscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#isFolded.: true, |
| 107 | optscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#opt.: opt, |
| 108 | } |
| 109 | indent := firstLineIndentColumnByOptscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/firstLineIndentColumnByOpt().(opt) |
| 110 | if indent > 0 { |
| 111 | mstate.firstLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#firstLineIndentColumn. = lastDelimColumn + indent |
| 112 | } |
| 113 | c.mstatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#mstate. = mstate |
| 114 | } |
| 115 | |
| 116 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) setRawFoldedscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#setRawFolded().(column int) { |
| 117 | mstate := &MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#{ |
| 118 | isRawFoldedscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#isRawFolded.: true, |
| 119 | } |
| 120 | mstate.updateIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#updateIndentColumn().(column) |
| 121 | c.mstatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#mstate. = mstate |
| 122 | } |
| 123 | |
| 124 | func firstLineIndentColumnByOptscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/firstLineIndentColumnByOpt().(opt string) int { |
| 125 | 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, "-") |
| 126 | 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, "+") |
| 127 | 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, "-") |
| 128 | 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, "+") |
| 129 | i, _ := 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) |
| 130 | return int(i) |
| 131 | } |
| 132 | |
| 133 | func (s *MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#) lastDelimColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#lastDelimColumn().() int { |
| 134 | if s.firstLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#firstLineIndentColumn. == 0 { |
| 135 | return 0 |
| 136 | } |
| 137 | return s.firstLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#firstLineIndentColumn. - 1 |
| 138 | } |
| 139 | |
| 140 | func (s *MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#) updateIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#updateIndentColumn().(column int) { |
| 141 | if s.firstLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#firstLineIndentColumn. == 0 { |
| 142 | s.firstLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#firstLineIndentColumn. = column |
| 143 | } |
| 144 | if s.lineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#lineIndentColumn. == 0 { |
| 145 | s.lineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#lineIndentColumn. = column |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | func (s *MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#) updateSpaceOnlyIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#updateSpaceOnlyIndentColumn().(column int) { |
| 150 | if s.firstLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#firstLineIndentColumn. != 0 { |
| 151 | return |
| 152 | } |
| 153 | s.spaceOnlyIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#spaceOnlyIndentColumn. = column |
| 154 | } |
| 155 | |
| 156 | func (s *MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#) validateIndentAfterSpaceOnlyscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#validateIndentAfterSpaceOnly().(column int) error { |
| 157 | if s.firstLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#firstLineIndentColumn. != 0 { |
| 158 | return nil |
| 159 | } |
| 160 | if s.spaceOnlyIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#spaceOnlyIndentColumn. > column { |
| 161 | return errorsscip-go gomod github.com/golang/go/src go1.21.0 errors/.Newscip-go gomod github.com/golang/go/src go1.21.0 errors/New().("invalid number of indent is specified after space only") |
| 162 | } |
| 163 | return nil |
| 164 | } |
| 165 | |
| 166 | func (s *MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#) validateIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#validateIndentColumn().() error { |
| 167 | if firstLineIndentColumnByOptscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/firstLineIndentColumnByOpt().(s.optscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#opt.) == 0 { |
| 168 | return nil |
| 169 | } |
| 170 | if s.firstLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#firstLineIndentColumn. > s.lineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#lineIndentColumn. { |
| 171 | return errorsscip-go gomod github.com/golang/go/src go1.21.0 errors/.Newscip-go gomod github.com/golang/go/src go1.21.0 errors/New().("invalid number of indent is specified in the multi-line header") |
| 172 | } |
| 173 | return nil |
| 174 | } |
| 175 | |
| 176 | func (s *MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#) updateNewLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#updateNewLineState().() { |
| 177 | s.prevLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#prevLineIndentColumn. = s.lineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#lineIndentColumn. |
| 178 | if s.lineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#lineIndentColumn. != 0 { |
| 179 | s.lastNotSpaceOnlyLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#lastNotSpaceOnlyLineIndentColumn. = s.lineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#lineIndentColumn. |
| 180 | } |
| 181 | s.foldedNewLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#foldedNewLine. = true |
| 182 | s.lineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#lineIndentColumn. = 0 |
| 183 | } |
| 184 | |
| 185 | func (s *MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#) isIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#isIndentColumn().(column int) bool { |
| 186 | if s.firstLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#firstLineIndentColumn. == 0 { |
| 187 | return column == 1 |
| 188 | } |
| 189 | return s.firstLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#firstLineIndentColumn. > column |
| 190 | } |
| 191 | |
| 192 | func (s *MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#) addIndentscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#addIndent().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#, column int) { |
| 193 | if s.firstLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#firstLineIndentColumn. == 0 { |
| 194 | return |
| 195 | } |
| 196 | |
| 197 | // If the first line of the document has already been evaluated, the number is treated as the threshold, since the `firstLineIndentColumn` is a positive number. |
| 198 | if column < s.firstLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#firstLineIndentColumn. { |
| 199 | return |
| 200 | } |
| 201 | |
| 202 | // `c.foldedNewLine` is a variable that is set to true for every newline. |
| 203 | if !s.isLiteralscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#isLiteral. && s.foldedNewLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#foldedNewLine. { |
| 204 | s.foldedNewLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#foldedNewLine. = false |
| 205 | } |
| 206 | // Since addBuf ignore space character, add to the buffer directly. |
| 207 | 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., ' ') |
| 208 | ctx.notSpaceCharPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#notSpaceCharPos. = len(ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.) |
| 209 | } |
| 210 | |
| 211 | // updateNewLineInFolded if Folded or RawFolded context and the content on the current line starts at the same column as the previous line, |
| 212 | // treat the new-line-char as a space. |
| 213 | func (s *MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#) updateNewLineInFoldedscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#updateNewLineInFolded().(ctx *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#, column int) { |
| 214 | if s.isLiteralscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#isLiteral. { |
| 215 | return |
| 216 | } |
| 217 | |
| 218 | // Folded or RawFolded. |
| 219 | |
| 220 | if !s.foldedNewLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#foldedNewLine. { |
| 221 | return |
| 222 | } |
| 223 | var ( |
| 224 | lastChar rune |
| 225 | prevLastChar rune |
| 226 | ) |
| 227 | if len(ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.) != 0 { |
| 228 | lastChar = 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] |
| 229 | } |
| 230 | if len(ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.) > 1 { |
| 231 | prevLastChar = 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.)-2] |
| 232 | } |
| 233 | if s.lineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#lineIndentColumn. == s.prevLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#prevLineIndentColumn. { |
| 234 | // --- |
| 235 | // > |
| 236 | // a |
| 237 | // b |
| 238 | if lastChar == '\n' { |
| 239 | 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] = ' ' |
| 240 | } |
| 241 | } else if s.prevLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#prevLineIndentColumn. == 0 && s.lastNotSpaceOnlyLineIndentColumnscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#lastNotSpaceOnlyLineIndentColumn. == column { |
| 242 | // if previous line is indent-space and new-line-char only, prevLineIndentColumn is zero. |
| 243 | // In this case, last new-line-char is removed. |
| 244 | // --- |
| 245 | // > |
| 246 | // a |
| 247 | // |
| 248 | // b |
| 249 | if lastChar == '\n' && prevLastChar == '\n' { |
| 250 | ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf. = 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] |
| 251 | ctx.notSpaceCharPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#notSpaceCharPos. = len(ctx.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.) |
| 252 | } |
| 253 | } |
| 254 | s.foldedNewLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#foldedNewLine. = false |
| 255 | } |
| 256 | |
| 257 | func (s *MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#) hasTrimAllEndNewlineOptscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#hasTrimAllEndNewlineOpt().() bool { |
| 258 | return 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().(s.optscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#opt., "-") || stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.HasSuffixscip-go gomod github.com/golang/go/src go1.21.0 strings/HasSuffix().(s.optscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#opt., "-") || s.isRawFoldedscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#isRawFolded. |
| 259 | } |
| 260 | |
| 261 | func (s *MultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#) hasKeepAllEndNewlineOptscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#hasKeepAllEndNewlineOpt().() bool { |
| 262 | return 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().(s.optscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#opt., "+") || stringsscip-go gomod github.com/golang/go/src go1.21.0 strings/.HasSuffixscip-go gomod github.com/golang/go/src go1.21.0 strings/HasSuffix().(s.optscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#opt., "+") |
| 263 | } |
| 264 | |
| 265 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) addTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addToken().(tk *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#) { |
| 266 | if tk == nil { |
| 267 | return |
| 268 | } |
| 269 | c.tokensscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#tokens. = append(c.tokensscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#tokens., tk) |
| 270 | } |
| 271 | |
| 272 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) addBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addBuf().(r rune) { |
| 273 | if len(c.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.) == 0 && (r == ' ' || r == '\t') { |
| 274 | return |
| 275 | } |
| 276 | c.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf. = append(c.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf., r) |
| 277 | if r != ' ' && r != '\t' { |
| 278 | c.notSpaceCharPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#notSpaceCharPos. = len(c.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.) |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) addBufWithTabscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addBufWithTab().(r rune) { |
| 283 | if len(c.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.) == 0 && r == ' ' { |
| 284 | return |
| 285 | } |
| 286 | c.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf. = append(c.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf., r) |
| 287 | if r != ' ' { |
| 288 | c.notSpaceCharPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#notSpaceCharPos. = len(c.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.) |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) addOriginBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#addOriginBuf().(r rune) { |
| 293 | c.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf. = append(c.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf., r) |
| 294 | if r != ' ' && r != '\t' { |
| 295 | c.notSpaceOrgCharPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#notSpaceOrgCharPos. = len(c.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.) |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) removeRightSpaceFromBufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#removeRightSpaceFromBuf().() { |
| 300 | trimmedBuf := c.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.[:c.notSpaceOrgCharPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#notSpaceOrgCharPos.] |
| 301 | buflen := len(trimmedBuf) |
| 302 | diff := len(c.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.) - buflen |
| 303 | if diff > 0 { |
| 304 | c.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf. = c.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.[:buflen] |
| 305 | c.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf. = c.bufferedSrcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#bufferedSrc().() |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) isEOSscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#isEOS().() bool { |
| 310 | return len(c.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.)-1 <= c.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx. |
| 311 | } |
| 312 | |
| 313 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) isNextEOSscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#isNextEOS().() bool { |
| 314 | return len(c.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.) <= c.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.+1 |
| 315 | } |
| 316 | |
| 317 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) nextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#next().() bool { |
| 318 | return c.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx. < c.sizescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#size. |
| 319 | } |
| 320 | |
| 321 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) sourcescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#source().(s, e int) string { |
| 322 | return string(c.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.[s:e]) |
| 323 | } |
| 324 | |
| 325 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) previousCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#previousChar().() rune { |
| 326 | if c.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx. > 0 { |
| 327 | return c.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.[c.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.-1] |
| 328 | } |
| 329 | return rune(0) |
| 330 | } |
| 331 | |
| 332 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) currentCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#currentChar().() rune { |
| 333 | if c.sizescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#size. > c.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx. { |
| 334 | return c.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.[c.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.] |
| 335 | } |
| 336 | return rune(0) |
| 337 | } |
| 338 | |
| 339 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) nextCharscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#nextChar().() rune { |
| 340 | if c.sizescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#size. > c.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.+1 { |
| 341 | return c.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.[c.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.+1] |
| 342 | } |
| 343 | return rune(0) |
| 344 | } |
| 345 | |
| 346 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) repeatNumscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#repeatNum().(r rune) int { |
| 347 | cnt := 0 |
| 348 | for i := c.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx.; i < c.sizescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#size.; i++ { |
| 349 | if c.srcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#src.[i] == r { |
| 350 | cnt++ |
| 351 | } else { |
| 352 | break |
| 353 | } |
| 354 | } |
| 355 | return cnt |
| 356 | } |
| 357 | |
| 358 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) progressscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#progress().(num int) { |
| 359 | c.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx. += num |
| 360 | } |
| 361 | |
| 362 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) existsBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#existsBuffer().() bool { |
| 363 | return len(c.bufferedSrcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#bufferedSrc().()) != 0 |
| 364 | } |
| 365 | |
| 366 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) isMultiLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#isMultiLine().() bool { |
| 367 | return c.mstatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#mstate. != nil |
| 368 | } |
| 369 | |
| 370 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bufferedSrcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#bufferedSrc().() []rune { |
| 371 | src := c.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.[:c.notSpaceCharPosscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#notSpaceCharPos.] |
| 372 | if c.isMultiLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#isMultiLine().() { |
| 373 | mstate := c.getMultiLineStatescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#getMultiLineState().() |
| 374 | // remove end '\n' character and trailing empty lines. |
| 375 | // https://yaml.org/spec/1.2.2/#8112-block-chomping-indicator |
| 376 | if mstate.hasTrimAllEndNewlineOptscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#hasTrimAllEndNewlineOpt().() { |
| 377 | // If the '-' flag is specified, all trailing newline characters will be removed. |
| 378 | src = []rune(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().(string(src), "\n")) |
| 379 | } else if !mstate.hasKeepAllEndNewlineOptscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#hasKeepAllEndNewlineOpt().() { |
| 380 | // Normally, all but one of the trailing newline characters are removed. |
| 381 | var newLineCharCount int |
| 382 | for i := len(src) - 1; i >= 0; i-- { |
| 383 | if src[i] == '\n' { |
| 384 | newLineCharCount++ |
| 385 | continue |
| 386 | } |
| 387 | break |
| 388 | } |
| 389 | removedNewLineCharCount := newLineCharCount - 1 |
| 390 | for removedNewLineCharCount > 0 { |
| 391 | src = []rune(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().(string(src), "\n")) |
| 392 | removedNewLineCharCount-- |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | // If the text ends with a space character, remove all of them. |
| 397 | if mstate.hasTrimAllEndNewlineOptscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#hasTrimAllEndNewlineOpt().() { |
| 398 | src = []rune(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().(string(src), " ")) |
| 399 | } |
| 400 | if string(src) == "\n" { |
| 401 | // If the content consists only of a newline, |
| 402 | // it can be considered as the document ending without any specified value, |
| 403 | // so it is treated as an empty string. |
| 404 | src = []rune{} |
| 405 | } |
| 406 | if mstate.hasKeepAllEndNewlineOptscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/MultiLineState#hasKeepAllEndNewlineOpt().() && len(src) == 0 { |
| 407 | src = []rune{'\n'} |
| 408 | } |
| 409 | } |
| 410 | return src |
| 411 | } |
| 412 | |
| 413 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) bufferedTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#bufferedToken().(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#) *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# { |
| 414 | if c.idxscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#idx. == 0 { |
| 415 | return nil |
| 416 | } |
| 417 | source := c.bufferedSrcscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#bufferedSrc().() |
| 418 | if len(source) == 0 { |
| 419 | c.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf. = c.bufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#buf.[:0] // clear value's buffer only. |
| 420 | return nil |
| 421 | } |
| 422 | var tk *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# |
| 423 | if c.isMultiLinescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#isMultiLine().() { |
| 424 | tk = 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(source), string(c.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), pos) |
| 425 | } else { |
| 426 | tk = tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.Newscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/New().(string(source), string(c.obufscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#obuf.), pos) |
| 427 | } |
| 428 | c.setTokenTypeByPrevTagscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#setTokenTypeByPrevTag().(tk) |
| 429 | c.resetBufferscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#resetBuffer().() |
| 430 | return tk |
| 431 | } |
| 432 | |
| 433 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) setTokenTypeByPrevTagscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#setTokenTypeByPrevTag().(tk *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#) { |
| 434 | lastTk := c.lastTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#lastToken().() |
| 435 | if lastTk == nil { |
| 436 | return |
| 437 | } |
| 438 | if lastTk.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`/.TagTypescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/TagType. { |
| 439 | return |
| 440 | } |
| 441 | tag := tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.ReservedTagKeywordscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/ReservedTagKeyword#(lastTk.Valuescip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/Token#Value.) |
| 442 | if _, exists := tokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/.ReservedTagKeywordMapscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/token`/ReservedTagKeywordMap.[tag]; !exists { |
| 443 | 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. |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | func (c *Contextscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#) lastTokenscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#lastToken().() *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# { |
| 448 | if len(c.tokensscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#tokens.) != 0 { |
| 449 | return c.tokensscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#tokens.[len(c.tokensscip-go gomod github.com/goccy/go-yaml . `github.com/goccy/go-yaml/scanner`/Context#tokens.)-1] |
| 450 | } |
| 451 | return nil |
| 452 | } |