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

Method parse

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

Source from the content-addressed store, hash-verified

960 this.args = args;
961 }
962 static parse(parser) {
963 var token;
964 if (token = parser.matchTokenType("STRING")) {
965 return new _ObjectKey(token.value, null, null);
966 } else if (parser.matchOpToken("[")) {
967 var expr = parser.parseElement("expression");
968 parser.requireOpToken("]");
969 return new _ObjectKey(null, expr, { value: expr });
970 } else {
971 var key = "";
972 do {
973 token = parser.matchTokenType("IDENTIFIER") || parser.matchOpToken("-");
974 if (token) key += token.value;
975 } while (token);
976 return new _ObjectKey(key, null, null);
977 }
978 }
979 evalStatically() {
980 if (!this.expr) return this.key;
981 return super.evalStatically();

Callers

nothing calls this directly

Calls 4

matchTokenTypeMethod · 0.45
matchOpTokenMethod · 0.45
parseElementMethod · 0.45
requireOpTokenMethod · 0.45

Tested by

no test coverage detected