(particle = undefined)
| 19320 | } |
| 19321 | class OmnifixAtomParser extends AbstractAtomParser { |
| 19322 | getAtomArray(particle = undefined) { |
| 19323 | const atomsArr = [] |
| 19324 | const def = this._definition |
| 19325 | const program = particle ? particle.root : undefined |
| 19326 | const parsersProgram = def.languageDefinitionProgram |
| 19327 | const atoms = particle ? particle.atoms : [] |
| 19328 | const requiredAtomTypeDefs = this.getRequiredAtomTypeIds().map(atomTypeId => parsersProgram.getAtomTypeDefinitionById(atomTypeId)) |
| 19329 | const catchAllAtomTypeId = this.catchAllAtomTypeId |
| 19330 | const catchAllAtomTypeDef = catchAllAtomTypeId && parsersProgram.getAtomTypeDefinitionById(catchAllAtomTypeId) |
| 19331 | atoms.forEach((atom, atomIndex) => { |
| 19332 | let atomConstructor |
| 19333 | for (let index = 0; index < requiredAtomTypeDefs.length; index++) { |
| 19334 | const atomTypeDefinition = requiredAtomTypeDefs[index] |
| 19335 | if (atomTypeDefinition.isValid(atom, program)) { |
| 19336 | // todo: cleanup atomIndex/atomIndex stuff |
| 19337 | atomConstructor = atomTypeDefinition.getAtomConstructor() |
| 19338 | atomsArr.push(new atomConstructor(particle, atomIndex, atomTypeDefinition, atomTypeDefinition.id, false, def)) |
| 19339 | requiredAtomTypeDefs.splice(index, 1) |
| 19340 | return true |
| 19341 | } |
| 19342 | } |
| 19343 | if (catchAllAtomTypeDef && catchAllAtomTypeDef.isValid(atom, program)) { |
| 19344 | atomConstructor = catchAllAtomTypeDef.getAtomConstructor() |
| 19345 | atomsArr.push(new atomConstructor(particle, atomIndex, catchAllAtomTypeDef, catchAllAtomTypeId, true, def)) |
| 19346 | return true |
| 19347 | } |
| 19348 | atomsArr.push(new ParsersUnknownAtomTypeAtom(particle, atomIndex, undefined, undefined, false, def)) |
| 19349 | }) |
| 19350 | const atomCount = atoms.length |
| 19351 | requiredAtomTypeDefs.forEach((atomTypeDef, index) => { |
| 19352 | let atomConstructor = atomTypeDef.getAtomConstructor() |
| 19353 | atomsArr.push(new atomConstructor(particle, atomCount + index, atomTypeDef, atomTypeDef.id, false, def)) |
| 19354 | }) |
| 19355 | return atomsArr |
| 19356 | } |
| 19357 | } |
| 19358 | class ParsersExampleParser extends Particle {} |
| 19359 | class ParsersCompilerParser extends Particle { |
no test coverage detected