(state)
| 2444 | } |
| 2445 | |
| 2446 | function readDocument(state) { |
| 2447 | var documentStart = state.position, |
| 2448 | _position, |
| 2449 | directiveName, |
| 2450 | directiveArgs, |
| 2451 | hasDirectives = false, |
| 2452 | ch; |
| 2453 | |
| 2454 | state.version = null; |
| 2455 | state.checkLineBreaks = state.legacy; |
| 2456 | state.tagMap = {}; |
| 2457 | state.anchorMap = {}; |
| 2458 | |
| 2459 | while ((ch = state.input.charCodeAt(state.position)) !== 0) { |
| 2460 | skipSeparationSpace(state, true, -1); |
| 2461 | |
| 2462 | ch = state.input.charCodeAt(state.position); |
| 2463 | |
| 2464 | if (state.lineIndent > 0 || ch !== 0x25/* % */) { |
| 2465 | break; |
| 2466 | } |
| 2467 | |
| 2468 | hasDirectives = true; |
| 2469 | ch = state.input.charCodeAt(++state.position); |
| 2470 | _position = state.position; |
| 2471 | |
| 2472 | while (ch !== 0 && !is_WS_OR_EOL(ch)) { |
| 2473 | ch = state.input.charCodeAt(++state.position); |
| 2474 | } |
| 2475 | |
| 2476 | directiveName = state.input.slice(_position, state.position); |
| 2477 | directiveArgs = []; |
| 2478 | |
| 2479 | if (directiveName.length < 1) { |
| 2480 | throwError(state, 'directive name must not be less than one character in length'); |
| 2481 | } |
| 2482 | |
| 2483 | while (ch !== 0) { |
| 2484 | while (is_WHITE_SPACE(ch)) { |
| 2485 | ch = state.input.charCodeAt(++state.position); |
| 2486 | } |
| 2487 | |
| 2488 | if (ch === 0x23/* # */) { |
| 2489 | do { ch = state.input.charCodeAt(++state.position); } |
| 2490 | while (ch !== 0 && !is_EOL(ch)); |
| 2491 | break; |
| 2492 | } |
| 2493 | |
| 2494 | if (is_EOL(ch)) break; |
| 2495 | |
| 2496 | _position = state.position; |
| 2497 | |
| 2498 | while (ch !== 0 && !is_WS_OR_EOL(ch)) { |
| 2499 | ch = state.input.charCodeAt(++state.position); |
| 2500 | } |
| 2501 | |
| 2502 | directiveArgs.push(state.input.slice(_position, state.position)); |
| 2503 | } |
no test coverage detected