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

Method parse

tools/common/_hyperscript.iife.js:3855–3891  ·  view source on GitHub ↗
(parser, root)

Source from the content-addressed store, hash-verified

3853 this._isComputed = urRoot.type === "computedStyleRef";
3854 }
3855 static parse(parser, root) {
3856 if (!parser.matchToken("of")) return;
3857 var newRoot = parser.requireElement("unaryExpression");
3858 var childOfUrRoot = null;
3859 var urRoot = root;
3860 while (urRoot.root) {
3861 childOfUrRoot = urRoot;
3862 urRoot = urRoot.root;
3863 }
3864 var validOfRoots = ["symbol", "attributeRef", "styleRef", "computedStyleRef"];
3865 if (!validOfRoots.includes(urRoot.type)) {
3866 parser.raiseError("Cannot take a property of a non-symbol: " + urRoot.type);
3867 }
3868 var attribute = urRoot.type === "attributeRef";
3869 var style = urRoot.type === "styleRef" || urRoot.type === "computedStyleRef";
3870 var attributeElt = attribute || style ? urRoot : null;
3871 var prop = urRoot.name;
3872 var propertyAccess = new _OfExpression(
3873 urRoot.token,
3874 // can be undefined for attributeRef
3875 newRoot,
3876 attributeElt,
3877 root,
3878 { root: newRoot },
3879 urRoot
3880 );
3881 if (urRoot.type === "attributeRef") {
3882 propertyAccess.attribute = urRoot;
3883 }
3884 if (childOfUrRoot) {
3885 childOfUrRoot.root = propertyAccess;
3886 childOfUrRoot.args = { root: propertyAccess };
3887 } else {
3888 root = propertyAccess;
3889 }
3890 return parser.parseElement("indirectExpression", root);
3891 }
3892 resolve(context, { root: rootVal }) {
3893 if (this._isAttribute) {
3894 return context.meta.runtime.resolveAttribute(rootVal, this._prop);

Callers

nothing calls this directly

Calls 4

matchTokenMethod · 0.45
requireElementMethod · 0.45
raiseErrorMethod · 0.45
parseElementMethod · 0.45

Tested by

no test coverage detected