MCPcopy Index your code
hub / github.com/Shopify/go-lua / readMultiLine

Method readMultiLine

scanner.go:167–202  ·  view source on GitHub ↗
(comment bool, sep int)

Source from the content-addressed store, hash-verified

165}
166
167func (s *scanner) readMultiLine(comment bool, sep int) (str string) {
168 if s.saveAndAdvance(); isNewLine(s.current) {
169 s.incrementLineNumber()
170 }
171 for {
172 switch s.current {
173 case endOfStream:
174 if comment {
175 s.scanError("unfinished long comment", tkEOS)
176 } else {
177 s.scanError("unfinished long string", tkEOS)
178 }
179 case ']':
180 if s.skipSeparator() == sep {
181 s.saveAndAdvance()
182 if !comment {
183 str = s.buffer.String()
184 str = str[2+sep : len(str)-(2+sep)]
185 }
186 s.buffer.Reset()
187 return
188 }
189 case '\r':
190 s.current = '\n'
191 fallthrough
192 case '\n':
193 s.save(s.current)
194 s.incrementLineNumber()
195 default:
196 if !comment {
197 s.save(s.current)
198 }
199 s.advance()
200 }
201 }
202}
203
204func (s *scanner) readDigits() (c rune) {
205 for c = s.current; isDecimal(c); c = s.current {

Callers 1

scanMethod · 0.95

Calls 8

saveAndAdvanceMethod · 0.95
incrementLineNumberMethod · 0.95
scanErrorMethod · 0.95
skipSeparatorMethod · 0.95
saveMethod · 0.95
advanceMethod · 0.95
isNewLineFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected