(state)
| 12473 | } |
| 12474 | |
| 12475 | function readDocument(state) { |
| 12476 | var documentStart = state.position, |
| 12477 | _position, |
| 12478 | directiveName, |
| 12479 | directiveArgs, |
| 12480 | hasDirectives = false, |
| 12481 | ch; |
| 12482 | |
| 12483 | state.version = null; |
| 12484 | state.checkLineBreaks = state.legacy; |
| 12485 | state.tagMap = {}; |
| 12486 | state.anchorMap = {}; |
| 12487 | |
| 12488 | while ((ch = state.input.charCodeAt(state.position)) !== 0) { |
| 12489 | skipSeparationSpace(state, true, -1); |
| 12490 | |
| 12491 | ch = state.input.charCodeAt(state.position); |
| 12492 | |
| 12493 | if (state.lineIndent > 0 || ch !== 0x25/* % */) { |
| 12494 | break; |
| 12495 | } |
| 12496 | |
| 12497 | hasDirectives = true; |
| 12498 | ch = state.input.charCodeAt(++state.position); |
| 12499 | _position = state.position; |
| 12500 | |
| 12501 | while (ch !== 0 && !is_WS_OR_EOL(ch)) { |
| 12502 | ch = state.input.charCodeAt(++state.position); |
| 12503 | } |
| 12504 | |
| 12505 | directiveName = state.input.slice(_position, state.position); |
| 12506 | directiveArgs = []; |
| 12507 | |
| 12508 | if (directiveName.length < 1) { |
| 12509 | throwError(state, 'directive name must not be less than one character in length'); |
| 12510 | } |
| 12511 | |
| 12512 | while (ch !== 0) { |
| 12513 | while (is_WHITE_SPACE(ch)) { |
| 12514 | ch = state.input.charCodeAt(++state.position); |
| 12515 | } |
| 12516 | |
| 12517 | if (ch === 0x23/* # */) { |
| 12518 | do { ch = state.input.charCodeAt(++state.position); } |
| 12519 | while (ch !== 0 && !is_EOL(ch)); |
| 12520 | break; |
| 12521 | } |
| 12522 | |
| 12523 | if (is_EOL(ch)) break; |
| 12524 | |
| 12525 | _position = state.position; |
| 12526 | |
| 12527 | while (ch !== 0 && !is_WS_OR_EOL(ch)) { |
| 12528 | ch = state.input.charCodeAt(++state.position); |
| 12529 | } |
| 12530 | |
| 12531 | directiveArgs.push(state.input.slice(_position, state.position)); |
| 12532 | } |
no test coverage detected