(particleCount = 1, indentCount = -1, parsersAlreadySynthesized = [], seed = Date.now())
| 19818 | } |
| 19819 | // todo: refactor |
| 19820 | synthesizeParticle(particleCount = 1, indentCount = -1, parsersAlreadySynthesized = [], seed = Date.now()) { |
| 19821 | let inScopeParserIds = this._getInScopeParserIds() |
| 19822 | const catchAllParserId = this._getFromExtended(ParsersConstants.catchAllParser) |
| 19823 | if (catchAllParserId) inScopeParserIds.push(catchAllParserId) |
| 19824 | const thisId = this.id |
| 19825 | if (!parsersAlreadySynthesized.includes(thisId)) parsersAlreadySynthesized.push(thisId) |
| 19826 | const lines = [] |
| 19827 | while (particleCount) { |
| 19828 | const line = this._generateSimulatedLine(seed) |
| 19829 | if (line) lines.push(" ".repeat(indentCount >= 0 ? indentCount : 0) + line) |
| 19830 | this._getConcreteNonErrorInScopeParticleDefinitions(inScopeParserIds.filter(parserId => !parsersAlreadySynthesized.includes(parserId))) |
| 19831 | .filter(def => this._shouldSynthesize(def, parsersAlreadySynthesized)) |
| 19832 | .forEach(def => { |
| 19833 | const chain = parsersAlreadySynthesized // .slice(0) |
| 19834 | chain.push(def.id) |
| 19835 | def.synthesizeParticle(1, indentCount + 1, chain, seed).forEach(line => lines.push(line)) |
| 19836 | }) |
| 19837 | particleCount-- |
| 19838 | } |
| 19839 | return lines |
| 19840 | } |
| 19841 | get atomParser() { |
| 19842 | if (!this._atomParser) { |
| 19843 | const atomParsingStrategy = this._getFromExtended(ParsersConstants.atomParser) |
nothing calls this directly
no test coverage detected