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

Method parse

tools/common/_hyperscript.iife.js:4225–4240  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

4223 this.args = { lhs, rhs };
4224 }
4225 static parse(parser) {
4226 var expr = parser.parseElement("unaryExpression");
4227 var mathOp, initialMathOp = null;
4228 mathOp = parser.matchAnyOpToken("+", "-", "*", "/") || parser.matchToken("mod");
4229 while (mathOp) {
4230 initialMathOp = initialMathOp || mathOp;
4231 var operator = mathOp.value;
4232 if (initialMathOp.value !== operator) {
4233 parser.raiseError("You must parenthesize math operations with different operators");
4234 }
4235 var rhs = parser.parseElement("unaryExpression");
4236 expr = new _MathOperator(expr, operator, rhs);
4237 mathOp = parser.matchAnyOpToken("+", "-", "*", "/") || parser.matchToken("mod");
4238 }
4239 return expr;
4240 }
4241 resolve(context, { lhs: lhsVal, rhs: rhsVal }) {
4242 if (this.operator === "+") {
4243 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