From 6117466b13d62831e1c3a53bfdae0aab8afb1c3e Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 11 Sep 2009 00:08:23 +0000 Subject: [PATCH] *** empty log message *** --- XmlExpr.cs | 493 ++++++++++++++++++++++++++++-------------------------------- 1 file changed, 230 insertions(+), 263 deletions(-) diff --git a/XmlExpr.cs b/XmlExpr.cs index ba46189..d37fc40 100644 --- a/XmlExpr.cs +++ b/XmlExpr.cs @@ -6,72 +6,120 @@ using System.Xml; namespace System.Xml.Expression { -public class XmlName : IEquatable + public class Xex { - private static NameTable nt = new NameTable (); + public class Name : IEquatable + { + private static NameTable nt = new NameTable (); + + private object name; + + private Name (string str) + { + name = nt.Add (str); + } + + private Name (XmlAttribute attr) + { + name = attr.Value; + } - private object name; + private Name (XmlNode node) + { + name = node.Name; + } - private XmlName (string str) + public static implicit operator Name (string str) { - name = nt.Add (str); + return new Name (str); } - public static implicit operator XmlName (string str) - { - return new XmlName (str); - } - - public static bool operator== (XmlName n1, XmlName n2) + public static implicit operator string (Name name) { - return n1.name == n2.name; + return (string) name.name; } - public static bool operator!= (XmlName n1, XmlName n2) + public static bool operator== (Name n1, Name n2) + { + return n1.name == n2.name; + } + + public static bool operator!= (Name n1, Name n2) + { + return n1.name != n2.name; + } + + public bool Equals (Name other) { return name == other.name; } + public override bool Equals (object obj) { return obj == name; } + public override int GetHashCode () { - return n1.name != n2.name; + return ((string) name).GetHashCode (); } - public bool Equals (XmlName other) { return name == other.name; } - public override bool Equals (object obj) { return obj == name; } - public override int GetHashCode () - { - return ((string) name).GetHashCode (); + public static NameTable Table { get { return nt; } } } - public static NameTable Table { get { return nt; } } - } - - public class Xex - { - private static NameTable nt = new NameTable (); + private static Name Nvalue = "value"; + private static Name Nvar = "var"; + private static Name Ndefun = "defun"; + private static Name Ncond = "cond"; + private static Name Nprogn = "progn"; + private static Name Nwhen = "when"; - public static object Name (string str) + public class Bindings { - return nt.Add (str); - } + private Name name; + private object value; + private Bindings next; + + internal Bindings (Name name, object value) + { + this.name = name; + this.value = value; + } + + internal Bindings () + { + } + + internal Bindings Bind (Name name, object value) + { + Bindings bindings = new Bindings (name, value); + bindings.next = this; + return bindings; + } - public static NameTable Table { get { return nt; } } + internal Bindings SetBoundary () + { + Bindings bindings = new Bindings (); + bindings.next = this; + return this; + } - private static object Nvar = Name ("var"); - private static object Ndefun = Name ("defun"); - private static object Ncond = Name ("cond"); - private static object Nprogn = Name ("progn"); - private static object Nwhen = Name ("when"); + internal Bindings Pop () + { + return bindings.next; + } + + public override string ToString () + { + string str = "(bindings"; + for (Bindings b = this; b != null; b = b.next) + str += " " + name + ":" + value; + return str + ")"; + } + } public class Domain { private Domain parent; - internal Dictionary boundaries = new Stack (); - internal Translator translator; public object context; - internal Domain () - { - boundaries.Push (bindings); - } + internal Dictionary functions + = new Dictionary (); + private Bindings bindings; + + internal Domain () { } public Domain (object context) : this (basic, context) { } @@ -79,47 +127,39 @@ public class XmlName : IEquatable { this.parent = parent; this.context = context; - boundaries.Push (bindings); } - public void AddTranslator (Translator translator) + public void Bind (Name name, object value) { - if (this.translator == null) - this.translator = translator; + if (bindings == null) + bindings = new Bindings (name, value); else - this.translator += translator; + bindings = bindings.Bind (name, value); } - public void Bind (MSymbol sym, object value) - { - bindings = bindings.Cons (sym, value); - } - - public MPlist SetBoundary () + public Bindings SetBoundary () { boundaries.Push (bindings); return bindings; } - public void UnboundTo (MPlist boundary) + public void UnboundTo (Bindings boundary) { while (boundary != boundaries.Pop ()); - while (bindings != boundary) - bindings = bindings.next; + while (bindings.Pop != boundary); } - public void Defun (string name, Builtin builtin, int min_arg, int max_arg) + public void Defun (Name name, Builtin builtin, int min_arg, int max_arg) { Defun (name, builtin, min_arg, max_arg, false); } - public void Defun (string name, Builtin builtin, int min_arg, int max_arg, + public void Defun (Name name, Builtin builtin, int min_arg, int max_arg, bool specialp) { - MSymbol sym = name; - Function func = (Function) functions.Get (sym); + Function func; - if (func != null) + if (functions.TryGetValue (name, out func)) { if (func.min_arg < min_arg || func.max_arg > max_arg) throw new Exception ("Incompatible argument numbers to override: " @@ -132,39 +172,17 @@ public class XmlName : IEquatable } else { - func = new Function (sym, builtin, min_arg, max_arg, specialp); - functions = functions.Cons (sym, func); + functions[name] + = new Function (name, builtin, min_arg, max_arg, specialp); } } - public void Defun (MSymbol sym, MPlist args, MPlist body) - { - Function func = (Function) functions.Get (sym); - - if (func != null) - { - int nargs = args == null ? 0 : args.Count; - - if (func.min_arg < nargs || func.max_arg > nargs) - throw new Exception ("Incompatible argument numbers to override: " - + sym); - func.lambda.SetArgs (args); - func.lambda.SetBody (body, this); - func.builtin = null; - } - else - { - func = new Function (sym, args, body, this); - functions = functions.Cons (sym, func); - } - } - public void Defun (XmlNode node) { - MSymbol sym = node.Attributes["id"].Value; - Function func = (Function) functions.Get (sym); + Name name = node.Attributes["id"]; + Function func; - if (func != null) + if (functions.TryGetValue (name, out func)) { XmlNode args = node.FirstChild; int nargs = args.Name == "args" ? args.ChildNodes.Count : 0; @@ -182,7 +200,7 @@ public class XmlName : IEquatable } } - internal Function GetFunc (MSymbol name) + internal Function GetFunc (Name name) { Function func = (Function) functions.Get (name); @@ -195,7 +213,7 @@ public class XmlName : IEquatable return func; } - public bool CopyFunc (Domain domain, MSymbol name) + public bool CopyFunc (Domain domain, Name name) { Function func = (Function) functions.Get (name); if (func == null) @@ -210,7 +228,7 @@ public class XmlName : IEquatable domain.functions = domain.functions.Cons (p.key, p.val); } - public object GetValue (MSymbol name) + public object GetValue (Name name) { MPlist slot = bindings.Find (name); @@ -223,7 +241,7 @@ public class XmlName : IEquatable return slot.val; } - public object SetValue (MSymbol name, object val) + public object SetValue (Name name, object val) { MPlist boundary = boundaries.Peek (); @@ -237,26 +255,17 @@ public class XmlName : IEquatable return val; } - public bool IsBound (MSymbol name) + public bool IsBound (Name name) { return (bindings.Find (name) != null); } - public void Translate (MPlist plist) - { - if (parent != null) - parent.Translate (plist); - if (translator != null) - for (MPlist p = plist; ! p.IsEmpty; p = p.next) - translator (p, this); - } - public override string ToString () { string str = "<(functions"; - foreach (MPlist p in functions) - str += " " + p.key; - str += ") (bindings " + bindings + ")"; + foreach (KeyValuePair kv in functions) + str += " " + kv.Key; + str += ") " + bindings; if (context != null) str += " (" + context + ")"; str += ">"; @@ -264,49 +273,20 @@ public class XmlName : IEquatable } } - public delegate object Builtin (MExpression[] args, Domain domain); - public delegate void Translator (MPlist plist, Domain domain); + public delegate object Builtin (Xex[] args, Domain domain); internal class Function { internal class Lambda { - internal MSymbol[] args; - internal MExpression[] body; - - public Lambda (MPlist args, MPlist body, Domain domain) - { - SetArgs (args); - SetBody (body, domain); - } + internal Name[] args; + internal Xex[] body; public Lambda (XmlNode node, Domain domain) { Set (node, domain); } - public void SetArgs (MPlist args) - { - int len = args == null ? 0 : args.Count; - - if (this.args == null) - this.args = new MSymbol[len]; - for (int i = 0; i < len; i++, args = args.next) - this.args[i] = args.Symbol; - } - - public void SetBody (MPlist body, Domain domain) - { - int len = body == null ? 0 : body.Count; - if (this.body == null) - this.body = new MExpression[len]; - for (int i = 0; i < len; i++, body = body.next) - { - domain.Translate (body); - this.body[i] = new MExpression (body.key, body.val, domain); - } - } - public void Set (XmlNode node, Domain domain) { XmlNodeList body = node.ChildNodes; @@ -316,21 +296,21 @@ public class XmlName : IEquatable { XmlNodeList args = body[0].ChildNodes; if (this.args == null) - this.args = new MSymbol[args.Count]; + this.args = new Name[args.Count]; for (int i = 0; i < args.Count; i++) this.args[i] = args[i].InnerText; idx++; } else if (this.args == null) - this.args = new MSymbol[0]; + this.args = new Name[0]; if (this.body == null) - this.body = new MExpression[body.Count - idx]; + this.body = new Xex[body.Count - idx]; for (int i = 0; idx < body.Count; i++, idx++) - this.body[i] = new MExpression (body[idx], domain); + this.body[i] = new Xex (body[idx], domain); } } - public readonly MSymbol Name; + public readonly Name Name; public Builtin builtin; public int min_arg, max_arg; internal Lambda lambda; @@ -338,7 +318,7 @@ public class XmlName : IEquatable internal static Function ignore, varref, block; - public Function (MSymbol name, Builtin builtin, + public Function (Name name, Builtin builtin, int min_arg, int max_arg, bool specialp) { Name = name; @@ -348,15 +328,7 @@ public class XmlName : IEquatable this.specialp = specialp; } - internal Function (MSymbol name, MPlist args, MPlist body, - Domain domain) - { - Name = name; - lambda = new Lambda (args, body, domain); - this.min_arg = this.max_arg = lambda.args.Length; - } - - internal Function (MSymbol name, XmlNode node, Domain domain) + internal Function (Name name, XmlNode node, Domain domain) { Name = name; lambda = new Lambda (node, domain); @@ -365,7 +337,7 @@ public class XmlName : IEquatable private Function () { - Name = MSymbol.nil; + Name = Name.nil; } static Function () @@ -375,29 +347,29 @@ public class XmlName : IEquatable block = new Function (Mprogn, progn, 0, -1, true); } - private static object get_value (MExpression[] args, Domain domain) + private static object get_value (Xex[] args, Domain domain) { - return domain.GetValue ((MSymbol) args[0].val); + return domain.GetValue ((Name) args[0].val); } - public object Call (MExpression[] args, Domain domain) + public object Call (Xex[] args, Domain domain) { if (builtin != null) { if (! specialp) - foreach (MExpression e in args) + foreach (Xex e in args) e.Eval (domain); return builtin (args, domain); } if (lambda == null) return null; - MPlist orig_bindings = domain.bindings; + Bindings orig_bindings = domain.bindings; object result = false; try { int i = 0; - foreach (MSymbol arg in lambda.args) + foreach (Name arg in lambda.args) domain.Bind (arg, args[i++].Eval (domain)); - foreach (MExpression e in lambda.body) + foreach (Xex e in lambda.body) result = e.Eval (domain); } finally { domain.bindings = orig_bindings; @@ -408,7 +380,7 @@ public class XmlName : IEquatable private static Domain basic; - static MExpression () + static Xex () { basic = new Domain (); @@ -447,13 +419,13 @@ public class XmlName : IEquatable basic.AddTranslator (new Translator (translate_cond)); } - private static object set_value (MExpression[] args, Domain domain) + private static object set_value (Xex[] args, Domain domain) { - return domain.SetValue ((MSymbol) args[0].args[0].val, + return domain.SetValue ((Name) args[0].args[0].val, args[1].Eval (domain)); } - private static object not (MExpression[] args, Domain domain) + private static object not (Xex[] args, Domain domain) { if (args[0].val is int) return (int) args[0].val == 0; @@ -462,34 +434,34 @@ public class XmlName : IEquatable return true; } - private static object plus (MExpression[] args, Domain domain) + private static object plus (Xex[] args, Domain domain) { if (args[0].val is int) { int n = 0; - foreach (MExpression e in args) + foreach (Xex e in args) n += (int) e.val; return n; } else if (args[0].val is MText) { MText mt = new MText (); - foreach (MExpression e in args) + foreach (Xex e in args) mt += (MText) e.val; return mt; } throw new Exception ("Not an integer nor MText: " + args[0].val); } - private static object multi (MExpression[] args, Domain domain) + private static object multi (Xex[] args, Domain domain) { int n = 1; - foreach (MExpression e in args) + foreach (Xex e in args) n *= (int) e.val; return n; } - private static object minus (MExpression[] args, Domain domain) + private static object minus (Xex[] args, Domain domain) { int n = (int) args[0].val; if (args.Length == 1) @@ -499,7 +471,7 @@ public class XmlName : IEquatable return n; } - private static object divide (MExpression[] args, Domain domain) + private static object divide (Xex[] args, Domain domain) { int n = (int) args[0].val; for (int i = 1; i < args.Length; i++) @@ -507,7 +479,7 @@ public class XmlName : IEquatable return n; } - private static object percent (MExpression[] args, Domain domain) + private static object percent (Xex[] args, Domain domain) { int n = (int) args[0].val; for (int i = 1; i < args.Length; i++) @@ -515,25 +487,25 @@ public class XmlName : IEquatable return n; } - private static object logior (MExpression[] args, Domain domain) + private static object logior (Xex[] args, Domain domain) { int n = 0; - foreach (MExpression e in args) + foreach (Xex e in args) n |= (int) e.val; return n; } - private static object logand (MExpression[] args, Domain domain) + private static object logand (Xex[] args, Domain domain) { int n = 0; - foreach (MExpression e in args) + foreach (Xex e in args) n &= (int) e.val; return n; } - private static object pluseq (MExpression[] args, Domain domain) + private static object pluseq (Xex[] args, Domain domain) { - MSymbol sym = (MSymbol) args[0].args[0].val; + Name sym = (Name) args[0].args[0].val; object val = domain.GetValue (sym); if (val is int) @@ -554,9 +526,9 @@ public class XmlName : IEquatable return val; } - private static object multieq (MExpression[] args, Domain domain) + private static object multieq (Xex[] args, Domain domain) { - MSymbol sym = (MSymbol) args[0].args[0].val; + Name sym = (Name) args[0].args[0].val; int n = (int) domain.GetValue (sym); for (int i = 1; i < args.Length; i++) @@ -564,9 +536,9 @@ public class XmlName : IEquatable return domain.SetValue (sym, (object) n); } - private static object minuseq (MExpression[] args, Domain domain) + private static object minuseq (Xex[] args, Domain domain) { - MSymbol sym = (MSymbol) args[0].args[0].val; + Name sym = (Name) args[0].args[0].val; int n = (int) domain.GetValue (sym); for (int i = 1; i < args.Length; i++) @@ -574,9 +546,9 @@ public class XmlName : IEquatable return domain.SetValue (sym, (object) n); } - private static object divideeq (MExpression[] args, Domain domain) + private static object divideeq (Xex[] args, Domain domain) { - MSymbol sym = (MSymbol) args[0].args[0].val; + Name sym = (Name) args[0].args[0].val; int n = (int) domain.GetValue (sym); for (int i = 1; i < args.Length; i++) @@ -584,9 +556,9 @@ public class XmlName : IEquatable return domain.SetValue (sym, (object) n); } - private static object percenteq (MExpression[] args, Domain domain) + private static object percenteq (Xex[] args, Domain domain) { - MSymbol sym = (MSymbol) args[0].args[0].val; + Name sym = (Name) args[0].args[0].val; int n = (int) domain.GetValue (sym); for (int i = 1; i < args.Length; i++) @@ -594,9 +566,9 @@ public class XmlName : IEquatable return domain.SetValue (sym, (object) n); } - private static object logioreq (MExpression[] args, Domain domain) + private static object logioreq (Xex[] args, Domain domain) { - MSymbol sym = (MSymbol) args[0].args[0].val; + Name sym = (Name) args[0].args[0].val; int n = (int) domain.GetValue (sym); for (int i = 1; i < args.Length; i++) @@ -604,9 +576,9 @@ public class XmlName : IEquatable return domain.SetValue (sym, (object) n); } - private static object logandeq (MExpression[] args, Domain domain) + private static object logandeq (Xex[] args, Domain domain) { - MSymbol sym = (MSymbol) args[0].args[0].val; + Name sym = (Name) args[0].args[0].val; int n = (int) domain.GetValue (sym); for (int i = 1; i < args.Length; i++) @@ -614,35 +586,35 @@ public class XmlName : IEquatable return domain.SetValue (sym, (object) n); } - private static object lshift (MExpression[] args, Domain domain) + private static object lshift (Xex[] args, Domain domain) { return (int) args[0].val << (int) args[1].val; } - private static object lshifteq (MExpression[] args, Domain domain) + private static object lshifteq (Xex[] args, Domain domain) { - MSymbol sym = (MSymbol) args[0].args[0].val; + Name sym = (Name) args[0].args[0].val; int n = (int) domain.GetValue (sym); n <<= (int) args[1].Eval (domain); return domain.SetValue (sym, (object) n); } - private static object rshift (MExpression[] args, Domain domain) + private static object rshift (Xex[] args, Domain domain) { return (int) args[0].val >> (int) args[1].val; } - private static object rshifteq (MExpression[] args, Domain domain) + private static object rshifteq (Xex[] args, Domain domain) { - MSymbol sym = (MSymbol) args[0].args[0].val; + Name sym = (Name) args[0].args[0].val; int n = (int) domain.GetValue (sym); n >>= (int) args[1].Eval (domain); return domain.SetValue (sym, (object) n); } - private static object eq (MExpression[] args, Domain domain) + private static object eq (Xex[] args, Domain domain) { int n = (int) args[0].val; @@ -652,12 +624,12 @@ public class XmlName : IEquatable return true; } - private static object noteq (MExpression[] args, Domain domain) + private static object noteq (Xex[] args, Domain domain) { return ((int) args[0].val != (int) args[1].val); } - private static object less (MExpression[] args, Domain domain) + private static object less (Xex[] args, Domain domain) { int n = (int) args[0].val; @@ -671,7 +643,7 @@ public class XmlName : IEquatable return true; } - private static object lesseq (MExpression[] args, Domain domain) + private static object lesseq (Xex[] args, Domain domain) { int n = (int) args[0].val; for (int i = 1; i < args.Length; i++) @@ -684,7 +656,7 @@ public class XmlName : IEquatable return true; } - private static object more (MExpression[] args, Domain domain) + private static object more (Xex[] args, Domain domain) { int n = (int) args[0].val; for (int i = 1; i < args.Length; i++) @@ -697,7 +669,7 @@ public class XmlName : IEquatable return true; } - private static object moreeq (MExpression[] args, Domain domain) + private static object moreeq (Xex[] args, Domain domain) { int n = (int) args[0].val; for (int i = 1; i < args.Length; i++) @@ -710,16 +682,16 @@ public class XmlName : IEquatable return true; } - private static object progn (MExpression[] args, Domain domain) + private static object progn (Xex[] args, Domain domain) { object result = false; - foreach (MExpression e in args) + foreach (Xex e in args) result = e.Eval (domain); return result; } - private static bool check_condition (MExpression condition, Domain domain) + private static bool check_condition (Xex condition, Domain domain) { object result = condition.Eval (domain); return (result is bool ? (bool) result @@ -727,7 +699,7 @@ public class XmlName : IEquatable : true); } - private static object ifclause (MExpression[] args, Domain domain) + private static object ifclause (Xex[] args, Domain domain) { object result = false; @@ -739,7 +711,7 @@ public class XmlName : IEquatable return result; } - private static object whenclause (MExpression[] args, Domain domain) + private static object whenclause (Xex[] args, Domain domain) { object result = false; @@ -749,7 +721,7 @@ public class XmlName : IEquatable return result; } - private static object whileclause (MExpression[] args, Domain domain) + private static object whileclause (Xex[] args, Domain domain) { while (check_condition (args[0], domain)) for (int i = 1; i < args.Length; i++) @@ -757,34 +729,18 @@ public class XmlName : IEquatable return false; } - // (cond (COND1 ...) (COND2 ...) ...) - // => (cond (when COND1 ...) (when COND2 ...) ...) - private static void translate_cond (MPlist plist, Domain domain) - { - if (plist.IsPlist) - { - plist = plist.Plist; - if (plist.IsSymbol && plist.Symbol == Mcond) - { - plist.val = Mprogn; - for (plist = plist.next; ! plist.IsEmpty; plist = plist.next) - { - if (! plist.IsPlist) - throw new Exception ("Invalid cond form: " + plist); - plist.Plist.Push (MSymbol.symbol, Mwhen); - } - } - } - } + // FUNCALL: function != null + // VARREF: function == null, args[0] = DIRECT-SYMBOL + // DIRECT: function == null, args == null private Function function; - private MExpression[] args; + private Xex[] args; private object val; - public MExpression[] Args { get { return args; } } + public Xex[] Args { get { return args; } } public object Val { get { return val; } } - private MExpression (object val) + private Xex (object val) { this.val = val; } @@ -792,26 +748,48 @@ public class XmlName : IEquatable // EXPR = SYMBOL | MTEXT | INTEGER | FUNCALL | PROGN // FUNCALL = '(' SYMBOL EXPR* ')' // PROGN = '(' EXPR * ')' - private MExpression (MSymbol key, object val, Domain domain) + private Xex (XmlNode node, Domain domain) { - if (key == MSymbol.symbol) + object name = node.Name; + + if (name == Nvalue) { - function = Function.varref; - args = new MExpression[1]; - args[0] = new MExpression (val); + object type = node.Attributes["type"]; + + if (type == Ninteger) + val = parse_integer (node.InnerText); + else if (type == Nstring) + val = node.InnerText; + else if (type == Nsymbol) + val = (Name) node.InnerText; + else if (type == Nboolean) + val = node.InnerText == "true"; + else if (type == Nlist) + { + List list = new List; + for (XmlNode n = node.FirstChild; n != null; n = n.NextSibling) + list.Add (new Xex (n, domain)); + val = list; + } + else + throw new Exception ("Unknown type: " + type); } - else if (key == MSymbol.integer - || key == MSymbol.mtext) + else if (name = Nval) { - this.val = val; + name = name.Attributes[]; + + args = new Xex[1]; + args[0] = new Xex ( + + } - else if (key == MSymbol.plist) + else if (key == Name.plist) { MPlist p = (MPlist) val; if (p.IsSymbol) { - MSymbol sym = p.Symbol; + Name sym = p.Symbol; if (sym == Mdefun) { @@ -825,7 +803,7 @@ public class XmlName : IEquatable throw new Exception ("Invalid function argument: " + p.val); domain.Defun (sym, p.Plist, p.next); - // This Mexpression is just a dummy. + // This Xex is just a dummy. } else { @@ -836,38 +814,27 @@ public class XmlName : IEquatable || (function.max_arg >= 0 && nargs > function.max_arg)) throw new Exception ("Invalid number of arguments to: " + sym + " " + nargs); - args = new MExpression[nargs]; + args = new Xex[nargs]; for (int i = 0; i < nargs; i++, p = p.next) { domain.Translate (p); - args[i] = new MExpression (p.key, p.val, domain); + args[i] = new Xex (p.key, p.val, domain); } } } else { - args = new MExpression[1]; - args[0] = new MExpression (p, domain); + args = new Xex[1]; + args[0] = new Xex (p, domain); } } else throw new Exception ("Invalid expression: " + key + ":" + val); } - public MExpression (MPlist plist, Domain domain) - { - function = Function.block; - args = new MExpression[plist.Count]; - for (int i = 0; ! plist.IsEmpty; i++, plist = plist.next) - { - domain.Translate (plist); - args[i] = new MExpression (plist.key, plist.val, domain); - } - } - - public MExpression (XmlNode node, Domain domain) + public Xex (XmlNode node, Domain domain) { - MSymbol sym = node.Name; + Name sym = node.Name; function = domain.GetFunc (sym); @@ -877,11 +844,11 @@ public class XmlName : IEquatable if (nargs < function.min_arg || (function.max_arg >= 0 && nargs > function.max_arg)) throw new Exception ("Invalid number of arguments: " + node.InnerXml); - args = new MExpression[nargs]; + args = new Xex[nargs]; int i; for (i = 0; i < attrs.Count; i++) { - string str = sttrs[i].Value; + string str = attrs[i].Value; } } @@ -890,8 +857,8 @@ public class XmlName : IEquatable { if (function == null) { - if (val is MSymbol) - val = domain.GetValue ((MSymbol) val); + if (val is Name) + val = domain.GetValue ((Name) val); } else val = function.Call (args, domain); @@ -906,7 +873,7 @@ public class XmlName : IEquatable { str = "(" + function.Name.Name; if (args != null) - foreach (MExpression e in args) + foreach (Xex e in args) str += " " + e.ToString (); str += ")"; } -- 1.7.10.4