From af5c8ea937dad17ee76f5f541b973f12afbcb6a5 Mon Sep 17 00:00:00 2001 From: handa Date: Tue, 23 Feb 2010 15:58:37 +0000 Subject: [PATCH] *** empty log message *** --- MInputMethod.cs | 14 +++---- Makefile | 7 +++- XmlExpr.cs | 123 ++++++++++++++----------------------------------------- xex.txt | 2 +- 4 files changed, 44 insertions(+), 102 deletions(-) diff --git a/MInputMethod.cs b/MInputMethod.cs index c27af0a..0670f99 100644 --- a/MInputMethod.cs +++ b/MInputMethod.cs @@ -1035,14 +1035,14 @@ namespace M17N.Input static Selector () { selectors = new Dictionary (); - selectors ["@<"] = selectors["@first"] = new Selector ('<'); - selectors ["@="] = selectors["@current"] = new Selector ('='); - selectors ["@>"] = selectors["@last"] = new Selector ('>'); - selectors ["@-"] = selectors["@previous"] = new Selector ('-'); - selectors ["@+"] = selectors["@next"] = new Selector ('+'); - selectors ["@["] = selectors["@previous-candidate-change"] + selectors["@<"] = selectors["@first"] = new Selector ('<'); + selectors["@="] = selectors["@current"] = new Selector ('='); + selectors["@>"] = selectors["@last"] = new Selector ('>'); + selectors["@-"] = selectors["@previous"] = new Selector ('-'); + selectors["@+"] = selectors["@next"] = new Selector ('+'); + selectors["@["] = selectors["@previous-candidate-change"] = new Selector ('['); - selectors ["@]"] = selectors["@next-candidate-change"] + selectors["@]"] = selectors["@next-candidate-change"] = new Selector (']'); } diff --git a/Makefile b/Makefile index ccf25d3..3baa87f 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ M17NIM.dll: ${INPUT_SRC} M17N.dll M17NCore.dll XmlExpr.dll $(RUNCS) -out:$@ -t:library -r:M17N.dll -r:M17NCore.dll -r:XmlExpr.dll ${INPUT_SRC} XmlExpr.dll: ${XEX_SRC} - $(RUNCS) -out:$@ -t:library ${XEX_SRC} + $(RUNCS) -doc:XmlExpr.xml -out:$@ -t:library ${XEX_SRC} input.exe: input.cs M17NIM.dll XmlExpr.dll $(RUNCS) -r:M17N.dll -r:M17NCore.dll -r:XmlExpr.dll -r:M17NIM.dll $< @@ -48,3 +48,8 @@ temp.exe: temp.cs test.exe: test.cs $(CS) test.cs + +doc: XmlExpr.xml + mdoc-update -delete -i XmlExpr.xml -o docs/en XmlExpr.dll + mdoc assemble -o XmlExpr docs/en + sudo cp XmlExpr.tree XmlExpr.zip XmlExpr.source `pkg-config monodoc --variable sourcesdir` diff --git a/XmlExpr.cs b/XmlExpr.cs index 18de2ec..8a6cb13 100644 --- a/XmlExpr.cs +++ b/XmlExpr.cs @@ -252,22 +252,6 @@ namespace System.Xml { private int[] range; - public bool IsSubrange (int[] r) - { - if (range == null) - return true; - for (int i = 0; i < r.Length; i += 2) - { - int j; - for (j = 0; j < range.Length; j += 2) - if (range[j] <= r[i] && range[j + 1] >= r[i + 1]) - break; - if (j >= range.Length) - return false; - } - return true; - } - public IntType (Domain domain, Symbol name, int n, string desc, int[] range) : base (domain, name, new Term (n), desc) @@ -305,22 +289,6 @@ namespace System.Xml { private string[] range; - public bool IsSubrange (string[] r) - { - if (range == null) - return true; - for (int i = 0; i < r.Length; i++) - { - int j; - for (j = 0; j < range.Length; j++) - if (range[j] == r[i]) - break; - if (j >= range.Length) - return false; - } - return true; - } - public StrType (Domain domain, Symbol name, Str str, string desc, string[] range) : base (domain, name, new Term (str), desc) @@ -355,22 +323,6 @@ namespace System.Xml { public Symbol[] range; - public bool IsSubrange (Symbol[] r) - { - if (range == null) - return true; - for (int i = 0; i < r.Length; i++) - { - int j; - for (j = 0; j < range.Length; j++) - if (range[j] == r[i]) - break; - if (j >= range.Length) - return false; - } - return true; - } - public SymType (Domain domain, Symbol name, Symbol sym, string desc, Symbol[] range) : base (domain, name, new Term (sym), desc) @@ -877,7 +829,7 @@ namespace System.Xml return vari; } - public Variable DefvarInt (Symbol name, int n, string desc, int[] range) + public Variable Defvar (Symbol name, int n, string desc, int[] range) { Variable vari; @@ -888,12 +840,7 @@ namespace System.Xml throw new Error (Error.VariableTypeConflict, "Not an integer variable: {0}", name); if (range != null) - { - if (! intvari.IsSubrange (range)) - throw new Error (Error.VariableRangeConflict, - "Conflicting variable range: {0}", name); - intvari.Range = range;; - } + intvari.Range = range;; if (desc != null) intvari.Description = desc; } @@ -905,60 +852,50 @@ namespace System.Xml return vari; } - public Variable DefvarStr (Symbol name, string str, string desc, - string[] range) + public Variable Defvar (Symbol name, Symbol sym, string desc, + Symbol[] range) { Variable vari; if (variables.TryGetValue (name, out vari)) { - Variable.StrType strvari = vari as Variable.StrType; - if (strvari == null) + Variable.SymType symvari = vari as Variable.SymType; + if (symvari == null) throw new Error (Error.VariableTypeConflict, - "Not a string variable: {0}", name); + "Not a symbol variable: {0}", name); if (range != null) - { - if (! strvari.IsSubrange (range)) - throw new Error (Error.VariableRangeConflict, - "Conflicting variable range: {0}", name); - strvari.Range = range; - } + symvari.Range = range; if (desc != null) - strvari.Description = desc; + symvari.Description = desc; } else { - vari = new Variable.StrType (this, name, new Str (str), desc, - range); + vari = new Variable.SymType (this, name, sym, desc, range); variables[name] = vari; } return vari; } - public Variable DefvarSym (Symbol name, Symbol sym, string desc, - Symbol[] range) + public Variable Defvar (Symbol name, string str, string desc, + string[] range) { Variable vari; if (variables.TryGetValue (name, out vari)) { - Variable.SymType symvari = vari as Variable.SymType; - if (symvari == null) + Variable.StrType strvari = vari as Variable.StrType; + if (strvari == null) throw new Error (Error.VariableTypeConflict, - "Not a symbol variable: {0}", name); + "Not a string variable: {0}", name); if (range != null) - { - if (! symvari.IsSubrange (range)) - throw new Error (Error.VariableRangeConflict, - "Conflicting variable range: {0}", name); - symvari.Range = range; - } + strvari.Range = range; if (desc != null) - symvari.Description = desc; + strvari.Description = desc; } else { - vari = new Variable.SymType (this, name, sym, desc, range); + vari = new Variable.StrType (this, name, new Str (str), desc, + range); variables[name] = vari; } return vari; @@ -1409,7 +1346,7 @@ namespace System.Xml { Term result = arg.Eval (domain); if (domain.Thrown ()) - result; + return result; if (! result.IsTrue) return Zero; } @@ -1451,7 +1388,7 @@ namespace System.Xml { Term result = args[0].Eval (domain); - if (domain.Thrown) + if (domain.Thrown ()) return result; if (result.IsTrue) return args[1].Eval (domain); @@ -1464,7 +1401,7 @@ namespace System.Xml { Term result = args[0].Eval (domain); - if (domain.Thrown) + if (domain.Thrown ()) return result; if (! result.IsTrue) return Zero; @@ -1472,7 +1409,7 @@ namespace System.Xml for (int i = 1; i < args.Length; i++) { result = args[i].Eval (domain); - if (domain.Thrown) + if (domain.Thrown ()) return result; } return result; @@ -2029,9 +1966,9 @@ namespace System.Xml /// Create a term of a specific value /// Value of the term. /// A term. - /// Create a term whose value is . + /// Create a term whose value is . /// It is evaluated to a term that is returned by "Eval" method - /// of . + /// of . public Term (TermValue val) { intval = 0; objval = val; } internal Term (Str str) { intval = 0; objval = str; } @@ -2055,8 +1992,8 @@ namespace System.Xml /// function as arguments. /// A funcall term. /// Create a funcall term that is evaluated to a term - /// returned by the function when called - /// with . + /// returned by the function when called + /// with . public Term (Domain domain, Symbol fname, Term[] args) : this (domain, fname, Qnull, args) { } @@ -2348,7 +2285,7 @@ namespace System.Xml } } } - vari = domain.DefvarInt (vname, val, desc, range); + vari = domain.Defvar (vname, val, desc, range); } else if (type == Qstring) { @@ -2359,7 +2296,7 @@ namespace System.Xml for (int i = 0; i < nranges; i++) range[i] = range_list[i].FirstChild.InnerText; } - vari = domain.DefvarStr (vname, node.InnerText, desc, range); + vari = domain.Defvar (vname, node.InnerText, desc, range); } else if (type == Qsymbol) { @@ -2370,7 +2307,7 @@ namespace System.Xml for (int i = 0; i < nranges; i++) range[i] = range_list[i].FirstChild.InnerText; } - vari = domain.DefvarSym (vname, (Symbol) node.InnerText, desc, + vari = domain.Defvar (vname, (Symbol) node.InnerText, desc, range); } else diff --git a/xex.txt b/xex.txt index 055a0eb..31badfd 100644 --- a/xex.txt +++ b/xex.txt @@ -109,7 +109,7 @@ SYMTERM = SYMBOL | VAR (value is SYMBOL) | FUNCALL (return SYMBOL) LISTTERM = LIST | VAR (value is LIST) | FUNCALL (return LIST) XXXTERM = TERM -;; Here after, when an argument written as TERM, it is given to a +;; Here after, when an argument is written as TERM, it is given to a ;; function without being evaluted. Otherwise, an evaluated term is ;; given. "the value is NUM" means "the value is ;; NUM". -- 1.7.10.4