Skip to content

Commit

Permalink
Version 101
Browse files Browse the repository at this point in the history
  • Loading branch information
breck7 committed Jan 31, 2025
1 parent 73e1a58 commit 0a9fb04
Show file tree
Hide file tree
Showing 43 changed files with 426 additions and 422 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scrollsdk",
"version": "100.3.0",
"version": "101.0.0",
"description": "This npm package includes the Particles class, the Parsers compiler-compiler, a Parsers IDE, and more, all implemented in Particles, Parsers, and TypeScript.",
"types": "./built/scrollsdk.node.d.ts",
"main": "./products/Particle.js",
Expand Down
2 changes: 1 addition & 1 deletion particle/Particle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3119,7 +3119,7 @@ class Particle extends AbstractParticle {
return str ? indent + str.replace(/\n/g, indent) : ""
}

static getVersion = () => "100.3.0"
static getVersion = () => "101.0.0"

static fromDisk(path: string): Particle {
const format = this._getFileFormat(path)
Expand Down
8 changes: 4 additions & 4 deletions products/DesignerApp.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class DesignerApp extends AbstractParticleComponentParser {
}
this.codeWidgets = []
}
createParserCombinator() {
return new Particle.ParserCombinator(undefined, {
createParserPool() {
return new Particle.ParserPool(undefined, {
githubTriangleComponent,
samplesComponent,
tableComponent,
Expand Down Expand Up @@ -432,8 +432,8 @@ class explainResultsComponent extends AbstractParticleComponentParser {
}
}
class tableComponent extends AbstractParticleComponentParser {
createParserCombinator() {
return new Particle.ParserCombinator(undefined, {
createParserPool() {
return new Particle.ParserPool(undefined, {
compiledResultsComponent: compiledResultsComponent,
executionResultsComponent: executionResultsComponent,
explainResultsComponent: explainResultsComponent
Expand Down
40 changes: 20 additions & 20 deletions products/Parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,8 @@ class ParserBackedParticle extends Particle {
this._cache_paintParticles = new Particle(this.toPaintParticles())
this._cache_programAtomTypeStringMTime = particleMTime
}
createParserCombinator() {
return this.isRoot() ? new Particle.ParserCombinator(BlobParser) : new Particle.ParserCombinator(this.parent._getParser()._getCatchAllParser(this.parent), {})
createParserPool() {
return this.isRoot() ? new Particle.ParserPool(BlobParser) : new Particle.ParserPool(this.parent._getParserPool()._getCatchAllParser(this.parent), {})
}
get parserId() {
return this.definition.parserIdFromDefinition
Expand Down Expand Up @@ -614,17 +614,17 @@ ${indent}${closeSubparticlesString}`
}
}
class BlobParser extends ParserBackedParticle {
createParserCombinator() {
return new Particle.ParserCombinator(BlobParser, {})
createParserPool() {
return new Particle.ParserPool(BlobParser, {})
}
getErrors() {
return []
}
}
// todo: can we remove this? hard to extend.
class UnknownParserParticle extends ParserBackedParticle {
createParserCombinator() {
return new Particle.ParserCombinator(UnknownParserParticle, {})
createParserPool() {
return new Particle.ParserPool(UnknownParserParticle, {})
}
getErrors() {
return [new UnknownParserError(this)]
Expand Down Expand Up @@ -1033,7 +1033,7 @@ class UnknownParserError extends AbstractParticleError {
get message() {
const particle = this.getParticle()
const parentParticle = particle.parent
const options = parentParticle._getParser().getCueOptions()
const options = parentParticle._getParserPool().getCueOptions()
return super.message + ` Invalid parser "${particle.cue}". Valid parsers are: ${Utils._listToEnglishText(options, 7)}.`
}
get atomSuggestion() {
Expand Down Expand Up @@ -1203,7 +1203,7 @@ class ParsersEnumTestParticle extends AbstractParsersAtomTestParser {
}
}
class atomTypeDefinitionParser extends AbstractExtendibleParticle {
createParserCombinator() {
createParserPool() {
const types = {}
types[ParsersConstants.regex] = ParsersRegexTestParser
types[ParsersConstants.reservedAtoms] = ParsersReservedAtomsTestParser
Expand All @@ -1216,7 +1216,7 @@ class atomTypeDefinitionParser extends AbstractExtendibleParticle {
types[ParsersConstants.max] = Particle
types[ParsersConstants.description] = Particle
types[ParsersConstants.extends] = Particle
return new Particle.ParserCombinator(undefined, types)
return new Particle.ParserPool(undefined, types)
}
get id() {
return this.getAtom(0)
Expand Down Expand Up @@ -1396,7 +1396,7 @@ class OmnifixAtomParser extends AbstractAtomParser {
}
class ParsersExampleParser extends Particle {}
class ParsersCompilerParser extends Particle {
createParserCombinator() {
createParserPool() {
const types = [
ParsersConstantsCompiler.stringTemplate,
ParsersConstantsCompiler.indentCharacter,
Expand All @@ -1409,7 +1409,7 @@ class ParsersCompilerParser extends Particle {
types.forEach(type => {
map[type] = Particle
})
return new Particle.ParserCombinator(undefined, map)
return new Particle.ParserPool(undefined, map)
}
}
class AbstractParserConstantParser extends Particle {
Expand Down Expand Up @@ -1447,7 +1447,7 @@ class AbstractParserDefinitionParser extends AbstractExtendibleParticle {
super(...arguments)
this._isLooping = false
}
createParserCombinator() {
createParserPool() {
// todo: some of these should just be on nonRootParticles
const types = [
ParsersConstants.popularity,
Expand Down Expand Up @@ -1486,7 +1486,7 @@ class AbstractParserDefinitionParser extends AbstractExtendibleParticle {
map[ParsersConstantsConstantTypes.float] = ParsersParserConstantFloat
map[ParsersConstants.compilerParser] = ParsersCompilerParser
map[ParsersConstants.example] = ParsersExampleParser
return new Particle.ParserCombinator(undefined, map, [{ regex: HandParsersProgram.parserFullRegex, parser: parserDefinitionParser }])
return new Particle.ParserPool(undefined, map, [{ regex: HandParsersProgram.parserFullRegex, parser: parserDefinitionParser }])
}
toTypeScriptInterface(used = new Set()) {
let subparticlesInterfaces = []
Expand Down Expand Up @@ -1572,7 +1572,7 @@ ${properties.join("\n")}
}
// todo: remove
get runTimeCuesInScope() {
return this._getParser().getCueOptions()
return this._getParserPool().getCueOptions()
}
_getMyAtomTypeDefs() {
const requiredAtoms = this.get(ParsersConstants.atoms)
Expand Down Expand Up @@ -1685,7 +1685,7 @@ ${properties.join("\n")}
get parserAsJavascript() {
if (this._isBlobParser())
// todo: do we need this?
return "createParserCombinator() { return new Particle.ParserCombinator(this._getBlobParserCatchAllParser())}"
return "createParserPool() { return new Particle.ParserPool(this._getBlobParserCatchAllParser())}"
const parserInfo = this._createParserInfo(this._getMyInScopeParserIds())
const myCueMap = parserInfo.cueMap
const regexRules = parserInfo.regexTests
Expand All @@ -1695,7 +1695,7 @@ ${properties.join("\n")}
const hasCues = cues.length
const catchAllParser = this.catchAllParserToJavascript
if (!hasCues && !catchAllParser && !regexRules.length) return ""
const cuesStr = hasCues ? `Object.assign(Object.assign({}, super.createParserCombinator()._getCueMapAsObject()), {` + cues.map(cue => `"${cue}" : ${myCueMap[cue].parserIdFromDefinition}`).join(",\n") + "})" : "undefined"
const cuesStr = hasCues ? `Object.assign(Object.assign({}, super.createParserPool()._getCueMapAsObject()), {` + cues.map(cue => `"${cue}" : ${myCueMap[cue].parserIdFromDefinition}`).join(",\n") + "})" : "undefined"
const regexStr = regexRules.length
? `[${regexRules
.map(rule => {
Expand All @@ -1705,8 +1705,8 @@ ${properties.join("\n")}
: "undefined"
const catchAllStr = catchAllParser ? catchAllParser : this._amIRoot() ? `this._getBlobParserCatchAllParser()` : "undefined"
const scopedParserJavascript = this.myScopedParserDefinitions.map(def => def.asJavascriptClass).join("\n\n")
return `createParserCombinator() {${scopedParserJavascript}
return new Particle.ParserCombinator(${catchAllStr}, ${cuesStr}, ${regexStr})
return `createParserPool() {${scopedParserJavascript}
return new Particle.ParserPool(${catchAllStr}, ${cuesStr}, ${regexStr})
}`
}
get myScopedParserDefinitions() {
Expand Down Expand Up @@ -1948,10 +1948,10 @@ class parserDefinitionParser extends AbstractParserDefinitionParser {}
// HandParsersProgram is a constructor that takes a parsers file, and builds a new
// constructor for new language that takes files in that language to execute, compile, etc.
class HandParsersProgram extends AbstractParserDefinitionParser {
createParserCombinator() {
createParserPool() {
const map = {}
map[ParsersConstants.comment] = Particle
return new Particle.ParserCombinator(UnknownParserParticle, map, [
return new Particle.ParserPool(UnknownParserParticle, map, [
{ regex: HandParsersProgram.blankLineRegex, parser: Particle },
{ regex: HandParsersProgram.parserFullRegex, parser: parserDefinitionParser },
{ regex: HandParsersProgram.atomTypeFullRegex, parser: atomTypeDefinitionParser }
Expand Down
40 changes: 20 additions & 20 deletions products/Parsers.ts.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,8 @@ class ParserBackedParticle extends Particle {
this._cache_paintParticles = new Particle(this.toPaintParticles())
this._cache_programAtomTypeStringMTime = particleMTime
}
createParserCombinator() {
return this.isRoot() ? new Particle.ParserCombinator(BlobParser) : new Particle.ParserCombinator(this.parent._getParser()._getCatchAllParser(this.parent), {})
createParserPool() {
return this.isRoot() ? new Particle.ParserPool(BlobParser) : new Particle.ParserPool(this.parent._getParserPool()._getCatchAllParser(this.parent), {})
}
get parserId() {
return this.definition.parserIdFromDefinition
Expand Down Expand Up @@ -612,17 +612,17 @@ ${indent}${closeSubparticlesString}`
}
}
class BlobParser extends ParserBackedParticle {
createParserCombinator() {
return new Particle.ParserCombinator(BlobParser, {})
createParserPool() {
return new Particle.ParserPool(BlobParser, {})
}
getErrors() {
return []
}
}
// todo: can we remove this? hard to extend.
class UnknownParserParticle extends ParserBackedParticle {
createParserCombinator() {
return new Particle.ParserCombinator(UnknownParserParticle, {})
createParserPool() {
return new Particle.ParserPool(UnknownParserParticle, {})
}
getErrors() {
return [new UnknownParserError(this)]
Expand Down Expand Up @@ -1031,7 +1031,7 @@ class UnknownParserError extends AbstractParticleError {
get message() {
const particle = this.getParticle()
const parentParticle = particle.parent
const options = parentParticle._getParser().getCueOptions()
const options = parentParticle._getParserPool().getCueOptions()
return super.message + ` Invalid parser "${particle.cue}". Valid parsers are: ${Utils._listToEnglishText(options, 7)}.`
}
get atomSuggestion() {
Expand Down Expand Up @@ -1201,7 +1201,7 @@ class ParsersEnumTestParticle extends AbstractParsersAtomTestParser {
}
}
class atomTypeDefinitionParser extends AbstractExtendibleParticle {
createParserCombinator() {
createParserPool() {
const types = {}
types[ParsersConstants.regex] = ParsersRegexTestParser
types[ParsersConstants.reservedAtoms] = ParsersReservedAtomsTestParser
Expand All @@ -1214,7 +1214,7 @@ class atomTypeDefinitionParser extends AbstractExtendibleParticle {
types[ParsersConstants.max] = Particle
types[ParsersConstants.description] = Particle
types[ParsersConstants.extends] = Particle
return new Particle.ParserCombinator(undefined, types)
return new Particle.ParserPool(undefined, types)
}
get id() {
return this.getAtom(0)
Expand Down Expand Up @@ -1394,7 +1394,7 @@ class OmnifixAtomParser extends AbstractAtomParser {
}
class ParsersExampleParser extends Particle {}
class ParsersCompilerParser extends Particle {
createParserCombinator() {
createParserPool() {
const types = [
ParsersConstantsCompiler.stringTemplate,
ParsersConstantsCompiler.indentCharacter,
Expand All @@ -1407,7 +1407,7 @@ class ParsersCompilerParser extends Particle {
types.forEach(type => {
map[type] = Particle
})
return new Particle.ParserCombinator(undefined, map)
return new Particle.ParserPool(undefined, map)
}
}
class AbstractParserConstantParser extends Particle {
Expand Down Expand Up @@ -1445,7 +1445,7 @@ class AbstractParserDefinitionParser extends AbstractExtendibleParticle {
super(...arguments)
this._isLooping = false
}
createParserCombinator() {
createParserPool() {
// todo: some of these should just be on nonRootParticles
const types = [
ParsersConstants.popularity,
Expand Down Expand Up @@ -1484,7 +1484,7 @@ class AbstractParserDefinitionParser extends AbstractExtendibleParticle {
map[ParsersConstantsConstantTypes.float] = ParsersParserConstantFloat
map[ParsersConstants.compilerParser] = ParsersCompilerParser
map[ParsersConstants.example] = ParsersExampleParser
return new Particle.ParserCombinator(undefined, map, [{ regex: HandParsersProgram.parserFullRegex, parser: parserDefinitionParser }])
return new Particle.ParserPool(undefined, map, [{ regex: HandParsersProgram.parserFullRegex, parser: parserDefinitionParser }])
}
toTypeScriptInterface(used = new Set()) {
let subparticlesInterfaces = []
Expand Down Expand Up @@ -1570,7 +1570,7 @@ ${properties.join("\n")}
}
// todo: remove
get runTimeCuesInScope() {
return this._getParser().getCueOptions()
return this._getParserPool().getCueOptions()
}
_getMyAtomTypeDefs() {
const requiredAtoms = this.get(ParsersConstants.atoms)
Expand Down Expand Up @@ -1683,7 +1683,7 @@ ${properties.join("\n")}
get parserAsJavascript() {
if (this._isBlobParser())
// todo: do we need this?
return "createParserCombinator() { return new Particle.ParserCombinator(this._getBlobParserCatchAllParser())}"
return "createParserPool() { return new Particle.ParserPool(this._getBlobParserCatchAllParser())}"
const parserInfo = this._createParserInfo(this._getMyInScopeParserIds())
const myCueMap = parserInfo.cueMap
const regexRules = parserInfo.regexTests
Expand All @@ -1693,7 +1693,7 @@ ${properties.join("\n")}
const hasCues = cues.length
const catchAllParser = this.catchAllParserToJavascript
if (!hasCues && !catchAllParser && !regexRules.length) return ""
const cuesStr = hasCues ? `Object.assign(Object.assign({}, super.createParserCombinator()._getCueMapAsObject()), {` + cues.map(cue => `"${cue}" : ${myCueMap[cue].parserIdFromDefinition}`).join(",\n") + "})" : "undefined"
const cuesStr = hasCues ? `Object.assign(Object.assign({}, super.createParserPool()._getCueMapAsObject()), {` + cues.map(cue => `"${cue}" : ${myCueMap[cue].parserIdFromDefinition}`).join(",\n") + "})" : "undefined"
const regexStr = regexRules.length
? `[${regexRules
.map(rule => {
Expand All @@ -1703,8 +1703,8 @@ ${properties.join("\n")}
: "undefined"
const catchAllStr = catchAllParser ? catchAllParser : this._amIRoot() ? `this._getBlobParserCatchAllParser()` : "undefined"
const scopedParserJavascript = this.myScopedParserDefinitions.map(def => def.asJavascriptClass).join("\n\n")
return `createParserCombinator() {${scopedParserJavascript}
return new Particle.ParserCombinator(${catchAllStr}, ${cuesStr}, ${regexStr})
return `createParserPool() {${scopedParserJavascript}
return new Particle.ParserPool(${catchAllStr}, ${cuesStr}, ${regexStr})
}`
}
get myScopedParserDefinitions() {
Expand Down Expand Up @@ -1946,10 +1946,10 @@ class parserDefinitionParser extends AbstractParserDefinitionParser {}
// HandParsersProgram is a constructor that takes a parsers file, and builds a new
// constructor for new language that takes files in that language to execute, compile, etc.
class HandParsersProgram extends AbstractParserDefinitionParser {
createParserCombinator() {
createParserPool() {
const map = {}
map[ParsersConstants.comment] = Particle
return new Particle.ParserCombinator(UnknownParserParticle, map, [
return new Particle.ParserPool(UnknownParserParticle, map, [
{ regex: HandParsersProgram.blankLineRegex, parser: Particle },
{ regex: HandParsersProgram.parserFullRegex, parser: parserDefinitionParser },
{ regex: HandParsersProgram.atomTypeFullRegex, parser: atomTypeDefinitionParser }
Expand Down
Loading

0 comments on commit 0a9fb04

Please sign in to comment.