MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / constructor

Method constructor

contributed/jsonparser/jsonparser.js:156–163  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

154 // The VPT class constructor initializes with an optional matcher or patterns, always invoking 'begin' for the matcher and only for patterns matching the root pattern.
155 // Note: Instances of VPT with a matcher or patterns cannot be shared; VPT constructor must execute for each new parser.
156 constructor(options) {
157 if (options === undefined)
158 throw new Error("invalid options");
159 this.node = this.makeNode(NodeType.root);
160 this.matcher = options.matcher;
161 this.patterns = options.patterns;
162 this.doEvent("onBegin");
163 }
164
165 // Execute 'matcher events' unconditionally and 'pattern events' selectively when nodes match a pattern.
166 doEvent(event) {

Callers

nothing calls this directly

Calls 2

makeNodeMethod · 0.95
doEventMethod · 0.95

Tested by

no test coverage detected