Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 12212x 12212x 12212x 12212x 12212x 12212x 80x 80x 12210x 12210x 12212x 1x 1x 12210x 12212x 14x 14x 14x 14x 14x 14x 14x 14x 12210x 12210x 12210x 12210x 12212x 2x 2x 12212x | /** @import { Expression } from 'estree' */ /** @import { Parser } from '../index.js' */ import { parse_expression_at } from '../acorn.js'; import { regex_whitespace } from '../../patterns.js'; import * as e from '../../../errors.js'; /** * @param {Parser} parser * @returns {Expression} */ export default function read_expression(parser) { try { const node = parse_expression_at(parser.template, parser.ts, parser.index); let num_parens = 0; for (let i = parser.index; i < /** @type {number} */ (node.start); i += 1) { if (parser.template[i] === '(') num_parens += 1; } let index = /** @type {number} */ (node.end); if (node.trailingComments !== undefined && node.trailingComments.length > 0) { index = node.trailingComments.at(-1).end; } while (num_parens > 0) { const char = parser.template[index]; if (char === ')') { num_parens -= 1; } else if (!regex_whitespace.test(char)) { e.expected_token(index, ')'); } index += 1; } parser.index = index; return /** @type {Expression} */ (node); } catch (err) { parser.acorn_error(err); } } |