[e-cvs] cvs commit: e/src/jsrc/org/quasiliteral/text FirstCharSplitter.java Identifiers.java SimpleQuasiParser.java Substituter.java

markm@eros.cs.jhu.edu markm@eros.cs.jhu.edu
Mon, 10 Dec 2001 13:27:01 -0500


markm       01/12/10 13:27:01

  Modified:    src/jsrc/org/capml/quasi QuasiContent.java
                        QuasiContentPattHole.java QuasiElement.java
               src/jsrc/org/erights/build EYaccFixer.java
               src/jsrc/org/erights/e/elang/evm EMethodNode.java ENode.java
                        QuasiLiteralExpr.java QuasiLiteralPatt.java
                        QuasiPatternExpr.java QuasiPatternPatt.java
               src/jsrc/org/erights/e/elang/interp ScopeSetup.java
               src/jsrc/org/erights/e/elang/syntax e.y
               src/jsrc/org/erights/e/elib/base MessageDesc.java
                        MethodNode.java ParamDesc.java
               src/jsrc/org/erights/e/elib/prim JavaMemberNode.java
                        OverloaderNode.java VTable.java VarSetterNode.java
  Added:       src/jsrc/org/quasiliteral/base IncompleteQuasiException.java
                        MatchMaker.java QuasiExprParser.java
                        QuasiPatternParser.java ValueMaker.java
                        package.html
               src/jsrc/org/quasiliteral/text FirstCharSplitter.java
                        Identifiers.java SimpleQuasiParser.java
                        Substituter.java
  Removed:     src/jsrc/org/erights/e/elib/quasi FirstCharSplitter.java
                        Identifiers.java IncompleteQuasiException.java
                        MatchMaker.java QuasiExprParser.java
                        QuasiPatternParser.java SimpleQuasiParser.java
                        Substituter.java ValueMaker.java package.html
  Log:
  package motion

Revision  Changes    Path
1.9       +1 -1      e/src/jsrc/org/capml/quasi/QuasiContent.java

Index: QuasiContent.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/capml/quasi/QuasiContent.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- QuasiContent.java	2001/12/02 06:01:41	1.8
+++ QuasiContent.java	2001/12/10 18:26:59	1.9
@@ -24,7 +24,7 @@
 import org.capml.dom.Node;
 import org.capml.dom.Text;
 import org.erights.e.elib.eio.TextWriter;
-import org.erights.e.elib.quasi.MatchMaker;
+import org.quasiliteral.base.MatchMaker;
 import org.erights.e.elib.serial.PassByConstruction;
 import org.erights.e.elib.serial.Persistent;
 import org.erights.e.elib.tables.ConstList;



1.8       +1 -1      e/src/jsrc/org/capml/quasi/QuasiContentPattHole.java

Index: QuasiContentPattHole.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/capml/quasi/QuasiContentPattHole.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- QuasiContentPattHole.java	2001/12/02 06:01:41	1.7
+++ QuasiContentPattHole.java	2001/12/10 18:26:59	1.8
@@ -23,7 +23,7 @@
 
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.prim.StaticMaker;
-import org.erights.e.elib.quasi.IncompleteQuasiException;
+import org.quasiliteral.base.IncompleteQuasiException;
 import org.erights.e.elib.tables.FlexList;
 
 import java.io.IOException;



1.9       +1 -1      e/src/jsrc/org/capml/quasi/QuasiElement.java

Index: QuasiElement.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/capml/quasi/QuasiElement.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- QuasiElement.java	2001/12/02 06:01:41	1.8
+++ QuasiElement.java	2001/12/10 18:26:59	1.9
@@ -25,7 +25,7 @@
 import org.capml.dom.Node;
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.prim.StaticMaker;
-import org.erights.e.elib.quasi.IncompleteQuasiException;
+import org.quasiliteral.base.IncompleteQuasiException;
 import org.erights.e.elib.tables.ConstList;
 import org.erights.e.elib.tables.FlexList;
 



1.26      +3 -3      e/src/jsrc/org/erights/build/EYaccFixer.java

Index: EYaccFixer.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/build/EYaccFixer.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- EYaccFixer.java	2001/11/10 19:40:38	1.25
+++ EYaccFixer.java	2001/12/10 18:27:00	1.26
@@ -1,9 +1,9 @@
 package org.erights.build;
 
 import org.erights.e.elib.prim.E;
-import org.erights.e.elib.quasi.MatchMaker;
-import org.erights.e.elib.quasi.SimpleQuasiParser;
-import org.erights.e.elib.quasi.ValueMaker;
+import org.quasiliteral.base.MatchMaker;
+import org.quasiliteral.text.SimpleQuasiParser;
+import org.quasiliteral.base.ValueMaker;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.Twine;
 import org.erights.e.meta.java.io.FileSugar;



1.26      +0 -20     e/src/jsrc/org/erights/e/elang/evm/EMethodNode.java

Index: EMethodNode.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/EMethodNode.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- EMethodNode.java	2001/11/12 18:23:15	1.25
+++ EMethodNode.java	2001/12/10 18:27:00	1.26
@@ -103,24 +103,4 @@
      */
     public void addJavaMemberNodesToMap(FlexMap map) {
     }
-
-    /**
-     * Ignores docComment
-     */
-    public boolean matchBind(Object[] args,
-                             Object specimen,
-                             FlexList bindings) {
-        EMethodNode other;
-        try {
-            other = (EMethodNode)Ref.resolution(specimen);
-        } catch (ClassCastException cce) {
-            //using a try/catch since success is typical and we have
-            //to pay for the test in the cast anyway
-            return false;
-        }
-        return (myArity == other.myArity
-          && myVerb.equals(other.myVerb)
-          && myMethod.matchBind(args, other.myMethod, bindings));
-    }
-
 }



1.9       +0 -1      e/src/jsrc/org/erights/e/elang/evm/ENode.java

Index: ENode.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/ENode.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ENode.java	2001/12/02 06:01:42	1.8
+++ ENode.java	2001/12/10 18:27:00	1.9
@@ -23,7 +23,6 @@
 
 import org.erights.e.elang.scope.ScopeMap;
 import org.erights.e.elang.visitors.ETreeVisitor;
-import org.erights.e.elib.base.ParseNode;
 import org.erights.e.elib.util.AlreadyDefinedException;
 
 /**



1.24      +1 -1      e/src/jsrc/org/erights/e/elang/evm/QuasiLiteralExpr.java

Index: QuasiLiteralExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/QuasiLiteralExpr.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- QuasiLiteralExpr.java	2001/12/02 06:01:42	1.23
+++ QuasiLiteralExpr.java	2001/12/10 18:27:00	1.24
@@ -22,7 +22,7 @@
 import org.erights.e.elang.scope.EvalContext;
 import org.erights.e.elang.visitors.ETreeVisitor;
 import org.erights.e.elib.eio.TextWriter;
-import org.erights.e.elib.quasi.IncompleteQuasiException;
+import org.quasiliteral.base.IncompleteQuasiException;
 import org.erights.e.elib.tables.FlexList;
 
 import java.io.IOException;



1.14      +1 -1      e/src/jsrc/org/erights/e/elang/evm/QuasiLiteralPatt.java

Index: QuasiLiteralPatt.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/QuasiLiteralPatt.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- QuasiLiteralPatt.java	2001/12/02 06:01:42	1.13
+++ QuasiLiteralPatt.java	2001/12/10 18:27:00	1.14
@@ -22,7 +22,7 @@
 import org.erights.e.elang.scope.EvalContext;
 import org.erights.e.elang.visitors.ETreeVisitor;
 import org.erights.e.elib.eio.TextWriter;
-import org.erights.e.elib.quasi.IncompleteQuasiException;
+import org.quasiliteral.base.IncompleteQuasiException;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.util.OneArgFunc;
 



1.25      +1 -1      e/src/jsrc/org/erights/e/elang/evm/QuasiPatternExpr.java

Index: QuasiPatternExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/QuasiPatternExpr.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- QuasiPatternExpr.java	2001/12/02 06:01:42	1.24
+++ QuasiPatternExpr.java	2001/12/10 18:27:00	1.25
@@ -22,7 +22,7 @@
 import org.erights.e.elang.scope.EvalContext;
 import org.erights.e.elang.visitors.ETreeVisitor;
 import org.erights.e.elib.eio.TextWriter;
-import org.erights.e.elib.quasi.IncompleteQuasiException;
+import org.quasiliteral.base.IncompleteQuasiException;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.util.AlreadyDefinedException;
 



1.14      +1 -1      e/src/jsrc/org/erights/e/elang/evm/QuasiPatternPatt.java

Index: QuasiPatternPatt.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/QuasiPatternPatt.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- QuasiPatternPatt.java	2001/12/02 06:01:42	1.13
+++ QuasiPatternPatt.java	2001/12/10 18:27:00	1.14
@@ -22,7 +22,7 @@
 import org.erights.e.elang.scope.EvalContext;
 import org.erights.e.elang.visitors.ETreeVisitor;
 import org.erights.e.elib.eio.TextWriter;
-import org.erights.e.elib.quasi.IncompleteQuasiException;
+import org.quasiliteral.base.IncompleteQuasiException;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.util.AlreadyDefinedException;
 import org.erights.e.elib.util.OneArgFunc;



1.78      +1 -1      e/src/jsrc/org/erights/e/elang/interp/ScopeSetup.java

Index: ScopeSetup.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/interp/ScopeSetup.java,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- ScopeSetup.java	2001/12/02 06:01:43	1.77
+++ ScopeSetup.java	2001/12/10 18:27:00	1.78
@@ -35,7 +35,7 @@
 import org.erights.e.elib.prim.E;
 import org.erights.e.elib.prim.StaticMaker;
 import org.erights.e.elib.prim.Thrower;
-import org.erights.e.elib.quasi.SimpleQuasiParser;
+import org.quasiliteral.text.SimpleQuasiParser;
 import org.erights.e.elib.ref.Ref;
 import org.erights.e.elib.ref.Resolver;
 import org.erights.e.elib.serial.PassByConstructionGuard;



1.101     +71 -0     e/src/jsrc/org/erights/e/elang/syntax/e.y

Index: e.y
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/syntax/e.y,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- e.y	2001/12/10 16:55:32	1.100
+++ e.y	2001/12/10 18:27:00	1.101
@@ -146,7 +146,42 @@
 %token MisMatch         /* !~ */
 %token Audit            /* :: */
 
+/* Non-token Kernel-E Term-tree tag names (ie, functor names) */
 
+%token AssignExpr
+%token CallExpr
+%token DefineExpr
+%token EscapeExpr
+%token HideExpr
+%token IfExpr
+%token LiteralExpr
+%token MatchBindExpr
+%token NounExpr
+%token ObjectExpr
+%token QuasiLiteralExpr
+%token QuasiPatternExpr
+%token ScopeExpr
+%token SendExpr
+%token SeqExpr
+%token SlotExpr
+%token MetaExpr
+%token CatchExpr
+%token FinallyExpr
+
+%token FinalPattern
+%token VarPattern
+%token ListPattern
+%token CdrPattern
+%token IgnorePattern
+%token SuchThatPattern
+%token QuasiLiteralPatt
+%token QuasiPatternPatt
+
+%token EScript
+%token EMethod
+%token Matcher
+
+
 /* Grammar follows */
 %%
 
@@ -1670,6 +1705,42 @@
     TheTokens[MatchBind]        = "MatchBind";
     TheTokens[MisMatch]         = "MisMatch";
     TheTokens[Audit]            = "Audit";
+
+    /* Non-token Kernel-E Term-tree tag names (ie, functor names) */
+
+    TheTokens[AssignExpr]       = "AssignExpr";
+    TheTokens[CallExpr]         = "CallExpr";
+    TheTokens[DefineExpr]       = "DefineExpr";
+    TheTokens[EscapeExpr]       = "EscapeExpr";
+    TheTokens[HideExpr]         = "HideExpr";
+    TheTokens[IfExpr]           = "IfExpr";
+    TheTokens[LiteralExpr]      = "LiteralExpr";
+    TheTokens[MatchBindExpr]    = "MatchBindExpr";
+    TheTokens[NounExpr]         = "NounExpr";
+    TheTokens[ObjectExpr]       = "ObjectExpr";
+    TheTokens[QuasiLiteralExpr] = "QuasiLiteralExpr";
+    TheTokens[QuasiPatternExpr] = "QuasiPatternExpr";
+    TheTokens[ScopeExpr]        = "ScopeExpr";
+    TheTokens[SendExpr]         = "SendExpr";
+    TheTokens[SeqExpr]          = "SeqExpr";
+    TheTokens[SlotExpr]         = "SlotExpr";
+    TheTokens[MetaExpr]         = "MetaExpr";
+    TheTokens[CatchExpr]        = "CatchExpr";
+    TheTokens[FinallyExpr]      = "FinallyExpr";
+
+    TheTokens[FinalPattern]     = "FinalPattern";
+    TheTokens[VarPattern]       = "VarPattern";
+    TheTokens[ListPattern]      = "ListPattern";
+    TheTokens[CdrPattern]       = "CdrPattern";
+    TheTokens[IgnorePattern]    = "IgnorePattern";
+    TheTokens[SuchThatPattern]  = "SuchThatPattern";
+    TheTokens[QuasiLiteralPatt] = "QuasiLiteralPatt";
+    TheTokens[QuasiPatternPatt] = "QuasiPatternPatt";
+
+    TheTokens[EScript]          = "EScript";
+    TheTokens[EMethod]          = "EMethod";
+    TheTokens[Matcher]          = "Matcher";
+
 }
 
 /**



1.11      +2 -3      e/src/jsrc/org/erights/e/elib/base/MessageDesc.java

Index: MessageDesc.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/base/MessageDesc.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- MessageDesc.java	2001/12/05 00:46:10	1.10
+++ MessageDesc.java	2001/12/10 18:27:00	1.11
@@ -25,10 +25,9 @@
 import org.erights.e.elib.prim.E;
 import org.erights.e.elib.prim.StaticMaker;
 import org.erights.e.elib.serial.Persistent;
-import org.erights.e.elib.tables.ConstList;
-import org.erights.e.elib.slot.ValueGuard;
 import org.erights.e.elib.slot.NullOkMaker;
-import org.erights.e.elib.slot.SlotGuard;
+import org.erights.e.elib.slot.ValueGuard;
+import org.erights.e.elib.tables.ConstList;
 
 import java.io.IOException;
 



1.19      +2 -23     e/src/jsrc/org/erights/e/elib/base/MethodNode.java

Index: MethodNode.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/base/MethodNode.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- MethodNode.java	2001/12/05 00:46:10	1.18
+++ MethodNode.java	2001/12/10 18:27:00	1.19
@@ -19,10 +19,9 @@
 Contributor(s): ______________________________________.
 */
 
-import org.erights.e.elib.quasi.MatchMaker;
 import org.erights.e.elib.slot.SimpleSlotMaker;
-import org.erights.e.elib.slot.ValueGuard;
 import org.erights.e.elib.slot.SlotGuard;
+import org.erights.e.elib.slot.ValueGuard;
 import org.erights.e.elib.tables.ConstList;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.FlexMap;
@@ -33,7 +32,7 @@
  * @see org.erights.e.elib.prim.VTable
  * @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
  */
-public abstract class MethodNode implements Script, MatchMaker {
+public abstract class MethodNode implements Script {
 
     /**
      *
@@ -98,25 +97,5 @@
             return otv != null && aVerb.equals(otv);
         }
         return false;
-    }
-
-// For MatchMaker
-    /**
-     *
-     */
-    public abstract boolean matchBind(Object[] args,
-                                      Object specimen,
-                                      FlexList bindings);
-
-    /**
-     *
-     */
-    public ConstList matchBind(Object[] args, Object specimen) {
-        FlexList bindings = FlexList.make();
-        if (matchBind(args, specimen, bindings)) {
-            return bindings.snapshot();
-        } else {
-            return null;
-        }
     }
 }



1.11      +1 -1      e/src/jsrc/org/erights/e/elib/base/ParamDesc.java

Index: ParamDesc.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/base/ParamDesc.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ParamDesc.java	2001/12/05 00:46:10	1.10
+++ ParamDesc.java	2001/12/10 18:27:00	1.11
@@ -25,8 +25,8 @@
 import org.erights.e.elib.prim.E;
 import org.erights.e.elib.prim.StaticMaker;
 import org.erights.e.elib.serial.Persistent;
-import org.erights.e.elib.slot.SlotGuard;
 import org.erights.e.elib.slot.NullOkMaker;
+import org.erights.e.elib.slot.SlotGuard;
 import org.erights.e.elib.slot.ValueGuard;
 
 import java.io.IOException;



1.33      +2 -23     e/src/jsrc/org/erights/e/elib/prim/JavaMemberNode.java

Index: JavaMemberNode.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/prim/JavaMemberNode.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- JavaMemberNode.java	2001/12/05 00:46:10	1.32
+++ JavaMemberNode.java	2001/12/10 18:27:00	1.33
@@ -22,19 +22,13 @@
 import org.erights.e.develop.exception.ExceptionMgr;
 import org.erights.e.elib.base.ClassDesc;
 import org.erights.e.elib.base.Ejector;
-import org.erights.e.elib.base.MethodNode;
 import org.erights.e.elib.base.MessageDesc;
+import org.erights.e.elib.base.MethodNode;
 import org.erights.e.elib.base.ParamDesc;
 import org.erights.e.elib.eio.TextWriter;
-import org.erights.e.elib.ref.Ref;
-import org.erights.e.elib.tables.FlexList;
-import org.erights.e.elib.tables.FlexMap;
 import org.erights.e.elib.tables.ConstList;
+import org.erights.e.elib.tables.FlexMap;
 import org.erights.e.elib.util.OneArgFunc;
-import org.erights.e.elib.slot.ValueGuard;
-import org.erights.e.elib.slot.SimpleSlotMaker;
-import org.erights.e.elib.slot.NullOkMaker;
-import org.erights.e.elib.slot.SlotGuard;
 
 import java.io.IOException;
 import java.lang.reflect.Member;
@@ -210,21 +204,6 @@
      */
     public boolean isOkCovered() {
         return myOkCoverageFlag;
-    }
-
-    /**
-     *
-     */
-    public boolean matchBind(Object[] args,
-                             Object specimen,
-                             FlexList bindings) {
-        JavaMemberNode other;
-        if (getClass().isInstance(specimen)) {
-            other = (JavaMemberNode)Ref.resolution(specimen);
-        } else {
-            return false;
-        }
-        return myMember.equals(other.myMember);
     }
 
     /**



1.10      +0 -11     e/src/jsrc/org/erights/e/elib/prim/OverloaderNode.java

Index: OverloaderNode.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/prim/OverloaderNode.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- OverloaderNode.java	2001/11/10 19:40:45	1.9
+++ OverloaderNode.java	2001/12/10 18:27:00	1.10
@@ -23,7 +23,6 @@
 
 import org.erights.e.elib.base.MethodNode;
 import org.erights.e.elib.eio.TextWriter;
-import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.FlexMap;
 
 import java.io.IOException;
@@ -119,16 +118,6 @@
             throw new IllegalArgumentException("Doesn't match any overload");
         }
         return myNodes[index].execute(self, aVerb, optNewArgs);
-    }
-
-    /**
-     *
-     */
-    public boolean matchBind(Object[] args,
-                             Object specimen,
-                             FlexList bindings) {
-        throw new RuntimeException
-          ("XXX OverloaderNode matchBind not yet implemented");
     }
 
     /**



1.38      +1 -75     e/src/jsrc/org/erights/e/elib/prim/VTable.java

Index: VTable.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/prim/VTable.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- VTable.java	2001/12/10 06:11:02	1.37
+++ VTable.java	2001/12/10 18:27:00	1.38
@@ -24,9 +24,6 @@
 import org.erights.e.elib.base.MethodNode;
 import org.erights.e.elib.base.Script;
 import org.erights.e.elib.eio.TextWriter;
-import org.erights.e.elib.quasi.MatchMaker;
-import org.erights.e.elib.ref.Ref;
-import org.erights.e.elib.tables.ConstList;
 import org.erights.e.elib.tables.ConstMap;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.FlexMap;
@@ -40,7 +37,7 @@
  *
  * @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
  */
-public class VTable implements Script, MatchMaker {
+public class VTable implements Script {
 
     /**
      * The fully qualified behavior name, sort of.  XXX explain
@@ -203,77 +200,6 @@
             }
         }
         return script.execute(self, verb, args);
-    }
-
-    /**
-     *
-     */
-    public ConstList matchBind(Object[] args, Object specimen) {
-        FlexList bindings = FlexList.make();
-        if (matchBind(args, specimen, bindings)) {
-            return bindings.snapshot();
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     *
-     */
-    public boolean matchBind(Object[] args,
-                             Object specimen,
-                             FlexList bindings) {
-        VTable other;
-        try {
-            other = (VTable)Ref.resolution(specimen);
-        } catch (ClassCastException cce) {
-            //using a try/catch since success is typical and we have
-            //to pay for the test in the cast anyway
-            return false;
-        }
-        if (myOptName != other.optName()) {
-            return false;
-        }
-        boolean mineIsNull = myOptOtherwise == null;
-        boolean otherIsNull = other.myOptOtherwise == null;
-        if (mineIsNull != otherIsNull) {
-            return false;
-        }
-        if (!mineIsNull) {
-            boolean mineIsMatcher = myOptOtherwise instanceof MatchMaker;
-            boolean otherIsMatcher
-              = other.myOptOtherwise instanceof MatchMaker;
-            if (mineIsMatcher != otherIsMatcher) {
-                return false;
-            }
-            if (mineIsMatcher) {
-                if (!((MatchMaker)myOptOtherwise).matchBind(args,
-                                                            other.myOptOtherwise,
-                                                            bindings)) {
-                    return false;
-                }
-            } else {
-                if (!myOptOtherwise.equals(other.myOptOtherwise)) {
-                    return false;
-                }
-            }
-        }
-        ConstMap meths = methods();
-        int len = meths.size();
-        if (other.methods().size() != len) {
-            return false;
-        }
-        String[] mverbs = (String[])meths.getKeys(String.class);
-        for (int i = 0; i < len; i++) {
-            String mverb = mverbs[i];
-            MethodNode optOtherMeth = other.optMethod(mverb);
-            if (optOtherMeth == null) {
-                return false;
-            }
-            MethodNode meth = (MethodNode)meths.get(mverb);
-            return meth.matchBind(args, optOtherMeth, bindings);
-        }
-        return true;
     }
 
     /**



1.15      +0 -2      e/src/jsrc/org/erights/e/elib/prim/VarSetterNode.java

Index: VarSetterNode.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/prim/VarSetterNode.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- VarSetterNode.java	2001/12/05 00:46:10	1.14
+++ VarSetterNode.java	2001/12/10 18:27:00	1.15
@@ -19,8 +19,6 @@
 Contributor(s): ______________________________________.
 */
 
-import org.erights.e.elib.slot.VoidMaker;
-
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 



1.1                  e/src/jsrc/org/quasiliteral/base/IncompleteQuasiException.java

Index: IncompleteQuasiException.java
===================================================================
package org.quasiliteral.base;

/*
The contents of this file are subject to the Improvements to the
Distributed E Language Implementation License Version 1.0 (the
"License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.erights.org/download/mmlicense.html

Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.

The Original Code is the Improvements to the Distributed E Language
Implementation, released May 27, 1999.

The Initial Developer of the Original Code is Mark S. Miller.
Copyright (C) 1999 Mark S. Miller. All Rights Reserved.

Contributor(s): ______________________________________.
*/

/**
 * Thrown by a non-filled in quasi data structure (a data structure acting in
 * the role of ValueMaker or MatchMaker) when an operation is
 * performed that requires a complete (non-quasi) data structure.
 *
 * @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
 */
public class IncompleteQuasiException extends RuntimeException {

    public IncompleteQuasiException() {
    }

    public IncompleteQuasiException(String msg) {
        super(msg);
    }
}



1.1                  e/src/jsrc/org/quasiliteral/base/MatchMaker.java

Index: MatchMaker.java
===================================================================
package org.quasiliteral.base;

/*
The contents of this file are subject to the Electric Communities E Open
Source Code License Version 1.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License
at http://www.communities.com/EL/.

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
the specific language governing rights and limitations under the License.

The Original Code is the Distributed E Language Implementation, released
July 20, 1998.

The Initial Developer of the Original Code is Electric Communities.
Copyright (C) 1998 Electric Communities. All Rights Reserved.

Contributor(s): ______________________________________.
*/

import org.erights.e.elib.tables.ConstList;
import org.erights.e.elib.tables.FlexList;


/**
 * Represents a pattern template.
 * <p>
 * A MatchMaker plus the args are a pattern.  It will match itself plus args
 * against a provided specimen and either 1) report failure, or 2) report
 * success and provide binding resulting from the match.
 *
 * @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
 */
public interface MatchMaker {

    /**
     * Reports failure by returning null.  Reports success by returning a
     * list of bindings.  Appropriate for a top level match.
     */
    ConstList matchBind(Object[] args, Object specimen);

    /**
     * Reports failure by returning false, in which case 'bindings' should
     * not be assumed to still be meaningful.  Reports success by returning
     * true and adding the bindings to appropriate places in 'bindings'.
     * Appropriate for matching a component pattern within a larger pattern
     * match.
     */
    boolean matchBind(Object[] args, Object specimen, FlexList bindings);
}



1.1                  e/src/jsrc/org/quasiliteral/base/QuasiExprParser.java

Index: QuasiExprParser.java
===================================================================
package org.quasiliteral.base;

/*
The contents of this file are subject to the Improvements to the
Distributed E Language Implementation License Version 1.0 (the
"License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.erights.org/download/mmlicense.html

Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.

The Original Code is the Improvements to the Distributed E Language
Implementation, released May 27, 1999.

The Initial Developer of the Original Code is Mark S. Miller.
Copyright (C) 1999 Mark S. Miller. All Rights Reserved.

Contributor(s): ______________________________________.
*/

import org.erights.e.elib.tables.Twine;

/**
 * Given a template string in the language this quasi parser understands,
 * parse it into a ValueMaker which will generate objects of the form the
 * template describes.  The template language is a value description language
 * augmented with $-holes, representing values to be provided at runtime to
 * the ValueMaker.
 *
 * @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
 */
public interface QuasiExprParser {

    /**
     * For the i'th $-hole, dlrHoles[i] is the position of that hole in
     * template, and the character at that position in template must be '$'.
     * '$' characters that don't correspond to positions in dlrHoles are
     * treated as part of the parser's normal language rather than indicating
     * $-holes.
     */
    ValueMaker valueMaker(Twine template, int[] dlrHoles);

    /**
     * In this old format, each $-hole is represented by a substring like
     * '${3}' for $-hole number 3 (the fourth hole).  '$' and '@' characters
     * that are not holes must be doubled.
     *
     * @deprecated
     */
    ValueMaker valueMaker(Twine template);
}



1.1                  e/src/jsrc/org/quasiliteral/base/QuasiPatternParser.java

Index: QuasiPatternParser.java
===================================================================
package org.quasiliteral.base;

/*
The contents of this file are subject to the Improvements to the
Distributed E Language Implementation License Version 1.0 (the
"License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.erights.org/download/mmlicense.html

Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.

The Original Code is the Improvements to the Distributed E Language
Implementation, released May 27, 1999.

The Initial Developer of the Original Code is Mark S. Miller.
Copyright (C) 1999 Mark S. Miller. All Rights Reserved.

Contributor(s): ______________________________________.
*/

import org.erights.e.elib.tables.Twine;

/**
 * Given a template string in the language this quasi parser understands,
 * parse it into a MatchMaker which will match objects of the form the
 * template describes.  The template language is a value description language
 * augmented with $-holes and @-holes, representing values to be provided at
 * runtime to the MatchMaker, or values for it to extract from the specimen,
 * respectively.
 *
 * @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
 */
public interface QuasiPatternParser {

    /**
     * For the i'th $-hole, dlrHoles[i] is the position of that hole in
     * template, and the character at that position in template must be '$'.
     * '$' characters that don't correspond to positions in dlrHoles are
     * treated as part of the parser's normal language rather than indicating
     * $-holes.  Likewise for embedded '@' characters and positions in
     * atHoles.
     */
    MatchMaker matchMaker(Twine template, int[] dlrHoles, int[] atHoles);

    /**
     * In this old format, each $-hole is represented by a substring like
     * '${3}' for $-hole number 3 (the fourth hole).  Likewise for embedded
     * '@' characters and positions in atHoles.  '$' and '@' characters that
     * are not holes must be doubled.
     *
     * @deprecated
     */
    MatchMaker matchMaker(Twine template);
}



1.1                  e/src/jsrc/org/quasiliteral/base/ValueMaker.java

Index: ValueMaker.java
===================================================================
package org.quasiliteral.base;

/*
The contents of this file are subject to the Improvements to the
Distributed E Language Implementation License Version 1.0 (the
"License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.erights.org/download/mmlicense.html

Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.

The Original Code is the Improvements to the Distributed E Language
Implementation, released May 27, 1999.

The Initial Developer of the Original Code is Mark S. Miller.
Copyright (C) 1999 Mark S. Miller. All Rights Reserved.

Contributor(s): ______________________________________.
*/

/**
 * Represents a template of a value (a quasi literal value) to be filled in
 * by args to make an actual value.
 *
 * @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
 */
public interface ValueMaker {

    /**
     * Each each arg to fill in the corresponding hole, and return the
     * resulting value.
     * <p>
     * It is often appropriate to think of <ul>
     * <li>a ValueMaker as an expression,</li>
     * <li>substitution as expression evaluation,</li>
     * <li>the 'args' array as the environment,</li>
     * <li>dollar-holes as variable names (actually numbers) to be looked up
     *     in the environment, and</li>
     * <li>the result as the value the expression evaluated to.</li>
     * </ul>
     * In this sense, we can think of E's quasiliteral framework as an means
     * for the non-privileged extension of the expression evaluation
     * machinery.
     */
    Object substitute(Object[] args);
}



1.1                  e/src/jsrc/org/quasiliteral/base/package.html

Index: package.html
===================================================================

QUASI Javadoc Package Comment




Base package for quasi-literal expressions and patterns.

@author Mark S. Miller 1.1 e/src/jsrc/org/quasiliteral/text/FirstCharSplitter.java Index: FirstCharSplitter.java =================================================================== package org.quasiliteral.text; /* The contents of this file are subject to the Electric Communities E Open Source Code License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.communities.com/EL/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is the Distributed E Language Implementation, released July 20, 1998. The Initial Developer of the Original Code is Electric Communities. Copyright (C) 1998 Electric Communities. All Rights Reserved. Contributor(s): ______________________________________. */ /** * Splits a string on the first occurrence of any of a set of "special" * characters. * * @author <a href="mailto:markm@erights.org">Mark S. Miller</a> */ public class FirstCharSplitter { /** optimize the Ascii subset into an array lookup */ private boolean[] mySpecialFlags = new boolean[128]; /** do a linear lookup on the rest of the special */ private String myRestChars; /** * */ public FirstCharSplitter(String specials) { StringBuffer restChars = new StringBuffer(); for (int i = 0; i < specials.length(); i++) { char c = specials.charAt(i); if (c < 128) { mySpecialFlags[c] = true; } else { restChars.append(c); } } myRestChars = restChars.toString(); } /** * Return the index of the first occurrence of any of the special chars * in str, or -1 if none are found. */ public int findIn(String str) { int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); if (c < 128) { if (mySpecialFlags[c]) { return i; } } else if (myRestChars.indexOf(c) != -1) { return i; } } return -1; } } 1.1 e/src/jsrc/org/quasiliteral/text/Identifiers.java Index: Identifiers.java =================================================================== package org.quasiliteral.text; /* The contents of this file are subject to the Electric Communities E Open Source Code License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.communities.com/EL/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is the Distributed E Language Implementation, released July 20, 1998. The Initial Developer of the Original Code is Electric Communities. Copyright (C) 1998 Electric Communities. All Rights Reserved. Contributor(s): ______________________________________. */ import org.erights.e.develop.exception.ExceptionMgr; import org.erights.e.elib.tables.AssocFunc; import org.erights.e.elib.tables.Iteratable; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.Reader; /** * For iterating thru a file an identifier at a time. * * @author <a href="mailto:markm@erights.org">Mark S. Miller</a> */ public class Identifiers implements Iteratable { Reader myReader; /** * */ static public Identifiers run(File file) throws FileNotFoundException { return new Identifiers(new FileReader(file)); } /** * */ public Identifiers(Reader reader) { myReader = reader; } /** * */ public void iterate(AssocFunc func) { try { int ch = myReader.read(); StringBuffer delim = new StringBuffer(); StringBuffer ident = new StringBuffer(); while (ch != -1) { delim.setLength(0); ident.setLength(0); while (ch != -1 && !Character.isJavaIdentifierPart((char)ch)) { delim.append((char)ch); ch = myReader.read(); } while (ch != -1 && Character.isJavaIdentifierPart((char)ch)) { ident.append((char)ch); ch = myReader.read(); } func.run(delim.toString(), ident.toString()); } } catch (IOException ioe) { throw ExceptionMgr.asSafe(ioe); } } } 1.1 e/src/jsrc/org/quasiliteral/text/SimpleQuasiParser.java Index: SimpleQuasiParser.java =================================================================== package org.quasiliteral.text; /* The contents of this file are subject to the Electric Communities E Open Source Code License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.communities.com/EL/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is the Distributed E Language Implementation, released July 20, 1998. The Initial Developer of the Original Code is Electric Communities. Copyright (C) 1998 Electric Communities. All Rights Reserved. Contributor(s): ______________________________________. */ import org.erights.e.elib.tables.IdentityCacheTable; import org.erights.e.elib.tables.Twine; import org.quasiliteral.base.ValueMaker; import org.quasiliteral.base.MatchMaker; import org.quasiliteral.base.QuasiExprParser; import org.quasiliteral.base.QuasiPatternParser; /** * The default -- and simplest -- of the quasi parsers * * @author <a href="mailto:markm@erights.org">Mark S. Miller</a> */ public class SimpleQuasiParser implements QuasiExprParser, QuasiPatternParser { static public final SimpleQuasiParser THE_ONE = new SimpleQuasiParser(); /** * caches previous simple parses (as is used for quasi-parsing) */ private IdentityCacheTable myCache; private SimpleQuasiParser() { myCache = new IdentityCacheTable(Substituter.class, 100); } /** * */ private Substituter make(Twine template) { Substituter result = (Substituter)myCache.get(template, null); if (null == result) { result = new Substituter(template); myCache.put(template, result); } return result; } /** * */ public ValueMaker valueMaker(Twine template, int[] dlrHoles) { throw new RuntimeException ("XXX new quasi valueMaker API not yet implemented"); } /** * Synonym for 'make', used by quasi-literal expansion */ public ValueMaker valueMaker(Twine template) { return make(template); } /** * */ public MatchMaker matchMaker(Twine template, int[] dlrHoles, int[] atHoles) { throw new RuntimeException ("XXX new quasi matchMaker API not yet implemented"); } /** * Synonym for 'make', used by quasi-pattern expansion */ public MatchMaker matchMaker(Twine template) { return make(template); } } 1.1 e/src/jsrc/org/quasiliteral/text/Substituter.java Index: Substituter.java =================================================================== package org.quasiliteral.text; /* The contents of this file are subject to the Electric Communities E Open Source Code License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.communities.com/EL/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is the Distributed E Language Implementation, released July 20, 1998. The Initial Developer of the Original Code is Electric Communities. Copyright (C) 1998 Electric Communities. All Rights Reserved. Contributor(s): ______________________________________. */ import org.erights.e.develop.exception.ExceptionMgr; import org.erights.e.elib.eio.TextWriter; import org.erights.e.elib.prim.E; import org.erights.e.elib.tables.ConstList; import org.erights.e.elib.tables.FlexList; import org.erights.e.elib.tables.Twine; import org.quasiliteral.base.ValueMaker; import org.quasiliteral.base.MatchMaker; import java.io.StringWriter; /** * The default -- and simplest -- of the quasi parsers * * @author <a href="mailto:markm@erights.org">Mark S. Miller</a> */ public class Substituter implements ValueMaker, MatchMaker { /** * A template is "compiled" into an array of three kinds of * elements: <p> * A Twine represents a literal string segment. <p> * A positive Integer represents a position into which to * substitute an arg. <p> * A negative Integer represents a pattern position (XXX needs * a real explanation). <p> * * XXX this representation is a kludge */ private Object[] myTemplate; private int myMatchSize; //XXX find a way to break this up cleanly /*package*/ Substituter(Twine template) { int len = template.size(); FlexList t = FlexList.make(); StringBuffer buffer = new StringBuffer(); myMatchSize = 0; for (int i = 0; i < len; i++) { char c1 = template.charAt(i); if (c1 != '$' && c1 != '@') { //not a marker buffer.append(c1); } else if (i >= len - 1) { //terminal marker buffer.append(c1); } else { i++; char c2 = template.charAt(i); if (c1 == c2) { //doubled marker character, drop one buffer.append(c2); } else if (c2 != '{') { //not special, so back up and act normal i--; buffer.append(c1); } else { //Got one! if (buffer.length() >= 1) { //end of literal segment t.push(Twine.fromString(buffer.toString())); buffer.setLength(0); } int index = 0; for (i++; i < len; i++) { c2 = template.charAt(i); if (c2 == '}') { break; } else if (isDigit(c2)) { index = index * 10 + (c2 - '0'); } else { throw new Error("missing '}': " + template); } } if (c1 == '@') { myMatchSize = Math.max(myMatchSize, index + 1); index = ~index; } t.push(new Integer(index)); } } } if (buffer.length() >= 1) { //end of literal segment t.push(Twine.fromString(buffer.toString())); } myTemplate = (Object[])t.getArray(Object.class); } /** * */ static private boolean isDigit(char c) { return '0' <= c && c <= '9'; } /** * As a quasi-pattern, "first" replace all ${i}s with args[i]s, * then see if the speciman matches the pattern. If not, return * null. If so, return an array in which the i'th element is the * part of the specimen that matched @{i}. */ public ConstList matchBind(Object[] args, Object specimen) { Twine specstr = (Twine)E.as(specimen, Twine.class); int s = 0; //index into specimen FlexList flex = FlexList.fromType(Twine.class, myMatchSize); int[] iPtr = {0}; while (iPtr[0] < myTemplate.length) { Twine prefix = optSegments(iPtr, args); if (prefix != null) { if (specstr.startsWith(prefix.bare(), s)) { //prefix matches. Skip it and go on s += prefix.size(); } else { //prefix doesn't match return null; } } else { //match everything until the *first* match of the next //segments. If the next segment is a pattern, match //the empty string. int index = ~((Integer)myTemplate[iPtr[0]]).intValue(); iPtr[0]++; if (iPtr[0] >= myTemplate.length) { //last segment, eat the rest flex.put(index, specstr.run(s, specstr.size())); s = specstr.size(); } else { Twine next = optSegments(iPtr, args); if (next != null) { int s2 = specstr.indexOf(next.bare(), s); if (s2 == -1) { //next segments won't match, may as well //fail now return null; } else { //eat until after next flex.put(index, specstr.run(s, s2)); s = s2 + next.size(); } } else { //next segment is also a pattern, so I abstain flex.put(index, ""); } } } } if (s == specstr.size()) { return flex.snapshot(); } else { //pattern fully matched, but with specimen left over return null; } } /** * */ public boolean matchBind(Object[] args, Object specimen, FlexList bindings) { ConstList binds = matchBind(args, specimen); if (binds == null) { return false; } int len = binds.size(); bindings.ensureSize(len); for (int i = 0; i < len; i++) { bindings.put(i, binds.get(i)); } return true; } /** * If the iPtr[0]'th segment is a pattern, then return null and * leave iPtr alone. Otherwise, return the string gotten by * appending the consecutive non-pattern segments starting with * the iPtr[0]'th segment, and modify iPtr[0] to be the following * segment number. */ private ConstList optSequence(int[] iPtr, Object[] args) { FlexList flex = FlexList.make(); int startPos = iPtr[0]; for (; iPtr[0] < myTemplate.length; iPtr[0]++) { Object seg = myTemplate[iPtr[0]]; if (seg instanceof Twine) { flex.push(seg); } else { int index = ((Integer)seg).intValue(); if (index >= 0) { flex.push(args[index]); } else { break; } } } if (startPos == iPtr[0]) { return null; } else { return flex.snapshot(); } } /** * If the iPtr[0]'th segment is a pattern, then return null and * leave iPtr alone. Otherwise, return the string gotten by * appending the consecutive non-pattern segments starting with * the iPtr[0]'th segment, and modify iPtr[0] to be the following * segment number. */ private Twine optSegments(int[] iPtr, Object[] args) { ConstList sequence = optSequence(iPtr, args); if (null == sequence) { return null; } StringBuffer buf = new StringBuffer(); int len = sequence.size(); for (int i = 0; i < len; i++) { buf.append(E.toString(sequence.get(i))); } return Twine.fromString(buf.toString()); } /** * Evaluate as a quasi-literal by replacing ${i} with args[i], for all i */ public Object substitute(Object[] args) { int[] iPtr = { 0 }; ConstList list = optSequence(iPtr, args); if (null == list || iPtr[0] != myTemplate.length) { throw new RuntimeException ("can't substitute() with a pattern: " + this); } StringWriter strWriter = new StringWriter(); try { new TextWriter(strWriter).printAll((Object[])list.getArray()); } catch (Throwable th) { throw ExceptionMgr.asSafe(th); } return strWriter.getBuffer().toString(); } /** * The number of arguments that must be provided to substitute() or * matchBind() */ public int numArgs() { int result = 0; for (int i = 0; i < myTemplate.length; i++) { if (myTemplate[i] instanceof Integer && ((Integer)myTemplate[i]).intValue() >= 0) { result++; } } return result; } /** * The number of bindings that will be returned by matchBind() */ public int numPatterns() { int result = 0; for (int i = 0; i < myTemplate.length; i++) { if (myTemplate[i] instanceof Integer && ((Integer)myTemplate[i]).intValue() < 0) { result++; } } return result; } /** * Prints using the template string */ public String toString() { StringBuffer result = new StringBuffer().append("simple new(\""); for (int i = 0; i < myTemplate.length; i++) { if (myTemplate[i] instanceof Twine) { //XXX should double internal marker characters result.append(myTemplate[i]); } else { int index = ((Integer)myTemplate[i]).intValue(); if (index >= 0) { result.append("${" + index + "}"); } else { result.append("@{" + ~index + "}"); } } } result.append("\")"); return result.toString(); } }