* Start of the parse levels below, in order of precedence * @return {Node} node * @private
(expression, extraNodes)
| 612 | * @private |
| 613 | */ |
| 614 | function parseStart (expression, extraNodes) { |
| 615 | const state = initialState() |
| 616 | Object.assign(state, { expression, extraNodes }) |
| 617 | getToken(state) |
| 618 | |
| 619 | const node = parseBlock(state) |
| 620 | |
| 621 | // check for garbage at the end of the expression |
| 622 | // an expression ends with a empty character '' and tokenType DELIMITER |
| 623 | if (state.token !== '') { |
| 624 | if (state.tokenType === TOKENTYPE.DELIMITER) { |
| 625 | // user entered a not existing operator like "//" |
| 626 | |
| 627 | // TODO: give hints for aliases, for example with "<>" give as hint " did you mean !== ?" |
| 628 | throw createError(state, 'Unexpected operator ' + state.token) |
| 629 | } else { |
| 630 | throw createSyntaxError(state, 'Unexpected part "' + state.token + '"') |
| 631 | } |
| 632 | } |
| 633 | |
| 634 | return node |
| 635 | } |
| 636 | |
| 637 | /** |
| 638 | * Parse a block with expressions. Expressions can be separated by a newline |
no test coverage detected
searching dependent graphs…