import {abstract} from './common.js';import * as errors from './errors.js';import * as pexprs from './pexprs-main.js';
pexprs.PExpr.prototype.assertChoicesHaveUniformArity = abstract( 'assertChoicesHaveUniformArity',);
pexprs.any.assertChoicesHaveUniformArity = pexprs.end.assertChoicesHaveUniformArity = pexprs.Terminal.prototype.assertChoicesHaveUniformArity = pexprs.Range.prototype.assertChoicesHaveUniformArity = pexprs.Param.prototype.assertChoicesHaveUniformArity = pexprs.Lex.prototype.assertChoicesHaveUniformArity = pexprs.UnicodeChar.prototype.assertChoicesHaveUniformArity = function(ruleName) { };
pexprs.Alt.prototype.assertChoicesHaveUniformArity = function(ruleName) { if (this.terms.length === 0) { return; } const arity = this.terms[0].getArity(); for (let idx = 0; idx < this.terms.length; idx++) { const term = this.terms[idx]; term.assertChoicesHaveUniformArity(); const otherArity = term.getArity(); if (arity !== otherArity) { throw errors.inconsistentArity(ruleName, arity, otherArity, term); } }};
pexprs.Extend.prototype.assertChoicesHaveUniformArity = function(ruleName) { const actualArity = this.terms[0].getArity(); const expectedArity = this.terms[1].getArity(); if (actualArity !== expectedArity) { throw errors.inconsistentArity(ruleName, expectedArity, actualArity, this.terms[0]); }};
pexprs.Seq.prototype.assertChoicesHaveUniformArity = function(ruleName) { for (let idx = 0; idx < this.factors.length; idx++) { this.factors[idx].assertChoicesHaveUniformArity(ruleName); }};
pexprs.Iter.prototype.assertChoicesHaveUniformArity = function(ruleName) { this.expr.assertChoicesHaveUniformArity(ruleName);};
pexprs.Not.prototype.assertChoicesHaveUniformArity = function(ruleName) { };
pexprs.Lookahead.prototype.assertChoicesHaveUniformArity = function(ruleName) { this.expr.assertChoicesHaveUniformArity(ruleName);};
pexprs.Apply.prototype.assertChoicesHaveUniformArity = function(ruleName) { };