MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / parse

Method parse

www/js/_hyperscript-max.js:4549–4564  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

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