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

Method parse

www/js/_hyperscript.esm.js:967–983  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

965 this.args = args;
966 }
967 static parse(parser) {
968 var token;
969 if (token = parser.matchTokenType("STRING")) {
970 return new _ObjectKey(token.value, null, null);
971 } else if (parser.matchOpToken("[")) {
972 var expr = parser.parseElement("expression");
973 parser.requireOpToken("]");
974 return new _ObjectKey(null, expr, { value: expr });
975 } else {
976 var key = "";
977 do {
978 token = parser.matchTokenType("IDENTIFIER") || parser.matchOpToken("-");
979 if (token) key += token.value;
980 } while (token);
981 return new _ObjectKey(key, null, null);
982 }
983 }
984 evalStatically() {
985 if (!this.expr) return this.key;
986 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