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

markm@eros.cs.jhu.edu markm@eros.cs.jhu.edu
Sat, 22 Dec 2001 00:46:10 -0500


markm       01/12/22 00:46:10

  Modified:    src      Makefile
               src/jsrc/org/capml/quasi QuasiContent.java
                        QuasiContentExprHole.java QuasiContentList.java
                        QuasiContentPattHole.java QuasiElement.java
                        QuasiText.java
               src/jsrc/org/erights/e/elang/evm AssignExpr.java
                        CallExpr.java CatchExpr.java CdrPattern.java
                        DefineExpr.java EExpr.java EMethod.java
                        EScript.java EscapeExpr.java FinallyExpr.java
                        HideExpr.java IfExpr.java IgnorePattern.java
                        ListPattern.java LiteralExpr.java
                        MatchBindExpr.java Matcher.java MetaExpr.java
                        NounExpr.java NounPattern.java ObjectExpr.java
                        ParseNode.java Pattern.java QuasiLiteralExpr.java
                        QuasiLiteralPatt.java QuasiPatternExpr.java
                        QuasiPatternPatt.java ScopeExpr.java SendExpr.java
                        SeqExpr.java SlotExpr.java SuchThatPattern.java
               src/jsrc/org/erights/e/elang/interp InteractiveInterp.java
               src/jsrc/org/erights/e/elang/visitors SubstVisitor.java
               src/jsrc/org/quasiliteral/base MatchMaker.java
                        ValueMaker.java
               src/jsrc/org/quasiliteral/quasiterm QAstro.java
                        QAstroArg.java QAtHole.java QBuilder.java
                        QDollarHole.java QFunctor.java QHole.java
                        QSome.java QTerm.java
               src/jsrc/org/quasiliteral/syntax BaseLexer.java
               src/jsrc/org/quasiliteral/term Term.java TermLexer.java
               src/jsrc/org/quasiliteral/text EYaccFixer.java
                        Substituter.java
  Log:
  some bug fixes

Revision  Changes    Path
1.132     +2 -2      e/src/Makefile

Index: Makefile
===================================================================
RCS file: /cvs/e/src/Makefile,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -r1.131 -r1.132
--- Makefile	2001/12/21 05:30:35	1.131
+++ Makefile	2001/12/22 05:46:08	1.132
@@ -7,8 +7,8 @@
 
 # Prefix tagging this release's attributes
 PREFIX=E
-DOTVER=0.8.10epsilon1
-TAGVER=0_8_10epsilon1
+DOTVER=0.8.10epsilon2
+TAGVER=0_8_10epsilon2
 RELEASE=working
 
 TOP=..



1.11      +2 -2      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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- QuasiContent.java	2001/12/10 20:30:08	1.10
+++ QuasiContent.java	2001/12/22 05:46:08	1.11
@@ -145,7 +145,7 @@
      * @-holes are Strings, if they were extracted by a tagName @-hole, or a
      * Content, if they were extracted by an @-hole in content position.
      */
-    public ConstList matchBind(Object[] args, Object specimen) {
+    public ConstList matchBind(ConstList args, Object specimen) {
         FlexList bindings = FlexList.make();
         if (matchBind(args, specimen, bindings)) {
             return bindings.snapshot();
@@ -167,7 +167,7 @@
      * tagName @-hole, or a Content, if they were extracted by an @-hole in
      * content position.
      */
-    public abstract boolean matchBind(Object[] args,
+    public abstract boolean matchBind(ConstList args,
                                       Object specimen,
                                       FlexList bindings);
 



1.8       +3 -2      e/src/jsrc/org/capml/quasi/QuasiContentExprHole.java

Index: QuasiContentExprHole.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/capml/quasi/QuasiContentExprHole.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- QuasiContentExprHole.java	2001/12/02 06:01:41	1.7
+++ QuasiContentExprHole.java	2001/12/22 05:46:08	1.8
@@ -25,6 +25,7 @@
 import org.erights.e.elib.prim.StaticMaker;
 import org.erights.e.elib.ref.Ref;
 import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.ConstList;
 
 import java.io.IOException;
 import java.math.BigInteger;
@@ -74,10 +75,10 @@
      * Since a $-hole doesn't contain any @-holes, 'bindings' is ignored and
      * a boolean is simply returned.
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
-        return Ref.same(toContent(args[myIndex]),
+        return Ref.same(toContent(args.get(myIndex)),
                         toContent(specimen));
     }
 



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

Index: QuasiContentList.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/capml/quasi/QuasiContentList.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- QuasiContentList.java	2001/12/02 06:01:41	1.8
+++ QuasiContentList.java	2001/12/22 05:46:08	1.9
@@ -88,7 +88,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         int len = myQuasis.size();



1.10      +2 -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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- QuasiContentPattHole.java	2001/12/10 20:30:08	1.9
+++ QuasiContentPattHole.java	2001/12/22 05:46:08	1.10
@@ -24,6 +24,7 @@
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.prim.StaticMaker;
 import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.ConstList;
 import org.quasiliteral.base.IncompleteQuasiException;
 
 import java.io.IOException;
@@ -76,7 +77,7 @@
      * Specimen must be Content or String.  The equivalent Content is placed
      * into bindings.
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         bind(bindings, myIndex, toContent(specimen));



1.11      +2 -2      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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- QuasiElement.java	2001/12/10 20:30:08	1.10
+++ QuasiElement.java	2001/12/22 05:46:08	1.11
@@ -106,7 +106,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         Node other = optTheOne(specimen);
@@ -127,7 +127,7 @@
         } else {
             int index = ((Integer)myTagName).intValue();
             if (index >= 0) {
-                String tagName = (String)args[index];
+                String tagName = (String)args.get(index);
                 if (!tagName.equals(otherTagName)) {
                     //$-hole arg doesn't match the specimen's tag
                     return false;



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

Index: QuasiText.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/capml/quasi/QuasiText.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- QuasiText.java	2001/12/02 06:01:41	1.8
+++ QuasiText.java	2001/12/22 05:46:08	1.9
@@ -26,6 +26,7 @@
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.prim.StaticMaker;
 import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.ConstList;
 
 import java.io.IOException;
 
@@ -73,7 +74,7 @@
      *
      * XXX Open issue: who merges adjacent Text nodes?
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         Node other = optTheOne(specimen);



1.36      +2 -1      e/src/jsrc/org/erights/e/elang/evm/AssignExpr.java

Index: AssignExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/AssignExpr.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- AssignExpr.java	2001/12/18 21:59:30	1.35
+++ AssignExpr.java	2001/12/22 05:46:08	1.36
@@ -28,6 +28,7 @@
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.FlexMap;
 import org.erights.e.elib.tables.Twine;
+import org.erights.e.elib.tables.ConstList;
 import org.quasiliteral.astro.Astro;
 import org.quasiliteral.astro.AstroTag;
 import org.quasiliteral.term.QuasiBuilder;
@@ -114,7 +115,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         AssignExpr other;



1.36      +2 -1      e/src/jsrc/org/erights/e/elang/evm/CallExpr.java

Index: CallExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/CallExpr.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- CallExpr.java	2001/12/14 00:06:00	1.35
+++ CallExpr.java	2001/12/22 05:46:08	1.36
@@ -27,6 +27,7 @@
 import org.erights.e.elib.prim.E;
 import org.erights.e.elib.ref.Ref;
 import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.ConstList;
 
 import java.io.IOException;
 
@@ -109,7 +110,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         CallExpr other;



1.20      +2 -1      e/src/jsrc/org/erights/e/elang/evm/CatchExpr.java

Index: CatchExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/CatchExpr.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- CatchExpr.java	2001/12/02 06:01:42	1.19
+++ CatchExpr.java	2001/12/22 05:46:08	1.20
@@ -26,6 +26,7 @@
 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.ConstList;
 
 import java.io.IOException;
 
@@ -111,7 +112,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         CatchExpr other;



1.20      +2 -1      e/src/jsrc/org/erights/e/elang/evm/CdrPattern.java

Index: CdrPattern.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/CdrPattern.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- CdrPattern.java	2001/12/19 10:18:06	1.19
+++ CdrPattern.java	2001/12/22 05:46:08	1.20
@@ -27,6 +27,7 @@
 import org.erights.e.elib.ref.Ref;
 import org.erights.e.elib.tables.EList;
 import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.ConstList;
 import org.erights.e.elib.util.OneArgFunc;
 
 import java.io.IOException;
@@ -78,7 +79,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         CdrPattern other;



1.32      +2 -1      e/src/jsrc/org/erights/e/elang/evm/DefineExpr.java

Index: DefineExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/DefineExpr.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- DefineExpr.java	2001/12/02 06:01:42	1.31
+++ DefineExpr.java	2001/12/22 05:46:08	1.32
@@ -24,6 +24,7 @@
 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.ConstList;
 
 import java.io.IOException;
 
@@ -107,7 +108,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         DefineExpr other;



1.34      +2 -1      e/src/jsrc/org/erights/e/elang/evm/EExpr.java

Index: EExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/EExpr.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- EExpr.java	2001/12/02 06:01:42	1.33
+++ EExpr.java	2001/12/22 05:46:08	1.34
@@ -27,6 +27,7 @@
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.prim.E;
 import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.ConstList;
 
 import java.io.IOException;
 
@@ -59,7 +60,7 @@
     /**
      *
      */
-    public EExpr substitute(Object[] args) {
+    public EExpr substitute(ConstList args) {
         SubstVisitor visitor = new SubstVisitor(args);
         return visitor.xformEExpr(this);
     }



1.16      +2 -1      e/src/jsrc/org/erights/e/elang/evm/EMethod.java

Index: EMethod.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/EMethod.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- EMethod.java	2001/11/10 19:40:39	1.15
+++ EMethod.java	2001/12/22 05:46:08	1.16
@@ -26,6 +26,7 @@
 import org.erights.e.elib.ref.Ref;
 import org.erights.e.elib.slot.ValueGuard;
 import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.ConstList;
 
 import java.io.IOException;
 
@@ -135,7 +136,7 @@
     /**
      * Ignores docComment
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         EMethod other;



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

Index: EScript.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/EScript.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- EScript.java	2001/12/02 06:01:42	1.13
+++ EScript.java	2001/12/22 05:46:08	1.14
@@ -99,7 +99,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         EScript other;



1.28      +2 -1      e/src/jsrc/org/erights/e/elang/evm/EscapeExpr.java

Index: EscapeExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/EscapeExpr.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- EscapeExpr.java	2001/12/02 06:01:42	1.27
+++ EscapeExpr.java	2001/12/22 05:46:08	1.28
@@ -25,6 +25,7 @@
 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.ConstList;
 
 import java.io.IOException;
 
@@ -100,7 +101,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         EscapeExpr other;



1.17      +2 -1      e/src/jsrc/org/erights/e/elang/evm/FinallyExpr.java

Index: FinallyExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/FinallyExpr.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- FinallyExpr.java	2001/12/02 06:01:42	1.16
+++ FinallyExpr.java	2001/12/22 05:46:08	1.17
@@ -24,6 +24,7 @@
 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.ConstList;
 
 import java.io.IOException;
 
@@ -92,7 +93,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         FinallyExpr other;



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

Index: HideExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/HideExpr.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- HideExpr.java	2001/12/02 06:01:42	1.24
+++ HideExpr.java	2001/12/22 05:46:08	1.25
@@ -24,6 +24,7 @@
 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.ConstList;
 
 import java.io.IOException;
 
@@ -79,7 +80,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         HideExpr other;



1.26      +2 -1      e/src/jsrc/org/erights/e/elang/evm/IfExpr.java

Index: IfExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/IfExpr.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- IfExpr.java	2001/12/02 06:01:42	1.25
+++ IfExpr.java	2001/12/22 05:46:08	1.26
@@ -24,6 +24,7 @@
 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.ConstList;
 
 import java.io.IOException;
 
@@ -99,7 +100,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         IfExpr other;



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

Index: IgnorePattern.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/IgnorePattern.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- IgnorePattern.java	2001/12/02 06:01:42	1.13
+++ IgnorePattern.java	2001/12/22 05:46:08	1.14
@@ -24,6 +24,7 @@
 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.ConstList;
 import org.erights.e.elib.util.OneArgFunc;
 
 import java.io.IOException;
@@ -61,7 +62,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         IgnorePattern other;



1.18      +2 -1      e/src/jsrc/org/erights/e/elang/evm/ListPattern.java

Index: ListPattern.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/ListPattern.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ListPattern.java	2001/12/19 10:18:06	1.17
+++ ListPattern.java	2001/12/22 05:46:08	1.18
@@ -27,6 +27,7 @@
 import org.erights.e.elib.ref.Ref;
 import org.erights.e.elib.tables.EList;
 import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.ConstList;
 import org.erights.e.elib.util.OneArgFunc;
 
 import java.io.IOException;
@@ -80,7 +81,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         ListPattern other;



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

Index: LiteralExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/LiteralExpr.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- LiteralExpr.java	2001/12/02 06:01:42	1.24
+++ LiteralExpr.java	2001/12/22 05:46:08	1.25
@@ -25,6 +25,7 @@
 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.ConstList;
 
 import java.io.IOException;
 import java.math.BigInteger;
@@ -74,7 +75,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         LiteralExpr other;



1.30      +2 -1      e/src/jsrc/org/erights/e/elang/evm/MatchBindExpr.java

Index: MatchBindExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/MatchBindExpr.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- MatchBindExpr.java	2001/12/02 06:01:42	1.29
+++ MatchBindExpr.java	2001/12/22 05:46:08	1.30
@@ -25,6 +25,7 @@
 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.ConstList;
 
 import java.io.IOException;
 
@@ -110,7 +111,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         MatchBindExpr other;



1.12      +1 -1      e/src/jsrc/org/erights/e/elang/evm/Matcher.java

Index: Matcher.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/Matcher.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Matcher.java	2001/11/10 19:40:39	1.11
+++ Matcher.java	2001/12/22 05:46:08	1.12
@@ -118,7 +118,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         Matcher other;



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

Index: MetaExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/MetaExpr.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- MetaExpr.java	2001/12/02 06:01:42	1.13
+++ MetaExpr.java	2001/12/22 05:46:08	1.14
@@ -5,6 +5,7 @@
 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.ConstList;
 
 import java.io.IOException;
 
@@ -54,7 +55,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         MetaExpr other;



1.30      +2 -1      e/src/jsrc/org/erights/e/elang/evm/NounExpr.java

Index: NounExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/NounExpr.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- NounExpr.java	2001/12/02 06:01:42	1.29
+++ NounExpr.java	2001/12/22 05:46:08	1.30
@@ -27,6 +27,7 @@
 import org.erights.e.elib.slot.Slot;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.FlexMap;
+import org.erights.e.elib.tables.ConstList;
 
 import java.io.IOException;
 
@@ -101,7 +102,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         NounExpr other;



1.9       +2 -1      e/src/jsrc/org/erights/e/elang/evm/NounPattern.java

Index: NounPattern.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/NounPattern.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- NounPattern.java	2001/12/14 00:06:00	1.8
+++ NounPattern.java	2001/12/22 05:46:08	1.9
@@ -25,6 +25,7 @@
 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 java.io.IOException;
 
@@ -123,7 +124,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         NounPattern other;



1.40      +1 -1      e/src/jsrc/org/erights/e/elang/evm/ObjectExpr.java

Index: ObjectExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/ObjectExpr.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- ObjectExpr.java	2001/12/02 06:01:42	1.39
+++ ObjectExpr.java	2001/12/22 05:46:08	1.40
@@ -142,7 +142,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         ObjectExpr other;



1.2       +4 -4      e/src/jsrc/org/erights/e/elang/evm/ParseNode.java

Index: ParseNode.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/ParseNode.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ParseNode.java	2001/12/10 20:30:08	1.1
+++ ParseNode.java	2001/12/22 05:46:08	1.2
@@ -114,14 +114,14 @@
     /**
      *
      */
-    public abstract boolean matchBind(Object[] args,
+    public abstract boolean matchBind(ConstList args,
                                       Object specimen,
                                       FlexList bindings);
 
     /**
      *
      */
-    public ConstList matchBind(Object[] args, Object specimen) {
+    public ConstList matchBind(ConstList args, Object specimen) {
         FlexList bindings = FlexList.make();
         if (matchBind(args, specimen, bindings)) {
             return bindings.snapshot();
@@ -135,7 +135,7 @@
      * members must match exactly.
      */
     static protected boolean matchBind(ParseNode[] templates,
-                                       Object[] args,
+                                       ConstList args,
                                        ParseNode[] specimens,
                                        FlexList bindings) {
         int len = templates.length;
@@ -154,7 +154,7 @@
      * Convenience method for handling nulls.  nulls must match exactly.
      */
     static protected boolean matchBind(ParseNode optTemplate,
-                                       Object[] args,
+                                       ConstList args,
                                        ParseNode optSpecimen,
                                        FlexList bindings) {
         if (optTemplate == null) {



1.32      +2 -1      e/src/jsrc/org/erights/e/elang/evm/Pattern.java

Index: Pattern.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/Pattern.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- Pattern.java	2001/12/02 06:01:42	1.31
+++ Pattern.java	2001/12/22 05:46:08	1.32
@@ -23,6 +23,7 @@
 import org.erights.e.elang.visitors.SubstVisitor;
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.util.OneArgFunc;
+import org.erights.e.elib.tables.ConstList;
 
 import java.io.IOException;
 
@@ -56,7 +57,7 @@
     /**
      *
      */
-    public Pattern substitute(Object[] args) {
+    public Pattern substitute(ConstList args) {
         SubstVisitor visitor = new SubstVisitor(args);
         return visitor.xformPattern(this);
     }



1.26      +3 -4      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.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- QuasiLiteralExpr.java	2001/12/10 20:30:08	1.25
+++ QuasiLiteralExpr.java	2001/12/22 05:46:08	1.26
@@ -23,6 +23,7 @@
 import org.erights.e.elang.visitors.ETreeVisitor;
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.ConstList;
 import org.quasiliteral.base.IncompleteQuasiException;
 
 import java.io.IOException;
@@ -81,12 +82,10 @@
         return myIndex;
     }
 
-    static private final Object[] NO_ARGS = {};
-
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         //XXX Need to do the same() rather than doing another
@@ -94,7 +93,7 @@
         //equality on all the Exprs.
         //return Ref.same(substitute(args), specimen);
 
-        return substitute(args).matchBind(NO_ARGS,
+        return substitute(args).matchBind(ConstList.EmptyList,
                                           specimen,
                                           FlexList.make());
     }



1.16      +3 -4      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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- QuasiLiteralPatt.java	2001/12/10 20:30:08	1.15
+++ QuasiLiteralPatt.java	2001/12/22 05:46:08	1.16
@@ -23,6 +23,7 @@
 import org.erights.e.elang.visitors.ETreeVisitor;
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.ConstList;
 import org.erights.e.elib.util.OneArgFunc;
 import org.quasiliteral.base.IncompleteQuasiException;
 
@@ -92,12 +93,10 @@
         return myIndex;
     }
 
-    static private final Object[] NO_ARGS = {};
-
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         //XXX Need to do the areEquals() rather than doing another
@@ -105,7 +104,7 @@
         //equals methods on all the Patterns.
         //return EqualsExpr.areEquals(substitute(args), specimen);
 
-        return substitute(args).matchBind(NO_ARGS,
+        return substitute(args).matchBind(ConstList.EmptyList,
                                           specimen,
                                           FlexList.make());
     }



1.27      +2 -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.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- QuasiPatternExpr.java	2001/12/10 20:30:08	1.26
+++ QuasiPatternExpr.java	2001/12/22 05:46:08	1.27
@@ -23,6 +23,7 @@
 import org.erights.e.elang.visitors.ETreeVisitor;
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.ConstList;
 import org.erights.e.elib.util.AlreadyDefinedException;
 import org.quasiliteral.base.IncompleteQuasiException;
 
@@ -84,7 +85,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         bindings.ensureSize(myIndex + 1);



1.16      +2 -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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- QuasiPatternPatt.java	2001/12/10 20:30:08	1.15
+++ QuasiPatternPatt.java	2001/12/22 05:46:08	1.16
@@ -23,6 +23,7 @@
 import org.erights.e.elang.visitors.ETreeVisitor;
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.ConstList;
 import org.erights.e.elib.util.AlreadyDefinedException;
 import org.erights.e.elib.util.OneArgFunc;
 import org.quasiliteral.base.IncompleteQuasiException;
@@ -96,7 +97,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         bindings.ensureSize(myIndex + 1);



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

Index: ScopeExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/ScopeExpr.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- ScopeExpr.java	2001/12/02 06:01:42	1.24
+++ ScopeExpr.java	2001/12/22 05:46:08	1.25
@@ -25,6 +25,7 @@
 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.ConstList;
 
 import java.io.IOException;
 
@@ -72,7 +73,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         ScopeExpr other;



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

Index: SendExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/SendExpr.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- SendExpr.java	2001/12/02 06:01:42	1.24
+++ SendExpr.java	2001/12/22 05:46:08	1.25
@@ -25,6 +25,7 @@
 import org.erights.e.elib.prim.E;
 import org.erights.e.elib.ref.Ref;
 import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.ConstList;
 
 import java.io.IOException;
 
@@ -103,7 +104,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         SendExpr other;



1.13      +2 -1      e/src/jsrc/org/erights/e/elang/evm/SeqExpr.java

Index: SeqExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/SeqExpr.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SeqExpr.java	2001/12/02 06:01:42	1.12
+++ SeqExpr.java	2001/12/22 05:46:08	1.13
@@ -24,6 +24,7 @@
 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.ConstList;
 
 import java.io.IOException;
 
@@ -83,7 +84,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         SeqExpr other;



1.28      +2 -1      e/src/jsrc/org/erights/e/elang/evm/SlotExpr.java

Index: SlotExpr.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/SlotExpr.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- SlotExpr.java	2001/12/02 06:01:42	1.27
+++ SlotExpr.java	2001/12/22 05:46:08	1.28
@@ -25,6 +25,7 @@
 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 java.io.IOException;
 
@@ -76,7 +77,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         SlotExpr other;



1.16      +2 -1      e/src/jsrc/org/erights/e/elang/evm/SuchThatPattern.java

Index: SuchThatPattern.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/evm/SuchThatPattern.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- SuchThatPattern.java	2001/12/02 06:01:42	1.15
+++ SuchThatPattern.java	2001/12/22 05:46:08	1.16
@@ -25,6 +25,7 @@
 import org.erights.e.elib.prim.Thrower;
 import org.erights.e.elib.ref.Ref;
 import org.erights.e.elib.tables.FlexList;
+import org.erights.e.elib.tables.ConstList;
 import org.erights.e.elib.util.OneArgFunc;
 
 import java.io.IOException;
@@ -69,7 +70,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         SuchThatPattern other;



1.19      +2 -2      e/src/jsrc/org/erights/e/elang/interp/InteractiveInterp.java

Index: InteractiveInterp.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/interp/InteractiveInterp.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- InteractiveInterp.java	2001/12/12 06:35:57	1.18
+++ InteractiveInterp.java	2001/12/22 05:46:09	1.19
@@ -62,7 +62,7 @@
  */
 public class InteractiveInterp implements Interpreter, InterpLoop {
 
-    static EExpr[] SubstArgs = null;
+    static private ConstList SubstArgs = null;
 
     static private void initSubst() {
         if (null != SubstArgs) {
@@ -73,7 +73,7 @@
             Twine twine = Twine.fromString("interp getResult(" + i + ")");
             sargs[i] = (EExpr)EParser.run(twine);
         }
-        SubstArgs = sargs;
+        SubstArgs = ConstList.fromArray(sargs);
     }
 
     private ConstList myArgs;



1.8       +6 -4      e/src/jsrc/org/erights/e/elang/visitors/SubstVisitor.java

Index: SubstVisitor.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/visitors/SubstVisitor.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SubstVisitor.java	2001/09/06 09:55:47	1.7
+++ SubstVisitor.java	2001/12/22 05:46:09	1.8
@@ -1,5 +1,7 @@
 package org.erights.e.elang.visitors;
 
+import org.erights.e.elib.tables.ConstList;
+
 /*
 The contents of this file are subject to the Improvements to the
 Distributed E Language Implementation License Version 1.0 (the
@@ -27,12 +29,12 @@
  */
 public class SubstVisitor extends CopyVisitor {
 
-    private Object[] myArgs;
+    private ConstList myArgs;
 
     /**
      *
      */
-    public SubstVisitor(Object[] args) {
+    public SubstVisitor(ConstList args) {
         myArgs = args;
     }
 
@@ -44,7 +46,7 @@
      *
      */
     public Object visitQuasiLiteralExpr(int index) {
-        return myArgs[index];
+        return myArgs.get(index);
     }
 
 
@@ -55,6 +57,6 @@
      *
      */
     public Object visitQuasiLiteralPatt(int index) {
-        return myArgs[index];
+        return myArgs.get(index);
     }
 }



1.2       +2 -2      e/src/jsrc/org/quasiliteral/base/MatchMaker.java

Index: MatchMaker.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/base/MatchMaker.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MatchMaker.java	2001/12/10 18:27:00	1.1
+++ MatchMaker.java	2001/12/22 05:46:09	1.2
@@ -38,7 +38,7 @@
      * 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);
+    ConstList matchBind(ConstList args, Object specimen);
 
     /**
      * Reports failure by returning false, in which case 'bindings' should
@@ -47,5 +47,5 @@
      * Appropriate for matching a component pattern within a larger pattern
      * match.
      */
-    boolean matchBind(Object[] args, Object specimen, FlexList bindings);
+    boolean matchBind(ConstList args, Object specimen, FlexList bindings);
 }



1.2       +3 -1      e/src/jsrc/org/quasiliteral/base/ValueMaker.java

Index: ValueMaker.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/base/ValueMaker.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ValueMaker.java	2001/12/10 18:27:00	1.1
+++ ValueMaker.java	2001/12/22 05:46:09	1.2
@@ -1,5 +1,7 @@
 package org.quasiliteral.base;
 
+import org.erights.e.elib.tables.ConstList;
+
 /*
 The contents of this file are subject to the Improvements to the
 Distributed E Language Implementation License Version 1.0 (the
@@ -45,5 +47,5 @@
      * for the non-privileged extension of the expression evaluation
      * machinery.
      */
-    Object substitute(Object[] args);
+    Object substitute(ConstList args);
 }



1.2       +64 -2     e/src/jsrc/org/quasiliteral/quasiterm/QAstro.java

Index: QAstro.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/quasiterm/QAstro.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- QAstro.java	2001/12/21 05:30:35	1.1
+++ QAstro.java	2001/12/22 05:46:10	1.2
@@ -1,10 +1,15 @@
 package org.quasiliteral.quasiterm;
 
 import org.erights.e.develop.assertion.T;
+import org.erights.e.elib.tables.ConstList;
+import org.erights.e.elib.tables.EList;
+import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.Twine;
 import org.quasiliteral.astro.Astro;
 import org.quasiliteral.astro.AstroBuilder;
 import org.quasiliteral.astro.AstroTag;
+import org.quasiliteral.base.MatchMaker;
+import org.quasiliteral.base.ValueMaker;
 
 //This file is hereby placed in the public domain
 
@@ -12,13 +17,69 @@
  *
  * @author <a href="mailto:markm@caplet.com">Mark Miller</a>
  */
-public abstract class QAstro extends QAstroArg implements Astro {
+public abstract class QAstro extends QAstroArg
+  implements Astro, ValueMaker, MatchMaker {
 
     public QAstro(AstroBuilder builder, Twine source) {
         super(builder, source);
     }
 
     /**
+     * @return :Astro
+     */
+    public Object substitute(ConstList args) {
+        ConstList list = substSlice(args, EMPTY_INDEX);
+        T.require(list.size() == 1,
+                  "Must be singleton: ", list);
+        return list.get(0);
+    }
+
+    /**
+     * Transitive snapshot through all substructure that's instanceof EList.
+     */
+    static private Object transSnapshot(Object thing) {
+        if (!(thing instanceof EList)) {
+            return thing;
+        }
+        EList list = (EList)thing;
+        int len = list.size();
+        Object[] result = new Object[len];
+        for (int i = 0; i < len; i++) {
+            result[i] = transSnapshot(list.get(i));
+        }
+        return ConstList.fromArray(result);
+    }
+
+    /**
+     *
+     */
+    public ConstList matchBind(ConstList args, Object specimen) {
+        FlexList bindings = FlexList.make();
+        if (matchBind(args, specimen, bindings)) {
+            return (ConstList)transSnapshot(bindings);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     *
+     * @param args See the doc on 'args' in {@link #substitute(Object[],
+     *             String)}
+     * @param specimen :Astro
+     * @param bindings Like 'args', but by extraction from specimen
+     * @return Do we have a match?
+     */
+    public boolean matchBind(ConstList args,
+                             Object specimen,
+                             FlexList bindings) {
+        return 1 == matchBindSlice(args,
+                                   ConstList.EmptyList.with(specimen),
+                                   bindings,
+                                   EMPTY_INDEX);
+    }
+
+    /**
      *
      */
     public Astro build(AstroBuilder builder) {
@@ -82,5 +143,6 @@
      * If this Astro (or derivatives) should not be used as a functor, then
      * this operation should throw.
      */
-    /*package*/ abstract QAstro asFunctor();
+    /*package*/
+    abstract QAstro asFunctor();
 }



1.4       +34 -74    e/src/jsrc/org/quasiliteral/quasiterm/QAstroArg.java

Index: QAstroArg.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/quasiterm/QAstroArg.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- QAstroArg.java	2001/12/21 05:30:35	1.3
+++ QAstroArg.java	2001/12/22 05:46:10	1.4
@@ -1,23 +1,18 @@
 package org.quasiliteral.quasiterm;
 
-import org.erights.e.develop.assertion.T;
 import org.erights.e.develop.exception.ExceptionMgr;
+import org.erights.e.elib.base.ClassDesc;
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.serial.PassByConstruction;
 import org.erights.e.elib.serial.Persistent;
+import org.erights.e.elib.slot.ValueGuard;
 import org.erights.e.elib.tables.ConstList;
+import org.erights.e.elib.tables.EList;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.Selfless;
 import org.erights.e.elib.tables.Twine;
-import org.erights.e.elib.tables.EList;
-import org.erights.e.elib.base.Ejector;
-import org.erights.e.elib.base.ClassDesc;
-import org.erights.e.elib.slot.ValueGuard;
-import org.erights.e.elib.prim.E;
 import org.quasiliteral.astro.AstroArg;
 import org.quasiliteral.astro.AstroBuilder;
-import org.quasiliteral.base.MatchMaker;
-import org.quasiliteral.base.ValueMaker;
 import org.quasiliteral.term.QuasiBuilder;
 
 import java.io.IOException;
@@ -30,8 +25,7 @@
  * @author <a href="mailto:markm@caplet.com">Mark Miller</a>
  */
 public abstract class QAstroArg
-  implements Selfless, PassByConstruction, Persistent,
-  AstroArg, ValueMaker, MatchMaker {
+  implements Selfless, PassByConstruction, Persistent, AstroArg {
 
     /**
      *
@@ -68,16 +62,6 @@
     }
 
     /**
-     * @return :Astro
-     */
-    public Object substitute(Object[] args) {
-        ConstList list = substSlice(args, EMPTY_INDEX);
-        T.require(list.size() == 1,
-                  "Must be singleton: ", list);
-        return list.get(0);
-    }
-
-    /**
      * @param args Each arg[i] is of a type matched to the corresponding
      *             dollar-hole.  For example, if dollar-hole 3 (ie "${3}")
      *             has rank "?*+", then args[3] must be a list of lists of
@@ -88,53 +72,8 @@
      *              If a dollar-hole's hole-num is 3 and index is [4,5], then
      *              the dollar-hole would evaluate to args[3][4][5].
      * @return :(ConstList of(Astro))
-     */
-    public abstract ConstList substSlice(Object[] args, int[] index);
-
-    /**
-     * Transitive snapshot through all substructure that's instanceof EList.
-     */
-    static private Object transSnapshot(Object thing) {
-        if (! (thing instanceof EList)) {
-            return thing;
-        }
-        EList list = (EList)thing;
-        int len = list.size();
-        Object[] result = new Object[len];
-        for (int i = 0; i < len; i++) {
-            result[i] = transSnapshot(list.get(i));
-        }
-        return ConstList.fromArray(result);
-    }
-
-    /**
-     *
-     */
-    public ConstList matchBind(Object[] args, Object specimen) {
-        FlexList bindings = FlexList.make();
-        if (matchBind(args, specimen, bindings)) {
-            return (ConstList)transSnapshot(bindings);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     *
-     * @param args See the doc on 'args' in {@link #substitute(Object[],
-     *             String)}
-     * @param specimen :Astro
-     * @param bindings Like 'args', but by extraction from specimen
-     * @return Do we have a match?
      */
-    public boolean matchBind(Object[] args,
-                             Object specimen,
-                             FlexList bindings) {
-        return 1 == matchBindSlice(args,
-                                   ConstList.EmptyList.with(specimen),
-                                   bindings,
-                                   EMPTY_INDEX);
-    }
+    public abstract ConstList substSlice(ConstList args, int[] index);
 
     /**
      *
@@ -151,14 +90,14 @@
      *         successful match of no elements, so -1 is used to instead
      *         indicate a failed match.
      */
-    public abstract int matchBindSlice(Object[] args,
+    public abstract int matchBindSlice(ConstList args,
                                        ConstList specimenList,
                                        FlexList bindings,
                                        int[] index);
 
     /**
-     * For this substree and this index-prefix, how many index elements should
-     * be enumerated?
+     * For this substree and this index-prefix, what's the most number of
+     * index elements that should be enumerated?
      * <p>
      * If this subtree has no dollar-holes, it should just return shapeSoFar.
      * The initial shapeSoFar is -1 (meaning "indeterminate"), so a tree with
@@ -166,14 +105,28 @@
      * QTerm) just asks all its children, passing to each the shapeSoFar from
      * the previous.
      * <p>
-     * All the rest of the semantics is specific to dollar-hole or to raking
-     * nodes, so see the documentation there.
+     * All the rest of the semantics is specific to dollar-hole, at-hole, or
+     * to raking nodes, so see the documentation there.
      */
-    /*package*/ abstract int getShape(Object args[],
-                                      int[] prefix,
-                                      int shapeSoFar);
+    /*package*/
+    abstract int startShape(ConstList args,
+                            FlexList optBindings,
+                            int[] prefix,
+                            int shapeSoFar);
 
     /**
+     * For this subtree and this index elements, 'shape' is the number of
+     * index elements that have been successfully enumerated.
+     * <p>
+     * For each prefix, startShape and endShape form the openning and closing
+     * brackets around calls to matchBindSlice or substSlice.
+     */
+    /*package*/
+    abstract void endShape(FlexList optBindings,
+                           int[] prefix,
+                           int shape);
+
+    /**
      * What source text was originally lexed or parsed to produce this node,
      * or a representative token of this node?
      */
@@ -207,6 +160,13 @@
      *
      */
     public String toString() {
+        return asText();
+    }
+
+    /**
+     *
+     */
+    public String asText() {
         StringWriter strWriter = new StringWriter();
         try {
             prettyPrintOn(new TextWriter(strWriter));



1.2       +33 -51    e/src/jsrc/org/quasiliteral/quasiterm/QAtHole.java

Index: QAtHole.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/quasiterm/QAtHole.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- QAtHole.java	2001/12/21 05:30:35	1.1
+++ QAtHole.java	2001/12/22 05:46:10	1.2
@@ -1,16 +1,13 @@
 package org.quasiliteral.quasiterm;
 
-import org.erights.e.develop.format.StringHelper;
 import org.erights.e.develop.assertion.T;
-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.prim.StaticMaker;
 import org.erights.e.elib.tables.ConstList;
+import org.erights.e.elib.tables.EList;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.Twine;
-import org.erights.e.elib.tables.EList;
-import org.erights.e.elib.base.Ejector;
 import org.quasiliteral.astro.Astro;
 import org.quasiliteral.astro.AstroArg;
 import org.quasiliteral.astro.AstroBuilder;
@@ -97,73 +94,58 @@
 
     /**
      * An at-hole doesn't contribute to the shape, so just returns
-     * shapeSoFar.
+     * shapeSoFar, but initializes the binding at [myHoleNum]+prefix to a
+     * new empty FlexList.
      */
     /*package*/
-    int getShape(Object[] args, int[] prefix, int shapeSoFar) {
+    int startShape(ConstList args,
+                   FlexList optBindings,
+                   int[] prefix,
+                   int shapeSoFar) {
+        T.require(null != optBindings,
+                  "no at-holes in a ValueMaker: ", this);
+        multiPut(optBindings, myHoleNum, prefix, FlexList.make());
         return shapeSoFar;
     }
 
     /**
+     * Truncate and snapshot the bindings at [myHoleNum]+prefix to shape.
+     */
+    /*package*/
+    void endShape(FlexList optBindings,
+                  int[] prefix,
+                  int shape) {
+        T.require(null != optBindings,
+                  "no at-holes in a ValueMaker: ", this);
+        FlexList list = (FlexList)multiGet(optBindings.snapshot(),
+                                           myHoleNum,
+                                           prefix,
+                                           false);
+        list.setSize(shape);
+        multiPut(optBindings,
+                 myHoleNum,
+                 prefix,
+                 list.snapshot());
+    }
+
+    /**
      * This throws, complaining that a quasi-tree with an @-hole may not be
      * used as a ValueMaker.
      */
-    public ConstList substSlice(Object[] args, int[] index) {
+    public ConstList substSlice(ConstList args, int[] index) {
         throw new RuntimeException
           ("A quasi-tree with an @-hole may not be used as a ValueMaker: " +
            this);
     }
 
     /**
-     * Given a multi-dimensional list and an index path, put newValue at that
-     * position in the list.
-     * <p>
-     * For example, if 'bindings' is [['a','b'],['c','d','e']] diverge(),
-     * 'holeNum' is 1, 'index' is [2], and 'newValue' is 'x', then the 'e'
-     * should be replaced with 'x', since it's at list[1][2].  If any index
-     * step is out of bounds, the corresponding list is grown to include it
-     * (see {@link FlexList#ensureSize(int)} and null is returned.
-     * Alternatively, if an old value is being overwritten, then that old
-     * value is also returned.
-     */
-    static public Object multiPut(FlexList bindings,
-                                  int holeNum,
-                                  int[] index,
-                                  Object newValue) {
-        FlexList list = bindings;
-        int dest = holeNum;
-        for (int i = 0, len = index.length; i < len; i++) {
-            list.ensureSize(dest +1);
-            Object optNext = list.get(dest);
-            if (optNext == null) {
-                optNext = FlexList.make(index[i] +1);
-                list.put(dest, optNext);
-            } else if (optNext instanceof FlexList) {
-                //we're cool
-            } else {
-                optNext = EListGuard.coerce(optNext, null);
-                optNext = ((EList)optNext).diverge();
-            }
-            list = (FlexList)optNext;
-            dest = index[i];
-        }
-        Object result = null;
-        if (list.size() > dest) {
-            result = list.get(dest);
-        }
-        list.ensureSize(dest +1);
-        list.put(dest, newValue);
-        return result;
-    }
-
-    /**
      * This extracts the specimen into the binding at [myHoleNum]+index.
      * <p>
      * This first ensures the specimen meets our own constraints.
      *
      * @return -1 or 1, depending on whether they match.
      */
-    public int matchBindSlice(Object[] args,
+    public int matchBindSlice(ConstList args,
                               ConstList specimenList,
                               FlexList bindings,
                               int[] index) {
@@ -171,7 +153,7 @@
             return -1;
         }
         Object specimen = specimenList.get(0);
-        if (! matches(specimen)) {
+        if (!matches(specimen)) {
             return -1;
         }
         //XXX when matches/1 coerces term to an Astro, this should be updated



1.5       +2 -2      e/src/jsrc/org/quasiliteral/quasiterm/QBuilder.java

Index: QBuilder.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/quasiterm/QBuilder.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- QBuilder.java	2001/12/21 05:30:35	1.4
+++ QBuilder.java	2001/12/22 05:46:10	1.5
@@ -1,10 +1,10 @@
 package org.quasiliteral.quasiterm;
 
+import org.erights.e.develop.assertion.T;
 import org.erights.e.elib.tables.EList;
+import org.erights.e.elib.tables.EmptyTwine;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.Twine;
-import org.erights.e.elib.tables.EmptyTwine;
-import org.erights.e.develop.assertion.T;
 import org.quasiliteral.astro.Astro;
 import org.quasiliteral.astro.AstroArg;
 import org.quasiliteral.astro.AstroBuilder;



1.2       +18 -49    e/src/jsrc/org/quasiliteral/quasiterm/QDollarHole.java

Index: QDollarHole.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/quasiterm/QDollarHole.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- QDollarHole.java	2001/12/21 05:30:35	1.1
+++ QDollarHole.java	2001/12/22 05:46:10	1.2
@@ -1,16 +1,14 @@
 package org.quasiliteral.quasiterm;
 
-import org.erights.e.develop.format.StringHelper;
 import org.erights.e.develop.assertion.T;
-import org.erights.e.develop.exception.ExceptionMgr;
+import org.erights.e.elib.base.Ejector;
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.prim.E;
 import org.erights.e.elib.prim.StaticMaker;
 import org.erights.e.elib.tables.ConstList;
+import org.erights.e.elib.tables.EList;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.Twine;
-import org.erights.e.elib.tables.EList;
-import org.erights.e.elib.base.Ejector;
 import org.quasiliteral.astro.Astro;
 import org.quasiliteral.astro.AstroArg;
 import org.quasiliteral.astro.AstroBuilder;
@@ -95,48 +93,6 @@
     }
 
     /**
-     * Given a multi-dimensional list and an index path, retrieve the
-     * corresponding element of the list.
-     * <p>
-     * For example, if 'args' is [['a','b'],['c','d','e']], 'holeNum' is 1,
-     * 'index' is [2,3], and 'repeat' is true, then the answer should be
-     * 'e', since it's at args[1][2], and the repeat flag allows us to ignore
-     * the 3 when we find that 'e' isn't a list.  If 'repeat' had been false,
-     * the presence of an additional step on the index path would have caused
-     * an exception to be thrown.  In either case, if an index step is out of
-     * bounds, an exception is thrown regardless of the value of 'repeat'.
-     */
-    static public Object multiGet(Object args[],
-                                  int holeNum,
-                                  int[] index,
-                                  boolean repeat) {
-        Object result = args[holeNum];
-        for (int i = 0, len = index.length; i < len; i++) {
-            Ejector optEj = null;
-            if (repeat) {
-                optEj = new Ejector();
-            }
-            EList list;
-            try {
-                list = (EList)EListGuard.coerce(result, optEj);
-            } catch (Throwable th) {
-                if (null == optEj) {
-                    throw ExceptionMgr.asSafe(th);
-                } else {
-                    optEj.result(th);
-                    //It doesn't matter why the coercion failed.  If we're
-                    //here, the coercion failed rather than throwing.  This
-                    //means we should simply repeat the last non-list result
-                    //we got.
-                    return result;
-                }
-            }
-            result = list.get(index[i]);
-        }
-        return result;
-    }
-
-    /**
      * If the substitution arg at [myHoleHum]+prefix is actually a list
      * for further indexing, what's the size of that list?
      * <p>
@@ -146,7 +102,10 @@
      * not -1), then require these to agree.
      */
     /*package*/
-    int getShape(Object[] args, int[] prefix, int shapeSoFar) {
+    int startShape(ConstList args,
+                   FlexList optBindings,
+                   int[] prefix,
+                   int shapeSoFar) {
         Object term = multiGet(args, myHoleNum, prefix, true);
         Ejector ej = new Ejector();
         EList list;
@@ -166,11 +125,21 @@
     }
 
     /**
+     * Do nothing.
+     */
+    /*package*/
+    void endShape(FlexList optBindings,
+                  int[] prefix,
+                  int shape) {
+        // Do nothing.
+    }
+
+    /**
      * This extracts the substitution arg at [myHoleNum]+index, requires that
      * it matches, and returns a singleton list containing that arg (which
      * should be a literal term).
      */
-    public ConstList substSlice(Object[] args, int[] index) {
+    public ConstList substSlice(ConstList args, int[] index) {
         Object term = multiGet(args, myHoleNum, index, true);
         T.require(matches(term),
                   "Term ", term, " doesn't match ", this);
@@ -188,7 +157,7 @@
      *
      * @return -1 or 1, depending on whether they match.
      */
-    public int matchBindSlice(Object[] args,
+    public int matchBindSlice(ConstList args,
                               ConstList specimenList,
                               FlexList bindings,
                               int[] index) {



1.2       +16 -5     e/src/jsrc/org/quasiliteral/quasiterm/QFunctor.java

Index: QFunctor.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/quasiterm/QFunctor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- QFunctor.java	2001/12/21 05:30:35	1.1
+++ QFunctor.java	2001/12/22 05:46:10	1.2
@@ -138,7 +138,7 @@
      * @return A single list of a single Astro, whose functor is based on
      *         literal functor info of this qfunctor
      */
-    public ConstList substSlice(Object[] args, int[] index) {
+    public ConstList substSlice(ConstList args, int[] index) {
         Astro tFunctor;
         if (null == myOptData) {
             tFunctor = myBuilder.leafTag(myTag, mySource);
@@ -155,7 +155,7 @@
      *         specimenList[0] matches that of this qfunctor, while ignoring
      *         the args.
      */
-    public int matchBindSlice(Object[] args,
+    public int matchBindSlice(ConstList args,
                               ConstList specimenList,
                               FlexList bindings,
                               int[] index) {
@@ -223,9 +223,20 @@
      * Just returns shapeSoFar, since this has no shape and no children
      */
     /*package*/
-    int getShape(Object args[],
-                 int[] prefix,
-                 int shapeSoFar) {
+    int startShape(ConstList args,
+                   FlexList optBindings,
+                   int[] prefix,
+                   int shapeSoFar) {
         return shapeSoFar;
+    }
+
+    /**
+     * Do nothing.
+     */
+    /*package*/
+    void endShape(FlexList optBindings,
+                  int[] prefix,
+                  int shape) {
+        // Do nothing.
     }
 }



1.2       +101 -9    e/src/jsrc/org/quasiliteral/quasiterm/QHole.java

Index: QHole.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/quasiterm/QHole.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- QHole.java	2001/12/21 05:30:35	1.1
+++ QHole.java	2001/12/22 05:46:10	1.2
@@ -1,11 +1,15 @@
 package org.quasiliteral.quasiterm;
 
+import org.erights.e.develop.assertion.T;
+import org.erights.e.develop.exception.ExceptionMgr;
+import org.erights.e.elib.base.Ejector;
+import org.erights.e.elib.tables.ConstList;
+import org.erights.e.elib.tables.EList;
+import org.erights.e.elib.tables.Twine;
+import org.erights.e.elib.tables.FlexList;
+import org.quasiliteral.astro.Astro;
 import org.quasiliteral.astro.AstroBuilder;
 import org.quasiliteral.astro.AstroTag;
-import org.quasiliteral.astro.Astro;
-import org.erights.e.elib.tables.Twine;
-import org.erights.e.elib.tables.ConstList;
-import org.erights.e.develop.assertion.T;
 
 //This file is hereby placed in the public domain
 
@@ -25,21 +29,24 @@
      *         substitution are at myHoleNum.  If this is an at-hole, the
      *         corresponding literal term is the specimen.
      */
-    /*package*/ final AstroTag myOptTag;
+    /*package*/
+    final AstroTag myOptTag;
 
     /**
      * @serial Which hole am I?  If this is a dollar-hole, then this
      *         says which substitution-arg.  If this is an at-hole, then this
      *         says which binding.
      */
-    /*package*/ final int myHoleNum;
+    /*package*/
+    final int myHoleNum;
 
     /**
      * @serial If true, then the corresponding literal term must be
      *         0-arity.  If false, then the corresponding literal term may
      *         itself have any argument list, and this is a termHole
      */
-    /*package*/ final boolean myIsFunctorHole;
+    /*package*/
+    final boolean myIsFunctorHole;
 
     /**
      * Makes a hole that matches a term (either a substitution-arg or a
@@ -77,6 +84,90 @@
     }
 
     /**
+     * Given a multi-dimensional list and an index path, retrieve the
+     * corresponding element of the list.
+     * <p>
+     * For example, if 'args' is [['a','b'],['c','d','e']], 'holeNum' is 1,
+     * 'index' is [2,3], and 'repeat' is true, then the answer should be
+     * 'e', since it's at args[1][2], and the repeat flag allows us to ignore
+     * the 3 when we find that 'e' isn't a list.  If 'repeat' had been false,
+     * the presence of an additional step on the index path would have caused
+     * an exception to be thrown.  In either case, if an index step is out of
+     * bounds, an exception is thrown regardless of the value of 'repeat'.
+     */
+    static public Object multiGet(ConstList args,
+                                  int holeNum,
+                                  int[] index,
+                                  boolean repeat) {
+        Object result = args.get(holeNum);
+        for (int i = 0, len = index.length; i < len; i++) {
+            Ejector optEj = null;
+            if (repeat) {
+                optEj = new Ejector();
+            }
+            EList list;
+            try {
+                list = (EList)EListGuard.coerce(result, optEj);
+            } catch (Throwable th) {
+                if (null == optEj) {
+                    throw ExceptionMgr.asSafe(th);
+                } else {
+                    optEj.result(th);
+                    //It doesn't matter why the coercion failed.  If we're
+                    //here, the coercion failed rather than throwing.  This
+                    //means we should simply repeat the last non-list result
+                    //we got.
+                    return result;
+                }
+            }
+            result = list.get(index[i]);
+        }
+        return result;
+    }
+
+    /**
+     * Given a multi-dimensional list and an index path, put newValue at that
+     * position in the list.
+     * <p>
+     * For example, if 'bindings' is [['a','b'],['c','d','e']] diverge(),
+     * 'holeNum' is 1, 'index' is [2], and 'newValue' is 'x', then the 'e'
+     * should be replaced with 'x', since it's at list[1][2].  If any index
+     * step is out of bounds, the corresponding list is grown to include it
+     * (see {@link FlexList#ensureSize(int)} and null is returned.
+     * Alternatively, if an old value is being overwritten, then that old
+     * value is also returned.
+     */
+    static public Object multiPut(FlexList bindings,
+                                  int holeNum,
+                                  int[] index,
+                                  Object newValue) {
+        FlexList list = bindings;
+        int dest = holeNum;
+        for (int i = 0, len = index.length; i < len; i++) {
+            list.ensureSize(dest + 1);
+            Object optNext = list.get(dest);
+            if (optNext == null) {
+                optNext = FlexList.make(index[i] + 1);
+                list.put(dest, optNext);
+            } else if (optNext instanceof FlexList) {
+                //we're cool
+            } else {
+                optNext = EListGuard.coerce(optNext, null);
+                optNext = ((EList)optNext).diverge();
+            }
+            list = (FlexList)optNext;
+            dest = index[i];
+        }
+        Object result = null;
+        if (list.size() > dest) {
+            result = list.get(dest);
+        }
+        list.ensureSize(dest + 1);
+        list.put(dest, newValue);
+        return result;
+    }
+
+    /**
      * Does the literal 'term' match the pattern represented by this hole?
      * <p>
      * When this hole is a dollar-hole, term will be a substitution-arg.
@@ -92,7 +183,7 @@
      */
     /*package*/
     boolean matches(Object term) {
-        if (! (term instanceof Astro)) {
+        if (!(term instanceof Astro)) {
             return false;
         }
         Astro astro = (Astro)term;
@@ -159,5 +250,6 @@
     /**
      *
      */
-    /*package*/ abstract QHole asTagged(Astro ident);
+    /*package*/
+    abstract QHole asTagged(Astro ident);
 }



1.2       +44 -27    e/src/jsrc/org/quasiliteral/quasiterm/QSome.java

Index: QSome.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/quasiterm/QSome.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- QSome.java	2001/12/21 05:30:35	1.1
+++ QSome.java	2001/12/22 05:46:10	1.2
@@ -1,15 +1,14 @@
 package org.quasiliteral.quasiterm;
 
+import org.erights.e.develop.assertion.T;
+import org.erights.e.elib.eio.TextWriter;
+import org.erights.e.elib.prim.StaticMaker;
 import org.erights.e.elib.tables.ConstList;
+import org.erights.e.elib.tables.EList;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.Twine;
-import org.erights.e.elib.tables.EList;
-import org.erights.e.elib.eio.TextWriter;
-import org.erights.e.elib.prim.StaticMaker;
-import org.erights.e.develop.assertion.T;
-import org.quasiliteral.astro.AstroTag;
-import org.quasiliteral.astro.AstroArg;
 import org.quasiliteral.astro.Astro;
+import org.quasiliteral.astro.AstroArg;
 import org.quasiliteral.astro.AstroBuilder;
 import org.quasiliteral.term.QuasiBuilder;
 
@@ -72,31 +71,36 @@
      */
     static private boolean inBounds(int num, char quant) {
         switch (quant) {
-            case '?': return num == 0 || num == 1;
-            case '+': return num >= 1;
-            case '*': return num >= 0;
-            default: throw new RuntimeException
-              ("Must be '?', '+', or '*': " + quant);
+            case '?':
+                return num == 0 || num == 1;
+            case '+':
+                return num >= 1;
+            case '*':
+                return num >= 0;
+            default:
+                throw new RuntimeException
+                  ("Must be '?', '+', or '*': " + quant);
         }
     }
 
     /**
      *
      */
-    public ConstList substSlice(Object[] args, int[] index) {
+    public ConstList substSlice(ConstList args, int[] index) {
         T.require(null != myOptSubPattern,
                   "A ValueMaker must have a sub-pattern: ", this);
-        int shape = myOptSubPattern.getShape(args, index, -1);
+        int shape = myOptSubPattern.startShape(args, null, index, -1);
         T.require(shape >= 0,
                   "Indeterminate repetition: ", this);
         FlexList result = FlexList.fromType(Astro.class, shape);
         int lastDim = index.length;
-        int[] subIndex = (int[])EList.resize(index, lastDim +1);
+        int[] subIndex = (int[])EList.resize(index, lastDim + 1);
         for (int i = 0; i < shape; i++) {
             subIndex[lastDim] = i;
             ConstList slice = myOptSubPattern.substSlice(args, subIndex);
             result.append(slice);
         }
+        myOptSubPattern.endShape(null, index, shape);
         T.require(inBounds(result.size(), myQuant),
                   "Improper quantity: " + shape, " vs " + myQuant);
         return result.snapshot();
@@ -105,32 +109,37 @@
     /**
      *
      */
-    public int matchBindSlice(Object[] args,
+    public int matchBindSlice(ConstList args,
                               ConstList specimenList,
                               FlexList bindings,
                               int[] index) {
         if (null == myOptSubPattern) {
             int result = specimenList.size();
             switch (myQuant) {
-                case '?': return Math.min(result, 1);
-                case '+': return result <= 0 ? -1 : result;
-                case '*': return result;
-                default: T.fail("Unrecognized: " + myQuant);
+                case '?':
+                    return Math.min(result, 1);
+                case '+':
+                    return result <= 0 ? -1 : result;
+                case '*':
+                    return result;
+                default:
+                    T.fail("Unrecognized: " + myQuant);
             }
             return -666; //just so the compiler will know
         }
-        int shape = myOptSubPattern.getShape(args, index, -1);
+        int maxShape = myOptSubPattern.startShape(args, bindings, index, -1);
         int result = 0;
         int lastDim = index.length;
-        int[] subIndex = (int[])EList.resize(index, lastDim +1);
-        for (int i = 0; shape == -1 || i < shape; i++) {
+        int[] subIndex = (int[])EList.resize(index, lastDim + 1);
+        int shapeSoFar = 0;
+        for (; maxShape == -1 || shapeSoFar < maxShape; shapeSoFar++) {
             if (specimenList.size() == 0) {
                 break;
             }
             if (myQuant == '?' && result >= 1) {
                 break;
             }
-            subIndex[lastDim] = i;
+            subIndex[lastDim] = shapeSoFar;
             int more = myOptSubPattern.matchBindSlice(args,
                                                       specimenList,
                                                       bindings,
@@ -138,12 +147,13 @@
             if (-1 == more) {
                 break;
             }
-            T.require(more >= 1 || shape != -1,
+            T.require(more >= 1 || maxShape != -1,
                       "Patterns of indeterminate rank must make progress: ",
                       this, " vs ", specimenList);
             result += more;
             specimenList = specimenList.run(more, specimenList.size());
         }
+        myOptSubPattern.endShape(bindings, index, shapeSoFar);
         T.require(inBounds(result, myQuant),
                   "Improper quantity: " + result, " vs " + myQuant);
         return result;
@@ -152,10 +162,17 @@
     /**
      *
      */
+    /*package*/
+    int startShape(ConstList args,
+                   FlexList optBindings, int[] prefix,
+                   int shapeSoFar) {
+        throw new RuntimeException("XXX not yet implemented");
+    }
+
     /*package*/
-    int getShape(Object args[],
-                 int[] prefix,
-                 int shapeSoFar) {
+    void endShape(FlexList optBindings,
+                  int[] prefix,
+                  int shape) {
         throw new RuntimeException("XXX not yet implemented");
     }
 



1.5       +28 -7     e/src/jsrc/org/quasiliteral/quasiterm/QTerm.java

Index: QTerm.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/quasiterm/QTerm.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- QTerm.java	2001/12/21 05:30:35	1.4
+++ QTerm.java	2001/12/22 05:46:10	1.5
@@ -152,7 +152,7 @@
      *         literal functor info of this qterm, and whose args are the
      *         concatentation of the substSlice of the qargs of this qterm.
      */
-    public ConstList substSlice(Object[] args, int[] index) {
+    public ConstList substSlice(ConstList args, int[] index) {
         Astro tFunctor = (Astro)myQFunctor.substSlice(args, index).get(0);
         Object tArgs = myBuilder.list();
         for (int i = 0, ilen = myQArgs.size(); i < ilen; i++) {
@@ -175,7 +175,7 @@
      * @return -1 or 1, depending on whether specimenList[0] matches this
      *         qterm.
      */
-    public int matchBindSlice(Object[] args,
+    public int matchBindSlice(ConstList args,
                               ConstList specimenList,
                               FlexList bindings,
                               int[] index) {
@@ -279,14 +279,35 @@
      * A QTerm has whatever shape its children agree on
      */
     /*package*/
-    int getShape(Object args[],
-                 int[] prefix,
-                 int shapeSoFar) {
-        shapeSoFar = myQFunctor.getShape(args, prefix, shapeSoFar);
+    int startShape(ConstList args,
+                   FlexList optBindings,
+                   int[] prefix,
+                   int shapeSoFar) {
+        shapeSoFar = myQFunctor.startShape(args,
+                                           optBindings,
+                                           prefix,
+                                           shapeSoFar);
         for (int i = 0, len = myQArgs.size(); i < len; i++) {
             QAstroArg qArg = (QAstroArg)myQArgs.get(i);
-            shapeSoFar = qArg.getShape(args, prefix, shapeSoFar);
+            shapeSoFar = qArg.startShape(args,
+                                         optBindings,
+                                         prefix,
+                                         shapeSoFar);
         }
         return shapeSoFar;
+    }
+
+    /**
+     * Just delegate to all children
+     */
+    /*package*/
+    void endShape(FlexList optBindings,
+                  int[] prefix,
+                  int shape) {
+        myQFunctor.endShape(optBindings, prefix, shape);
+        for (int i = 0, len = myQArgs.size(); i < len; i++) {
+            QAstroArg qArg = (QAstroArg)myQArgs.get(i);
+            qArg.endShape(optBindings, prefix, shape);
+        }
     }
 }



1.8       +1 -0      e/src/jsrc/org/quasiliteral/syntax/BaseLexer.java

Index: BaseLexer.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/syntax/BaseLexer.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- BaseLexer.java	2001/12/18 05:24:44	1.7
+++ BaseLexer.java	2001/12/22 05:46:10	1.8
@@ -108,6 +108,7 @@
         myInput = input;
         myPos = -1;
         myPartialFlag = partialFlag;
+        //XXX postpone first line-read till first token-read.
         myLTwine = myInput.optNextLine(false, 0, 'x', 0);
         if (null == myLTwine) {
             myLData = null;



1.21      +34 -14    e/src/jsrc/org/quasiliteral/term/Term.java

Index: Term.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/Term.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Term.java	2001/12/21 05:30:35	1.20
+++ Term.java	2001/12/22 05:46:10	1.21
@@ -301,6 +301,13 @@
      *
      */
     public String toString() {
+        return asText();
+    }
+
+    /**
+     *
+     */
+    public String asText() {
         StringWriter strWriter = new StringWriter();
         try {
             prettyPrintOn(new TextWriter(strWriter), false);
@@ -315,8 +322,10 @@
      */
     public void prettyPrintOn(TextWriter out, boolean quasiFlag)
       throws IOException {
-        String label = myTag.getTagName();
-        if (null != myOptData) {
+        String label;
+        if (null == myOptData) {
+            label = myTag.getTagName();
+        } else {
             label = E.toQuote(myOptData).bare();
             if (quasiFlag) {
                 label = StringHelper.replaceAll(label, "$", "$$");
@@ -324,29 +333,40 @@
                 label = StringHelper.replaceAll(label, "`", "``");
             }
         }
-        out.print(label);
         int h = getHeight();
-        if (h <= 1) {
-            if (myArgs.size() != 0) {
-                throw new RuntimeException("internal: bad height " + h);
+        int reps;
+        String open;
+        String close;
+        if ("tuple".equals(label)) {
+            reps = 1;
+            open = "[";
+            close = "]";
+        } else {
+            out.print(label);
+            if (h <= 1) {
+                if (myArgs.size() != 0) {
+                    throw new RuntimeException("internal: bad height " + h);
+                }
+                //If it's a leaf, don't show parens either
+                return;
             }
-            //If it's a leaf, don't show parens either
-            return;
+            reps = label.length() + 1;
+            open = "(";
+            close = ")";
         }
-        if (h == 2) {
+        if (h <= 2) {
             //If it only contains leaves, do it on one line
-            out.print("(");
+            out.print(open);
             ((Term)myArgs.get(0)).prettyPrintOn(out, quasiFlag);
             for (int i = 1; i < myArgs.size(); i++) {
                 out.print(", ");
                 ((Term)myArgs.get(i)).prettyPrintOn(out, quasiFlag);
             }
-            out.print(")");
+            out.print(close);
             return;
         }
         //print each child lined up.
-        out.print("(");
-        int reps = label.length() + 1;
+        out.print(open);
         String spaces = StringHelper.multiply(" ", reps);
         TextWriter sub = out.indent(spaces);
 
@@ -355,6 +375,6 @@
             sub.println(",");
             ((Term)myArgs.get(i)).prettyPrintOn(sub, quasiFlag);
         }
-        sub.print(")");
+        sub.print(close);
     }
 }



1.13      +8 -0      e/src/jsrc/org/quasiliteral/term/TermLexer.java

Index: TermLexer.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/TermLexer.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TermLexer.java	2001/12/10 20:30:10	1.12
+++ TermLexer.java	2001/12/22 05:46:10	1.13
@@ -160,6 +160,14 @@
                 {
                     return closeBracket();
                 }
+            case '[':
+                {
+                    return openBracket(']');
+                }
+            case ']':
+                {
+                    return closeBracket();
+                }
             case '/':
                 {
                     nextChar();



1.2       +9 -9      e/src/jsrc/org/quasiliteral/text/EYaccFixer.java

Index: EYaccFixer.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/text/EYaccFixer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EYaccFixer.java	2001/12/18 05:24:44	1.1
+++ EYaccFixer.java	2001/12/22 05:46:10	1.2
@@ -3,6 +3,7 @@
 import org.erights.e.elib.prim.E;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.Twine;
+import org.erights.e.elib.tables.ConstList;
 import org.erights.e.meta.java.io.FileSugar;
 import org.quasiliteral.base.MatchMaker;
 import org.quasiliteral.base.ValueMaker;
@@ -98,8 +99,6 @@
         return result;
     }
 
-    static private final Object[] NO_ARGS = {};
-
     static private short[] eatMyShorts(String numbers) {
         FlexList result = FlexList.fromType(Short.TYPE, 1000);
         int len = numbers.length();
@@ -139,12 +138,13 @@
         dataDir.mkdirs();
 
         String original = FileSugar.getText(parseFile);
-        FlexList partsList = ParseQPatt.matchBind(NO_ARGS, original).diverge();
-        if (null == partsList) {
+        FlexList parts =
+          ParseQPatt.matchBind(ConstList.EmptyList, original).diverge();
+        if (null == parts) {
             throw new NullPointerException("didn't recognize yacc output");
         }
-        short[] yytable = eatMyShorts(partsList.get(1).toString());
-        short[] yycheck = eatMyShorts(partsList.get(2).toString());
+        short[] yytable = eatMyShorts(parts.get(1).toString());
+        short[] yycheck = eatMyShorts(parts.get(2).toString());
         OutputStream outp = new FileOutputStream(dataFile);
         ObjectOutput obOutp = new ObjectOutputStream(outp);
         obOutp.writeObject(yytable);
@@ -153,10 +153,10 @@
         obOutp.close();
 
         String hash = new Long(checkhash(yytable, yycheck)).toString() + "L";
-        partsList.push(hash);
-        String[] parts = (String[])partsList.getArray(String.class);
+        parts.push(hash);
 
-        FileSugar.setText(parseFile, E.toString(ParseQExpr.substitute(parts)));
+        FileSugar.setText(parseFile,
+                          E.toString(ParseQExpr.substitute(parts.snapshot())));
         System.out.println("parser generated");
     }
 }



1.3       +6 -6      e/src/jsrc/org/quasiliteral/text/Substituter.java

Index: Substituter.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/text/Substituter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Substituter.java	2001/12/10 20:30:10	1.2
+++ Substituter.java	2001/12/22 05:46:10	1.3
@@ -123,7 +123,7 @@
      * 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) {
+    public ConstList matchBind(ConstList args, Object specimen) {
         Twine specstr = (Twine)E.as(specimen, Twine.class);
         int s = 0;  //index into specimen
         FlexList flex = FlexList.fromType(Twine.class, myMatchSize);
@@ -179,7 +179,7 @@
     /**
      *
      */
-    public boolean matchBind(Object[] args,
+    public boolean matchBind(ConstList args,
                              Object specimen,
                              FlexList bindings) {
         ConstList binds = matchBind(args, specimen);
@@ -201,7 +201,7 @@
      * the iPtr[0]'th segment, and modify iPtr[0] to be the following
      * segment number.
      */
-    private ConstList optSequence(int[] iPtr, Object[] args) {
+    private ConstList optSequence(int[] iPtr, ConstList args) {
         FlexList flex = FlexList.make();
         int startPos = iPtr[0];
         for (; iPtr[0] < myTemplate.length; iPtr[0]++) {
@@ -211,7 +211,7 @@
             } else {
                 int index = ((Integer)seg).intValue();
                 if (index >= 0) {
-                    flex.push(args[index]);
+                    flex.push(args.get(index));
                 } else {
                     break;
                 }
@@ -231,7 +231,7 @@
      * the iPtr[0]'th segment, and modify iPtr[0] to be the following
      * segment number.
      */
-    private Twine optSegments(int[] iPtr, Object[] args) {
+    private Twine optSegments(int[] iPtr, ConstList args) {
         ConstList sequence = optSequence(iPtr, args);
         if (null == sequence) {
             return null;
@@ -247,7 +247,7 @@
     /**
      * Evaluate as a quasi-literal by replacing ${i} with args[i], for all i
      */
-    public Object substitute(Object[] args) {
+    public Object substitute(ConstList args) {
         int[] iPtr = { 0 };
         ConstList list = optSequence(iPtr, args);
         if (null == list || iPtr[0] != myTemplate.length) {