From 323ada012d3bed0c6f7a6d5d0ee14b409b7457c7 Mon Sep 17 00:00:00 2001
From: Charles Krinke
Date: Wed, 13 Aug 2008 14:13:49 +0000
Subject: Mantis#1931. Thank you kindly, Kinoc for a patch that: * Yield Prolog
1.0.1 Released : it passes all but 9 of the 421 tests in the ISO Prolog test
suite (97.8%) . * support dynamic predicates and rules. * support 'import' to
use external static functions improves connection to C# functions * Matches
Yield Prolog r831
---
.../Shared/Api/Runtime/YieldProlog/BagofAnswers.cs | 33 +-
.../Api/Runtime/YieldProlog/FindallAnswers.cs | 13 +-
.../Shared/Api/Runtime/YieldProlog/Functor.cs | 8 +
.../Shared/Api/Runtime/YieldProlog/Functor1.cs | 22 +-
.../Shared/Api/Runtime/YieldProlog/Functor2.cs | 17 +-
.../Shared/Api/Runtime/YieldProlog/Functor3.cs | 16 +-
.../Api/Runtime/YieldProlog/IndexedAnswers.cs | 3 +-
.../Shared/Api/Runtime/YieldProlog/ListPair.cs | 16 +-
.../Shared/Api/Runtime/YieldProlog/Parser.cs | 514 +++++++++++++--------
.../Shared/Api/Runtime/YieldProlog/Variable.cs | 32 +-
.../Shared/Api/Runtime/YieldProlog/YP.cs | 319 ++++++++++++-
.../Shared/Api/Runtime/YieldProlog/YPCompiler.cs | 326 +++++++++++--
12 files changed, 992 insertions(+), 327 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Runtime')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs
index c2bb0b7..4a4e052 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/BagofAnswers.cs
@@ -113,6 +113,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
}
+ // disable warning on l1, don't see how we can
+ // code this differently
+ #pragma warning disable 0168
+
///
/// For each result, unify the _freeVariables and unify bagArrayVariable with the associated bag.
///
@@ -127,27 +131,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
// No unbound free variables, so we only filled one bag. If empty, bagof fails.
if (_findallBagArray.Count > 0)
{
-// disable warning: don't see how we can code this differently short
-// of rewriting the whole thing
-#pragma warning disable 0168
foreach (bool l1 in bagArrayVariable.unify(_findallBagArray))
yield return false;
-#pragma warning restore 0168
}
}
else
{
foreach (KeyValuePair> valuesAndBag in _bagForFreeVariables)
{
-// disable warning: don't see how we can code this differently short
-// of rewriting the whole thing
-#pragma warning disable 0168
foreach (bool l1 in YP.unifyArrays(_freeVariables, valuesAndBag.Key))
{
foreach (bool l2 in bagArrayVariable.unify(valuesAndBag.Value))
yield return false;
}
-#pragma warning restore 0168
// Debug: Should we free memory of the answers already returned?
}
}
@@ -161,15 +157,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public IEnumerable result(object Bag)
{
Variable bagArrayVariable = new Variable();
-// disable warning: don't see how we can code this differently short
-// of rewriting the whole thing
-#pragma warning disable 0168
foreach (bool l1 in resultArray(bagArrayVariable))
{
foreach (bool l2 in YP.unify(Bag, ListPair.make((List)bagArrayVariable.getValue())))
yield return false;
}
-#pragma warning restore 0168
}
///
@@ -181,9 +173,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public IEnumerable resultSet(object Bag)
{
Variable bagArrayVariable = new Variable();
-// disable warning: don't see how we can code this differently short
-// of rewriting the whole thing
-#pragma warning disable 0168
foreach (bool l1 in resultArray(bagArrayVariable))
{
List bagArray = (List)bagArrayVariable.getValue();
@@ -191,19 +180,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
foreach (bool l2 in YP.unify(Bag, ListPair.makeWithoutRepeatedTerms(bagArray)))
yield return false;
}
-#pragma warning restore 0168
}
public static IEnumerable bagofArray
(object Template, object Goal, IEnumerable goalIterator, Variable bagArrayVariable)
{
BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
-// disable warning: don't see how we can code this differently short
-// of rewriting the whole thing
-#pragma warning disable 0168
foreach (bool l1 in goalIterator)
bagOfAnswers.add();
-#pragma warning restore 0168
return bagOfAnswers.resultArray(bagArrayVariable);
}
@@ -211,12 +195,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
(object Template, object Goal, IEnumerable goalIterator, object Bag)
{
BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
-// disable warning: don't see how we can code this differently short
-// of rewriting the whole thing
-#pragma warning disable 0168
foreach (bool l1 in goalIterator)
bagOfAnswers.add();
-#pragma warning restore 0168
return bagOfAnswers.result(Bag);
}
@@ -224,14 +204,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
(object Template, object Goal, IEnumerable goalIterator, object Bag)
{
BagofAnswers bagOfAnswers = new BagofAnswers(Template, Goal);
-// disable warning: don't see how we can code this differently short
-// of rewriting the whole thing
-#pragma warning disable 0168
foreach (bool l1 in goalIterator)
bagOfAnswers.add();
-#pragma warning restore 0168
return bagOfAnswers.resultSet(Bag);
}
+ #pragma warning restore 0168
///
/// A TermArrayEqualityComparer implements IEqualityComparer to compare two object arrays using YP.termEqual.
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/FindallAnswers.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/FindallAnswers.cs
index fbb173e..f175494 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/FindallAnswers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/FindallAnswers.cs
@@ -71,6 +71,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
return YP.unify(Bag, result);
}
+ // disable warning on l1, don't see how we can
+ // code this differently
+ #pragma warning disable 0168
+
///
/// This is a simplified findall when the goal is a single call.
///
@@ -81,12 +85,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public static IEnumerable findall(object Template, IEnumerable goal, object Bag)
{
FindallAnswers findallAnswers = new FindallAnswers(Template);
- // disable warning on l1, don't see how we can
- // code this differently
- #pragma warning disable 0168
foreach (bool l1 in goal)
findallAnswers.add();
- #pragma warning restore 0168
return findallAnswers.result(Bag);
}
@@ -99,13 +99,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public static List findallArray(object Template, IEnumerable goal)
{
FindallAnswers findallAnswers = new FindallAnswers(Template);
- // disable warning on l1, don't see how we can
- // code this differently
- #pragma warning disable 0168
foreach (bool l1 in goal)
findallAnswers.add();
- #pragma warning restore 0168
return findallAnswers.resultArray();
}
+ #pragma warning restore 0168
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor.cs
index 8ef8de0..4d65f5b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor.cs
@@ -98,6 +98,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
return make(Atom.a(name), args);
}
+ ///
+ /// If arg is another Functor, then succeed (yield once) if this and arg have the
+ /// same name and all functor args unify, otherwise fail (don't yield).
+ /// If arg is a Variable, then call its unify to unify with this.
+ /// Otherwise fail (don't yield).
+ ///
+ ///
+ ///
public IEnumerable unify(object arg)
{
arg = YP.getValue(arg);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor1.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor1.cs
index 69fbeee..351114d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor1.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor1.cs
@@ -49,6 +49,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
}
+ // disable warning on l1, don't see how we can
+ // code this differently
+ #pragma warning disable 0168
+ ///
+ /// If arg is another Functor1, then succeed (yield once) if this and arg have the
+ /// same name and the functor args unify, otherwise fail (don't yield).
+ /// If arg is a Variable, then call its unify to unify with this.
+ /// Otherwise fail (don't yield).
+ ///
+ ///
+ ///
public IEnumerable unify(object arg)
{
arg = YP.getValue(arg);
@@ -57,25 +68,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Functor1 argFunctor = (Functor1)arg;
if (_name.Equals(argFunctor._name))
{
- // disable warning on l1, don't see how we can
- // code this differently
- #pragma warning disable 0168
foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1))
yield return false;
- #pragma warning restore 0168
}
}
else if (arg is Variable)
{
- // disable warning on l1, don't see how we can
- // code this differently
- #pragma warning disable 0168
foreach (bool l1 in ((Variable)arg).unify(this))
yield return false;
- #pragma warning restore 0168
-
}
}
+ #pragma warning restore 0168
+
public override string ToString()
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs
index 4ae325e..6817d11 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor2.cs
@@ -51,6 +51,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
}
+ // disable warning on l1, don't see how we can
+ // code this differently
+ #pragma warning disable 0168
+ /// If arg is another Functor2, then succeed (yield once) if this and arg have the
+ /// same name and all functor args unify, otherwise fail (don't yield).
+ /// If arg is a Variable, then call its unify to unify with this.
+ /// Otherwise fail (don't yield).
public IEnumerable unify(object arg)
{
arg = YP.getValue(arg);
@@ -59,27 +66,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Functor2 argFunctor = (Functor2)arg;
if (_name.Equals(argFunctor._name))
{
-// disable warning: don't see how we can code this differently short
-// of rewriting the whole thing
-#pragma warning disable 0168
foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1))
{
foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2))
yield return false;
}
-#pragma warning restore 0168
}
}
else if (arg is Variable)
{
-// disable warning: don't see how we can code this differently short
-// of rewriting the whole thing
-#pragma warning disable 0168
foreach (bool l1 in ((Variable)arg).unify(this))
yield return false;
-#pragma warning restore 0168
}
}
+ #pragma warning restore 0168
+
public override string ToString()
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs
index 907bfca..b237a82 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Functor3.cs
@@ -53,6 +53,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
}
+ // disable warning on l1, don't see how we can
+ // code this differently
+ #pragma warning disable 0168
+ /// If arg is another Functor3, then succeed (yield once) if this and arg have the
+ /// same name and all functor args unify, otherwise fail (don't yield).
+ /// If arg is a Variable, then call its unify to unify with this.
+ /// Otherwise fail (don't yield).
public IEnumerable unify(object arg)
{
arg = YP.getValue(arg);
@@ -61,9 +68,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Functor3 argFunctor = (Functor3)arg;
if (_name.Equals(argFunctor._name))
{
-// disable warning: don't see how we can code this differently short
-// of rewriting the whole thing
-#pragma warning disable 0168
foreach (bool l1 in YP.unify(_arg1, argFunctor._arg1))
{
foreach (bool l2 in YP.unify(_arg2, argFunctor._arg2))
@@ -72,19 +76,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
yield return false;
}
}
-#pragma warning restore 0168
}
}
else if (arg is Variable)
{
-// disable warning: don't see how we can code this differently short
-// of rewriting the whole thing
-#pragma warning disable 0168
foreach (bool l1 in ((Variable)arg).unify(this))
yield return false;
-#pragma warning restore 0168
}
}
+ #pragma warning restore 0168
public override string ToString()
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs
index 7d41945..681b2f2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/IndexedAnswers.cs
@@ -270,8 +270,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
throw new PrologException("instantiation_error", "Head is an unbound variable");
object[] arguments = YP.getFunctorArgs(Head);
- // We always match Head from _allAnswers, and the Body is
- // Atom.a("true").
+ // We always match Head from _allAnswers, and the Body is Atom.a("true").
#pragma warning disable 0168
foreach (bool l1 in YP.unify(Body, Atom.a("true")))
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/ListPair.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/ListPair.cs
index 83ace2d..daac0ba 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/ListPair.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/ListPair.cs
@@ -132,6 +132,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
///
/// Return an array of the elements in list or null if it is not
/// a proper list. If list is Atom.NIL, return an array of zero elements.
+ /// If the list or one of the tails of the list is Variable, raise an instantiation_error.
/// This does not call YP.getValue on each element.
///
///
@@ -143,10 +144,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
return new object[0];
List result = new List();
- for (object element = list;
- element is Functor2 && ((Functor2)element)._name == Atom.DOT;
- element = YP.getValue(((Functor2)element)._arg2))
+ object element = list;
+ while (true) {
+ if (element == Atom.NIL)
+ break;
+ if (element is Variable)
+ throw new PrologException(Atom.a("instantiation_error"),
+ "List tail is an unbound variable");
+ if (!(element is Functor2 && ((Functor2)element)._name == Atom.DOT))
+ // Not a proper list.
+ return null;
result.Add(((Functor2)element)._arg1);
+ element = YP.getValue(((Functor2)element)._arg2);
+ }
if (result.Count <= 0)
return null;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs
index 3a15449..34010e7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Parser.cs
@@ -31,10 +31,86 @@
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 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 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);
+ }
+ }
+ }
+ }
+
+ ///
+ /// For read_term, check if Options has variable_names(Variables).
+ /// Otherwise, ignore Options.
+ ///
+ ///
+ ///
+ ///
+ private static IEnumerable 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 read1(object Term)
+ {
+ return read_term2(Term, Atom.NIL);
+ }
+
+ public static IEnumerable read2(object Input, object Term)
+ {
+ return read_term3(Input, Term, Atom.NIL);
+ }
+
public static IEnumerable formatError(object Output, object Format, object Arguments)
{
// Debug: Simple implementation for now.
@@ -44,9 +120,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
yield return false;
}
- // disable warning on l1, don't see how we can
- // code this differently
- #pragma warning disable 0168, 0219
// Debug: Hand-modify this central predicate to do tail recursion.
public static IEnumerable read_tokens(object arg1, object arg2, object arg3)
@@ -217,7 +290,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 l2 in YP.unify(arg1, new Functor2("f", Term, Variables)))
{
foreach (bool l3 in YP.repeat())
{
@@ -225,14 +298,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
foreach (bool l5 in remove_pos(Answer, Term))
{
- if (YP.termEqual(Term, Atom.a(@"end_of_file")))
+ if (YP.termEqual(Term, Atom.a("end_of_file")))
{
yield break;
- // goto cutIf1;
+ goto cutIf1;
}
yield return false;
- // cutIf1:
- // { }
+ cutIf1:
+ { }
}
}
}
@@ -267,7 +340,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object X = arg2;
Variable _Pos = new Variable();
Variable _Name = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor3(@"$VAR", _Pos, _Name, X)))
+ foreach (bool l2 in YP.unify(arg1, new Functor3("$VAR", _Pos, _Name, X)))
{
if (YP.var(X))
{
@@ -311,9 +384,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 l2 in YP.unify(arg1, new Functor2(",", A, B)))
{
- foreach (bool l3 in YP.unify(arg2, new Functor2(@",", NA, NB)))
+ foreach (bool l3 in YP.unify(arg2, new Functor2(",", NA, NB)))
{
foreach (bool l4 in remove_pos(A, NA))
{
@@ -432,9 +505,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 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 l3 in YP.unify(arg3, new ListPair(new Functor2("comment", S, E), Zs)))
{
foreach (bool l4 in remove_comments(Xs, Ys, Zs))
{
@@ -450,11 +523,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 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 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 l4 in YP.unify(arg3, new ListPair(new Functor2("list", Pos, Pos2), Zs)))
{
foreach (bool l5 in YP.unify(Pos2, YP.add(Pos, 1)))
{
@@ -474,11 +547,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 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 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 l4 in YP.unify(arg3, new ListPair(new Functor2("list", Pos, Pos2), Zs)))
{
foreach (bool l5 in YP.unify(Pos2, YP.add(Pos, 1)))
{
@@ -523,7 +596,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
object S0 = arg2;
object x3 = arg3;
- foreach (bool l2 in syntax_error(new ListPair(Token, new ListPair(Atom.a(@"or"), new ListPair(Atom.a(@"operator"), new ListPair(Atom.a(@"expected"), Atom.NIL)))), S0))
+ foreach (bool l2 in syntax_error(ListPair.make(new object[] { Token, Atom.a("or"), Atom.a("operator"), Atom.a("expected") }), S0))
{
yield return false;
}
@@ -569,7 +642,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable S = new Variable();
foreach (bool l2 in YP.unify(arg1, new ListPair(Token, S)))
{
- foreach (bool l3 in syntax_error(new ListPair(Atom.a(@"operator"), new ListPair(Atom.a(@"expected"), new ListPair(Atom.a(@"after"), new ListPair(Atom.a(@"expression"), Atom.NIL)))), 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;
}
@@ -585,7 +658,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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))
+ foreach (bool l3 in syntax_error(new ListPair(Atom.a("expression"), new ListPair(Atom.a("expected"), Atom.NIL)), Atom.NIL))
{
yield return false;
}
@@ -614,9 +687,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x2 = arg3;
object x3 = arg4;
object x4 = arg5;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"}")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("}")))
{
- foreach (bool l3 in cannot_start(Atom.a(@"}"), S0))
+ foreach (bool l3 in cannot_start(Atom.a("}"), S0))
{
yield return false;
}
@@ -627,9 +700,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x2 = arg3;
object x3 = arg4;
object x4 = arg5;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"]")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("]")))
{
- foreach (bool l3 in cannot_start(Atom.a(@"]"), S0))
+ foreach (bool l3 in cannot_start(Atom.a("]"), S0))
{
yield return false;
}
@@ -640,9 +713,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x2 = arg3;
object x3 = arg4;
object x4 = arg5;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@")")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a(")")))
{
- foreach (bool l3 in cannot_start(Atom.a(@")"), S0))
+ foreach (bool l3 in cannot_start(Atom.a(")"), S0))
{
yield return false;
}
@@ -653,9 +726,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x2 = arg3;
object x3 = arg4;
object x4 = arg5;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@",")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a(",")))
{
- foreach (bool l3 in cannot_start(Atom.a(@","), S0))
+ foreach (bool l3 in cannot_start(Atom.a(","), S0))
{
yield return false;
}
@@ -666,9 +739,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x2 = arg3;
object x3 = arg4;
object x4 = arg5;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"|")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("|")))
{
- foreach (bool l3 in cannot_start(Atom.a(@"|"), S0))
+ foreach (bool l3 in cannot_start(Atom.a("|"), S0))
{
yield return false;
}
@@ -679,22 +752,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object Precedence = arg3;
object Answer = arg4;
object S = arg5;
- Variable Chars = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor1(@"string", Chars)))
+ 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 l3 in exprtl0(S0, Chars, Precedence, Answer, S))
+ 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 l2 in YP.unify(arg1, new Functor1("number", Number)))
{
foreach (bool l3 in exprtl0(S0, Number, Precedence, Answer, S))
{
@@ -707,11 +813,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object Answer = arg4;
object S = arg5;
Variable S1 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"[")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("[")))
{
- foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a(@"]"), S1)))
+ 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))
+ foreach (bool l4 in read_atom(new Functor2("/", Atom.NIL, 0), S1, Precedence, Answer, S))
{
yield return false;
}
@@ -728,7 +834,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable S2 = new Variable();
Variable RestArgs = new Variable();
Variable S3 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"[")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("[")))
{
foreach (bool l3 in parse(S1, 999, Arg1, S2))
{
@@ -751,11 +857,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable Term = new Variable();
Variable S2 = new Variable();
Variable S3 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"(")))
+ 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 l4 in expect(Atom.a(")"), S2, S3))
{
foreach (bool l5 in exprtl0(S3, Term, Precedence, Answer, S))
{
@@ -774,11 +880,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable Term = new Variable();
Variable S2 = new Variable();
Variable S3 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@" (")))
+ 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 l4 in expect(Atom.a(")"), S2, S3))
{
foreach (bool l5 in exprtl0(S3, Term, Precedence, Answer, S))
{
@@ -795,11 +901,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 l2 in YP.unify(arg1, new Functor2("/", Atom.a("{"), _Pos)))
{
- foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a(@"}"), S1)))
+ foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a("}"), S1)))
{
- foreach (bool l4 in read_atom(Atom.a(@"{}"), S1, Precedence, Answer, S))
+ foreach (bool l4 in read_atom(Atom.a("{}"), S1, Precedence, Answer, S))
{
yield return false;
}
@@ -816,13 +922,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 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 l4 in expect(Atom.a("}"), S2, S3))
{
- foreach (bool l5 in exprtl0(S3, new Functor2(@"{}", Pos, Term), Precedence, Answer, S))
+ foreach (bool l5 in exprtl0(S3, new Functor2("{}", Pos, Term), Precedence, Answer, S))
{
yield return false;
}
@@ -844,15 +950,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 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 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 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))
{
@@ -874,9 +980,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 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))
+ foreach (bool l3 in exprtl0(S0, new Functor3("$VAR", Pos, Name, Variable_1), Precedence, Answer, S))
{
yield return false;
}
@@ -889,9 +995,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 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))
+ foreach (bool l3 in read_atom(new Functor2("/", Atom_1, P), S0, Precedence, Answer, S))
{
yield return false;
}
@@ -906,9 +1012,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 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 l3 in YP.unify(arg2, new ListPair(new Functor1("number", Number), S1)))
{
foreach (bool l4 in YP.unify(Negative, YP.negate(Number)))
{
@@ -930,9 +1036,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 l2 in YP.unify(arg1, new Functor2("/", Functor_1, Pos)))
{
- foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a(@"("), S1)))
+ foreach (bool l3 in YP.unify(arg2, new ListPair(Atom.a("("), S1)))
{
foreach (bool l4 in parse(S1, 999, Arg1, S2))
{
@@ -962,7 +1068,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 l2 in YP.unify(arg1, new Functor2("/", Op, Pos)))
{
foreach (bool l3 in prefixop(Op, Oprec, Aprec))
{
@@ -981,7 +1087,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
if (YP.greaterThan(Oprec, Precedence))
{
- foreach (bool l6 in syntax_error(new ListPair(Atom.a(@"prefix"), new ListPair(Atom.a(@"operator"), new ListPair(Op, new ListPair(Atom.a(@"in"), new ListPair(Atom.a(@"context"), new ListPair(Atom.a(@"with"), new ListPair(Atom.a(@"precedence"), new ListPair(Precedence, Atom.NIL)))))))), S0))
+ 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;
}
@@ -991,7 +1097,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
foreach (bool l6 in parse(S0, Aprec, Arg, S1))
{
- foreach (bool l7 in YP.univ(Term, new ListPair(Op, new ListPair(Pos, new ListPair(Arg, Atom.NIL)))))
+ 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))
{
@@ -1006,7 +1112,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
foreach (bool l6 in prefix_is_atom(S1, Oprec))
{
- foreach (bool l7 in exprtl(S1, Oprec, new Functor2(@"/", Op, Pos), Precedence, Answer, S))
+ foreach (bool l7 in exprtl(S1, Oprec, new Functor2("/", Op, Pos), Precedence, Answer, S))
{
yield return false;
}
@@ -1014,7 +1120,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
foreach (bool l5 in parse(S0, Aprec, Arg, S1))
{
- foreach (bool l6 in YP.univ(Term, new ListPair(Op, new ListPair(Pos, new ListPair(Arg, Atom.NIL)))))
+ 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))
{
@@ -1037,7 +1143,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 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))))
{
@@ -1053,7 +1159,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public static IEnumerable cannot_start(object Token, object S0)
{
{
- foreach (bool l2 in syntax_error(new ListPair(Token, new ListPair(Atom.a(@"cannot"), new ListPair(Atom.a(@"start"), new ListPair(Atom.a(@"an"), new ListPair(Atom.a(@"expression"), Atom.NIL))))), 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;
}
@@ -1068,7 +1174,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
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 l2 in YP.unify(arg1, new ListPair(Atom.a(","), S1)))
{
foreach (bool l3 in YP.unify(arg2, new ListPair(Term, Rest)))
{
@@ -1086,7 +1192,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
object S = arg3;
- foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(@")"), S)))
+ foreach (bool l2 in YP.unify(arg1, new ListPair(Atom.a(")"), S)))
{
foreach (bool l3 in YP.unify(arg2, Atom.NIL))
{
@@ -1099,7 +1205,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object S = arg1;
object x2 = arg2;
object x3 = arg3;
- foreach (bool l2 in syntax_error(new ListPair(Atom.a(@", or )"), new ListPair(Atom.a(@"expected"), new ListPair(Atom.a(@"in"), new ListPair(Atom.a(@"arguments"), Atom.NIL)))), S))
+ 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;
}
@@ -1113,7 +1219,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x2 = arg3;
foreach (bool l2 in YP.unify(arg1, Atom.NIL))
{
- foreach (bool l3 in syntax_error(new ListPair(Atom.a(@", | or ]"), new ListPair(Atom.a(@"expected"), new ListPair(Atom.a(@"in"), new ListPair(Atom.a(@"list"), Atom.NIL)))), 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;
}
@@ -1142,7 +1248,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable Term = new Variable();
Variable Rest = new Variable();
Variable S2 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@",")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a(",")))
{
foreach (bool l3 in YP.unify(arg3, new ListPair(Term, Rest)))
{
@@ -1163,11 +1269,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object Rest = arg3;
object S = arg4;
Variable S2 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"|")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("|")))
{
foreach (bool l3 in parse(S1, 999, Rest, S2))
{
- foreach (bool l4 in expect(Atom.a(@"]"), S2, S))
+ foreach (bool l4 in expect(Atom.a("]"), S2, S))
{
yield return false;
}
@@ -1178,7 +1284,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
Variable S1 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"]")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("]")))
{
foreach (bool l3 in YP.unify(arg2, S1))
{
@@ -1198,7 +1304,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object S1 = arg2;
object x3 = arg3;
object x4 = arg4;
- foreach (bool l2 in syntax_error(new ListPair(Atom.a(@", | or ]"), new ListPair(Atom.a(@"expected"), new ListPair(Atom.a(@"in"), new ListPair(Atom.a(@"list"), Atom.NIL)))), new ListPair(Token, S1)))
+ foreach (bool l2 in syntax_error(ListPair.make(new object[] { Atom.a(", | or ]"), Atom.a("expected"), Atom.a("in"), Atom.a("list") }), new ListPair(Token, S1)))
{
yield return false;
}
@@ -1237,7 +1343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable x1 = new Variable();
Variable x2 = new Variable();
Variable x3 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor3(@"var", x1, x2, x3)))
+ foreach (bool l2 in YP.unify(arg1, new Functor3("var", x1, x2, x3)))
{
foreach (bool l3 in YP.unify(arg2, 1))
{
@@ -1248,7 +1354,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
object x2 = arg3;
Variable x1 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor1(@"number", x1)))
+ foreach (bool l2 in YP.unify(arg1, new Functor1("number", x1)))
{
foreach (bool l3 in YP.unify(arg2, 1))
{
@@ -1259,7 +1365,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
object x2 = arg3;
Variable x1 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor1(@"string", x1)))
+ foreach (bool l2 in YP.unify(arg1, new Functor1("string", x1)))
{
foreach (bool l3 in YP.unify(arg2, 1))
{
@@ -1269,7 +1375,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
object x1 = arg3;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@" (")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a(" (")))
{
foreach (bool l3 in YP.unify(arg2, 1))
{
@@ -1279,7 +1385,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
object x1 = arg3;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"(")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("(")))
{
foreach (bool l3 in YP.unify(arg2, 0))
{
@@ -1289,7 +1395,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
object x1 = arg3;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@")")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a(")")))
{
foreach (bool l3 in YP.unify(arg2, -1))
{
@@ -1299,11 +1405,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
Variable x1 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"[")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("[")))
{
foreach (bool l3 in YP.unify(arg2, 0))
{
- foreach (bool l4 in YP.unify(arg3, new ListPair(Atom.a(@"]"), x1)))
+ foreach (bool l4 in YP.unify(arg3, new ListPair(Atom.a("]"), x1)))
{
yield return true;
yield break;
@@ -1313,7 +1419,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
object x1 = arg3;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"[")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("[")))
{
foreach (bool l3 in YP.unify(arg2, 1))
{
@@ -1323,7 +1429,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
object x1 = arg3;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"]")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("]")))
{
foreach (bool l3 in YP.unify(arg2, -1))
{
@@ -1333,11 +1439,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
Variable x1 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"{")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("{")))
{
foreach (bool l3 in YP.unify(arg2, 0))
{
- foreach (bool l4 in YP.unify(arg3, new ListPair(Atom.a(@"}"), x1)))
+ foreach (bool l4 in YP.unify(arg3, new ListPair(Atom.a("}"), x1)))
{
yield return true;
yield break;
@@ -1347,7 +1453,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
object x1 = arg3;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"{")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("{")))
{
foreach (bool l3 in YP.unify(arg2, 1))
{
@@ -1357,7 +1463,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
object x1 = arg3;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"}")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("}")))
{
foreach (bool l3 in YP.unify(arg2, -1))
{
@@ -1367,7 +1473,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
object x1 = arg3;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@",")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a(",")))
{
foreach (bool l3 in YP.unify(arg2, -1))
{
@@ -1377,7 +1483,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
object x1 = arg3;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"|")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("|")))
{
foreach (bool l3 in YP.unify(arg2, -1))
{
@@ -1389,7 +1495,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x3 = arg3;
Variable x1 = new Variable();
Variable x2 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor2(@"atom", x1, x2)))
+ foreach (bool l2 in YP.unify(arg1, new Functor2("atom", x1, x2)))
{
foreach (bool l3 in YP.unify(arg2, 0))
{
@@ -1405,9 +1511,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable F = new Variable();
Variable Pos = new Variable();
Variable S1 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"atom", F, Pos), new ListPair(Atom.a(@"("), S1))))
+ foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("atom", F, Pos), new ListPair(Atom.a("("), S1))))
{
- foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor2(@"atom", F, Pos), new ListPair(Atom.a(@"("), S1))))
+ foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor2("atom", F, Pos), new ListPair(Atom.a("("), S1))))
{
yield return true;
yield break;
@@ -1421,9 +1527,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable L = new Variable();
Variable P = new Variable();
Variable R = new Variable();
- foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"atom", F, Pos), S1)))
+ foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("atom", F, Pos), S1)))
{
- foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor(Atom.a(@"infixop", Atom.a(@"")), new object[] { new Functor2(@"/", F, Pos), L, P, R }), S1)))
+ foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor(Atom.a("infixop", Atom.a("")), new object[] { new Functor2("/", F, Pos), L, P, R }), S1)))
{
foreach (bool l4 in infixop(F, L, P, R))
{
@@ -1438,9 +1544,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable S1 = new Variable();
Variable L = new Variable();
Variable P = new Variable();
- foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"atom", F, Pos), S1)))
+ foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("atom", F, Pos), S1)))
{
- foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor3(Atom.a(@"postfixop", Atom.a(@"")), new Functor2(@"/", F, Pos), L, P), S1)))
+ foreach (bool l3 in YP.unify(arg2, new ListPair(new Functor3(Atom.a("postfixop", Atom.a("")), new Functor2("/", F, Pos), L, P), S1)))
{
foreach (bool l4 in postfixop(F, L, P))
{
@@ -1481,7 +1587,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable L = new Variable();
Variable x3 = new Variable();
Variable x4 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor(Atom.a(@"infixop", Atom.a(@"")), new object[] { x1, L, x3, x4 })))
+ foreach (bool l2 in YP.unify(arg1, new Functor(Atom.a("infixop", Atom.a("")), new object[] { x1, L, x3, x4 })))
{
if (YP.greaterThanOrEqual(L, P))
{
@@ -1494,7 +1600,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable x1 = new Variable();
Variable L = new Variable();
Variable x3 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor3(Atom.a(@"postfixop", Atom.a(@"")), x1, L, x3)))
+ foreach (bool l2 in YP.unify(arg1, new Functor3(Atom.a("postfixop", Atom.a("")), x1, L, x3)))
{
if (YP.greaterThanOrEqual(L, P))
{
@@ -1504,28 +1610,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
object x1 = arg2;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@")")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a(")")))
{
yield return false;
}
}
{
object x1 = arg2;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"]")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("]")))
{
yield return false;
}
}
{
object x1 = arg2;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"}")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("}")))
{
yield return false;
}
}
{
object P = arg2;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"|")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("|")))
{
if (YP.greaterThanOrEqual(1100, P))
{
@@ -1535,7 +1641,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
{
object P = arg2;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@",")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a(",")))
{
if (YP.greaterThanOrEqual(1000, P))
{
@@ -1594,13 +1700,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x2 = arg3;
object S1 = arg6;
Variable Term = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"}")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("}")))
{
foreach (bool l3 in YP.unify(arg2, Term))
{
foreach (bool l4 in YP.unify(arg4, Term))
{
- foreach (bool l5 in YP.unify(arg5, new ListPair(Atom.a(@"}"), S1)))
+ foreach (bool l5 in YP.unify(arg5, new ListPair(Atom.a("}"), S1)))
{
yield return false;
}
@@ -1612,13 +1718,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x2 = arg3;
object S1 = arg6;
Variable Term = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"]")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("]")))
{
foreach (bool l3 in YP.unify(arg2, Term))
{
foreach (bool l4 in YP.unify(arg4, Term))
{
- foreach (bool l5 in YP.unify(arg5, new ListPair(Atom.a(@"]"), S1)))
+ foreach (bool l5 in YP.unify(arg5, new ListPair(Atom.a("]"), S1)))
{
yield return false;
}
@@ -1630,13 +1736,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x2 = arg3;
object S1 = arg6;
Variable Term = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@")")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a(")")))
{
foreach (bool l3 in YP.unify(arg2, Term))
{
foreach (bool l4 in YP.unify(arg4, Term))
{
- foreach (bool l5 in YP.unify(arg5, new ListPair(Atom.a(@")"), S1)))
+ foreach (bool l5 in YP.unify(arg5, new ListPair(Atom.a(")"), S1)))
{
yield return false;
}
@@ -1652,13 +1758,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object S1 = arg6;
Variable Next = new Variable();
Variable S2 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@",")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a(",")))
{
if (YP.greaterThanOrEqual(Precedence, 1000))
{
foreach (bool l4 in parse(S1, 1000, Next, S2))
{
- foreach (bool l5 in exprtl(S2, 1000, new Functor2(@",", Term, Next), Precedence, Answer, S))
+ foreach (bool l5 in exprtl(S2, 1000, new Functor2(",", Term, Next), Precedence, Answer, S))
{
yield return false;
}
@@ -1668,7 +1774,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
foreach (bool l3 in YP.unify(Answer, Term))
{
- foreach (bool l4 in YP.unify(S, new ListPair(Atom.a(@","), S1)))
+ foreach (bool l4 in YP.unify(S, new ListPair(Atom.a(","), S1)))
{
yield return false;
}
@@ -1685,13 +1791,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object S1 = arg6;
Variable Next = new Variable();
Variable S2 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"|")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("|")))
{
if (YP.greaterThanOrEqual(Precedence, 1100))
{
foreach (bool l4 in parse(S1, 1100, Next, S2))
{
- foreach (bool l5 in exprtl(S2, 1100, new Functor2(@";", Term, Next), Precedence, Answer, S))
+ foreach (bool l5 in exprtl(S2, 1100, new Functor2(";", Term, Next), Precedence, Answer, S))
{
yield return false;
}
@@ -1701,7 +1807,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
foreach (bool l3 in YP.unify(Answer, Term))
{
- foreach (bool l4 in YP.unify(S, new ListPair(Atom.a(@"|"), S1)))
+ foreach (bool l4 in YP.unify(S, new ListPair(Atom.a("|"), S1)))
{
yield return false;
}
@@ -1717,9 +1823,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x5 = arg5;
object S1 = arg6;
Variable S = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor1(@"string", S)))
+ foreach (bool l2 in YP.unify(arg1, new Functor1("string", S)))
{
- foreach (bool l3 in cannot_follow(Atom.a(@"chars"), new Functor1(@"string", S), S1))
+ foreach (bool l3 in cannot_follow(Atom.a("chars"), new Functor1("string", S), S1))
{
yield return false;
}
@@ -1732,9 +1838,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x5 = arg5;
object S1 = arg6;
Variable N = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor1(@"number", N)))
+ foreach (bool l2 in YP.unify(arg1, new Functor1("number", N)))
{
- foreach (bool l3 in cannot_follow(Atom.a(@"number"), new Functor1(@"number", N), S1))
+ foreach (bool l3 in cannot_follow(Atom.a("number"), new Functor1("number", N), S1))
{
yield return false;
}
@@ -1746,11 +1852,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object Answer = arg4;
object S = arg5;
Variable S1 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"{")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("{")))
{
- foreach (bool l3 in YP.unify(arg6, new ListPair(Atom.a(@"}"), S1)))
+ foreach (bool l3 in YP.unify(arg6, new ListPair(Atom.a("}"), S1)))
{
- foreach (bool l4 in exprtl0_atom(Atom.a(@"{}"), Term, Precedence, Answer, S, S1))
+ foreach (bool l4 in exprtl0_atom(Atom.a("{}"), Term, Precedence, Answer, S, S1))
{
yield return false;
}
@@ -1764,9 +1870,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x3 = arg4;
object x4 = arg5;
object S1 = arg6;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"{")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("{")))
{
- foreach (bool l3 in cannot_follow(Atom.a(@"brace"), Atom.a(@"{"), S1))
+ foreach (bool l3 in cannot_follow(Atom.a("brace"), Atom.a("{"), S1))
{
yield return false;
}
@@ -1778,9 +1884,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object Answer = arg4;
object S = arg5;
Variable S1 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"[")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("[")))
{
- foreach (bool l3 in YP.unify(arg6, new ListPair(Atom.a(@"]"), S1)))
+ foreach (bool l3 in YP.unify(arg6, new ListPair(Atom.a("]"), S1)))
{
foreach (bool l4 in exprtl0_atom(Atom.NIL, Term, Precedence, Answer, S, S1))
{
@@ -1796,9 +1902,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x3 = arg4;
object x4 = arg5;
object S1 = arg6;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"[")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("[")))
{
- foreach (bool l3 in cannot_follow(Atom.a(@"bracket"), Atom.a(@"["), S1))
+ foreach (bool l3 in cannot_follow(Atom.a("bracket"), Atom.a("["), S1))
{
yield return false;
}
@@ -1810,9 +1916,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x3 = arg4;
object x4 = arg5;
object S1 = arg6;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"(")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("(")))
{
- foreach (bool l3 in cannot_follow(Atom.a(@"parenthesis"), Atom.a(@"("), S1))
+ foreach (bool l3 in cannot_follow(Atom.a("parenthesis"), Atom.a("("), S1))
{
yield return false;
}
@@ -1824,9 +1930,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x3 = arg4;
object x4 = arg5;
object S1 = arg6;
- foreach (bool l2 in YP.unify(arg1, Atom.a(@" (")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a(" (")))
{
- foreach (bool l3 in cannot_follow(Atom.a(@"parenthesis"), Atom.a(@"("), S1))
+ foreach (bool l3 in cannot_follow(Atom.a("parenthesis"), Atom.a("("), S1))
{
yield return false;
}
@@ -1841,9 +1947,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable A = new Variable();
Variable B = new Variable();
Variable P = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor3(@"var", A, B, P)))
+ foreach (bool l2 in YP.unify(arg1, new Functor3("var", A, B, P)))
{
- foreach (bool l3 in cannot_follow(Atom.a(@"variable"), new Functor3(@"var", A, B, P), S1))
+ foreach (bool l3 in cannot_follow(Atom.a("variable"), new Functor3("var", A, B, P), S1))
{
yield return false;
}
@@ -1857,9 +1963,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object S1 = arg6;
Variable F = new Variable();
Variable P = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor2(@"atom", F, P)))
+ foreach (bool l2 in YP.unify(arg1, new Functor2("atom", F, P)))
{
- foreach (bool l3 in exprtl0_atom(new Functor2(@"/", F, P), Term, Precedence, Answer, S, S1))
+ foreach (bool l3 in exprtl0_atom(new Functor2("/", F, P), Term, Precedence, Answer, S, S1))
{
yield return false;
}
@@ -1881,23 +1987,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable R1 = new Variable();
Variable L2 = new Variable();
Variable O2 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor2(@"/", F, Pos)))
+ foreach (bool l2 in YP.unify(arg1, new Functor2("/", F, Pos)))
{
foreach (bool l3 in ambigop(F, Precedence, L1, O1, R1, L2, O2))
{
foreach (bool l4 in prefix_is_atom(S1, Precedence))
{
- foreach (bool l5 in exprtl(new ListPair(new Functor3(Atom.a(@"postfixop", Atom.a(@"")), new Functor2(@"/", F, Pos), L2, O2), S1), 0, Term, Precedence, Answer, S))
+ foreach (bool l5 in exprtl(new ListPair(new Functor3(Atom.a("postfixop", Atom.a("")), new Functor2("/", F, Pos), L2, O2), S1), 0, Term, Precedence, Answer, S))
{
yield return false;
}
yield break;
}
- foreach (bool l4 in exprtl(new ListPair(new Functor(Atom.a(@"infixop", Atom.a(@"")), new object[] { new Functor2(@"/", F, Pos), L1, O1, R1 }), S1), 0, Term, Precedence, Answer, S))
+ foreach (bool l4 in exprtl(new ListPair(new Functor(Atom.a("infixop", Atom.a("")), new object[] { new Functor2("/", F, Pos), L1, O1, R1 }), S1), 0, Term, Precedence, Answer, S))
{
yield return false;
}
- foreach (bool l4 in exprtl(new ListPair(new Functor3(Atom.a(@"postfixop", Atom.a(@"")), new Functor2(@"/", F, Pos), L2, O2), S1), 0, Term, Precedence, Answer, S))
+ foreach (bool l4 in exprtl(new ListPair(new Functor3(Atom.a("postfixop", Atom.a("")), new Functor2("/", F, Pos), L2, O2), S1), 0, Term, Precedence, Answer, S))
{
yield return false;
}
@@ -1915,11 +2021,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable L1 = new Variable();
Variable O1 = new Variable();
Variable R1 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor2(@"/", F, Pos)))
+ foreach (bool l2 in YP.unify(arg1, new Functor2("/", F, Pos)))
{
foreach (bool l3 in infixop(F, L1, O1, R1))
{
- foreach (bool l4 in exprtl(new ListPair(new Functor(Atom.a(@"infixop", Atom.a(@"")), new object[] { new Functor2(@"/", F, Pos), L1, O1, R1 }), S1), 0, Term, Precedence, Answer, S))
+ foreach (bool l4 in exprtl(new ListPair(new Functor(Atom.a("infixop", Atom.a("")), new object[] { new Functor2("/", F, Pos), L1, O1, R1 }), S1), 0, Term, Precedence, Answer, S))
{
yield return false;
}
@@ -1936,11 +2042,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable Pos = new Variable();
Variable L2 = new Variable();
Variable O2 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor2(@"/", F, Pos)))
+ foreach (bool l2 in YP.unify(arg1, new Functor2("/", F, Pos)))
{
foreach (bool l3 in postfixop(F, L2, O2))
{
- foreach (bool l4 in exprtl(new ListPair(new Functor3(Atom.a(@"postfixop", Atom.a(@"")), new Functor2(@"/", F, Pos), L2, O2), S1), 0, Term, Precedence, Answer, S))
+ foreach (bool l4 in exprtl(new ListPair(new Functor3(Atom.a("postfixop", Atom.a("")), new Functor2("/", F, Pos), L2, O2), S1), 0, Term, Precedence, Answer, S))
{
yield return false;
}
@@ -1955,7 +2061,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object x4 = arg4;
object x5 = arg5;
Variable x7 = new Variable();
- foreach (bool l2 in syntax_error(new ListPair(new Functor2(@"-", Atom.a(@"non"), Atom.a(@"operator")), new ListPair(X, new ListPair(Atom.a(@"follows"), new ListPair(Atom.a(@"expression"), Atom.NIL)))), new ListPair(new Functor2(@"atom", X, x7), S1)))
+ foreach (bool l2 in syntax_error(ListPair.make(new object[] { new Functor2("-", Atom.a("non"), Atom.a("operator")), X, Atom.a("follows"), Atom.a("expression") }), new ListPair(new Functor2("atom", X, x7), S1)))
{
yield return false;
}
@@ -1966,7 +2072,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public static IEnumerable cannot_follow(object Type, object Token, object Tokens)
{
{
- foreach (bool l2 in syntax_error(new ListPair(Type, new ListPair(Atom.a(@"follows"), new ListPair(Atom.a(@"expression"), Atom.NIL))), new ListPair(Token, Tokens)))
+ foreach (bool l2 in syntax_error(ListPair.make(new object[] { Type, Atom.a("follows"), Atom.a("expression") }), new ListPair(Token, Tokens)))
{
yield return false;
}
@@ -2028,7 +2134,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable Other = new Variable();
Variable S2 = new Variable();
Variable Expr = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor(Atom.a(@"infixop", Atom.a(@"")), new object[] { new Functor2(@"/", F, Pos), L, O, R })))
+ foreach (bool l2 in YP.unify(arg1, new Functor(Atom.a("infixop", Atom.a("")), new object[] { new Functor2("/", F, Pos), L, O, R })))
{
if (YP.greaterThanOrEqual(Precedence, O))
{
@@ -2036,7 +2142,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
foreach (bool l5 in parse(S1, R, Other, S2))
{
- foreach (bool l6 in YP.univ(Expr, new ListPair(F, new ListPair(Pos, new ListPair(Term, new ListPair(Other, Atom.NIL))))))
+ foreach (bool l6 in YP.univ(Expr, ListPair.make(new object[] { F, Pos, Term, Other })))
{
foreach (bool l7 in exprtl(S2, O, Expr, Precedence, Answer, S))
{
@@ -2062,13 +2168,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable O = new Variable();
Variable Expr = new Variable();
Variable S2 = new Variable();
- foreach (bool l2 in YP.unify(arg1, new Functor3(Atom.a(@"postfixop", Atom.a(@"")), new Functor2(@"/", F, Pos), L, O)))
+ foreach (bool l2 in YP.unify(arg1, new Functor3(Atom.a("postfixop", Atom.a("")), new Functor2("/", F, Pos), L, O)))
{
if (YP.greaterThanOrEqual(Precedence, O))
{
if (YP.lessThanOrEqual(C, L))
{
- foreach (bool l5 in YP.univ(Expr, new ListPair(F, new ListPair(Pos, new ListPair(Term, Atom.NIL)))))
+ foreach (bool l5 in YP.univ(Expr, ListPair.make(new object[] { F, Pos, Term })))
{
foreach (bool l6 in peepop(S1, S2))
{
@@ -2092,7 +2198,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object S1 = arg7;
Variable Next = new Variable();
Variable S2 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@",")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a(",")))
{
if (YP.greaterThanOrEqual(Precedence, 1000))
{
@@ -2100,7 +2206,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
foreach (bool l5 in parse(S1, 1000, Next, S2))
{
- foreach (bool l6 in exprtl(S2, 1000, new Functor2(@",", Term, Next), Precedence, Answer, S))
+ foreach (bool l6 in exprtl(S2, 1000, new Functor2(",", Term, Next), Precedence, Answer, S))
{
yield return false;
}
@@ -2119,7 +2225,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
object S1 = arg7;
Variable Next = new Variable();
Variable S2 = new Variable();
- foreach (bool l2 in YP.unify(arg1, Atom.a(@"|")))
+ foreach (bool l2 in YP.unify(arg1, Atom.a("|")))
{
if (YP.greaterThanOrEqual(Precedence, 1100))
{
@@ -2127,7 +2233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
foreach (bool l5 in parse(S1, 1100, Next, S2))
{
- foreach (bool l6 in exprtl(S2, 1100, new Functor2(@";", Term, Next), Precedence, Answer, S))
+ foreach (bool l6 in exprtl(S2, 1100, new Functor2(";", Term, Next), Precedence, Answer, S))
{
yield return false;
}
@@ -2161,6 +2267,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
yield break;
}
+ foreach (bool l1 in YP.fail())
+ {
+ yield return false;
+ }
}
public static IEnumerable syntax_error(object _List)
@@ -2168,12 +2278,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
yield break;
}
+ foreach (bool l1 in YP.fail())
+ {
+ yield return false;
+ }
}
public static IEnumerable prefixop(object F, object O, object Q)
{
{
- foreach (bool l2 in YP.current_op(O, Atom.a(@"fx"), F))
+ foreach (bool l2 in YP.current_op(O, Atom.a("fx"), F))
{
foreach (bool l3 in YP.unify(Q, YP.subtract(O, 1)))
{
@@ -2181,7 +2295,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
goto cutIf1;
}
- foreach (bool l2 in YP.current_op(O, Atom.a(@"fy"), F))
+ foreach (bool l2 in YP.current_op(O, Atom.a("fy"), F))
{
foreach (bool l3 in YP.unify(Q, O))
{
@@ -2198,7 +2312,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public static IEnumerable postfixop(object F, object P, object O)
{
{
- foreach (bool l2 in YP.current_op(O, Atom.a(@"xf"), F))
+ foreach (bool l2 in YP.current_op(O, Atom.a("xf"), F))
{
foreach (bool l3 in YP.unify(P, YP.subtract(O, 1)))
{
@@ -2206,7 +2320,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
goto cutIf1;
}
- foreach (bool l2 in YP.current_op(O, Atom.a(@"yf"), F))
+ foreach (bool l2 in YP.current_op(O, Atom.a("yf"), F))
{
foreach (bool l3 in YP.unify(P, O))
{
@@ -2223,7 +2337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public static IEnumerable infixop(object F, object P, object O, object Q)
{
{
- foreach (bool l2 in YP.current_op(O, Atom.a(@"xfy"), F))
+ foreach (bool l2 in YP.current_op(O, Atom.a("xfy"), F))
{
foreach (bool l3 in YP.unify(P, YP.subtract(O, 1)))
{
@@ -2234,7 +2348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
goto cutIf1;
}
- foreach (bool l2 in YP.current_op(O, Atom.a(@"xfx"), F))
+ foreach (bool l2 in YP.current_op(O, Atom.a("xfx"), F))
{
foreach (bool l3 in YP.unify(P, YP.subtract(O, 1)))
{
@@ -2245,7 +2359,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
goto cutIf2;
}
- foreach (bool l2 in YP.current_op(O, Atom.a(@"yfx"), F))
+ foreach (bool l2 in YP.current_op(O, Atom.a("yfx"), F))
{
foreach (bool l3 in YP.unify(Q, YP.subtract(O, 1)))
{
@@ -2302,7 +2416,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
}
{
- foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"atom", Atom.a(@"end_of_file"), 0), Atom.NIL)))
+ foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("atom", Atom.a("end_of_file"), 0), Atom.NIL)))
{
yield return false;
}
@@ -2336,7 +2450,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
}
{
- foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"atom", Atom.a(@"end_of_file"), 0), Atom.NIL)))
+ foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("atom", Atom.a("end_of_file"), 0), Atom.NIL)))
{
foreach (bool l3 in YP.unify(arg2, Atom.NIL))
{
@@ -2407,7 +2521,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable NextCh = new Variable();
foreach (bool l2 in YP.unify(arg1, 37))
{
- foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2(@"comment", StartPos, EndPos), Tokens)))
+ foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("comment", StartPos, EndPos), Tokens)))
{
foreach (bool l4 in get_current_position(StartPos))
{
@@ -2456,7 +2570,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
if (YP.equal(C2, new ListPair(42, Atom.NIL)))
{
- foreach (bool l5 in YP.unify(T, new ListPair(new Functor2(@"comment", StartPos, EndPos), Tokens)))
+ foreach (bool l5 in YP.unify(T, new ListPair(new Functor2("comment", StartPos, EndPos), Tokens)))
{
foreach (bool l6 in get_current_position(StartPos1))
{
@@ -2498,7 +2612,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable NextCh = new Variable();
foreach (bool l2 in YP.unify(arg1, 33))
{
- foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2(@"atom", Atom.a(@"!"), Pos), Tokens)))
+ foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("atom", Atom.a("!"), Pos), Tokens)))
{
foreach (bool l4 in get_current_position(Pos))
{
@@ -2518,7 +2632,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable NextCh = new Variable();
foreach (bool l2 in YP.unify(arg1, 40))
{
- foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(@" ("), Tokens)))
+ foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(" ("), Tokens)))
{
foreach (bool l4 in YP.get_code(NextCh))
{
@@ -2535,7 +2649,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable NextCh = new Variable();
foreach (bool l2 in YP.unify(arg1, 41))
{
- foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(@")"), Tokens)))
+ foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(")"), Tokens)))
{
foreach (bool l4 in YP.get_code(NextCh))
{
@@ -2552,7 +2666,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable NextCh = new Variable();
foreach (bool l2 in YP.unify(arg1, 44))
{
- foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(@","), Tokens)))
+ foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(","), Tokens)))
{
foreach (bool l4 in YP.get_code(NextCh))
{
@@ -2570,7 +2684,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable NextCh = new Variable();
foreach (bool l2 in YP.unify(arg1, 59))
{
- foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2(@"atom", Atom.a(@";"), Pos), Tokens)))
+ foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("atom", Atom.a(";"), Pos), Tokens)))
{
foreach (bool l4 in get_current_position(Pos))
{
@@ -2591,7 +2705,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable NextCh = new Variable();
foreach (bool l2 in YP.unify(arg1, 91))
{
- foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2(@"/", Atom.a(@"["), Pos), Tokens)))
+ foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("/", Atom.a("["), Pos), Tokens)))
{
foreach (bool l4 in get_current_position(Pos))
{
@@ -2612,7 +2726,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable NextCh = new Variable();
foreach (bool l2 in YP.unify(arg1, 93))
{
- foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2(@"/", Atom.a(@"]"), Pos), Tokens)))
+ foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("/", Atom.a("]"), Pos), Tokens)))
{
foreach (bool l4 in get_current_position(Pos))
{
@@ -2633,7 +2747,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable NextCh = new Variable();
foreach (bool l2 in YP.unify(arg1, 123))
{
- foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2(@"/", Atom.a(@"{"), Pos), Tokens)))
+ foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("/", Atom.a("{"), Pos), Tokens)))
{
foreach (bool l4 in get_current_position(Pos))
{
@@ -2653,7 +2767,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable NextCh = new Variable();
foreach (bool l2 in YP.unify(arg1, 124))
{
- foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(@"|"), Tokens)))
+ foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("|"), Tokens)))
{
foreach (bool l4 in YP.get_code(NextCh))
{
@@ -2670,7 +2784,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable NextCh = new Variable();
foreach (bool l2 in YP.unify(arg1, 125))
{
- foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(@"}"), Tokens)))
+ foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("}"), Tokens)))
{
foreach (bool l4 in YP.get_code(NextCh))
{
@@ -2702,7 +2816,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable NextCh = new Variable();
foreach (bool l2 in YP.unify(arg1, 34))
{
- foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor1(@"string", Chars), Tokens)))
+ foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor1("string", Chars), Tokens)))
{
foreach (bool l4 in read_string(Chars, 34, NextCh))
{
@@ -3098,7 +3212,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable Atom_1 = new Variable();
Variable Pos = new Variable();
Variable Tokens = new Variable();
- foreach (bool l2 in YP.unify(arg3, new ListPair(new Functor2(@"atom", Atom_1, Pos), Tokens)))
+ foreach (bool l2 in YP.unify(arg3, new ListPair(new Functor2("atom", Atom_1, Pos), Tokens)))
{
foreach (bool l3 in YP.unify(Pos, 0))
{
@@ -3121,7 +3235,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable NextCh = new Variable();
foreach (bool l2 in YP.unify(arg1, 40))
{
- foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a(@"("), Tokens)))
+ foreach (bool l3 in YP.unify(arg3, new ListPair(Atom.a("("), Tokens)))
{
foreach (bool l4 in YP.get_code(NextCh))
{
@@ -3397,7 +3511,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable Tokens = new Variable();
Variable Chars = new Variable();
Variable NextCh = new Variable();
- foreach (bool l2 in YP.unify(arg3, new ListPair(new Functor3(@"var", Var, Name, StartPos), Tokens)))
+ foreach (bool l2 in YP.unify(arg3, new ListPair(new Functor3("var", Var, Name, StartPos), Tokens)))
{
foreach (bool l3 in get_current_position(StartPos))
{
@@ -3405,7 +3519,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
foreach (bool l5 in YP.atom_codes(Name, Chars))
{
- if (YP.termEqual(Name, Atom.a(@"_")))
+ if (YP.termEqual(Name, Atom.a("_")))
{
foreach (bool l7 in read_after_atom(NextCh, Dict, Tokens))
{
@@ -3435,7 +3549,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable N = new Variable();
Variable V = new Variable();
Variable L = new Variable();
- foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2(@"=", N, V), L)))
+ foreach (bool l2 in YP.unify(arg1, new ListPair(new Functor2("=", N, V), L)))
{
foreach (bool l3 in YP.unify(N, Name))
{
@@ -3493,7 +3607,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
foreach (bool l2 in YP.unify(LastCh, Ch))
{
- foreach (bool l3 in formatError(Atom.a(@"user_error"), Atom.a(@"~N** end of file in /*comment~n"), Atom.NIL))
+ foreach (bool l3 in formatError(Atom.a("user_error"), Atom.a("~N** end of file in /*comment~n"), Atom.NIL))
{
yield return false;
}
@@ -3633,7 +3747,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
if (YP.greaterThanOrEqual(Ch, new ListPair(48, Atom.NIL)))
{
- foreach (bool l4 in YP.unify(Tokens, new ListPair(new Functor1(@"number", Number), Tokens1)))
+ foreach (bool l4 in YP.unify(Tokens, new ListPair(new Functor1("number", Number), Tokens1)))
{
foreach (bool l5 in read_float(Number, Dict, Tokens1, new ListPair(48, Atom.NIL), Ch))
{
@@ -3662,7 +3776,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
goto cutIf3;
}
- foreach (bool l2 in formatError(Atom.a(@"user_error"), Atom.a(@"~N** end of file just after full stop~n"), Atom.NIL))
+ foreach (bool l2 in formatError(Atom.a("user_error"), Atom.a("~N** end of file just after full stop~n"), Atom.NIL))
{
}
cutIf3:
@@ -3680,7 +3794,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable NextCh = new Variable();
foreach (bool l2 in prepend(Digits, Chars, Rest))
{
- foreach (bool l3 in read_float(Digit, Rest, NextCh, Chars))
+ foreach (bool l3 in read_float4(Digit, Rest, NextCh, Chars))
{
foreach (bool l4 in YP.number_codes(Number, Chars))
{
@@ -3724,7 +3838,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
}
- public static IEnumerable read_float(object C1, object arg2, object NextCh, object Total)
+ public static IEnumerable read_float4(object C1, object arg2, object NextCh, object Total)
{
{
Variable Chars = new Variable();
@@ -3740,7 +3854,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
if (YP.lessThanOrEqual(C2, new ListPair(57, Atom.NIL)))
{
- foreach (bool l6 in read_float(C2, Chars, NextCh, Total))
+ foreach (bool l6 in read_float4(C2, Chars, NextCh, Total))
{
yield return false;
}
@@ -3770,7 +3884,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
foreach (bool l9 in YP.unify(More, Atom.NIL))
{
- foreach (bool l10 in formatError(Atom.a(@"user_error"), Atom.a(@"~N** Missing exponent in ~s~n"), new ListPair(Total, Atom.NIL)))
+ foreach (bool l10 in formatError(Atom.a("user_error"), Atom.a("~N** Missing exponent in ~s~n"), new ListPair(Total, Atom.NIL)))
{
}
}
@@ -3806,7 +3920,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
foreach (bool l9 in YP.unify(More, Atom.NIL))
{
- foreach (bool l10 in formatError(Atom.a(@"user_error"), Atom.a(@"~N** Missing exponent in ~s~n"), new ListPair(Total, Atom.NIL)))
+ foreach (bool l10 in formatError(Atom.a("user_error"), Atom.a("~N** Missing exponent in ~s~n"), new ListPair(Total, Atom.NIL)))
{
}
}
@@ -3840,7 +3954,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
foreach (bool l8 in YP.unify(More, Atom.NIL))
{
- foreach (bool l9 in formatError(Atom.a(@"user_error"), Atom.a(@"~N** Missing exponent in ~s~n"), new ListPair(Total, Atom.NIL)))
+ foreach (bool l9 in formatError(Atom.a("user_error"), Atom.a("~N** Missing exponent in ~s~n"), new ListPair(Total, Atom.NIL)))
{
}
}
@@ -3920,7 +4034,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
Variable C = new Variable();
Variable C3 = new Variable();
Variable Digits = new Variable();
- foreach (bool l2 in YP.unify(arg3, new ListPair(new Functor1(@"number", Number), Tokens)))
+ foreach (bool l2 in YP.unify(arg3, new ListPair(new Functor1("number", Number), Tokens)))
{
foreach (bool l3 in read_number4(C1, C2, 0, N))
{
@@ -3954,7 +4068,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
goto cutIf3;
}
- foreach (bool l5 in formatError(Atom.a(@"user_error"), Atom.a(@"~N** ~d' read as ~d '~n"), new ListPair(N, new ListPair(N, Atom.NIL))))
+ foreach (bool l5 in formatError(Atom.a("user_error"), Atom.a("~N** ~d' read as ~d '~n"), new ListPair(N, new ListPair(N, Atom.NIL))))
{
foreach (bool l6 in YP.unify(Number, N))
{
@@ -4240,7 +4354,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
if (YP.lessThan(C1, 0))
{
- foreach (bool l5 in formatError(Atom.a(@"user_error"), Atom.a(@"~N** end of file in ~cquoted~c~n"), new ListPair(Quote, new ListPair(Quote, Atom.NIL))))
+ foreach (bool l5 in formatError(Atom.a("user_error"), Atom.a("~N** end of file in ~cquoted~c~n"), new ListPair(Quote, new ListPair(Quote, Atom.NIL))))
{
foreach (bool l6 in YP.unify(Result, -1))
{
@@ -4332,7 +4446,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
if (YP.lessThan(C2, 0))
{
- foreach (bool l7 in formatError(Atom.a(@"user_error"), Atom.a(@"~N** end of file in ~c..~c^..~c~n"), new ListPair(Quote, new ListPair(92, new ListPair(Quote, Atom.NIL)))))
+ foreach (bool l7 in formatError(Atom.a("user_error"), Atom.a("~N** end of file in ~c..~c^..~c~n"), ListPair.make(new object[] { Quote, 92, Quote })))
{
foreach (bool l8 in YP.unify(Result, -1))
{
@@ -4432,7 +4546,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
foreach (bool l7 in YP.unify(Next, Char))
{
- foreach (bool l8 in formatError(Atom.a(@"user_error"), Atom.a(@"~N** Strange character ~d ends ~ctoken~c~n"), new ListPair(Char, new ListPair(Quote, new ListPair(Quote, Atom.NIL)))))
+ foreach (bool l8 in formatError(Atom.a("user_error"), Atom.a("~N** Strange character ~d ends ~ctoken~c~n"), ListPair.make(new object[] { Char, Quote, Quote })))
{
yield return false;
}
@@ -4456,6 +4570,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{ }
}
}
- #pragma warning restore 0168, 0219
+ #pragma warning restore 0168, 0219, 0162
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs
index f68a941..a606465 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Variable.cs
@@ -43,6 +43,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
bool ground();
}
+ ///
+ /// A Variable is passed to a function so that it can be unified with
+ /// value or another Variable. See getValue and unify for details.
+ ///
public class Variable : IUnifiable
{
// Use _isBound separate from _value so that it can be bound to any value,
@@ -50,6 +54,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
private bool _isBound = false;
private object _value;
+ ///
+ /// If this Variable is unbound, then just return this Variable.
+ /// Otherwise, if this has been bound to a value with unify, return the value.
+ /// If the bound value is another Variable, this follows the "variable chain"
+ /// to the end and returns the final value, or the final Variable if it is unbound.
+ /// For more details, see http://yieldprolog.sourceforge.net/tutorial1.html
+ ///
+ ///
public object getValue()
{
if (!_isBound)
@@ -68,6 +80,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
return result;
}
+ ///
+ /// If this Variable is bound, then just call YP.unify to unify this with arg.
+ /// (Note that if arg is an unbound Variable, then YP.unify will bind it to
+ /// this Variable's value.)
+ /// Otherwise, bind this Variable to YP.getValue(arg) and yield once. After the
+ /// yield, return this Variable to the unbound state.
+ /// For more details, see http://yieldprolog.sourceforge.net/tutorial1.html
+ ///
+ ///
+ ///
public IEnumerable unify(object arg)
{
if (!_isBound)
@@ -92,12 +114,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
else
{
-// disable warning: don't see how we can code this differently short
-// of rewriting the whole thing
-#pragma warning disable 0168
+ // disable warning on l1, don't see how we can
+ // code this differently
+ #pragma warning disable 0168
foreach (bool l1 in YP.unify(this, arg))
yield return false;
-#pragma warning restore 0168
+ #pragma warning restore 0168
}
}
@@ -105,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
object value = getValue();
if (value == this)
- return "Variable";
+ return "_Variable";
else
return getValue().ToString();
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs
index 76e307a..97c9087 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YP.cs
@@ -52,6 +52,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
private static TextWriter _outputStream = System.Console.Out;
private static TextReader _inputStream = System.Console.In;
private static IndexedAnswers _operatorTable = null;
+ private static Dictionary _prologFlags = new Dictionary();
+ public const int MAX_ARITY = 255;
///
/// An IClause is used so that dynamic predicates can call match.
@@ -62,6 +64,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
IEnumerable clause(object Head, object Body);
}
+ ///
+ /// If value is a Variable, then return its getValue. Otherwise, just
+ /// return value. You should call YP.getValue on any object that
+ /// may be a Variable to get the value to pass to other functions in
+ /// your system that are not part of Yield Prolog, such as math functions
+ /// or file I/O.
+ /// For more details, see http://yieldprolog.sourceforge.net/tutorial1.html
+ ///
+ ///
+ ///
public static object getValue(object value)
{
if (value is Variable)
@@ -70,6 +82,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
return value;
}
+ ///
+ /// If arg1 or arg2 is an object with a unify method (such as Variable or
+ /// Functor) then just call its unify with the other argument. The object's
+ /// unify method will bind the values or check for equals as needed.
+ /// Otherwise, both arguments are "normal" (atomic) values so if they
+ /// are equal then succeed (yield once), else fail (don't yield).
+ /// For more details, see http://yieldprolog.sourceforge.net/tutorial1.html
+ ///
+ ///
+ ///
+ ///
public static IEnumerable unify(object arg1, object arg2)
{
arg1 = getValue(arg1);
@@ -622,6 +645,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
if (args.Length == 0)
// Return the Name, even if it is not an Atom.
return YP.unify(Term, Name);
+ if (args.Length > MAX_ARITY)
+ throw new PrologException
+ (new Functor1("representation_error", Atom.a("max_arity")),
+ "Functor arity " + args.Length + " may not be greater than " + MAX_ARITY);
if (!atom(Name))
throw new PrologException
(new Functor2("type_error", Atom.a("atom"), Name),
@@ -666,6 +693,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
else
{
+ if ((int)Arity > MAX_ARITY)
+ throw new PrologException
+ (new Functor1("representation_error", Atom.a("max_arity")),
+ "Functor arity " + Arity + " may not be greater than " + MAX_ARITY);
if (!(FunctorName is Atom))
throw new PrologException
(new Functor2("type_error", Atom.a("atom"), FunctorName), "FunctorName is not an atom");
@@ -903,8 +934,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
_operatorTable.addAnswer(new object[] { 20, Atom.a("xfx"), Atom.a("<--") });
}
- foreach (bool l1 in _operatorTable.match(new object[] { Priority, Specifier, Operator }))
- yield return false;
+ return _operatorTable.match(new object[] { Priority, Specifier, Operator });
}
public static IEnumerable atom_length(object atom, object Length)
@@ -1491,9 +1521,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
return Term is Functor1 || Term is Functor2 || Term is Functor3 || Term is Functor;
}
+ ///
+ /// If input is a TextReader, use it. If input is an Atom or String, create a StreamReader with the
+ /// input as the filename. If input is a Prolog list, then read character codes from it.
+ ///
+ ///
public static void see(object input)
{
input = YP.getValue(input);
+ if (input is Variable)
+ throw new PrologException(Atom.a("instantiation_error"), "Arg is an unbound variable");
+
+ if (input == null)
+ {
+ _inputStream = null;
+ return;
+ }
if (input is TextReader)
{
_inputStream = (TextReader)input;
@@ -1509,21 +1552,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
_inputStream = new StreamReader((String)input);
return;
}
+ else if (input is Functor2 && ((Functor2)input)._name == Atom.DOT)
+ {
+ _inputStream = new CodeListReader(input);
+ return;
+ }
else
- throw new InvalidOperationException("Can't open stream for " + input);
+ throw new PrologException
+ (new Functor2("domain_error", Atom.a("stream_or_alias"), input),
+ "Input stream specifier not recognized");
}
public static void seen()
{
+ if (_inputStream == null)
+ return;
if (_inputStream == Console.In)
return;
_inputStream.Close();
_inputStream = Console.In;
}
+ public static IEnumerable current_input(object Stream)
+ {
+ return YP.unify(Stream, _inputStream);
+ }
+
+ ///
+ /// If output is a TextWriter, use it. If output is an Atom or a String, create a StreamWriter
+ /// with the input as the filename.
+ ///
+ ///
public static void tell(object output)
{
output = YP.getValue(output);
+ if (output is Variable)
+ throw new PrologException(Atom.a("instantiation_error"), "Arg is an unbound variable");
+
+ if (output == null)
+ {
+ _outputStream = null;
+ return;
+ }
if (output is TextWriter)
{
_outputStream = (TextWriter)output;
@@ -1540,11 +1610,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
return;
}
else
- throw new InvalidOperationException("Can't open stream for " + output);
+ throw new PrologException
+ (new Functor2("domain_error", Atom.a("stream_or_alias"), output),
+ "Can't open stream for " + output);
}
public static void told()
{
+ if (_outputStream == null)
+ return;
if (_outputStream == Console.Out)
return;
_outputStream.Close();
@@ -1558,6 +1632,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public static void write(object x)
{
+ if (_outputStream == null)
+ return;
x = YP.getValue(x);
if (x is double)
_outputStream.Write(doubleToString((double)x));
@@ -1591,6 +1667,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public static void put_code(object x)
{
+ if (_outputStream == null)
+ return;
if (var(x))
throw new PrologException(Atom.a("instantiation_error"), "Arg 1 is an unbound variable");
int xInt;
@@ -1602,11 +1680,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public static void nl()
{
+ if (_outputStream == null)
+ return;
_outputStream.WriteLine();
}
public static IEnumerable get_code(object code)
{
+ if (_inputStream == null)
+ return YP.unify(code, -1);
+ else
return YP.unify(code, _inputStream.Read());
}
@@ -1763,7 +1846,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
///
/// Match all clauses of the dynamic predicate with the name and with arity
/// arguments.Length.
- /// It is an error if the predicate is not defined.
+ /// If the predicate is not defined, return the result of YP.unknownPredicate.
///
/// must be an Atom
/// an array of arity number of arguments
@@ -1772,11 +1855,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
List clauses;
if (!_predicatesStore.TryGetValue(new NameArity(name, arguments.Length), out clauses))
- throw new PrologException
- (new Functor2
- (Atom.a("existence_error"), Atom.a("procedure"),
- new Functor2(Atom.SLASH, name, arguments.Length)),
- "Undefined predicate: " + name + "/" + arguments.Length);
+ return unknownPredicate(name, arguments.Length,
+ "Undefined dynamic predicate: " + name + "/" + arguments.Length);
if (clauses.Count == 1)
// Usually there is only one clause, so return it without needing to wrap it in an iterator.
@@ -1809,6 +1889,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
///
+ /// If _prologFlags["unknown"] is fail then return fail(), else if
+ /// _prologFlags["unknown"] is warning then write the message to YP.write and
+ /// return fail(), else throw a PrologException for existence_error. .
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static IEnumerable unknownPredicate(Atom name, int arity, string message)
+ {
+ establishPrologFlags();
+
+ if (_prologFlags["unknown"] == Atom.a("fail"))
+ return fail();
+ else if (_prologFlags["unknown"] == Atom.a("warning"))
+ {
+ write(message);
+ nl();
+ return fail();
+ }
+ else
+ throw new PrologException
+ (new Functor2
+ (Atom.a("existence_error"), Atom.a("procedure"),
+ new Functor2(Atom.SLASH, name, arity)), message);
+ }
+
+ ///
/// This is deprecated and just calls matchDynamic. This matches all clauses,
/// not just the ones defined with assertFact.
///
@@ -1951,7 +2059,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
_predicatesStore[nameArity] = new List();
}
- public static IEnumerable current_predicate(object NameSlashArity)
+ ///
+ /// If NameSlashArity is var, match with all the dynamic predicates using the
+ /// Name/Artity form.
+ /// If NameSlashArity is not var, check if the Name/Arity exists as a static or
+ /// dynamic predicate.
+ ///
+ ///
+ /// if not null, used to resolve references to the default
+ /// module Atom.a("")
+ ///
+ public static IEnumerable current_predicate(object NameSlashArity, Type declaringClass)
{
NameSlashArity = YP.getValue(NameSlashArity);
// First check if Name and Arity are nonvar so we can do a direct lookup.
@@ -1976,7 +2094,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
(new Functor2("domain_error", Atom.a("not_less_than_zero"), arity),
"Arity may not be less than zero");
- if (_predicatesStore.ContainsKey(new NameArity((Atom)name, (int)arity)))
+ if (YPCompiler.isCurrentPredicate((Atom)name, (int)arity, declaringClass))
// The predicate is defined.
yield return false;
}
@@ -1991,6 +2109,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
}
}
+ ///
+ /// Return true if the dynamic predicate store has an entry for the predicate
+ /// with name and arity.
+ ///
+ ///
+ ///
+ ///
+ public static bool isDynamicCurrentPredicate(Atom name, int arity)
+ {
+ return _predicatesStore.ContainsKey(new NameArity(name, arity));
+ }
+
public static void abolish(object NameSlashArity)
{
NameSlashArity = YP.getValue(NameSlashArity);
@@ -2019,6 +2149,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
throw new PrologException
(new Functor2("domain_error", Atom.a("not_less_than_zero"), arity),
"Arity may not be less than zero");
+ if ((int)arity > MAX_ARITY)
+ throw new PrologException
+ (new Functor1("representation_error", Atom.a("max_arity")),
+ "Arity may not be greater than " + MAX_ARITY);
if (isSystemPredicate((Atom)name, (int)arity))
throw new PrologException
@@ -2077,7 +2211,108 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
{
throw new PrologException(Term);
}
+ ///
+ /// This must be called by any function that uses YP._prologFlags to make sure
+ /// the initial defaults are loaded.
+ ///
+ private static void establishPrologFlags()
+ {
+ if (_prologFlags.Count > 0)
+ // Already established.
+ return;
+
+ // List these in the order they appear in the ISO standard.
+ _prologFlags["bounded"] = Atom.a("true");
+ _prologFlags["max_integer"] = Int32.MaxValue;
+ _prologFlags["min_integer"] = Int32.MinValue;
+ _prologFlags["integer_rounding_function"] = Atom.a("toward_zero");
+ _prologFlags["char_conversion"] = Atom.a("off");
+ _prologFlags["debug"] = Atom.a("off");
+ _prologFlags["max_arity"] = MAX_ARITY;
+ _prologFlags["unknown"] = Atom.a("error");
+ _prologFlags["double_quotes"] = Atom.a("codes");
+ }
+
+ public static IEnumerable current_prolog_flag(object Key, object Value)
+ {
+ establishPrologFlags();
+
+ Key = YP.getValue(Key);
+ Value = YP.getValue(Value);
+
+ if (Key is Variable)
+ {
+ // Bind all key values.
+ foreach (string key in _prologFlags.Keys)
+ {
+ foreach (bool l1 in YP.unify(Key, Atom.a(key)))
+ {
+ foreach (bool l2 in YP.unify(Value, _prologFlags[key]))
+ yield return false;
+ }
+ }
+ }
+ else
+ {
+ if (!(Key is Atom))
+ throw new PrologException
+ (new Functor2("type_error", Atom.a("atom"), Key), "Arg 1 Key is not an atom");
+ if (!_prologFlags.ContainsKey(((Atom)Key)._name))
+ throw new PrologException
+ (new Functor2("domain_error", Atom.a("prolog_flag"), Key),
+ "Arg 1 Key is not a recognized flag");
+
+ foreach (bool l1 in YP.unify(Value, _prologFlags[((Atom)Key)._name]))
+ yield return false;
+ }
+ }
+
+ public static void set_prolog_flag(object Key, object Value)
+ {
+ establishPrologFlags();
+
+ Key = YP.getValue(Key);
+ Value = YP.getValue(Value);
+
+ if (Key is Variable)
+ throw new PrologException(Atom.a("instantiation_error"),
+ "Arg 1 Key is an unbound variable");
+ if (Value is Variable)
+ throw new PrologException(Atom.a("instantiation_error"),
+ "Arg 1 Key is an unbound variable");
+ if (!(Key is Atom))
+ throw new PrologException
+ (new Functor2("type_error", Atom.a("atom"), Key), "Arg 1 Key is not an atom");
+
+ string keyName = ((Atom)Key)._name;
+ if (!_prologFlags.ContainsKey(keyName))
+ throw new PrologException
+ (new Functor2("domain_error", Atom.a("prolog_flag"), Key),
+ "Arg 1 Key " + Key + " is not a recognized flag");
+
+ bool valueIsOK = false;
+ if (keyName == "char_conversion")
+ valueIsOK = (Value == _prologFlags[keyName]);
+ else if (keyName == "debug")
+ valueIsOK = (Value == _prologFlags[keyName]);
+ else if (keyName == "unknown")
+ valueIsOK = (Value == Atom.a("fail") || Value == Atom.a("warning") ||
+ Value == Atom.a("error"));
+ else if (keyName == "double_quotes")
+ valueIsOK = (Value == Atom.a("codes") || Value == Atom.a("chars") ||
+ Value == Atom.a("atom"));
+ else
+ throw new PrologException
+ (new Functor3("permission_error", Atom.a("modify"), Atom.a("flag"), Key),
+ "May not modify Prolog flag " + Key);
+ if (!valueIsOK)
+ throw new PrologException
+ (new Functor2("domain_error", Atom.a("flag_value"), new Functor2("+", Key, Value)),
+ "May not set arg 1 Key " + Key + " to arg 2 Value " + Value);
+
+ _prologFlags[keyName] = Value;
+ }
///
/// script_event calls hosting script with events as a callback method.
///
@@ -2303,19 +2538,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
private IEnumerator _enumerator;
private PrologException _exception = null;
- public Catch(IEnumerable iterator)
+ ///
+ /// Call YP.getIterator(Goal, declaringClass) and save the returned iterator.
+ /// If getIterator throws an exception, save it the same as MoveNext().
+ ///
+ ///
+ ///
+ public Catch(object Goal, Type declaringClass)
+ {
+ try
{
- _enumerator = iterator.GetEnumerator();
+ _enumerator = getIterator(Goal, declaringClass).GetEnumerator();
+ }
+ catch (PrologException exception)
+ {
+ // MoveNext() will check this.
+ _exception = exception;
+ }
}
///
/// Call _enumerator.MoveNext(). If it throws a PrologException, set _exception
/// and return false. After this returns false, call unifyExceptionOrThrow.
- /// Assume that, after this returns false, it will not be called again.
///
///
public bool MoveNext()
{
+ if (_exception != null)
+ return false;
+
try
{
return _enumerator.MoveNext();
@@ -2372,6 +2623,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
public void Dispose()
{
+ if (_enumerator != null)
_enumerator.Dispose();
}
@@ -2407,7 +2659,42 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
foreach (bool l2 in YP.unify(Body, _Body))
yield return false;
}
- #pragma warning disable 0168
+ #pragma warning restore 0168
+ }
+ }
+
+ ///
+ /// CodeListReader extends TextReader and overrides Read to read the next code from
+ /// the CodeList which is a Prolog list of integer character codes.
+ ///
+ public class CodeListReader : TextReader
+ {
+ private object _CodeList;
+
+ public CodeListReader(object CodeList)
+ {
+ _CodeList = YP.getValue(CodeList);
+ }
+
+ ///
+ /// If the head of _CodeList is an integer, return it and advance the list. Otherwise,
+ /// return -1 for end of file.
+ ///
+ ///
+ public override int Read()
+ {
+ Functor2 CodeListPair = _CodeList as Functor2;
+ int code;
+ if (!(CodeListPair != null && CodeListPair._name == Atom.DOT &&
+ getInt(CodeListPair._arg1, out code)))
+ {
+ _CodeList = Atom.NIL;
+ return -1;
+ }
+
+ // Advance.
+ _CodeList = YP.getValue(CodeListPair._arg2);
+ return code;
}
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs
index 1f1b41d..de7f168 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/YPCompiler.cs
@@ -203,7 +203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
// disable warning on l1, don't see how we can
// code this differently
- #pragma warning disable 0168, 0164, 0162
+ #pragma warning disable 0168,0164,0162
public static bool isDetNoneOut(object State, object Term)
{
State = YP.getValue(State);
@@ -241,7 +241,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
return false;
}
- #pragma warning restore 0168, 0164, 0162
+ #pragma warning restore 0168,0164,0162
///
/// Return false if any of args is out, otherwise true.
@@ -280,7 +280,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.YieldProlog
// disable warning on l1, don't see how we can
// code this differently
- #pragma warning disable 0168, 0219, 0164, 0162
+ #pragma warning disable 0168, 0219,0164,0162
///
/// Use makeFunctionPseudoCode, convertFunctionCSharp and compileAnonymousFunction
@@ -405,8 +405,8 @@ namespace Temporary {
///
/// If the functor with name and args can be called directly as determined by
/// functorCallFunctionName, then call it and return its iterator. If the predicate is
- /// dynamic and undefined, or if static and the method cannot be found, throw
- /// a PrologException for existence_error.
+ /// dynamic and undefined, or if static and the method cannot be found, return
+ /// the result of YP.unknownPredicate.
/// This returns null if the functor has a special form than needs to be compiled
/// (including ,/2 and ;/2).
///
@@ -424,13 +424,11 @@ namespace Temporary {
{
Atom functionNameAtom = ((Atom)FunctionName.getValue());
if (functionNameAtom == Atom.NIL)
- {
// name is for a dynamic predicate.
return YP.matchDynamic(name, args);
- }
- // Set the default for the method to call.
string methodName = functionNameAtom._name;
+ // Set the default for the method to call.
Type methodClass = declaringClass;
bool checkMode = false;
@@ -448,10 +446,8 @@ namespace Temporary {
return null;
if (methodClass == null)
- throw new PrologException
- (new Functor2
- (Atom.a("existence_error"), Atom.a("procedure"),
- new Functor2(Atom.a("/"), name, args.Length)),
+ return YP.unknownPredicate
+ (name, args.Length,
"Cannot find predicate function for: " + name + "/" + args.Length +
" because declaringClass is null. Set declaringClass to the class containing " +
methodName);
@@ -486,10 +482,8 @@ namespace Temporary {
}
catch (MissingMethodException)
{
- throw new PrologException
- (new Functor2
- (Atom.a("existence_error"), Atom.a("procedure"),
- new Functor2(Atom.a("/"), name, args.Length)),
+ return YP.unknownPredicate
+ (name, args.Length,
"Cannot find predicate function " + methodName + " for " + name + "/" + args.Length +
" in " + methodClass.FullName);
}
@@ -498,6 +492,54 @@ namespace Temporary {
return null;
}
+ ///
+ /// Return true if there is a dynamic or static predicate with name and arity.
+ /// This returns false for built-in predicates.
+ ///
+ ///
+ ///
+ /// used to resolve references to the default
+ /// module Atom.a(""). If a declaringClass is needed to resolve the reference but it is
+ /// null, return false
+ ///
+ public static bool isCurrentPredicate(Atom name, int arity, Type declaringClass)
+ {
+ CompilerState state = new CompilerState();
+ Variable FunctionName = new Variable();
+ foreach (bool l1 in functorCallFunctionName(state, name, arity, FunctionName))
+ {
+ Atom functionNameAtom = ((Atom)FunctionName.getValue());
+ if (functionNameAtom == Atom.NIL)
+ // name is for a dynamic predicate.
+ return YP.isDynamicCurrentPredicate(name, arity);
+
+ string methodName = functionNameAtom._name;
+
+ if (methodName.StartsWith("YP."))
+ // current_predicate/1 should fail for built-ins.
+ return false;
+ if (methodName.Contains("."))
+ // We don't support calling inner classes, etc.
+ return false;
+ if (declaringClass == null)
+ return false;
+
+ foreach (MemberInfo member in declaringClass.GetMember(methodName))
+ {
+ MethodInfo method = member as MethodInfo;
+ if (method == null)
+ continue;
+ if ((method.Attributes | MethodAttributes.Static) == 0)
+ // Not a static method.
+ continue;
+ if (method.GetParameters().Length == arity)
+ return true;
+ }
+ }
+
+ return false;
+ }
+
// Compiler output follows.
public class YPInnerClass { }
@@ -567,9 +609,14 @@ namespace Temporary {
CompilerState.assertPred(State, Atom.a("nl"), Atom.a("det"));
CompilerState.assertPred(State, new Functor1("write", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
CompilerState.assertPred(State, new Functor1("put_code", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
+ CompilerState.assertPred(State, new Functor1("see", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
+ CompilerState.assertPred(State, Atom.a("seen"), Atom.a("det"));
+ CompilerState.assertPred(State, new Functor1("tell", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
+ CompilerState.assertPred(State, Atom.a("told"), Atom.a("det"));
CompilerState.assertPred(State, new Functor1("throw", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
CompilerState.assertPred(State, new Functor1("abolish", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
CompilerState.assertPred(State, new Functor1("retractall", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
+ CompilerState.assertPred(State, new Functor2("set_prolog_flag", new Functor2("::", Atom.a("univ"), Atom.a("in")), new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("det"));
CompilerState.assertPred(State, new Functor1("var", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
CompilerState.assertPred(State, new Functor1("nonvar", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
CompilerState.assertPred(State, new Functor1("atom", new Functor2("::", Atom.a("univ"), Atom.a("in"))), Atom.a("semidet"));
@@ -2121,7 +2168,7 @@ namespace Temporary {
{
foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("if", new Functor2("call", FunctionName, new ListPair(X1Code, new ListPair(X2Code, Atom.NIL))), BCode), Atom.NIL)))
{
- foreach (bool l4 in YP.univ(A, new ListPair(Name, new ListPair(X1, new ListPair(X2, Atom.NIL)))))
+ foreach (bool l4 in YP.univ(A, ListPair.make(new object[] { Name, X1, X2 })))
{
foreach (bool l5 in binaryExpressionConditional(Name, FunctionName))
{
@@ -2236,6 +2283,27 @@ namespace Temporary {
Variable B = new Variable();
Variable ATermCode = new Variable();
Variable BCode = new Variable();
+ foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("current_predicate", A), B)))
+ {
+ foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("foreach", new Functor2("call", Atom.a("YP.current_predicate"), new ListPair(ATermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL))), BCode), Atom.NIL)))
+ {
+ foreach (bool l4 in compileTerm(A, State, ATermCode))
+ {
+ foreach (bool l5 in compileRuleBody(B, State, BCode))
+ {
+ yield return true;
+ yield break;
+ }
+ }
+ }
+ }
+ }
+ {
+ object State = arg2;
+ Variable A = new Variable();
+ Variable B = new Variable();
+ Variable ATermCode = new Variable();
+ Variable BCode = new Variable();
foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor1("asserta", A), B)))
{
foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor2("call", Atom.a("YP.asserta"), new ListPair(ATermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL))), BCode)))
@@ -2299,7 +2367,7 @@ namespace Temporary {
Variable HandlerAndBCode = new Variable();
foreach (bool l2 in YP.unify(arg1, new Functor2(",", new Functor3("catch", Goal, Catcher, Handler), B)))
{
- foreach (bool l3 in YP.unify(arg3, new ListPair(new Functor3("declare", Atom.a("YP.Catch"), CatchGoal, new Functor2("new", Atom.a("YP.Catch"), new ListPair(new Functor2("call", Atom.a("YP.getIterator"), new ListPair(GoalTermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL))), Atom.NIL))), new ListPair(new Functor2("foreach", new Functor1("var", CatchGoal), BCode), new ListPair(new Functor2("foreach", new Functor3("callMember", new Functor1("var", CatchGoal), Atom.a("unifyExceptionOrThrow"), new ListPair(CatcherTermCode, Atom.NIL)), HandlerAndBCode), Atom.NIL)))))
+ foreach (bool l3 in YP.unify(arg3, ListPair.make(new object[] { new Functor3("declare", Atom.a("YP.Catch"), CatchGoal, new Functor2("new", Atom.a("YP.Catch"), new ListPair(GoalTermCode, new ListPair(new Functor2("call", Atom.a("getDeclaringClass"), Atom.NIL), Atom.NIL)))), new Functor2("foreach", new Functor1("var", CatchGoal), BCode), new Functor2("foreach", new Functor3("callMember", new Functor1("var", CatchGoal), Atom.a("unifyExceptionOrThrow"), new ListPair(CatcherTermCode, Atom.NIL)), HandlerAndBCode) })))
{
foreach (bool l4 in CompilerState.gensym(State, Atom.a("catchGoal"), CatchGoal))
{
@@ -2833,6 +2901,10 @@ namespace Temporary {
{
return true;
}
+ if (YP.termEqual(Name, Atom.a("current_predicate")))
+ {
+ return true;
+ }
if (YP.termEqual(Name, Atom.a("asserta")))
{
return true;
@@ -3016,19 +3088,6 @@ namespace Temporary {
}
}
{
- foreach (bool l2 in YP.unify(arg1, Atom.a("current_predicate")))
- {
- foreach (bool l3 in YP.unify(arg2, 1))
- {
- foreach (bool l4 in YP.unify(arg3, Atom.a("YP.current_predicate")))
- {
- yield return true;
- yield break;
- }
- }
- }
- }
- {
foreach (bool l2 in YP.unify(arg1, Atom.a("atom_length")))
{
foreach (bool l3 in YP.unify(arg2, 2))
@@ -3214,6 +3273,58 @@ namespace Temporary {
}
}
{
+ foreach (bool l2 in YP.unify(arg1, Atom.a("see")))
+ {
+ foreach (bool l3 in YP.unify(arg2, 1))
+ {
+ foreach (bool l4 in YP.unify(arg3, Atom.a("YP.see")))
+ {
+ yield return true;
+ yield break;
+ }
+ }
+ }
+ }
+ {
+ foreach (bool l2 in YP.unify(arg1, Atom.a("seen")))
+ {
+ foreach (bool l3 in YP.unify(arg2, 0))
+ {
+ foreach (bool l4 in YP.unify(arg3, Atom.a("YP.seen")))
+ {
+ yield return true;
+ yield break;
+ }
+ }
+ }
+ }
+ {
+ foreach (bool l2 in YP.unify(arg1, Atom.a("tell")))
+ {
+ foreach (bool l3 in YP.unify(arg2, 1))
+ {
+ foreach (bool l4 in YP.unify(arg3, Atom.a("YP.tell")))
+ {
+ yield return true;
+ yield break;
+ }
+ }
+ }
+ }
+ {
+ foreach (bool l2 in YP.unify(arg1, Atom.a("told")))
+ {
+ foreach (bool l3 in YP.unify(arg2, 0))
+ {
+ foreach (bool l4 in YP.unify(arg3, Atom.a("YP.told")))
+ {
+ yield return true;
+ yield break;
+ }
+ }
+ }
+ }
+ {
foreach (bool l2 in YP.unify(arg1, Atom.a("clause")))
{
foreach (bool l3 in YP.unify(arg2, 2))
@@ -3434,6 +3545,110 @@ namespace Temporary {
}
}
}
+ {
+ foreach (bool l2 in YP.unify(arg1, Atom.a("current_prolog_flag")))
+ {
+ foreach (bool l3 in YP.unify(arg2, 2))
+ {
+ foreach (bool l4 in YP.unify(arg3, Atom.a("YP.current_prolog_flag")))
+ {
+ yield return true;
+ yield break;
+ }
+ }
+ }
+ }
+ {
+ foreach (bool l2 in YP.unify(arg1, Atom.a("set_prolog_flag")))
+ {
+ foreach (bool l3 in YP.unify(arg2, 2))
+ {
+ foreach (bool l4 in YP.unify(arg3, Atom.a("YP.set_prolog_flag")))
+ {
+ yield return true;
+ yield break;
+ }
+ }
+ }
+ }
+ {
+ foreach (bool l2 in YP.unify(arg1, Atom.a("current_input")))
+ {
+ foreach (bool l3 in YP.unify(arg2, 1))
+ {
+ foreach (bool l4 in YP.unify(arg3, Atom.a("YP.current_input")))
+ {
+ yield return true;
+ yield break;
+ }
+ }
+ }
+ }
+ {
+ foreach (bool l2 in YP.unify(arg1, Atom.a("current_output")))
+ {
+ foreach (bool l3 in YP.unify(arg2, 1))
+ {
+ foreach (bool l4 in YP.unify(arg3, Atom.a("YP.current_output")))
+ {
+ yield return true;
+ yield break;
+ }
+ }
+ }
+ }
+ {
+ foreach (bool l2 in YP.unify(arg1, Atom.a("read_term")))
+ {
+ foreach (bool l3 in YP.unify(arg2, 2))
+ {
+ foreach (bool l4 in YP.unify(arg3, Atom.a("Parser.read_term2")))
+ {
+ yield return true;
+ yield break;
+ }
+ }
+ }
+ }
+ {
+ foreach (bool l2 in YP.unify(arg1, Atom.a("read_term")))
+ {
+ foreach (bool l3 in YP.unify(arg2, 3))
+ {
+ foreach (bool l4 in YP.unify(arg3, Atom.a("Parser.read_term3")))
+ {
+ yield return true;
+ yield break;
+ }
+ }
+ }
+ }
+ {
+ foreach (bool l2 in YP.unify(arg1, Atom.a("read")))
+ {
+ foreach (bool l3 in YP.unify(arg2, 1))
+ {
+ foreach (bool l4 in YP.unify(arg3, Atom.a("Parser.read1")))
+ {
+ yield return true;
+ yield break;
+ }
+ }
+ }
+ }
+ {
+ foreach (bool l2 in YP.unify(arg1, Atom.a("read")))
+ {
+ foreach (bool l3 in YP.unify(arg2, 2))
+ {
+ foreach (bool l4 in YP.unify(arg3, Atom.a("Parser.read2")))
+ {
+ yield return true;
+ yield break;
+ }
+ }
+ }
+ }
}
public static IEnumerable compileTerm(object arg1, object arg2, object arg3)
@@ -3494,6 +3709,34 @@ namespace Temporary {
object State = arg2;
Variable First = new Variable();
Variable Rest = new Variable();
+ Variable CompiledList = new Variable();
+ Variable x5 = new Variable();
+ Variable Rest2 = new Variable();
+ foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest)))
+ {
+ foreach (bool l3 in YP.unify(arg3, new Functor2("call", Atom.a("ListPair.make"), new ListPair(new Functor1("objectArray", CompiledList), Atom.NIL))))
+ {
+ if (YP.nonvar(Rest))
+ {
+ foreach (bool l5 in YP.unify(Rest, new ListPair(x5, Rest2)))
+ {
+ if (YP.termNotEqual(Rest2, Atom.NIL))
+ {
+ foreach (bool l7 in maplist_compileTerm(new ListPair(First, Rest), State, CompiledList))
+ {
+ yield return true;
+ yield break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ {
+ object State = arg2;
+ Variable First = new Variable();
+ Variable Rest = new Variable();
Variable Arg1 = new Variable();
Variable Arg2 = new Variable();
foreach (bool l2 in YP.unify(arg1, new ListPair(First, Rest)))
@@ -3563,7 +3806,7 @@ namespace Temporary {
{
foreach (bool l8 in compileTerm(X2, State, Arg2))
{
- foreach (bool l9 in YP.unify(Result, new Functor2("new", Atom.a("Functor2"), new ListPair(NameCode, new ListPair(Arg1, new ListPair(Arg2, Atom.NIL))))))
+ foreach (bool l9 in YP.unify(Result, new Functor2("new", Atom.a("Functor2"), ListPair.make(new object[] { NameCode, Arg1, Arg2 }))))
{
yield return true;
yield break;
@@ -3572,7 +3815,7 @@ namespace Temporary {
}
goto cutIf5;
}
- foreach (bool l6 in YP.unify(TermArgs, new ListPair(X1, new ListPair(X2, new ListPair(X3, Atom.NIL)))))
+ foreach (bool l6 in YP.unify(TermArgs, ListPair.make(new object[] { X1, X2, X3 })))
{
foreach (bool l7 in compileTerm(X1, State, Arg1))
{
@@ -3580,7 +3823,7 @@ namespace Temporary {
{
foreach (bool l9 in compileTerm(X3, State, Arg3))
{
- foreach (bool l10 in YP.unify(Result, new Functor2("new", Atom.a("Functor3"), new ListPair(NameCode, new ListPair(Arg1, new ListPair(Arg2, new ListPair(Arg3, Atom.NIL)))))))
+ foreach (bool l10 in YP.unify(Result, new Functor2("new", Atom.a("Functor3"), ListPair.make(new object[] { NameCode, Arg1, Arg2, Arg3 }))))
{
yield return true;
yield break;
@@ -3623,7 +3866,7 @@ namespace Temporary {
{
foreach (bool l7 in compileTerm(X2, State, Arg2))
{
- foreach (bool l8 in YP.unify(Result, new Functor2("new", Atom.a("Functor2"), new ListPair(NameCode, new ListPair(Arg1, new ListPair(Arg2, Atom.NIL))))))
+ foreach (bool l8 in YP.unify(Result, new Functor2("new", Atom.a("Functor2"), ListPair.make(new object[] { NameCode, Arg1, Arg2 }))))
{
yield return true;
yield break;
@@ -3632,7 +3875,7 @@ namespace Temporary {
}
goto cutIf7;
}
- foreach (bool l5 in YP.unify(TermArgs, new ListPair(X1, new ListPair(X2, new ListPair(X3, Atom.NIL)))))
+ foreach (bool l5 in YP.unify(TermArgs, ListPair.make(new object[] { X1, X2, X3 })))
{
foreach (bool l6 in compileTerm(X1, State, Arg1))
{
@@ -3640,7 +3883,7 @@ namespace Temporary {
{
foreach (bool l8 in compileTerm(X3, State, Arg3))
{
- foreach (bool l9 in YP.unify(Result, new Functor2("new", Atom.a("Functor3"), new ListPair(NameCode, new ListPair(Arg1, new ListPair(Arg2, new ListPair(Arg3, Atom.NIL)))))))
+ foreach (bool l9 in YP.unify(Result, new Functor2("new", Atom.a("Functor3"), ListPair.make(new object[] { NameCode, Arg1, Arg2, Arg3 }))))
{
yield return true;
yield break;
@@ -3725,9 +3968,11 @@ namespace Temporary {
{
foreach (bool l3 in YP.unify(arg3, new ListPair(FirstResult, RestResults)))
{
- foreach (bool l4 in compileTerm(First, State, FirstResult))
+ if (YP.nonvar(Rest))
+ {
+ foreach (bool l5 in compileTerm(First, State, FirstResult))
{
- foreach (bool l5 in maplist_compileTerm(Rest, State, RestResults))
+ foreach (bool l6 in maplist_compileTerm(Rest, State, RestResults))
{
yield return true;
yield break;
@@ -3737,6 +3982,7 @@ namespace Temporary {
}
}
}
+ }
public static IEnumerable compileExpression(object Term, object State, object Result)
{
@@ -6131,6 +6377,6 @@ namespace Temporary {
}
}
}
- #pragma warning restore 0168, 0219, 0164, 0162
+ #pragma warning restore 0168, 0219, 0164,0162
}
}
--
cgit v1.1