MCPcopy
hub / github.com/pquerna/ffjson / lexComment

Method lexComment

fflib/v1/lexer.go:213–258  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

211}
212
213func (ffl *FFLexer) lexComment() FFTok {
214 c, err := ffl.readByte()
215 if err != nil {
216 return FFTok_error
217 }
218
219 if c == '/' {
220 // a // comment, scan until line ends.
221 for {
222 c, err := ffl.readByte()
223 if err != nil {
224 return FFTok_error
225 }
226
227 if c == '\n' {
228 return FFTok_comment
229 }
230 }
231 } else if c == '*' {
232 // a /* */ comment, scan */
233 for {
234 c, err := ffl.readByte()
235 if err != nil {
236 return FFTok_error
237 }
238
239 if c == '*' {
240 c, err := ffl.readByte()
241
242 if err != nil {
243 return FFTok_error
244 }
245
246 if c == '/' {
247 return FFTok_comment
248 }
249
250 ffl.Error = FFErr_incomplete_comment
251 return FFTok_error
252 }
253 }
254 } else {
255 ffl.Error = FFErr_incomplete_comment
256 return FFTok_error
257 }
258}
259
260func (ffl *FFLexer) lexString() FFTok {
261 if ffl.captureAll {

Callers 1

ScanMethod · 0.95

Calls 1

readByteMethod · 0.95

Tested by

no test coverage detected