/YieldProlog/Modules/Parser.cs
C# | 4572 lines | 4458 code | 73 blank | 41 comment | 123 complexity | ce5d678426367e726ae3f51595df23f5 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- /*
- * Copyright (c) Contributors, http://aurora-sim.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Aurora-Sim Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
- using System;
- using System.Collections.Generic;
-
- // disable warning on l1, don't see how we can
- // code this differently
- #pragma warning disable 0168, 0219, 0162
-
- namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
- {
- public class Parser
- {
- public static IEnumerable<bool> read_term2(object Term, object Options)
- {
- Variable Answer = new Variable();
- Variable Variables = new Variable();
- foreach (bool l1 in read_termOptions(Options, Variables))
- {
- foreach (bool l2 in portable_read3(Answer, Variables, new Variable()))
- {
- foreach (bool l3 in remove_pos(Answer, Term))
- yield return false;
- }
- }
- }
-
- public static IEnumerable<bool> read_term3(object Input, object Term, object Options)
- {
- Variable SaveInput = new Variable();
- Variable Answer = new Variable();
- Variable Variables = new Variable();
- foreach (bool l1 in read_termOptions(Options, Variables))
- {
- foreach (bool l2 in YP.current_input(SaveInput))
- {
- try
- {
- YP.see(Input);
- foreach (bool l3 in portable_read3(Answer, Variables, new Variable()))
- {
- foreach (bool l4 in remove_pos(Answer, Term))
- yield return false;
- }
- }
- finally
- {
- YP.see(SaveInput);
- }
- }
- }
- }
-
- /// <summary>
- /// For read_term, check if Options has variable_names(Variables).
- /// Otherwise, ignore Options.
- /// </summary>
- /// <param name="Options"></param>
- /// <param name="Variables"></param>
- /// <returns></returns>
- private static IEnumerable<bool> read_termOptions(object Options, object Variables)
- {
- Options = YP.getValue(Options);
- if (Options is Variable)
- throw new PrologException(Atom.a("instantiation_error"), "Options is an unbound variable");
- // First try to match Options = [variable_names(Variables)]
- foreach (bool l1 in YP.unify(Options, ListPair.make(new Functor1("variable_names", Variables))))
- {
- yield return false;
- yield break;
- }
- // Default: Ignore Options.
- yield return false;
- }
-
- public static IEnumerable<bool> read1(object Term)
- {
- return read_term2(Term, Atom.NIL);
- }
-
- public static IEnumerable<bool> read2(object Input, object Term)
- {
- return read_term3(Input, Term, Atom.NIL);
- }
-
- public static IEnumerable<bool> formatError(object Output, object Format, object Arguments)
- {
- // Debug: Simple implementation for now.
- YP.write(Format);
- YP.write(Arguments);
- YP.nl();
- yield return false;
- }
-
-
- // Debug: Hand-modify this central predicate to do tail recursion.
- public static IEnumerable<bool> read_tokens(object arg1, object arg2, object arg3)
- {
- bool repeat = true;
- while (repeat)
- {
- repeat = false;
- {
- object C1 = arg1;
- object Dict = arg2;
- object Tokens = arg3;
- Variable C2 = new Variable();
- if (YP.lessThanOrEqual(C1, new ListPair(32, Atom.NIL)))
- {
- if (YP.greaterThanOrEqual(C1, 0))
- {
- foreach (bool l4 in YP.get_code(C2))
- {
- #if false
- foreach (bool l5 in read_tokens(C2, Dict, Tokens))
- {
- yield return false;
- }
- #endif
- arg1 = YP.getValue(C2);
- arg2 = YP.getValue(Dict);
- arg3 = YP.getValue(Tokens);
- repeat = true;
- }
- }
- goto cutIf1;
- }
- if (YP.greaterThanOrEqual(C1, new ListPair(97, Atom.NIL)))
- {
- if (YP.lessThanOrEqual(C1, new ListPair(122, Atom.NIL)))
- {
- foreach (bool l4 in read_identifier(C1, Dict, Tokens))
- {
- yield return false;
- }
- goto cutIf2;
- }
- }
- if (YP.greaterThanOrEqual(C1, new ListPair(65, Atom.NIL)))
- {
- if (YP.lessThanOrEqual(C1, new ListPair(90, Atom.NIL)))
- {
- foreach (bool l4 in read_variable(C1, Dict, Tokens))
- {
- yield return false;
- }
- goto cutIf3;
- }
- }
- if (YP.greaterThanOrEqual(C1, new ListPair(48, Atom.NIL)))
- {
- if (YP.lessThanOrEqual(C1, new ListPair(57, Atom.NIL)))
- {
- foreach (bool l4 in read_number(C1, Dict, Tokens))
- {
- yield return false;
- }
- goto cutIf4;
- }
- }
- if (YP.lessThan(C1, 127))
- {
- foreach (bool l3 in read_special(C1, Dict, Tokens))
- {
- yield return false;
- }
- goto cutIf5;
- }
- if (YP.lessThanOrEqual(C1, 160))
- {
- foreach (bool l3 in YP.get_code(C2))
- {
- #if false
- foreach (bool l4 in read_tokens(C2, Dict, Tokens))
- {
- yield return false;
- }
- #endif
- arg1 = YP.getValue(C2);
- arg2 = YP.getValue(Dict);
- arg3 = YP.getValue(Tokens);
- repeat = true;
- }
- goto cutIf6;
- }
- if (YP.greaterThanOrEqual(C1, 223))
- {
- if (YP.notEqual(C1, 247))
- {
- foreach (bool l4 in read_identifier(C1, Dict, Tokens))
- {
- yield return false;
- }
- goto cutIf7;
- }
- }
- if (YP.greaterThanOrEqual(C1, 192))
- {
- if (YP.notEqual(C1, 215))
- {
- foreach (bool l4 in read_variable(C1, Dict, Tokens))
- {
- yield return false;
- }
- goto cutIf8;
- }
- }
- if (YP.notEqual(C1, 170))
- {
- if (YP.notEqual(C1, 186))
- {
- foreach (bool l4 in read_symbol(C1, Dict, Tokens))
- {
- yield return false;
- }
- goto cutIf9;
- }
- }
- foreach (bool l2 in read_identifier(C1, Dict, Tokens))
- {
- yield return false;
- }
- cutIf9:
- cutIf8:
- cutIf7:
- cutIf6:
- cutIf5:
- cutIf4:
- cutIf3:
- cutIf2:
- cutIf1:
- { }
- }
- }
- }
-
- // Compiler output follows.
-
- class YPInnerClass { }
- // static Type getDeclaringClass() { return typeof(YPInnerClass).DeclaringType; }
-
- public static IEnumerable<bool> parseInput(object TermList)
- {
- {
- Variable TermAndVariables = new Variable();
- FindallAnswers findallAnswers1 = new FindallAnswers(TermAndVariables);
- foreach (bool l2 in parseInputHelper(TermAndVariables))
- {
- findallAnswers1.add();
- }
- foreach (bool l2 in findallAnswers1.result(TermList))
- {
- yield return false;
- }
- }
- }
-
- public static IEnumerable<bool> parseInputHelper(object arg1)
- {
- {
- Variable Term = new Variable();
- Variable Variables = new Variable();
- Variable Answer = new Variable();
- Variable x4 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor2("f", Term, Variables)))
- {
- foreach (bool l3 in YP.repeat())
- {
- foreach (bool l4 in portable_read3(Answer, Variables, x4))
- {
- foreach (bool l5 in remove_pos(Answer, Term))
- {
- if (YP.termEqual(Term, Atom.a("end_of_file")))
- {
- yield break;
- goto cutIf1;
- }
- yield return false;
- cutIf1:
- { }
- }
- }
- }
- }
- }
- }
-
- public static IEnumerable<bool> clear_errors()
- {
- {
- yield return false;
- }
- }
-
- public static IEnumerable<bool> remove_pos(object arg1, object arg2)
- {
- {
- Variable X = new Variable();
- foreach (bool l2 in YP.unify(arg1, X))
- {
- foreach (bool l3 in YP.unify(arg2, X))
- {
- if (YP.var(X))
- {
- yield return true;
- yield break;
- }
- }
- }
- }
- {
- object X = arg2;
- Variable _Pos = new Variable();
- Variable _Name = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor3("$VAR", _Pos, _Name, X)))
- {
- if (YP.var(X))
- {
- yield return true;
- yield break;
- }
- }
- }
- {
- foreach (bool l2 in YP.unify(arg1, Atom.NIL))
- {
- foreach (bool l3 in YP.unify(arg2, Atom.NIL))
- {
- yield return true;
- yield break;
- }
- }
- }
- {
- Variable H = new Variable();
- Variable T = new Variable();
- Variable NH = new Variable();
- Variable NT = new Variable();
- foreach (bool l2 in YP.unify(arg1, new ListPair(H, T)))
- {
- foreach (bool l3 in YP.unify(arg2, new ListPair(NH, NT)))
- {
- foreach (bool l4 in remove_pos(H, NH))
- {
- foreach (bool l5 in remove_pos(T, NT))
- {
- yield return false;
- }
- }
- yield break;
- }
- }
- }
- {
- Variable A = new Variable();
- Variable B = new Variable();
- Variable NA = new Variable();
- Variable NB = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor2(",", A, B)))
- {
- foreach (bool l3 in YP.unify(arg2, new Functor2(",", NA, NB)))
- {
- foreach (bool l4 in remove_pos(A, NA))
- {
- foreach (bool l5 in remove_pos(B, NB))
- {
- yield return false;
- }
- }
- yield break;
- }
- }
- }
- {
- Variable Atom_1 = new Variable();
- Variable _F = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom_1))
- {
- foreach (bool l3 in YP.unify(arg2, Atom_1))
- {
- foreach (bool l4 in YP.functor(Atom_1, _F, 0))
- {
- yield return false;
- }
- }
- }
- }
- {
- object Term = arg1;
- object NewTerm = arg2;
- Variable Func = new Variable();
- Variable _Pos = new Variable();
- Variable Args = new Variable();
- Variable NArgs = new Variable();
- if (YP.nonvar(Term))
- {
- foreach (bool l3 in YP.univ(Term, new ListPair(Func, new ListPair(_Pos, Args))))
- {
- foreach (bool l4 in remove_pos(Args, NArgs))
- {
- foreach (bool l5 in YP.univ(NewTerm, new ListPair(Func, NArgs)))
- {
- yield return false;
- }
- }
- }
- }
- }
- }
-
- public static IEnumerable<bool> portable_read_position(object Term, object PosTerm, object Syntax)
- {
- {
- foreach (bool l2 in portable_read(PosTerm, Syntax))
- {
- foreach (bool l3 in remove_pos(PosTerm, Term))
- {
- yield return false;
- }
- }
- }
- }
-
- public static IEnumerable<bool> portable_read(object Answer, object Syntax)
- {
- {
- Variable Tokens = new Variable();
- Variable ParseTokens = new Variable();
- foreach (bool l2 in read_tokens1(Tokens))
- {
- foreach (bool l3 in remove_comments(Tokens, ParseTokens, Syntax))
- {
- foreach (bool l4 in parse2(ParseTokens, Answer))
- {
- yield return false;
- }
- }
- }
- }
- }
-
- public static IEnumerable<bool> portable_read3(object Answer, object Variables, object Syntax)
- {
- {
- Variable Tokens = new Variable();
- Variable ParseTokens = new Variable();
- foreach (bool l2 in read_tokens2(Tokens, Variables))
- {
- foreach (bool l3 in remove_comments(Tokens, ParseTokens, Syntax))
- {
- foreach (bool l4 in parse2(ParseTokens, Answer))
- {
- yield return false;
- }
- }
- }
- }
- }
-
- public static IEnumerable<bool> remove_comments(object arg1, object arg2, object arg3)
- {
- {
- foreach (bool l2 in YP.unify(arg1, Atom.NIL))
- {
- foreach (bool l3 in YP.unify(arg2, Atom.NIL))
- {
- foreach (bool l4 in YP.unify(arg3, Atom.NIL))
- {
- yield return false;
- }
- }
- }
- }
- {
- object Ys = arg2;
- Variable S = new Variable();
- Variable E = new Variable();
- Variable Xs = new Variable();
- Variable Zs = new Variable();
- foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("comment", S, E), Xs)))
- {
- foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("comment", S, E), Zs)))
- {
- foreach (bool l4 in remove_comments(Xs, Ys, Zs))
- {
- yield return false;
- }
- yield break;
- }
- }
- }
- {
- Variable Pos = new Variable();
- Variable Xs = new Variable();
- Variable Ys = new Variable();
- Variable Pos2 = new Variable();
- Variable Zs = new Variable();
- foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("/", Atom.a("["), Pos), Xs)))
- {
- foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a("["), Ys)))
- {
- foreach (bool l4 in YP.unify(arg3, new ListPair(new Functor2("list", Pos, Pos2), Zs)))
- {
- foreach (bool l5 in YP.unify(Pos2, YP.add(Pos, 1)))
- {
- foreach (bool l6 in remove_comments(Xs, Ys, Zs))
- {
- yield return false;
- }
- }
- yield break;
- }
- }
- }
- }
- {
- Variable Pos = new Variable();
- Variable Xs = new Variable();
- Variable Ys = new Variable();
- Variable Pos2 = new Variable();
- Variable Zs = new Variable();
- foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("/", Atom.a("]"), Pos), Xs)))
- {
- foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a("]"), Ys)))
- {
- foreach (bool l4 in YP.unify(arg3, new ListPair(new Functor2("list", Pos, Pos2), Zs)))
- {
- foreach (bool l5 in YP.unify(Pos2, YP.add(Pos, 1)))
- {
- foreach (bool l6 in remove_comments(Xs, Ys, Zs))
- {
- yield return false;
- }
- }
- yield break;
- }
- }
- }
- }
- {
- object Zs = arg3;
- Variable Token = new Variable();
- Variable Xs = new Variable();
- Variable Ys = new Variable();
- foreach (bool l2 in YP.unify(arg1, new ListPair(Token, Xs)))
- {
- foreach (bool l3 in YP.unify(arg2, new ListPair(Token, Ys)))
- {
- foreach (bool l4 in remove_comments(Xs, Ys, Zs))
- {
- yield return false;
- }
- }
- }
- }
- }
-
- public static IEnumerable<bool> expect(object Token, object arg2, object arg3)
- {
- {
- object Rest = arg3;
- foreach (bool l2 in YP.unify(arg2, new ListPair(Token, Rest)))
- {
- yield return true;
- yield break;
- }
- }
- {
- object S0 = arg2;
- object x3 = arg3;
- foreach (bool l2 in syntax_error(ListPair.make(new object[] { Token, Atom.a("or"), Atom.a("operator"), Atom.a("expected") }), S0))
- {
- yield return false;
- }
- }
- }
-
- public static IEnumerable<bool> parse2(object Tokens, object Answer)
- {
- {
- Variable Term = new Variable();
- Variable LeftOver = new Variable();
- foreach (bool l2 in clear_errors())
- {
- foreach (bool l3 in parse(Tokens, 1200, Term, LeftOver))
- {
- foreach (bool l4 in all_read(LeftOver))
- {
- foreach (bool l5 in YP.unify(Answer, Term))
- {
- yield return false;
- }
- yield break;
- }
- }
- foreach (bool l3 in syntax_error(Tokens))
- {
- yield return false;
- }
- }
- }
- }
-
- public static IEnumerable<bool> all_read(object arg1)
- {
- {
- foreach (bool l2 in YP.unify(arg1, Atom.NIL))
- {
- yield return false;
- }
- }
- {
- Variable Token = new Variable();
- Variable S = new Variable();
- foreach (bool l2 in YP.unify(arg1, new ListPair(Token, S)))
- {
- foreach (bool l3 in syntax_error(ListPair.make(new object[] { Atom.a("operator"), Atom.a("expected"), Atom.a("after"), Atom.a("expression") }), new ListPair(Token, S)))
- {
- yield return false;
- }
- }
- }
- }
-
- public static IEnumerable<bool> parse(object arg1, object arg2, object arg3, object arg4)
- {
- {
- object x1 = arg2;
- object x2 = arg3;
- object x3 = arg4;
- foreach (bool l2 in YP.unify(arg1, Atom.NIL))
- {
- foreach (bool l3 in syntax_error(new ListPair(Atom.a("expression"), new ListPair(Atom.a("expected"), Atom.NIL)), Atom.NIL))
- {
- yield return false;
- }
- }
- }
- {
- object Precedence = arg2;
- object Term = arg3;
- object LeftOver = arg4;
- Variable Token = new Variable();
- Variable RestTokens = new Variable();
- foreach (bool l2 in YP.unify(arg1, new ListPair(Token, RestTokens)))
- {
- foreach (bool l3 in parse5(Token, RestTokens, Precedence, Term, LeftOver))
- {
- yield return false;
- }
- }
- }
- }
-
- public static IEnumerable<bool> parse5(object arg1, object arg2, object arg3, object arg4, object arg5)
- {
- {
- object S0 = arg2;
- object x2 = arg3;
- object x3 = arg4;
- object x4 = arg5;
- foreach (bool l2 in YP.unify(arg1, Atom.a("}")))
- {
- foreach (bool l3 in cannot_start(Atom.a("}"), S0))
- {
- yield return false;
- }
- }
- }
- {
- object S0 = arg2;
- object x2 = arg3;
- object x3 = arg4;
- object x4 = arg5;
- foreach (bool l2 in YP.unify(arg1, Atom.a("]")))
- {
- foreach (bool l3 in cannot_start(Atom.a("]"), S0))
- {
- yield return false;
- }
- }
- }
- {
- object S0 = arg2;
- object x2 = arg3;
- object x3 = arg4;
- object x4 = arg5;
- foreach (bool l2 in YP.unify(arg1, Atom.a(")")))
- {
- foreach (bool l3 in cannot_start(Atom.a(")"), S0))
- {
- yield return false;
- }
- }
- }
- {
- object S0 = arg2;
- object x2 = arg3;
- object x3 = arg4;
- object x4 = arg5;
- foreach (bool l2 in YP.unify(arg1, Atom.a(",")))
- {
- foreach (bool l3 in cannot_start(Atom.a(","), S0))
- {
- yield return false;
- }
- }
- }
- {
- object S0 = arg2;
- object x2 = arg3;
- object x3 = arg4;
- object x4 = arg5;
- foreach (bool l2 in YP.unify(arg1, Atom.a("|")))
- {
- foreach (bool l3 in cannot_start(Atom.a("|"), S0))
- {
- yield return false;
- }
- }
- }
- {
- object S0 = arg2;
- object Precedence = arg3;
- object Answer = arg4;
- object S = arg5;
- Variable Codes = new Variable();
- Variable Term = new Variable();
- Variable A = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor1("string", Codes)))
- {
- foreach (bool l3 in YP.current_prolog_flag(Atom.a("double_quotes"), Atom.a("atom")))
- {
- foreach (bool l4 in YP.atom_codes(Term, Codes))
- {
- foreach (bool l5 in exprtl0(S0, Term, Precedence, Answer, S))
- {
- yield return false;
- }
- }
- goto cutIf1;
- }
- foreach (bool l3 in YP.current_prolog_flag(Atom.a("double_quotes"), Atom.a("chars")))
- {
- foreach (bool l4 in YP.atom_codes(A, Codes))
- {
- foreach (bool l5 in YP.atom_chars(A, Term))
- {
- foreach (bool l6 in exprtl0(S0, Term, Precedence, Answer, S))
- {
- yield return false;
- }
- }
- }
- goto cutIf2;
- }
- foreach (bool l3 in YP.unify(Term, Codes))
- {
- foreach (bool l4 in exprtl0(S0, Term, Precedence, Answer, S))
- {
- yield return false;
- }
- }
- cutIf2:
- cutIf1:
- { }
- }
- }
- {
- object S0 = arg2;
- object Precedence = arg3;
- object Answer = arg4;
- object S = arg5;
- Variable Number = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor1("number", Number)))
- {
- foreach (bool l3 in exprtl0(S0, Number, Precedence, Answer, S))
- {
- yield return false;
- }
- }
- }
- {
- object Precedence = arg3;
- object Answer = arg4;
- object S = arg5;
- Variable S1 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a("[")))
- {
- foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a("]"), S1)))
- {
- foreach (bool l4 in read_atom(new Functor2("/", Atom.NIL, 0), S1, Precedence, Answer, S))
- {
- yield return false;
- }
- yield break;
- }
- }
- }
- {
- object S1 = arg2;
- object Precedence = arg3;
- object Answer = arg4;
- object S = arg5;
- Variable Arg1 = new Variable();
- Variable S2 = new Variable();
- Variable RestArgs = new Variable();
- Variable S3 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a("[")))
- {
- foreach (bool l3 in parse(S1, 999, Arg1, S2))
- {
- foreach (bool l4 in read_list(S2, RestArgs, S3))
- {
- foreach (bool l5 in exprtl0(S3, new ListPair(Arg1, RestArgs), Precedence, Answer, S))
- {
- yield return false;
- }
- yield break;
- }
- }
- }
- }
- {
- object S1 = arg2;
- object Precedence = arg3;
- object Answer = arg4;
- object S = arg5;
- Variable Term = new Variable();
- Variable S2 = new Variable();
- Variable S3 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a("(")))
- {
- foreach (bool l3 in parse(S1, 1200, Term, S2))
- {
- foreach (bool l4 in expect(Atom.a(")"), S2, S3))
- {
- foreach (bool l5 in exprtl0(S3, Term, Precedence, Answer, S))
- {
- yield return false;
- }
- yield break;
- }
- }
- }
- }
- {
- object S1 = arg2;
- object Precedence = arg3;
- object Answer = arg4;
- object S = arg5;
- Variable Term = new Variable();
- Variable S2 = new Variable();
- Variable S3 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(" (")))
- {
- foreach (bool l3 in parse(S1, 1200, Term, S2))
- {
- foreach (bool l4 in expect(Atom.a(")"), S2, S3))
- {
- foreach (bool l5 in exprtl0(S3, Term, Precedence, Answer, S))
- {
- yield return false;
- }
- yield break;
- }
- }
- }
- }
- {
- object Precedence = arg3;
- object Answer = arg4;
- object S = arg5;
- Variable _Pos = new Variable();
- Variable S1 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor2("/", Atom.a("{"), _Pos)))
- {
- foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a("}"), S1)))
- {
- foreach (bool l4 in read_atom(Atom.a("{}"), S1, Precedence, Answer, S))
- {
- yield return false;
- }
- yield break;
- }
- }
- }
- {
- object S1 = arg2;
- object Precedence = arg3;
- object Answer = arg4;
- object S = arg5;
- Variable Pos = new Variable();
- Variable Term = new Variable();
- Variable S2 = new Variable();
- Variable S3 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor2("/", Atom.a("{"), Pos)))
- {
- foreach (bool l3 in parse(S1, 1200, Term, S2))
- {
- foreach (bool l4 in expect(Atom.a("}"), S2, S3))
- {
- foreach (bool l5 in exprtl0(S3, new Functor2("{}", Pos, Term), Precedence, Answer, S))
- {
- yield return false;
- }
- yield break;
- }
- }
- }
- }
- {
- object Precedence = arg3;
- object Answer = arg4;
- object S = arg5;
- Variable Variable_1 = new Variable();
- Variable Name = new Variable();
- Variable Pos = new Variable();
- Variable S1 = new Variable();
- Variable Arg1 = new Variable();
- Variable S2 = new Variable();
- Variable RestArgs = new Variable();
- Variable S3 = new Variable();
- Variable Term = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor3("var", Variable_1, Name, Pos)))
- {
- foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a("("), S1)))
- {
- foreach (bool l4 in parse(S1, 999, Arg1, S2))
- {
- foreach (bool l5 in read_args(S2, RestArgs, S3))
- {
- foreach (bool l6 in YP.univ(Term, new ListPair(Atom.a("call"), new ListPair(new Functor3("$VAR", Pos, Name, Variable_1), new ListPair(Arg1, RestArgs)))))
- {
- foreach (bool l7 in exprtl0(S3, Term, Precedence, Answer, S))
- {
- yield return false;
- }
- }
- yield break;
- }
- }
- yield break;
- }
- }
- }
- {
- object S0 = arg2;
- object Precedence = arg3;
- object Answer = arg4;
- object S = arg5;
- Variable Variable_1 = new Variable();
- Variable Name = new Variable();
- Variable Pos = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor3("var", Variable_1, Name, Pos)))
- {
- foreach (bool l3 in exprtl0(S0, new Functor3("$VAR", Pos, Name, Variable_1), Precedence, Answer, S))
- {
- yield return false;
- }
- }
- }
- {
- object S0 = arg2;
- object Precedence = arg3;
- object Answer = arg4;
- object S = arg5;
- Variable Atom_1 = new Variable();
- Variable P = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor2("atom", Atom_1, P)))
- {
- foreach (bool l3 in read_atom(new Functor2("/", Atom_1, P), S0, Precedence, Answer, S))
- {
- yield return false;
- }
- }
- }
- }
-
- public static IEnumerable<bool> read_atom(object arg1, object arg2, object Precedence, object Answer, object S)
- {
- {
- Variable _Pos = new Variable();
- Variable Number = new Variable();
- Variable S1 = new Variable();
- Variable Negative = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor2("/", Atom.a("-"), _Pos)))
- {
- foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor1("number", Number), S1)))
- {
- foreach (bool l4 in YP.unify(Negative, YP.negate(Number)))
- {
- foreach (bool l5 in exprtl0(S1, Negative, Precedence, Answer, S))
- {
- yield return false;
- }
- }
- yield break;
- }
- }
- }
- {
- Variable Functor_1 = new Variable();
- Variable Pos = new Variable();
- Variable S1 = new Variable();
- Variable Arg1 = new Variable();
- Variable S2 = new Variable();
- Variable RestArgs = new Variable();
- Variable S3 = new Variable();
- Variable Term = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor2("/", Functor_1, Pos)))
- {
- foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a("("), S1)))
- {
- foreach (bool l4 in parse(S1, 999, Arg1, S2))
- {
- foreach (bool l5 in read_args(S2, RestArgs, S3))
- {
- foreach (bool l6 in YP.univ(Term, new ListPair(Functor_1, new ListPair(Pos, new ListPair(Arg1, RestArgs)))))
- {
- foreach (bool l7 in exprtl0(S3, Term, Precedence, Answer, S))
- {
- yield return false;
- }
- }
- yield break;
- }
- }
- yield break;
- }
- }
- }
- {
- object S0 = arg2;
- Variable Op = new Variable();
- Variable Pos = new Variable();
- Variable Oprec = new Variable();
- Variable Aprec = new Variable();
- Variable Flag = new Variable();
- Variable Term = new Variable();
- Variable Arg = new Variable();
- Variable S1 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor2("/", Op, Pos)))
- {
- foreach (bool l3 in prefixop(Op, Oprec, Aprec))
- {
- foreach (bool l4 in possible_right_operand(S0, Flag))
- {
- if (YP.lessThan(Flag, 0))
- {
- foreach (bool l6 in YP.univ(Term, new ListPair(Op, new ListPair(Pos, Atom.NIL))))
- {
- foreach (bool l7 in exprtl0(S0, Term, Precedence, Answer, S))
- {
- yield return false;
- }
- }
- goto cutIf1;
- }
- if (YP.greaterThan(Oprec, Precedence))
- {
- foreach (bool l6 in syntax_error(ListPair.make(new object[] { Atom.a("prefix"), Atom.a("operator"), Op, Atom.a("in"), Atom.a("context"), Atom.a("with"), Atom.a("precedence"), Precedence }), S0))
- {
- yield return false;
- }
- goto cutIf2;
- }
- if (YP.greaterThan(Flag, 0))
- {
- foreach (bool l6 in parse(S0, Aprec, Arg, S1))
- {
- foreach (bool l7 in YP.univ(Term, ListPair.make(new object[] { Op, Pos, Arg })))
- {
- foreach (bool l8 in exprtl(S1, Oprec, Term, Precedence, Answer, S))
- {
- yield return false;
- }
- }
- yield break;
- }
- goto cutIf3;
- }
- foreach (bool l5 in peepop(S0, S1))
- {
- foreach (bool l6 in prefix_is_atom(S1, Oprec))
- {
- foreach (bool l7 in exprtl(S1, Oprec, new Functor2("/", Op, Pos), Precedence, Answer, S))
- {
- yield return false;
- }
- }
- }
- foreach (bool l5 in parse(S0, Aprec, Arg, S1))
- {
- foreach (bool l6 in YP.univ(Term, ListPair.make(new object[] { Op, Pos, Arg })))
- {
- foreach (bool l7 in exprtl(S1, Oprec, Term, Precedence, Answer, S))
- {
- yield return false;
- }
- }
- yield break;
- }
- cutIf3:
- cutIf2:
- cutIf1:
- { }
- }
- yield break;
- }
- }
- }
- {
- object S0 = arg2;
- Variable Atom_1 = new Variable();
- Variable Pos = new Variable();
- Variable Term = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor2("/", Atom_1, Pos)))
- {
- foreach (bool l3 in YP.univ(Term, new ListPair(Atom_1, new ListPair(Pos, Atom.NIL))))
- {
- foreach (bool l4 in exprtl0(S0, Term, Precedence, Answer, S))
- {
- yield return false;
- }
- }
- }
- }
- }
-
- public static IEnumerable<bool> cannot_start(object Token, object S0)
- {
- {
- foreach (bool l2 in syntax_error(ListPair.make(new object[] { Token, Atom.a("cannot"), Atom.a("start"), Atom.a("an"), Atom.a("expression") }), S0))
- {
- yield return false;
- }
- }
- }
-
- public static IEnumerable<bool> read_args(object arg1, object arg2, object arg3)
- {
- {
- object S = arg3;
- Variable S1 = new Variable();
- Variable Term = new Variable();
- Variable Rest = new Variable();
- Variable S2 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(","), S1)))
- {
- foreach (bool l3 in YP.unify(arg2, new ListPair(Term, Rest)))
- {
- foreach (bool l4 in parse(S1, 999, Term, S2))
- {
- foreach (bool l5 in read_args(S2, Rest, S))
- {
- yield return false;
- }
- yield break;
- }
- yield break;
- }
- }
- }
- {
- object S = arg3;
- foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(")"), S)))
- {
- foreach (bool l3 in YP.unify(arg2, Atom.NIL))
- {
- yield return true;
- yield break;
- }
- }
- }
- {
- object S = arg1;
- object x2 = arg2;
- object x3 = arg3;
- foreach (bool l2 in syntax_error(ListPair.make(new object[] { Atom.a(", or )"), Atom.a("expected"), Atom.a("in"), Atom.a("arguments") }), S))
- {
- yield return false;
- }
- }
- }
-
- public static IEnumerable<bool> read_list(object arg1, object arg2, object arg3)
- {
- {
- object x1 = arg2;
- object x2 = arg3;
- foreach (bool l2 in YP.unify(arg1, Atom.NIL))
- {
- foreach (bool l3 in syntax_error(ListPair.make(new object[] { Atom.a(", | or ]"), Atom.a("expected"), Atom.a("in"), Atom.a("list") }), Atom.NIL))
- {
- yield return false;
- }
- }
- }
- {
- object Rest = arg2;
- object S = arg3;
- Variable Token = new Variable();
- Variable S1 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new ListPair(Token, S1)))
- {
- foreach (bool l3 in read_list4(Token, S1, Rest, S))
- {
- yield return false;
- }
- }…
Large files files are truncated, but you can click here to view the full file