MCPcopy Index your code
hub / github.com/bigskysoftware/_hyperscript / parse

Method parse

www/js/_hyperscript.js:4550–4565  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

4548 this.args = { lhs, rhs };
4549 }
4550 static parse(parser) {
4551 var expr = parser.parseElement("collectionExpression");
4552 var mathOp, initialMathOp = null;
4553 mathOp = parser.matchAnyOpToken("+", "-", "*", "/") || parser.matchToken("mod");
4554 while (mathOp) {
4555 initialMathOp = initialMathOp || mathOp;
4556 var operator = mathOp.value;
4557 if (initialMathOp.value !== operator) {
4558 parser.raiseError("You must parenthesize math operations with different operators");
4559 }
4560 var rhs = parser.parseElement("collectionExpression");
4561 expr = new _MathOperator(expr, operator, rhs);
4562 mathOp = parser.matchAnyOpToken("+", "-", "*", "/") || parser.matchToken("mod");
4563 }
4564 return expr;
4565 }
4566 resolve(context, { lhs: lhsVal, rhs: rhsVal }) {
4567 if (this.operator === "+") {
4568 if (Array.isArray(lhsVal)) return lhsVal.concat(rhsVal);

Callers

nothing calls this directly

Calls 4

parseElementMethod · 0.45
matchAnyOpTokenMethod · 0.45
matchTokenMethod · 0.45
raiseErrorMethod · 0.45

Tested by

no test coverage detected