lexCommand lexes a single command. Commands can either be unquoted and on a single line, or quoted and span multiple lines.
(l *lexer)
| 465 | // lexCommand lexes a single command. Commands can either be unquoted and on a |
| 466 | // single line, or quoted and span multiple lines. |
| 467 | func lexCommand(l *lexer) stateFn { |
| 468 | for { |
| 469 | n := l.next() |
| 470 | if n == '\n' { |
| 471 | l.errorf("empty command specification") |
| 472 | return nil |
| 473 | } else if any(n, quotes) { |
| 474 | err := l.acceptQuotedString(n) |
| 475 | if err != nil { |
| 476 | l.errorf("%s", err) |
| 477 | return nil |
| 478 | } |
| 479 | l.emit(itemQuotedString) |
| 480 | return lexInside |
| 481 | } else if any(n, spaces) { |
| 482 | l.acceptRun(spaces) |
| 483 | l.emit(itemSpace) |
| 484 | } else { |
| 485 | l.acceptLine(true) |
| 486 | l.emit(itemBareString) |
| 487 | return lexInside |
| 488 | } |
| 489 | } |
| 490 | } |
nothing calls this directly
no test coverage detected