MCPcopy Create free account
hub / github.com/breck7/scroll / _formatCode

Method _formatCode

external/.scrollLibs.js:20166–20173  ·  view source on GitHub ↗
(code)

Source from the content-addressed store, hash-verified

20164 return this._formatCode([this._inferRootParticleForAPrefixLanguage(parsersName).toString(), atomTypeDefs.join(particleBreakSymbol), parserDefs.join(particleBreakSymbol)].filter(identity => identity).join("\n"))
20165 }
20166 _formatCode(code) {
20167 // todo: make this run in browser too
20168 if (!this.isNodeJs()) return code
20169 const parsersProgram = new HandParsersProgram(Particle.fromDisk(__dirname + "/../langs/parsers/parsers.parsers"))
20170 const rootParser = parsersProgram.compileAndReturnRootParser()
20171 const program = new rootParser(code)
20172 return program.format().toString()
20173 }
20174 _getBestAtomType(cue, instanceCount, maxAtomsOnLine, allValues) {
20175 const asSet = new Set(allValues)
20176 const edgeSymbol = this.edgeSymbol

Callers 1

Calls 5

fromDiskMethod · 0.80
isNodeJsMethod · 0.45
toStringMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected