Limit pass count
This commit is contained in:
parent
2105886c5e
commit
c5efff9a0f
|
@ -12,6 +12,7 @@ export function main(argv: string[]) {
|
|||
let tree = reader.readToEnd();
|
||||
let macro = new S.Templates();
|
||||
|
||||
let passNumber = 1;
|
||||
let expansionNeeded = true;
|
||||
function expand<T>(p: S.Pattern<T>, f: (t: T) => S.Items) {
|
||||
tree = S.replace(tree, p, t => {
|
||||
|
@ -20,6 +21,9 @@ export function main(argv: string[]) {
|
|||
});
|
||||
}
|
||||
while (expansionNeeded) {
|
||||
if (passNumber >= 128) {
|
||||
throw new Error(`Too many compiler passes (${passNumber})!`);
|
||||
}
|
||||
expansionNeeded = false;
|
||||
expand(G.spawn,
|
||||
s => macro.template()`SPAWN[${s.name ?? []}][${S.joinItems(s.initialAssertions, ', ')}][[${s.bootProcBody}]]`);
|
||||
|
|
Loading…
Reference in New Issue