internal TreeRule MkIdRule(RankedAlphabet A) { if (!IsAcceptorRule) { throw new AutomataException(AutomataExceptionKind.MkIdRule_RuleIsNotAcceptorRule); } Expr[] args = new Expr[this.lookahead.Length + 1]; args[0] = A.AttrVar; for (int i = 1; i <= this.lookahead.Length; i++) { if (!(this.lookahead[i - 1].IsEmptyOrSingleton)) { throw new AutomataException(AutomataExceptionKind.MkIdRule_RuleIsNotFlat); } args[i] = (this.lookahead[i - 1].IsEmpty ? A.tt.Z.MkApp(A.Trans, A.tt.identityState, A.ChildVar(i)) : A.tt.Z.MkApp(A.Trans, this.lookahead[i - 1].SomeElement, A.ChildVar(i))); } var new_output = A.tt.Z.MkApp(symbol, args); var new_rule = new TreeRule(this.state, this.symbol, this.guard, new_output, this.lookahead); return(new_rule); }
internal TreeRule MkIdRule(RankedAlphabet A) { if (!IsAcceptorRule) throw new AutomataException(AutomataExceptionKind.MkIdRule_RuleIsNotAcceptorRule); Expr[] args = new Expr[this.lookahead.Length + 1]; args[0] = A.AttrVar; for (int i = 1; i <= this.lookahead.Length; i++) { if (!(this.lookahead[i-1].IsEmptyOrSingleton)) throw new AutomataException(AutomataExceptionKind.MkIdRule_RuleIsNotFlat); args[i] = (this.lookahead[i-1].IsEmpty ? A.tt.Z.MkApp(A.Trans, A.tt.identityState, A.ChildVar(i)) : A.tt.Z.MkApp(A.Trans, this.lookahead[i-1].SomeElement, A.ChildVar(i))); } var new_output = A.tt.Z.MkApp(symbol, args); var new_rule = new TreeRule(this.state, this.symbol, this.guard, new_output, this.lookahead); return new_rule; }