[e-cvs] cvs commit: e/src/jsrc/org/quasiliteral/term Functor.java SimpleTermBuilder.java Term.java TermBuilder.java TermLexer.java TermParser.java ToFunctor.java ToLiteral.java ToTerm.java ToTermList.java term.y

markm@eros.cs.jhu.edu markm@eros.cs.jhu.edu
Tue, 27 Nov 2001 02:27:55 -0500


markm       01/11/27 02:27:55

  Modified:    src      Makefile
               src/jsrc/antlr/actions/sather ActionLexer.java
               src/jsrc/org/erights/e/elang/syntax ELexer.java
               src/jsrc/org/erights/e/elib/tables CompositeTwine.java
                        EmptyTwine.java
               src/jsrc/org/erights/e/ui/elmer EInterpAdapter.java
               src/jsrc/org/quasiliteral/astro Astro.java
                        AstroLexerSharedInputState.java AstroToken.java
               src/jsrc/org/quasiliteral/term Functor.java
                        SimpleTermBuilder.java Term.java TermBuilder.java
                        TermLexer.java TermParser.java ToFunctor.java
                        ToLiteral.java ToTerm.java ToTermList.java term.y
  Added:       src/jsrc/org/quasiliteral/astro AstroSchema.java
                        AstroTag.java BaseSchema.java
  Removed:     src/jsrc/org/quasiliteral/quasiterm ArgHole.java AtHole.java
                        BaseHole.java DollarHole.java QuasiFunctor.java
                        QuasiNode.java QuasiTerm.java QuasiTermBuilder.java
  Log:
  Steps towards the next term tree reform.  Not a working state.

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

Index: Makefile
===================================================================
RCS file: /cvs/e/src/Makefile,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -r1.124 -r1.125
--- Makefile	2001/11/19 19:15:34	1.124
+++ Makefile	2001/11/27 07:27:53	1.125
@@ -7,8 +7,8 @@
 
 # Prefix tagging this release's attributes
 PREFIX=E
-DOTVER=0.8.10gamma3
-TAGVER=0_8_10gamma3
+DOTVER=0.8.10gamma4
+TAGVER=0_8_10gamma4
 RELEASE=working
 
 TOP=..



1.4       +107 -107  e/src/jsrc/antlr/actions/sather/ActionLexer.java

Index: ActionLexer.java
===================================================================
RCS file: /cvs/e/src/jsrc/antlr/actions/sather/ActionLexer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ActionLexer.java	2001/10/26 03:08:57	1.3
+++ ActionLexer.java	2001/11/27 07:27:53	1.4
@@ -44,10 +44,10 @@
     Text related translations
 
 	%append(x)	-> text := text.append(x)
-	%setText(x)	-> text := text.substring( 0, sa_begin ) 
+	%setText(x)	-> text := text.substring( 0, sa_begin )
                            text := text.append(x)
 	%getText	-> text.substring( sa_begin, text.length - sa_begin )
-	%setToken(x)	-> sa_token := x
+	%setOptToken(x)	-> sa_token := x
 	%setType(x)	-> sa_ttype := x
  */
 public class ActionLexer extends antlr.CharScanner implements ActionLexerTokenTypes, TokenStream
@@ -117,7 +117,7 @@
 					if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
 				else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());}
 				}
-				
+
 				if ( _returnToken==null ) continue tryAgain; // found SKIP token
 				_ttype = _returnToken.getType();
 				_returnToken.setType(_ttype);
@@ -142,7 +142,7 @@
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = ACTION;
 		int _saveIndex;
-		
+
 		{
 		int _cnt3=0;
 		_loop3:
@@ -207,12 +207,12 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mSTUFF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = STUFF;
 		int _saveIndex;
-		
+
 		switch ( LA(1)) {
 		case '(':
 		{
@@ -244,14 +244,14 @@
 					else {
 						break _loop7;
 					}
-					
+
 				} while (true);
 				}
 				match("*)");
 			}
 			else {
 			}
-			
+
 			}
 			break;
 		}
@@ -272,7 +272,7 @@
 					else {
 						break _loop10;
 					}
-					
+
 				} while (true);
 				}
 				{
@@ -288,13 +288,13 @@
 				else {
 					throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 				}
-				
+
 				}
 				newline();
 			}
 			else {
 			}
-			
+
 			}
 			break;
 		}
@@ -368,7 +368,7 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mAST_ITEM(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = AST_ITEM;
@@ -376,7 +376,7 @@
 		Token t=null;
 		Token id=null;
 		Token ctor=null;
-		
+
 		if ((LA(1)=='@') && (LA(2)=='(')) {
 			_saveIndex=text.length();
 			match('@');
@@ -390,10 +390,10 @@
 			text.setLength(_saveIndex);
 			mID(true);
 			id=_returnToken;
-			
+
 					String idt = id.getText();
 					text.setLength(_begin); text.append(generator.mapTreeId(idt,transInfo));
-					
+
 			{
 			if ((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2)))) {
 				{
@@ -417,7 +417,7 @@
 			}
 			else {
 			}
-			
+
 			}
 		}
 		else if ((LA(1)=='@') && (LA(2)=='[')) {
@@ -429,12 +429,12 @@
 		}
 		else if ((LA(1)=='@') && (LA(2)=='@')) {
 			match("@@");
-			
+
 					String r=currentRule.getRuleName()+"_AST"; text.setLength(_begin); text.append(r);
 					if ( transInfo!=null ) {
 						transInfo.refRuleRoot=r;	// we ref root of tree
 					}
-					
+
 			{
 			if ((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2)))) {
 				{
@@ -458,20 +458,20 @@
 			}
 			else {
 			}
-			
+
 			}
 		}
 		else {
 			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 		}
-		
+
 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
 			_token = makeToken(_ttype);
 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mTEXT_ITEM(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = TEXT_ITEM;
@@ -480,16 +480,16 @@
 		Token a2=null;
 		Token a3=null;
 		Token a4=null;
-		
+
 		if ((LA(1)=='%') && (LA(2)=='a')) {
 			match("%append(");
 			mTEXT_ARG(true);
 			a1=_returnToken;
 			match(')');
-			
-						String t = "text := text.append("+a1.getText()+")"; 
+
+						String t = "text := text.append("+a1.getText()+")";
 						text.setLength(_begin); text.append(t);
-					
+
 		}
 		else if ((LA(1)=='%') && (LA(2)=='s')) {
 			match("%set");
@@ -499,60 +499,60 @@
 				mTEXT_ARG(true);
 				a2=_returnToken;
 				match(')');
-				
+
 							String t;
 							t = "text := text.substring( 0, sa_begin ) + " + a2.getText();
 							text.setLength(_begin); text.append(t);
-							
+
 			}
 			else if ((LA(1)=='T') && (LA(2)=='o')) {
 				match("Token(");
 				mTEXT_ARG(true);
 				a3=_returnToken;
 				match(')');
-				
+
 							String t="_token = "+a3.getText();
 							text.setLength(_begin); text.append(t);
-							
+
 			}
 			else if ((LA(1)=='T') && (LA(2)=='y')) {
 				match("Type(");
 				mTEXT_ARG(true);
 				a4=_returnToken;
 				match(')');
-				
+
 							String t="sa_ttype := "+a4.getText();
 							text.setLength(_begin); text.append(t);
-							
+
 			}
 			else {
 				throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 			}
-			
+
 			}
 		}
 		else if ((LA(1)=='%') && (LA(2)=='g')) {
 			match("%getText");
-			
+
 						text.setLength(_begin); text.append("text.substring( sa_begin, text.length - sa_begin )");
-					
+
 		}
 		else {
 			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 		}
-		
+
 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
 			_token = makeToken(_ttype);
 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mSTRING(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = STRING;
 		int _saveIndex;
-		
+
 		match('"');
 		{
 		_loop86:
@@ -612,12 +612,12 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mCHAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = CHAR;
 		int _saveIndex;
-		
+
 		match('\'');
 		{
 		switch ( LA(1)) {
@@ -674,19 +674,19 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mTREE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = TREE;
 		int _saveIndex;
 		Token t=null;
 		Token t2=null;
-		
+
 			StringBuffer buf = new StringBuffer();
 			int n=0;
 			Vector terms = new Vector(10);
-		
-		
+
+
 		_saveIndex=text.length();
 		match('(');
 		text.setLength(_saveIndex);
@@ -815,7 +815,7 @@
 			else {
 				break _loop26;
 			}
-			
+
 		} while (true);
 		}
 		text.setLength(_begin); text.append(generator.getASTCreateString(terms));
@@ -828,12 +828,12 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mID(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = ID;
 		int _saveIndex;
-		
+
 		{
 		switch ( LA(1)) {
 		case 'a':  case 'b':  case 'c':  case 'd':
@@ -929,7 +929,7 @@
 			else {
 				break _loop80;
 			}
-			
+
 		} while (true);
 		}
 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
@@ -938,12 +938,12 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = WS;
 		int _saveIndex;
-		
+
 		{
 		int _cnt106=0;
 		_loop106:
@@ -970,7 +970,7 @@
 			else {
 				if ( _cnt106>=1 ) { break _loop106; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());}
 			}
-			
+
 			_cnt106++;
 		} while (true);
 		}
@@ -980,34 +980,34 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mVAR_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = VAR_ASSIGN;
 		int _saveIndex;
-		
+
 		match(":=");
-		
+
 				// inform the code generator that an assignment was done to
 				// AST root for the rule if invoker set refRuleRoot.
 				if ( transInfo!=null && transInfo.refRuleRoot!=null ) {
 					transInfo.assignToRoot=true;
 				}
-				
+
 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
 			_token = makeToken(_ttype);
 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mAST_CONSTRUCTOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = AST_CONSTRUCTOR;
 		int _saveIndex;
 		Token x=null;
 		Token y=null;
-		
+
 		_saveIndex=text.length();
 		match('[');
 		text.setLength(_saveIndex);
@@ -1149,25 +1149,25 @@
 		_saveIndex=text.length();
 		match(']');
 		text.setLength(_saveIndex);
-		
+
 				String ys = "";
 				if ( y!=null ) {
 					ys = ","+y.getText();
 				}
 				text.setLength(_begin); text.append(generator.getASTCreateString(null,x.getText()+ys));
-				
+
 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
 			_token = makeToken(_ttype);
 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mTEXT_ARG(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = TEXT_ARG;
 		int _saveIndex;
-		
+
 		{
 		switch ( LA(1)) {
 		case '\t':  case '\n':  case '\r':  case ' ':
@@ -1216,13 +1216,13 @@
 				else {
 					throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 				}
-				
+
 				}
 			}
 			else {
 				if ( _cnt54>=1 ) { break _loop54; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());}
 			}
-			
+
 			_cnt54++;
 		} while (true);
 		}
@@ -1232,13 +1232,13 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mTREE_ELEMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = TREE_ELEMENT;
 		int _saveIndex;
 		Token id=null;
-		
+
 		switch ( LA(1)) {
 		case '(':
 		{
@@ -1308,7 +1308,7 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 /** An ID_ELEMENT can be a func call, array ref, simple var,
  *  or AST label ref.
  */
@@ -1317,7 +1317,7 @@
 		_ttype = ID_ELEMENT;
 		int _saveIndex;
 		Token id=null;
-		
+
 		mID(true);
 		id=_returnToken;
 		{
@@ -1331,7 +1331,7 @@
 		else {
 			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 		}
-		
+
 		}
 		{
 		switch ( LA(1)) {
@@ -1349,7 +1349,7 @@
 			else {
 				throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 			}
-			
+
 			}
 			{
 			switch ( LA(1)) {
@@ -1419,7 +1419,7 @@
 					else {
 						break _loop42;
 					}
-					
+
 				} while (true);
 				}
 				break;
@@ -1526,7 +1526,7 @@
 				else {
 					if ( _cnt47>=1 ) { break _loop47; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());}
 				}
-				
+
 				_cnt47++;
 			} while (true);
 			}
@@ -1542,10 +1542,10 @@
 		case ')':  case '*':  case '+':  case ',':
 		case '-':  case '/':  case ':':  case ']':
 		{
-			
+
 						String t=generator.mapTreeId(id.getText(), transInfo);
 						text.setLength(_begin); text.append(t);
-						
+
 			{
 			if (((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2))))&&(transInfo!=null && transInfo.refRuleRoot!=null)) {
 				{
@@ -1572,7 +1572,7 @@
 			else {
 				throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 			}
-			
+
 			}
 			break;
 		}
@@ -1588,7 +1588,7 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 /** The arguments of a @[...] constructor are text, token type,
  *  or a tree.
  */
@@ -1596,7 +1596,7 @@
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = AST_CTOR_ELEMENT;
 		int _saveIndex;
-		
+
 		if ((LA(1)=='"') && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
 			mSTRING(false);
 		}
@@ -1609,19 +1609,19 @@
 		else {
 			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 		}
-		
+
 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
 			_token = makeToken(_ttype);
 			_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mINT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = INT;
 		int _saveIndex;
-		
+
 		{
 		int _cnt97=0;
 		_loop97:
@@ -1632,7 +1632,7 @@
 			else {
 				if ( _cnt97>=1 ) { break _loop97; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());}
 			}
-			
+
 			_cnt97++;
 		} while (true);
 		}
@@ -1642,12 +1642,12 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mARG(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = ARG;
 		int _saveIndex;
-		
+
 		{
 		switch ( LA(1)) {
 		case '\'':
@@ -1762,7 +1762,7 @@
 			else {
 				break _loop75;
 			}
-			
+
 		} while (true);
 		}
 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
@@ -1771,12 +1771,12 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mTEXT_ARG_ELEMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = TEXT_ARG_ELEMENT;
 		int _saveIndex;
-		
+
 		switch ( LA(1)) {
 		case ':':  case 'A':  case 'B':  case 'C':
 		case 'D':  case 'E':  case 'F':  case 'G':
@@ -1834,13 +1834,13 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mTEXT_ARG_ID_ELEMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = TEXT_ARG_ID_ELEMENT;
 		int _saveIndex;
 		Token id=null;
-		
+
 		mID(true);
 		id=_returnToken;
 		{
@@ -1854,7 +1854,7 @@
 		else {
 			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 		}
-		
+
 		}
 		{
 		switch ( LA(1)) {
@@ -1872,7 +1872,7 @@
 			else {
 				throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 			}
-			
+
 			}
 			{
 			_loop63:
@@ -1889,14 +1889,14 @@
 						else {
 							break _loop62;
 						}
-						
+
 					} while (true);
 					}
 				}
 				else {
 					break _loop63;
 				}
-				
+
 			} while (true);
 			}
 			{
@@ -1940,7 +1940,7 @@
 					else {
 						throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 					}
-					
+
 					}
 					mTEXT_ARG(false);
 					{
@@ -1967,7 +1967,7 @@
 				else {
 					if ( _cnt68>=1 ) { break _loop68; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());}
 				}
-				
+
 				_cnt68++;
 			} while (true);
 			}
@@ -2003,12 +2003,12 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mINT_OR_FLOAT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = INT_OR_FLOAT;
 		int _saveIndex;
-		
+
 		{
 		int _cnt100=0;
 		_loop100:
@@ -2019,7 +2019,7 @@
 			else {
 				if ( _cnt100>=1 ) { break _loop100; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());}
 			}
-			
+
 			_cnt100++;
 		} while (true);
 		}
@@ -2041,7 +2041,7 @@
 				else {
 					break _loop103;
 				}
-				
+
 			} while (true);
 			}
 		}
@@ -2050,7 +2050,7 @@
 		else {
 			throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 		}
-		
+
 		}
 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
 			_token = makeToken(_ttype);
@@ -2058,12 +2058,12 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = ESC;
 		int _saveIndex;
-		
+
 		match('\\');
 		{
 		switch ( LA(1)) {
@@ -2124,7 +2124,7 @@
 				else {
 					throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 				}
-				
+
 				}
 			}
 			else if (((LA(1) >= '\u0003' && LA(1) <= '~')) && (true)) {
@@ -2132,7 +2132,7 @@
 			else {
 				throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 			}
-			
+
 			}
 			break;
 		}
@@ -2150,7 +2150,7 @@
 			else {
 				throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
 			}
-			
+
 			}
 			break;
 		}
@@ -2166,12 +2166,12 @@
 		}
 		_returnToken = _token;
 	}
-	
+
 	protected final void mDIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
 		int _ttype; Token _token=null; int _begin=text.length();
 		_ttype = DIGIT;
 		int _saveIndex;
-		
+
 		matchRange('0','9');
 		if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
 			_token = makeToken(_ttype);
@@ -2179,8 +2179,8 @@
 		}
 		_returnToken = _token;
 	}
-	
-	
+
+
 	private static final long _tokenSet_0_data_[] = { -36988258362376L, 9223372036854775806L, 0L, 0L };
 	public static final BitSet _tokenSet_0 = new BitSet(_tokenSet_0_data_);
 	private static final long _tokenSet_1_data_[] = { 288230376151711744L, 576460745995190270L, 0L, 0L };
@@ -2221,5 +2221,5 @@
 	public static final BitSet _tokenSet_18 = new BitSet(_tokenSet_18_data_);
 	private static final long _tokenSet_19_data_[] = { 576388893205603840L, 576460746532061182L, 0L, 0L };
 	public static final BitSet _tokenSet_19 = new BitSet(_tokenSet_19_data_);
-	
+
 	}



1.66      +6 -3      e/src/jsrc/org/erights/e/elang/syntax/ELexer.java

Index: ELexer.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/syntax/ELexer.java,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- ELexer.java	2001/11/20 12:32:05	1.65
+++ ELexer.java	2001/11/27 07:27:54	1.66
@@ -21,6 +21,7 @@
 
 import org.erights.e.develop.exception.PrintStreamWriter;
 import org.erights.e.elib.eio.TextWriter;
+import org.erights.e.elib.tables.EmptyTwine;
 import org.erights.e.elib.tables.Twine;
 import org.quasiliteral.astro.AstroToken;
 
@@ -277,7 +278,8 @@
     /**
      *
      */
-    /*package*/ void syntaxError(String msg) throws SyntaxException {
+    /*package*/
+    void syntaxError(String msg) throws SyntaxException {
         int start = myOptStartPos;
         if (-1 == start) {
             start = myPos - 1;
@@ -295,7 +297,8 @@
     /**
      * nest defaults to -1, meaning "unknown"
      */
-    /*package*/ void needMore(String msg)
+    /*package*/
+    void needMore(String msg)
       throws NeedMoreException, SyntaxException {
         if (myPartialFlag) {
 
@@ -412,7 +415,7 @@
                 }
             case EOFCHAR:
                 {
-                    return new AstroToken(EParser.EOFTOK, Twine.fromString(""));
+                    return new AstroToken(EParser.EOFTOK, EmptyTwine.THE_ONE);
                 }
             case '\n':
                 {



1.14      +1 -1      e/src/jsrc/org/erights/e/elib/tables/CompositeTwine.java

Index: CompositeTwine.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/CompositeTwine.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- CompositeTwine.java	2001/11/11 00:15:31	1.13
+++ CompositeTwine.java	2001/11/27 07:27:54	1.14
@@ -173,7 +173,7 @@
      *
      */
     /*package*/ Twine infectOneToOne(String str) {
-        Twine result = Twine.fromString("");
+        Twine result = EmptyTwine.THE_ONE;
         int pos = 0;
         for (int i = 0; i < myParts.size(); i++) {
             Twine part = (Twine)myParts.get(i);



1.8       +2 -2      e/src/jsrc/org/erights/e/elib/tables/EmptyTwine.java

Index: EmptyTwine.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elib/tables/EmptyTwine.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- EmptyTwine.java	2001/11/11 00:15:31	1.7
+++ EmptyTwine.java	2001/11/27 07:27:54	1.8
@@ -32,14 +32,14 @@
  *
  * @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
  */
-/*package*/ class EmptyTwine extends Twine {
+public class EmptyTwine extends Twine {
 
     //static private final long serialVersionUID = ???;
 
     /**
      * The canonical instance
      */
-    static /*package*/ final Twine THE_ONE = new EmptyTwine();
+    static public final Twine THE_ONE = new EmptyTwine();
 
     /**
      *



1.41      +1 -1      e/src/jsrc/org/erights/e/ui/elmer/EInterpAdapter.java

Index: EInterpAdapter.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/ui/elmer/EInterpAdapter.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- EInterpAdapter.java	2001/11/10 19:40:52	1.40
+++ EInterpAdapter.java	2001/11/27 07:27:54	1.41
@@ -76,7 +76,7 @@
         String[] args = { "elmer" };
         Properties props = new Properties(System.getProperties());
         try {
-            TwineFeeder sacrificial = new TwineFeeder(Twine.fromString(""));
+            TwineFeeder sacrificial = new TwineFeeder(EmptyTwine.THE_ONE);
             myInterp = InteractiveInterp.make(
               ConstList.fromArray(args),
               ConstMap.fromProperties(props),



1.3       +35 -29    e/src/jsrc/org/quasiliteral/astro/Astro.java

Index: Astro.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/astro/Astro.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Astro.java	2001/11/10 19:40:53	1.2
+++ Astro.java	2001/11/27 07:27:54	1.3
@@ -6,10 +6,15 @@
 import antlr.collections.AST;
 
 /**
- * AST node implementation which stores tokens explicitly. This
- * is handy if you'd rather derive information from tokens on an
+ * AST node implementation which stores tokens explicitly.
+ * <p>
+ * This is handy if you'd rather derive information from tokens on an
  * as-needed basis instead of snarfing data from a token as an AST
  * is being built.
+ * <p>
+ * In keeping with the nature of Antlr ASTs, Astros are mutable.  The
+ * corresponding immutable, Persistent, & PassByCopy type is the
+ * {@link org.quasiliteral.term.Term}.
  *
  * @author <a href="mailto:markm@caplet.com">Mark S Miller</a>
  * @author Based on Danfuzz Bornstein's TokenAST
@@ -19,23 +24,23 @@
     /**
      *
      */
-    private Token myToken;
+    private Token myOptToken;
 
     /**
      * Construct an instance which (at least initially) is not associated
      * with a token.
      */
     public Astro() {
-        myToken = null;
+        myOptToken = null;
     }
 
     /**
      * Construct an instance which is associated with the given token.
      *
-     * @param tok null-ok; the token to associate this instance with
+     * @param optToken The (optional) token to associate this instance with
      */
-    public Astro(Token tok) {
-        initialize(tok);
+    public Astro(Token optToken) {
+        initialize(optToken);
     }
 
     /**
@@ -46,10 +51,10 @@
      * @return non-null; the token text
      */
     public String getText() {
-        if (myToken == null) {
+        if (myOptToken == null) {
             return "";
         } else {
-            return myToken.getText();
+            return myOptToken.getText();
         }
     }
 
@@ -60,10 +65,10 @@
      * @return the token type
      */
     public int getType() {
-        if (myToken == null) {
+        if (myOptToken == null) {
             return Token.INVALID_TYPE;
         } else {
-            return myToken.getType();
+            return myOptToken.getType();
         }
     }
 
@@ -71,29 +76,30 @@
      * Get the token associated with this instance. If there is no token
      * associated with this instance, then this returns <code>null</code>.
      *
-     * @return null-ok; the token associated with this instance or
-     * <code>mull</code> if there is no associated token
+     * @return The token associated with this instance, or <code>mull</code>
+     *         if there is no associated token
      */
-    public Token getToken() {
-        return myToken;
+    public Token getOptToken() {
+        return myOptToken;
     }
 
     /**
      * Set the token associated with this instance.
      *
-     * @param tok null-ok; the new token to associate with this instance
+     * @param optToken The new token (or null) to associate with this
+     *                 instance.
      */
-    public void setToken(Token tok) {
-        myToken = tok;
+    public void setOptToken(Token optToken) {
+        myOptToken = optToken;
     }
 
     /**
      * Initialize this instance with the given token.
      *
-     * @param tok null-ok; the token to associate with this instance
+     * @param optToken the token to associate with this instance
      */
-    public void initialize(Token tok) {
-        myToken = tok;
+    public void initialize(Token optToken) {
+        myOptToken = optToken;
     }
 
     /**
@@ -102,10 +108,10 @@
      * parameters and associate this instance with it.
      *
      * @param type the token type
-     * @param text null-ok; the token text
+     * @param optText The token text, or null
      */
-    public void initialize(int type, String text) {
-        initialize(new CommonToken(type, text));
+    public void initialize(int type, String optText) {
+        initialize(new CommonToken(type, optText));
     }
 
     /**
@@ -120,7 +126,7 @@
      */
     public void initialize(AST ast) {
         if (ast instanceof Astro) {
-            initialize(((Astro)ast).getToken());
+            initialize(((Astro)ast).getOptToken());
         } else {
             initialize(ast.getType(), ast.getText());
         }
@@ -135,10 +141,10 @@
      * @param text the new token text
      */
     public void setText(String text) {
-        if (myToken == null) {
+        if (myOptToken == null) {
             initialize(Token.INVALID_TYPE, text);
         } else {
-            myToken.setText(text);
+            myOptToken.setText(text);
         }
     }
 
@@ -152,10 +158,10 @@
      * @param type the new token type
      */
     public void setType(int type) {
-        if (myToken == null) {
+        if (myOptToken == null) {
             initialize(type, "");
         } else {
-            myToken.setType(type);
+            myOptToken.setType(type);
         }
     }
 



1.3       +2 -2      e/src/jsrc/org/quasiliteral/astro/AstroLexerSharedInputState.java

Index: AstroLexerSharedInputState.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/astro/AstroLexerSharedInputState.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AstroLexerSharedInputState.java	2001/11/10 19:40:53	1.2
+++ AstroLexerSharedInputState.java	2001/11/27 07:27:54	1.3
@@ -23,7 +23,7 @@
      * Construct an instance.
      *
      * @param s the input stream to use
-     * @param url null-ok; the file name to associate with this instance
+     * @param url The file name to associate with this instance
      */
     public AstroLexerSharedInputState(InputStream s, String url) {
         super(s);
@@ -61,7 +61,7 @@
     /**
      * Get the file name of this instance.
      *
-     * @return null-ok; the file name
+     * @return The file name
      */
     public String getSourceURL() {
         return mySourceURL;



1.6       +123 -36   e/src/jsrc/org/quasiliteral/astro/AstroToken.java

Index: AstroToken.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/astro/AstroToken.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AstroToken.java	2001/11/21 10:45:59	1.5
+++ AstroToken.java	2001/11/27 07:27:54	1.6
@@ -4,12 +4,18 @@
 import org.erights.e.elib.base.SourceSpan;
 import org.erights.e.elib.tables.ConstList;
 import org.erights.e.elib.tables.Twine;
+import org.erights.e.elib.tables.EmptyTwine;
+import org.erights.e.elib.prim.E;
+import org.erights.e.elib.ref.Ref;
 import org.quasiliteral.term.Functor;
 
 /**
  * A Kind of Antlr {@link Token} that preserves all the information in a
- * {@link Functor}, except that it uses an int rather that a string for the
- * token-type.
+ * {@link Functor}.
+ * <p>
+ * In keeping with the nature of an Antlr Token, and in order to be usable
+ * from within Antlr itself, AstroToken is mutable, but just mutable enough
+ * to accomodate Antlr.  Specifically, the various values are settable once.
  *
  * @author <a href="mailto:markm@caplet.com">Mark S Miller</a>
  * @author Based on ValueExtentToken by Danfuzz Bornstein
@@ -19,93 +25,174 @@
     /**
      *
      */
+    private AstroTag myOptTag;
+
+    /**
+     *
+     */
     private Twine mySource;
 
     /**
      * Must be a null, {@link Character}, {@link BigInteger}, {@link Double},
-     * {@link String}, or {@link Twine}.
+     * {@link String}, or {@link Twine}.  If not null, then the type must
+     * correspond to the tag.
      */
-    private Object myValue;
+    private Object myOptValue;
 
     /**
-     * Construct an instance. The instance will be of type {@link
-     * #INVALID_TYPE}, and have empty (<code>""</code>, not
-     * <code>null</code>) twine.
+     * Construct an instance.
+     * <p>
+     * The instance will be of type {@link #INVALID_TYPE}, and have empty
+     * (<code>""</code>, not <code>null</code>) source twine.
      */
     public AstroToken() {
-        this(INVALID_TYPE, Twine.fromString(""), null);
+        super();
     }
 
     /**
-     * Construct an instance. The instance will be of type {@link
-     * #INVALID_TYPE}
+     * Makes a token without literal data.
      */
-    public AstroToken(Twine source) {
-        this(INVALID_TYPE, source, null);
+    public AstroToken(AstroTag tag, Twine source) {
+        super(tag.getTypeCode(), source.bare());
+        myOptTag = tag;
+        setSource(source);
+        myOptValue = null;
     }
 
     /**
+     * Makes a token representing 'value' as literal data.
      *
-     */
-    public AstroToken(int ttype, Twine source) {
-        this(ttype, source, null);
-    }
-
-    /**
-     * @param ttype Identifies a token type in a particular grammar or set
+     * @param tag Identifies a token type in a particular grammar or set
      *              of related grammars.
      * @param source The source text this token was extracted from.  To
      *               provide no info, use "" rather than null.
-     * @param value null, {@link Character},
-     *                 {@link BigInteger}, {@link Double},
-     *                 {@link String}, or {@link Twine} calculated from
-     *                 lexing this token
-     */
-    public AstroToken(int ttype, Twine source, Object value) {
-        super(ttype, source.bare());
+     * @param value {@link Character},
+     *              {@link BigInteger}, {@link Double},
+     *              {@link String}, or {@link Twine} calculated from
+     *              lexing this token
+     */
+    public AstroToken(AstroTag tag, Twine source, Object value) {
+        super(tag.getTypeCode(), source.bare());
+        myOptTag = tag;
         setSource(source);
-        myValue = value;
+        myOptValue = value;
+        E.require(Ref.same(tag.getSchema().getOptLiteralDataTag(value),
+                           tag),
+                  "tag mismatch");
     }
 
     /**
      *
      */
-    public Functor asFunctor(ConstList typeNames) {
-        String tag = (String)typeNames.get(getType());
-        return new Functor(tag, mySource, myValue);
+    public AstroTag getTag() {
+        E.require(null != myOptTag, "No tag");
+        return myOptTag;
     }
 
     /**
      *
      */
+    public AstroSchema getSchema() {
+        return myOptTag.getSchema();
+    }
+
+    /**
+     * For when the type-code is already set by generic Antlr code, while
+     * Astro-specific knowledge of the schema comes along later.
+     * <p>
+     * To use this, the type code must already be set, and the tag must not
+     * yet be set.
+     */
+    public void setSchema(AstroSchema schema) {
+        E.require(null == myOptTag, "Tag already set");
+        E.require(INVALID_TYPE != getType(), "Type-code not yet set");
+        myOptTag = schema.getTagForCode(getType());
+    }
+    /**
+     *
+     */
     public Twine getSource() {
         return mySource;
     }
 
     /**
-     *
+     * If 'source' has source-span info, then setSource also sets line and
+     * column.
+     * <p>
+     * If the line&column info are already set, and if 'source' is bare, then
+     * 'setSource' should pick up source-span info from line and column and
+     * apply it to the source.  XXX bug: Currently, however, if line&column
+     * are already set at the time 'setSource' is called, an exception is
+     * thrown.
      */
     public void setSource(Twine source) {
-        mySource = source;
+        E.require(null == mySource, "Source already set");
+        //XXX should we be setting text here?  How should we think about text?
         setText(source.bare());
         SourceSpan optSpan = source.optSourceSpan();
         if (null != optSpan) {
             setLine(optSpan.getStartLine());
             setColumn(optSpan.getStartCol());
         }
+        //do this last to avoid tests in setLine and setColumn
+        mySource = source;
     }
 
     /**
-     *
+     * If this token represents a value as literal data, return that value,
+     * else null.
+     */
+    public Object getOptValue() {
+        return myOptValue;
+    }
+
+    /**
+     * If this token represents a value as literal data, return that value,
+     * else throw an exception.
      */
     public Object getValue() {
-        return myValue;
+        E.require(null != myOptValue, "No value: ", this);
+        return myOptValue;
     }
 
     /**
      *
+     */
+    public Functor asFunctor() {
+        return myOptTag.getSchema().functorFromToken(this);
+    }
+
+    /**
+     * Override to make set-once
+     */
+    public void setType(int t) {
+        E.require(INVALID_TYPE == getType(), "Type-code already set");
+        super.setType(t);
+    }
+
+    /**
+     * Override to make set-once
+     */
+    public void setLine(int l) {
+        E.require(getLine() == 0, "Line already set");
+        E.require(null == mySource, "Source already set");
+        super.setLine(l);
+    }
+
+    /**
+     * Override to make set-once
+     */
+    public void setColumn(int c) {
+        E.require(getColumn() == 0, "Column already set");
+        E.require(null == mySource, "Source already set");
+        super.setColumn(c);
+    }
+
+    /**
+     * Override to make set-once
      */
-    public void setValue(Object value) {
-        myValue = value;
+    public void setText(String s) {
+        E.require(null == text, "Text already set");
+        super.setText(s);
     }
 }



1.1                  e/src/jsrc/org/quasiliteral/astro/AstroSchema.java

Index: AstroSchema.java
===================================================================
package org.quasiliteral.astro;

import org.erights.e.elib.serial.PassByConstruction;
import org.erights.e.elib.serial.Persistent;
import org.erights.e.elib.tables.Twine;
import org.quasiliteral.term.Functor;
import org.quasiliteral.term.Term;
import antlr.Token;
import antlr.collections.AST;

//This file is hereby placed in the public domain

/**
 * Used to describe an Antlr grammar, and provide the means for conversion
 * between the {@link AST} representation and the {@link Term} tree
 * represetation.
 *
 * @author <a href="mailto:markm@caplet.com">Mark Miller</a>
 */
public interface AstroSchema extends PassByConstruction, Persistent {

    /**
     * Returns the tag represented by this type code in the grammar described
     * by this schema
     */
    AstroTag getTagForCode(int typeCode);

    /**
     * Returns the tag represented by this type name in the grammar described
     * by this schema
     */
    AstroTag getTagForName(String typeName);

    /**
     * Gets the tag for representing character literals.
     * <p>
     * The literal data is canonically represented by a Character object.
     */
    AstroTag getLiteralCharTag();

    /**
     * Gets the tag for representing integer literals.
     * <p>
     * The literal data is canonically represented by a BigInteger object.
     */
    AstroTag getLiteralIntegerTag();

    /**
     * Gets the tag for representing floating point literals.
     * <p>
     * The literal data is canonically represented by a Double object.
     */
    AstroTag getLiteralFloat64Tag();

    /**
     * Gets the tag for representing String literals.
     * <p>
     * The literal data is canonically represented by a Twine object.
     */
    AstroTag getLiteralStringTag();

    /**
     * Gets the tag for literally representing the provided data, or null if
     * data is the wrong kind.
     */
    AstroTag getOptLiteralDataTag(Object data);

    /**
     * Gets the tag for literally representing the provided data, or throws
     * if data is the wrong kind.
     */
    AstroTag getLiteralDataTag(Object data);

    /**
     * Converts a leaf from Functor to Token representation.
     */
    Token tokenFromFunctor(Functor functor);

    /**
     * Converts a leaf from Token to Functor representation.
     */
    Functor functorFromToken(Token token);

    /**
     * Converts an inner node from Term to AST representation.
     */
    AST astFromTerm(Term term);

    /**
     * Converts an inner node from AST to Term representation.
     */
    Term termFromAst(AST ast);

    /**
     * Makes a token not representing literal data
     */
    Token newToken(int typeCode, Twine source);

    /**
     * Makes a functor not representing literal data
     */
    Functor newFunctor(int typeCode, Twine source);

    /**
     * Makes a token representing literal data
     */
    Token literalToken(Twine source, Object data);

    /**
     * Makes a functor representing literal data
     */
    Functor literalFunctor(Twine source, Object data);
}



1.1                  e/src/jsrc/org/quasiliteral/astro/AstroTag.java

Index: AstroTag.java
===================================================================
package org.quasiliteral.astro;

import org.erights.e.elib.tables.Selfless;
import org.erights.e.elib.tables.Twine;
import org.erights.e.elib.serial.PassByConstruction;
import org.erights.e.elib.serial.Persistent;

//This file is hereby placed in the public domain

/**
 * Represents both an {@link AstroToken}'s token-type (and enumerated int code
 * specific to a grammar), and a Functor's type=name (the name of that
 * enumerated code in that grammar).
 * <p>
 * The notion of "specific to a grammar" is here abstracted into the notion
 * of an {@link AstroSchema}, within which these type-code/type-names are
 * defined, and that provides the means for translating between the two.
 * <p>
 * AstroTags are AstroSchemas can be used to describe Antlr grammars that use
 * only ASTs and Tokens as well.
 *
 * @author <a href="mailto:markm@caplet.com">Mark Miller</a>
 */
public class AstroTag implements PassByConstruction, Persistent {

    /**
     * The enumerated type code
     */
    private final int myTypeCode;

    /**
     * The name of the enumerated type code.
     */
    private final Twine myTypeName;

    /**
     * The schema of which this tag is a member
     */
    private final AstroSchema mySchema;

    /**
     *
     */
    public AstroTag(int typeCode, Twine typeName, AstroSchema schema) {
        myTypeCode = typeCode;
        myTypeName = typeName;
        mySchema = schema;
    }

    /**
     *
     */
    public int getTypeCode() {
        return myTypeCode;
    }

    /**
     *
     */
    public Twine getTypeName() {
        return myTypeName;
    }

    /**
     *
     */
    public AstroSchema getSchema() {
        return mySchema;
    }
}



1.1                  e/src/jsrc/org/quasiliteral/astro/BaseSchema.java

Index: BaseSchema.java
===================================================================
package org.quasiliteral.astro;

import org.erights.e.elib.tables.Selfless;
import org.erights.e.elib.tables.ConstMap;
import org.erights.e.elib.tables.Twine;
import org.erights.e.elib.tables.FlexList;
import org.erights.e.elib.tables.FlexMap;
import org.erights.e.elib.serial.PassByConstruction;
import org.erights.e.elib.serial.Persistent;
import org.erights.e.elib.prim.E;
import org.erights.e.elib.base.SourceSpan;
import org.quasiliteral.term.Functor;
import org.quasiliteral.term.Term;
import antlr.Token;
import antlr.collections.AST;

import java.math.BigInteger;

//This file is hereby placed in the public domain

/**
 *
 *
 * @author <a href="mailto:markm@caplet.com">Mark Miller</a>
 */
public class BaseSchema implements AstroSchema {

    /**
     *
     */
    private final AstroTag[] myByTypeCodes;

    /**
     * String (not Twine) => AstroTag
     */
    private final ConstMap myByTypeName;

    /**
     *
     */
    private transient AstroTag myOptLiteralCharTag = null;

    /**
     *
     */
    private transient AstroTag myOptLiteralIntegerTag = null;

    /**
     *
     */
    private transient AstroTag myOptLiteralFloat64Tag = null;

    /**
     *
     */
    private transient AstroTag myOptLiteralStringTag = null;

    /**
     *
     */
    public BaseSchema(Twine[] typeNames) {
        FlexList byCodes = FlexList.fromType(AstroTag.class,
                                             typeNames.length);
        FlexMap byNames = FlexMap.fromTypes(String.class,
                                            AstroTag.class,
                                            typeNames.length);
        for (int code = 0; code < typeNames.length; code++) {
            Twine optTypeName = typeNames[code];
            if (null != optTypeName) {
                AstroTag tag = new AstroTag(code, optTypeName, this);
                byCodes.put(code, tag);
                byNames.put(optTypeName.bare(), tag, true);
            }
        }
        myByTypeCodes = (AstroTag[])byCodes.getArray(AstroTag.class);
        myByTypeName = byNames.snapshot();
    }

    /**
     *
     */
    public AstroTag getTagForCode(int typeCode) {
        AstroTag result = myByTypeCodes[typeCode];
        E.requireSI(null != result, "No tag for type code: ", typeCode);
        return result;
    }

    /**
     *
     */
    public AstroTag getTagForName(String typeName) {
        AstroTag result = (AstroTag)myByTypeName.get(typeName, null);
        E.require(null != result, "No tag named: ", typeName);
        return result;
    }

    /**
     * The default implementation provided here just gets the tag whose name
     * is "LiteralChar".
     * <p>
     * May be overridden to describe a grammar with different conventions.
     */
    public AstroTag getLiteralCharTag() {
        if (null == myOptLiteralCharTag) {
            myOptLiteralCharTag = getTagForName("LiteralChar");
        }
        return myOptLiteralCharTag;
    }

    /**
     * The default implementation provided here just gets the tag whose name
     * is "LiteralInteger".
     * <p>
     * May be overridden to describe a grammar with different conventions.
     */
    public AstroTag getLiteralIntegerTag() {
        if (null == myOptLiteralIntegerTag) {
            myOptLiteralIntegerTag = getTagForName("LiteralInteger");
        }
        return myOptLiteralIntegerTag;
    }

    /**
     * The default implementation provided here just gets the tag whose name
     * is "LiteralFloat64".
     * <p>
     * May be overridden to describe a grammar with different conventions.
     */
    public AstroTag getLiteralFloat64Tag() {
        if (null == myOptLiteralFloat64Tag) {
            myOptLiteralFloat64Tag = getTagForName("LiteralFloat64");
        }
        return myOptLiteralFloat64Tag;
    }

    /**
     * The default implementation provided here just gets the tag whose name
     * is "LiteralString".
     * <p>
     * May be overridden to describe a grammar with different conventions.
     */
    public AstroTag getLiteralStringTag() {
        if (null == myOptLiteralStringTag) {
            myOptLiteralStringTag = getTagForName("LiteralString");
        }
        return myOptLiteralStringTag;
    }

    /**
     *
     */
    public AstroTag getOptLiteralDataTag(Object data) {
        if (data instanceof Character) {
            return getLiteralCharTag();

        } else if (data instanceof Number) {
            if (data instanceof Byte ||
              data instanceof Short ||
              data instanceof Integer ||
              data instanceof Long ||
              data instanceof BigInteger)
            {
                return getLiteralIntegerTag();
            } else if (data instanceof Float || data instanceof Double) {
                return getLiteralFloat64Tag();
            }

        } else if (data instanceof String || data instanceof Twine) {
            return getLiteralStringTag();
        }
        //not representable as a literal
        return null;
    }

    /**
     *
     */
    public AstroTag getLiteralDataTag(Object data) {
        AstroTag result = getOptLiteralDataTag(data);
        E.require(null != result, "Not a literal type: ", data.getClass());
        return result;
    }

    /**
     *
     */
    public Token tokenFromFunctor(Functor functor) {
        return new AstroToken(functor.getTag(),
                              functor.getSource(),
                              functor.getValue());
    }

    /**
     *
     */
    public Functor functorFromToken(Token token) {
        if (token instanceof AstroToken) {
            AstroToken at = (AstroToken)token;
            return new Functor(at.getTag(),
                               at.getSource(),
                               at.getOptValue());
        } else {
            AstroTag tag = getTagForCode(token.getType());
            SourceSpan span = new SourceSpan("unknown",
                                             false,
                                             token.getLine(),
                                             token.getColumn(),
                                             token.getLine(),
                                             token.getColumn());
            return new Functor(tag,
                               Twine.fromString(token.getText(), span),
                               null);
        }
    }

    /**
     *
     */
    public AST astFromTerm(Term term) {
        throw new RuntimeException("XXX not yet implemented");
    }

    /**
     *
     */
    public Term termFromAst(AST ast) {
        throw new RuntimeException("XXX not yet implemented");
    }

    /**
     *
     */
    public Token newToken(int typeCode, Twine source) {
        return new AstroToken(getTagForCode(typeCode), source);
    }

    /**
     *
     */
    public Functor newFunctor(int typeCode, Twine source) {
        return new Functor(getTagForCode(typeCode), source);
    }

    /**
     *
     */
    public Token literalToken(Twine source, Object data) {
        return new AstroToken(getLiteralDataTag(data), source, data)
    }

    /**
     *
     */
    public Functor literalFunctor(Twine source, Object data) {
        return new Functor(getLiteralDataTag(data), source, data)
    }
}



1.11      +43 -118   e/src/jsrc/org/quasiliteral/term/Functor.java

Index: Functor.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/Functor.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Functor.java	2001/11/21 14:21:32	1.10
+++ Functor.java	2001/11/27 07:27:54	1.11
@@ -13,7 +13,10 @@
 import org.erights.e.elib.tables.ConstMap;
 import org.erights.e.elib.tables.Selfless;
 import org.erights.e.elib.tables.Twine;
+import org.erights.e.elib.tables.EmptyTwine;
+import org.erights.e.elib.ref.Ref;
 import org.quasiliteral.astro.AstroToken;
+import org.quasiliteral.astro.AstroTag;
 
 import java.math.BigInteger;
 
@@ -51,7 +54,7 @@
     /**
      * @serial The name of an Antlr token type int in a particular grammar.
      */
-    private final String myTag;
+    private final AstroTag myTag;
 
     /**
      * @serial The source text corresponding to the original source of the
@@ -60,112 +63,51 @@
     private final Twine mySource;
 
     /**
-     * Indicates the type of myValue.
-     * <pre>
-     *   If myValue is      myValueType is
-     *       null              -1
-     *       a Character       TermParser.LiteralChar
-     *       a BigInteger      TermParser.LiteralInteger
-     *       a Double          TermParser.LiteralFloat64
-     *       a Twine           TermParser.LiteralString
-     * </pre>
+     * @serial null, {@link Character}, {@link BigInteger}, {@link Double},
+     * or {@link Twine} calculated from lexing the token
      */
-    private final int myValueType;
+    private final Object myOptValue;
 
     /**
-     * @serial null, {@link Character}, {@link BigInteger}, {@link Double},
-     * or {@link Twine} calculated from lexing the token
+     * A Functor that represents a token other than literal data in a
+     * particular grammar.
+     *
+     * @param tag Represents a token type in a particular grammar.
+     * @param source The source text corresponding to the original source of
+     *               the token, although it isn't necessarily the same as the
+     *               original source text.  In any case, its source span
+     *               information says what positions in the original source
+     *               it corresponds to. This is not part of the normal
+     *               printed form.
      */
-    private final Object myValue;
+    public Functor(AstroTag tag, Twine source) {
+        myTag = tag;
+        mySource = source;
+    }
 
     /**
-     * @param tag The name of an Antlr token type int in a particular
-     *             grammar.  Must be an identifier.  Printed only if not
-     *             implied by value.
+     * A Functor that represents literal data in a particular grammar.
+     *
+     * @param tag Represents a token type in a particular grammar.
      * @param source The source text corresponding to the original source of
      *               the token, although it isn't necessarily the same as the
      *               original source text.  In any case, its source span
      *               information says what positions in the original source
      *               it corresponds to. This is not part of the normal
      *               printed form.
-     * @param value null, {@link Character},
-     *                 {@link BigInteger} or other integral {@link Number},
+     * @param value {@link Character},
+     *                 {@link BigInteger} or other integral {@link Number}s,
      *                 {@link Double} or {@link Float}, or
      *                 {@link Twine} or {@link String}
      *                 If non-null, is always part of the normal printed
      *                 form.
      */
-    public Functor(String tag, Twine source, Object value) {
-        if (!TermLexer.isIdentifier(tag)) {
-            throw new RuntimeException("Must be an identifier: " + tag);
-        }
+    public Functor(AstroTag tag, Twine source, Object value) {
         myTag = tag;
         mySource = source;
-        myValueType = Converter.literalType(value);
-        switch (myValueType) {
-            case -1: {
-                myValue = null;
-                break;
-            }
-            case TermParser.LiteralChar: {
-                myValue = (Character)value;
-                break;
-            }
-            case TermParser.LiteralInteger: {
-                if (value instanceof BigInteger) {
-                    myValue = value;
-                } else {
-                    myValue = BigInteger.valueOf(((Number)value).longValue());
-                }
-                break;
-            }
-            case TermParser.LiteralFloat64: {
-                if (value instanceof Double) {
-                    myValue = value;
-                } else {
-                    myValue = new Double(((Float)value).doubleValue());
-                }
-                break;
-            }
-            case TermParser.LiteralString: {
-                if (value instanceof Twine) {
-                    myValue = value;
-                } else {
-                    myValue = Twine.fromString((String)value);
-                }
-                break;
-            }
-            default: {
-                throw new RuntimeException
-                  ("Unrecognized value type: " +
-                   ClassDesc.typeSig(value.getClass()));
-            }
-        }
-    }
-
-    /**
-     * Convert from an Antlr {@link Token}.
-     * <p>
-     * If token is an AstroToken, this just does token.asFunctor(typeNames),
-     * in which case equivalence should be preserved.
-     */
-    static public Functor fromToken(Token token,
-                                    String url,
-                                    ConstList typeNames) {
-        if (token instanceof AstroToken) {
-            return ((AstroToken)token).asFunctor(typeNames);
-        } else {
-            String tokenType = (String)typeNames.get(token.getType());
-            SourceSpan span = new SourceSpan(url,
-                                             false,
-                                             token.getLine(),
-                                             token.getColumn(),
-                                             token.getLine(),
-                                             token.getColumn());
-            return new Functor(tokenType,
-                               Twine.fromString(token.getText(), span),
-                               null);
-        }
+        myOptValue = value;
+        E.require(Ref.same(tag.getSchema().getOptLiteralDataTag(value),
+                           tag));
     }
 
     /**
@@ -173,9 +115,8 @@
      * <p>
      * This should be compatible with Antlr code that just assumes a Token.
      */
-    public AstroToken asToken(ConstMap typeNums) {
-        int tokenTypeInt = E.asInt(typeNums.get(myTag));
-        return new AstroToken(tokenTypeInt, mySource, myValue);
+    public Token asToken(ConstMap typeNums) {
+        return myTag.getSchema().tokenFromFunctor(this);
     }
 
     /**
@@ -186,7 +127,7 @@
      * of this Functor.
      */
     public Object build(TermBuilder builder) {
-        if (null == myValue) {
+        if (null == myOptValue) {
             return builder.functor(new AstroToken(TermParser.ID,
                                                   mySource,
                                                   myTag),
@@ -195,14 +136,14 @@
             return builder.functor(null,
                                    new AstroToken(myValueType,
                                                   mySource,
-                                                  myValue));
+                                                  myOptValue));
         } else {
             return builder.functor(new AstroToken(TermParser.ID,
-                                                  Twine.fromString(""),
+                                                  EmptyTwine.THE_ONE,
                                                   myTag),
                                    new AstroToken(myValueType,
                                                   mySource,
-                                                  myValue));
+                                                  myOptValue));
         }
     }
 
@@ -211,7 +152,7 @@
      */
     public Object[] getCanonicalState() {
         Object[] result = {
-            FunctorMaker, "new", myTag, mySource, myValue
+            FunctorMaker, "new", myTag, mySource, myOptValue
         };
         return result;
     }
@@ -219,7 +160,7 @@
     /**
      * An identifier typically representing a type of AST node.
      */
-    public String getTag() {
+    public AstroTag getTag() {
         return myTag;
     }
 
@@ -241,23 +182,7 @@
      * return a corresponding BigInteger.
      */
     public Object getValue() {
-        return myValue;
-    }
-
-    /**
-     * Indicates the type of getValue().
-     * <pre>
-     *   If getValue() is  getValueType() is
-     *       null              -1
-     *       a Character       TermParser.LiteralChar
-     *       a BigInteger      TermParser.LiteralInteger
-     *       a Double          TermParser.LiteralFloat64
-     *       a String          TermParser.LiteralString
-     *       a Twine           TermParser.LiteralString
-     * </pre>
-     */
-    public int getValueType() {
-        return myValueType;
+        return myOptValue;
     }
 
     /**
@@ -273,7 +198,7 @@
         if (0.0 != result) {
             return result;
         }
-        return E.asFloat64(E.call(myValue, "compareTo", ofunctor.myValue));
+        return E.asFloat64(E.call(myOptValue, "compareTo", ofunctor.myOptValue));
     }
 
     /**
@@ -295,10 +220,10 @@
      *
      */
     public String toString(boolean quasiFlag) {
-        if (null == myValue) {
-            return myTag;
+        if (null == myOptValue) {
+            return myTag.getTypeName().bare();
         }
-        String valueStr = E.toQuote(myValue).bare();
+        String valueStr = E.toQuote(myOptValue).bare();
         if (quasiFlag) {
             valueStr = StringHelper.replaceAll(valueStr, "$", "$$");
             valueStr = StringHelper.replaceAll(valueStr, "@", "@@");



1.8       +4 -4      e/src/jsrc/org/quasiliteral/term/SimpleTermBuilder.java

Index: SimpleTermBuilder.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/SimpleTermBuilder.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SimpleTermBuilder.java	2001/11/21 10:46:00	1.7
+++ SimpleTermBuilder.java	2001/11/27 07:27:54	1.8
@@ -61,12 +61,12 @@
     }
 
     /**
-     * @param fnctr :Functor
+     * @param functor :Functor
      * @param args :[Term*]
      * @return :Term
      */
-    public Object term(Object fnctr, Object args) {
-        return new Term((Functor)fnctr, (ConstList)args);
+    public Object term(Object functor, Object args) {
+        return new Term((Functor)functor, (ConstList)args);
     }
 
     /**
@@ -122,7 +122,7 @@
     /**
      * Not applicable -- doesn't do quasis.
      */
-    public Object termHole(Object optIdent, Object fnctrHole) {
+    public Object termHole(Object optIdent, Object functorHole) {
         throw new RuntimeException("No holes, not quasi parsing");
     }
 



1.7       +8 -6      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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Term.java	2001/11/21 14:21:32	1.6
+++ Term.java	2001/11/27 07:27:54	1.7
@@ -79,19 +79,21 @@
     static public Term fromAST(AST ast,
                                String url,
                                ConstList typeNames) {
-        Token token;
+        Token optToken = null;
         if (ast instanceof Astro) {
-            token = ((Astro)ast).getToken();
-        } else {
-            token = new CommonToken(ast.getType(), ast.getText());
+            optToken = ((Astro)ast).getOptToken();
         }
+        if (null == optToken) {
+            optToken = new CommonToken(ast.getType(), ast.getText());
+        }
         FlexList args = FlexList.fromType(Term.class);
         for (AST arg = ast.getFirstChild();
              null != arg;
-             arg = arg.getNextSibling()) {
+             arg = arg.getNextSibling())
+        {
             args.push(Term.fromAST(arg, url, typeNames));
         }
-        return new Term(Functor.fromToken(token, url, typeNames),
+        return new Term(Functor.fromToken(optToken, url, typeNames),
                         args.snapshot());
     }
 



1.7       +76 -54    e/src/jsrc/org/quasiliteral/term/TermBuilder.java

Index: TermBuilder.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/TermBuilder.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TermBuilder.java	2001/11/21 10:46:00	1.6
+++ TermBuilder.java	2001/11/27 07:27:54	1.7
@@ -1,5 +1,6 @@
 package org.quasiliteral.term;
 
+import org.quasiliteral.astro.AstroToken;
 
 
 /**
@@ -49,6 +50,27 @@
     boolean doesQuasis();
 
     /**
+     * The term 'functor(args...)'
+     *
+     * @param functor :PFunctor
+     * @param args :PArgs
+     * @return :PTerm
+     */
+    Object term(Object functor, Object args);
+
+    /**
+     * Promotes a functor-hole to a term-hole.
+     * <p>
+     * If the optIdent is provided, then it constrains the hole to only match
+     * Terms whose functor has that tag.
+     *
+     * @param optIdent :(AstroToken(ID) | null)
+     * @param functorHole :PFunctorHole
+     * @return :PTermHole
+     */
+    Object termHole(AstroToken optIdent, Object functorHole);
+
+    /**
      * The empty args list
      *
      * @return :PArgs
@@ -74,37 +96,8 @@
      */
     Object argList(Object list, Object next);
 
-    /**
-     * The term 'fnctr(args...)'
-     *
-     * @param fnctr :PFunctor
-     * @param args :PArgs
-     * @return :PTerm
-     */
-    Object term(Object fnctr, Object args);
-
-    /**
-     * Returns a representation of the functor whose type tag is optIdent's
-     * value, and whose value is optLit's value.
-     * <p>
-     * At least one of optIdent and optLit must not be null.  If optIdent is
-     * null and optLit is literal, optIdent defaults to the tag of the
-     * name of optLit's literal type.  If optLit is null, then, in a pattern,
-     * it means "don't-care".  In a non-pattern usage, null just means
-     * "no-data".
-     * <p>
-     * If optLit is a hole, then optIdent must be provided, and optLit remains
-     * a hole for literal data.  (The promotion of a lit-hole to a
-     * functor-hole is handled separately by functorHole/1.)
-     *
-     * @param optIdent :(AstroToken(ID) | null)
-     * @param optLit :(PLit | PLitHole | null)
-     * @return :PFunctor
-     */
-    Object functor(Object optIdent, Object optLit);
-
     /**
-     * Promotes a term-hole to an arg-hole, which represents a sequence of
+     * Promotes a term or term-hole to an arg, which represents a sequence of
      * terms.
      * <p>
      * An element of an args list may be an optional term or term-hole
@@ -115,55 +108,84 @@
      * specimen, within the constraints of the quantity indicator and
      * the term-hole's optional type tag.
      *
-     * @param optTerm :(PTermHole | null)
-     * @param quant :AstroToken('?', '+', or '*')
+     * @param optTerm :(PTerm | null)
+     * @param quant :("?" | "+" | "*" | ".")
      * @return :PArg
      */
-    Object argHole(Object optTerm, Object quant);
+    Object arg(Object optTerm, String quant);
 
     /**
-     * Promotes a functor-hole to a term-hole.
-     * <p>
-     * If the optIdent is provided, then it constrains the hole to only match
-     * Terms whose functor has that tag.
      *
-     * @param optIdent :(AstroToken(ID) | null)
-     * @param fnctrHole :PFunctorHole
-     * @return :PTermHole
      */
-    Object termHole(Object optIdent, Object fnctrHole);
+    Object argGroup(Object args, String quant);
 
     /**
-     * Promotes a literal-hole to a functor-hole.
-     * <p>
-     * @param litHole :PLitHole
-     * @return :PFunctorHole
+     * Returns a representation of the functor whose type tag is ident's
+     * value.
+     *
+     * @param optIdent :AstroToken(ID)
+     * @return :PFunctor
+     */
+    Object tag(AstroToken ident);
+
+    /**
+     * Returns a representation of the functor that represents this literal
+     * character (actually represented as a Character).
+     *
+     * @param lit :AstroToken(LiteralChar)
+     * @return :PFunctor
+     */
+    Object litChar(AstroToken lit);
+
+    /**
+     * Returns a representation of the functor that represents this literal
+     * (precision unlimited) integer (actually represented as a BigInteger).
+     *
+     * @param lit :AstroToken(LiteralInteger)
+     * @return :PFunctor
+     */
+    Object litInteger(AstroToken lit);
+
+    /**
+     * Returns a representation of the functor that represents this literal
+     * IEEE double precision floating point number (actually represented as a
+     * Double).
+     *
+     * @param lit :AstroToken(LiteralFloat64)
+     * @return :PFunctor
+     */
+    Object litFloat64(AstroToken lit);
+
+    /**
+     * Returns a representation of the functor that represents this literal
+     * string (actually represented as a Twine).
+     *
+     * @param lit :AstroToken(LiteralString)
+     * @return :PFunctor
      */
-    Object functorHole(Object litHole);
+    Object litString(AstroToken lit);
 
     /**
      * A dollar-hole corresponds to an extracted expression whose value
      * should be substituted in at runtime.
      * <p>
-     * As returned by dollarHole, this starts as a literal-hole (a hole
-     * representing literal data), but will often get promoted to another
-     * kind of hole.
+     * As returned by dollarHole, this starts as a functor-hole, but will
+     * often get promoted to another kind of hole.
      *
      * @param index :AstroToken(LiteralInteger)
      * @return :PLitHole
      */
-    Object dollarHole(Object index);
+    Object dollarHole(AstroToken index);
 
     /**
      * An at-hole corresponds to an extracted pattern to be matched against
      * the corresponding part of the specimen at runtime.
      * <p>
-     * As returned by dollarHole, this starts as a literal-hole (a hole
-     * representing literal data), but will often get promoted to another
-     * kind of hole.
+     * As returned by atHole, this starts as a functor-hole, but will
+     * often get promoted to another kind of hole.
      *
      * @param index :AstroToken(LiteralInteger)
      * @return :PLitHole
      */
-    Object atHole(Object index);
+    Object atHole(AstroToken index);
 }



1.7       +3 -1      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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TermLexer.java	2001/11/21 10:46:00	1.6
+++ TermLexer.java	2001/11/27 07:27:54	1.7
@@ -9,6 +9,7 @@
 import org.erights.e.elang.syntax.TwineFeeder;
 import org.erights.e.elib.eio.TextWriter;
 import org.erights.e.elib.tables.Twine;
+import org.erights.e.elib.tables.EmptyTwine;
 import org.quasiliteral.astro.AstroToken;
 
 import java.io.BufferedReader;
@@ -302,7 +303,8 @@
                 }
             case EOFCHAR:
                 {
-                    return new AstroToken(TermParser.EOFTOK, Twine.fromString(""));
+                    return new AstroToken(TermParser.EOFTOK,
+                                          EmptyTwine.THE_ONE);
                 }
             case '(':
                 {



1.7       +139 -105  e/src/jsrc/org/quasiliteral/term/TermParser.java

Index: TermParser.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/TermParser.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TermParser.java	2001/11/20 12:32:07	1.6
+++ TermParser.java	2001/11/27 07:27:54	1.7
@@ -155,54 +155,58 @@
 public final static short LiteralString=261;
 public final static short YYERRCODE=256;
 final static short yylhs[] = {                           -1,
-    0,    2,    2,    3,    3,    4,    4,    4,    5,    5,
-    5,    1,    1,    1,    1,    1,    6,    6,    6,    6,
-    7,    8,    8,    8,    8,    9,    9,
+    0,    1,    1,    1,    1,    1,    3,    3,    5,    5,
+    6,    6,    7,    7,    7,    7,    7,    7,    8,    8,
+    8,    2,    2,    2,    2,    2,    4,    4,
 };
 final static short yylen[] = {                            2,
-    1,    0,    1,    1,    3,    1,    2,    1,    1,    1,
-    1,    1,    4,    4,    1,    2,    1,    1,    3,    3,
-    1,    1,    1,    1,    1,    4,    4,
+    1,    1,    4,    4,    1,    2,    0,    1,    1,    3,
+    1,    3,    1,    2,    1,    1,    4,    2,    1,    1,
+    1,    1,    1,    1,    1,    1,    4,    4,
 };
 final static short yydefred[] = {                         0,
-    0,   22,   23,   24,   25,    0,    0,    0,    1,    0,
-    0,   17,   21,    0,   16,    0,    0,    0,    0,   19,
-   20,    0,    0,    9,   10,   11,    0,    0,    0,    4,
-    8,    0,   26,   27,    7,   13,    0,   14,    5,
+    0,   23,   24,   25,   26,    0,    0,    0,    1,    0,
+    0,    6,    0,    0,    0,    0,    0,    0,    0,   16,
+    0,   19,   20,   21,    0,    0,    0,    0,   11,   15,
+    0,   27,   28,    0,   18,   14,    3,    0,    0,    4,
+    0,    0,   12,   17,
 };
 final static short yydgoto[] = {                          8,
-   27,   28,   29,   30,   31,   10,   11,   12,   13,
+   25,   10,   26,   11,   27,   28,   29,   30,
 };
 final static short yysindex[] = {                       -31,
-  -34,    0,    0,    0,    0, -120, -119,    0,    0,  -26,
-  -25,    0,    0,  -27,    0, -242, -241,  -36,  -36,    0,
-    0, -106, -105,    0,    0,    0,  -32,  -20,  -22,    0,
-    0,  -18,    0,    0,    0,    0,  -36,    0,    0,
+  -34,    0,    0,    0,    0, -114, -110,    0,    0,  -17,
+  -16,    0, -233, -230,  -36,  -36,  -94,  -93,  -36,    0,
+ -227,    0,    0,    0,  -27,   -6,   -7,  -86,    0,    0,
+   -2,    0,    0,  -24,    0,    0,    0,  -36,  -36,    0,
+  -27,  -86,    0,    0,
 };
 final static short yyrindex[] = {                         0,
     1,    0,    0,    0,    0,    0,    0,    0,    0,    8,
-   12,    0,    0,    0,    0,    0,    0,  -16,  -16,    0,
-    0,    0,    0,    0,    0,    0,  -28,    0,  -15,    0,
-    0,    0,    0,    0,    0,    0,    0,    0,    0,
+   12,    0,    0,    0,   -1,   -1,    0,    0,    0,    0,
+    0,    0,    0,    0,  -30,    0,    5,  -23,    0,    0,
+    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,  -19,    0,    0,
 };
 final static short yygindex[] = {                         0,
-   29,   13,    0,   -3,    9,    0,   34,   24,   25,
+   47,    0,   32,   56,   40,   22,   23,  -22,
 };
-final static int YYTABLESIZE=234;
+final static int YYTABLESIZE=230;
 final static short yytable[] = {                          6,
-   18,    6,   16,   17,    6,   26,   25,   12,    6,   26,
-   25,   15,    6,   18,   19,    6,   22,   23,   33,   34,
-   36,   37,   38,   14,    2,    3,   24,    7,    9,    7,
-   24,   32,    7,   39,   15,   35,    7,   20,   21,    0,
-   18,   18,   18,   18,   18,    0,    0,    0,   12,   12,
-   12,   12,   15,   15,   15,   15,    0,    0,    0,    0,
-    0,    0,    0,   18,    0,    0,    0,    0,    0,    0,
-   12,    0,    0,    0,   15,    0,    0,    0,    0,    0,
-    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+   22,    6,   36,   19,    6,   24,   23,    2,   13,   20,
+   13,    5,   14,   13,   24,   23,   41,    9,   44,   38,
+    9,   10,   15,   16,   10,   17,   22,    7,   18,    7,
+   32,   33,    7,   35,   37,   22,   38,   39,   40,    7,
+   22,   22,   22,   22,   22,    8,    9,   31,    2,    2,
+    2,    2,    5,    5,    5,    5,   12,   21,   34,   42,
+    0,   43,    0,   22,    0,    0,    0,    0,    0,    0,
+    2,    0,    0,    0,    5,    0,    0,    0,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,   13,    0,    0,    0,    0,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+    0,    0,    0,    0,   22,    0,    0,    0,    0,    0,
+    0,    2,    0,    0,    0,    5,    0,    0,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
@@ -211,24 +215,23 @@
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
     1,    2,    3,    4,    5,    1,    2,    3,    4,    5,
-    2,    3,    4,    5,
 };
 final static short yycheck[] = {                         36,
-    0,   36,  123,  123,   36,   42,   43,    0,   36,   42,
-   43,    0,   41,   40,   40,   44,  259,  259,  125,  125,
-   41,   44,   41,   58,   41,   41,   63,   64,    0,   64,
-   63,   19,   64,   37,    1,   27,   64,   14,   14,   -1,
-   40,   41,   42,   43,   44,   -1,   -1,   -1,   41,   42,
-   43,   44,   41,   42,   43,   44,   -1,   -1,   -1,   -1,
-   -1,   -1,   -1,   63,   -1,   -1,   -1,   -1,   -1,   -1,
+    0,   36,   25,   40,   36,   42,   43,    0,  123,   46,
+   41,    0,  123,   44,   42,   43,   41,   41,   41,   44,
+   44,   41,   40,   40,   44,  259,   63,   64,  259,   64,
+  125,  125,   64,  261,   41,   63,   44,  124,   41,   41,
+   40,   41,   42,   43,   44,   41,    0,   16,   41,   42,
+   43,   44,   41,   42,   43,   44,    1,   94,   19,   38,
+   -1,   39,   -1,   63,   -1,   -1,   -1,   -1,   -1,   -1,
    63,   -1,   -1,   -1,   63,   -1,   -1,   -1,   -1,   -1,
-   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,  124,   -1,   -1,   -1,   -1,   -1,   -1,
    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+   -1,   -1,   -1,   -1,  124,   -1,   -1,   -1,   -1,   -1,
+   -1,  124,   -1,   -1,   -1,  124,   -1,   -1,   -1,   -1,
    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
@@ -237,9 +240,7 @@
    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   257,  258,  259,  260,  261,  257,  258,  259,  260,  261,
-  258,  259,  260,  261,
 };
 final static short YYFINAL=8;
 final static short YYMAXTOKEN=261;
@@ -247,12 +248,12 @@
 "end-of-file",null,null,null,null,null,null,null,null,null,null,null,null,null,
 null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
 null,null,null,null,null,null,"'$'",null,null,null,"'('","')'","'*'","'+'",
-"','",null,null,null,null,null,null,null,null,null,null,null,null,null,"':'",
+"','",null,"'.'",null,null,null,null,null,null,null,null,null,null,null,null,
 null,null,null,null,"'?'","'@'",null,null,null,null,null,null,null,null,null,
-null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
 null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
+null,null,null,null,"'^'",null,null,null,null,null,null,null,null,null,null,
 null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
-null,"'{'",null,"'}'",null,null,null,null,null,null,null,null,null,null,null,
+null,null,"'{'","'|'","'}'",null,null,null,null,null,null,null,null,null,null,
 null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
 null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
 null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
@@ -260,41 +261,42 @@
 null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
 null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
 null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
-null,null,null,null,null,null,null,null,"ID","LiteralChar","LiteralInteger",
-"LiteralFloat64","LiteralString",
+null,null,null,null,null,null,null,null,null,"ID","LiteralChar",
+"LiteralInteger","LiteralFloat64","LiteralString",
 };
 final static String yyrule[] = {
 "$accept : start",
 "start : term",
+"term : functor",
+"term : functor '(' argList ')'",
+"term : functorHole '(' argList ')'",
+"term : functorHole",
+"term : ID functorHole",
 "argList :",
 "argList : args",
 "args : arg",
 "args : args ',' arg",
-"arg : term",
-"arg : term quant",
-"arg : quant",
+"arg : seq",
+"arg : arg '|' seq",
+"seq : term",
+"seq : term quant",
+"seq : quant",
+"seq : '.'",
+"seq : '(' args ')' quant",
+"seq : '^' LiteralString",
 "quant : '?'",
 "quant : '+'",
 "quant : '*'",
-"term : functor",
-"term : functor '(' argList ')'",
-"term : functorHole '(' argList ')'",
-"term : functorHole",
-"term : ID functorHole",
-"functor : literal",
 "functor : ID",
-"functor : ID ':' literal",
-"functor : ID ':' litHole",
-"functorHole : litHole",
-"literal : LiteralChar",
-"literal : LiteralInteger",
-"literal : LiteralFloat64",
-"literal : LiteralString",
-"litHole : '$' '{' LiteralInteger '}'",
-"litHole : '@' '{' LiteralInteger '}'",
+"functor : LiteralChar",
+"functor : LiteralInteger",
+"functor : LiteralFloat64",
+"functor : LiteralString",
+"functorHole : '$' '{' LiteralInteger '}'",
+"functorHole : '@' '{' LiteralInteger '}'",
 };
 
-//#line 91 "term.y"
+//#line 127 "term.y"
 
 /**
  * contains all the tokens after yylval
@@ -409,7 +411,7 @@
 static public ConstList getTokenNames() {
     return ConstList.fromArray(TheTokens);
 }
-//#line 361 "TermParser.java"
+//#line 363 "TermParser.java"
 //###############################################################
 // method: yylexdebug : check lexer state
 //###############################################################
@@ -556,78 +558,110 @@
       {
 //########## USER-SUPPLIED ACTIONS ##########
 case 1:
-//#line 30 "term.y"
+//#line 65 "term.y"
 { myOptResult = val_peek(0); }
 break;
 case 2:
-//#line 34 "term.y"
-{ yyval = b.argList(); }
+//#line 69 "term.y"
+{ yyval = b.term(val_peek(0), b.argList()); }
 break;
+case 3:
+//#line 70 "term.y"
+{ yyval = b.term(val_peek(3), val_peek(1)); }
+break;
 case 4:
-//#line 39 "term.y"
-{ yyval = b.argList(val_peek(0)); }
+//#line 71 "term.y"
+{ yyval = b.term(val_peek(3), val_peek(1)); }
 break;
 case 5:
-//#line 40 "term.y"
-{ yyval = b.argList(val_peek(2), val_peek(0)); }
+//#line 73 "term.y"
+{ yyval = b.termHole(null, val_peek(0)); }
+break;
+case 6:
+//#line 74 "term.y"
+{ yyval = b.termHole((AstroToken)val_peek(1), val_peek(0));}
 break;
 case 7:
-//#line 48 "term.y"
-{ yyval = b.argHole(  val_peek(1), val_peek(0)); }
+//#line 78 "term.y"
+{ yyval = b.argList(); }
 break;
-case 8:
-//#line 49 "term.y"
-{ yyval = b.argHole(null, val_peek(0)); }
+case 9:
+//#line 83 "term.y"
+{ yyval = b.argList(val_peek(0)); }
 break;
+case 10:
+//#line 84 "term.y"
+{ yyval = b.argList(val_peek(2), val_peek(0)); }
+break;
 case 12:
-//#line 59 "term.y"
-{ yyval = b.term(val_peek(0), b.argList()); }
+//#line 89 "term.y"
+{ yyval = b.alt(val_peek(2), val_peek(0)); }
 break;
 case 13:
-//#line 60 "term.y"
-{ yyval = b.term(val_peek(3), val_peek(1)); }
+//#line 96 "term.y"
+{ yyval = b.seq(  val_peek(0), "."); }
 break;
 case 14:
-//#line 61 "term.y"
-{ yyval = b.term(val_peek(3), val_peek(1)); }
+//#line 97 "term.y"
+{ yyval = b.seq(  val_peek(1), (String)val_peek(0)); }
 break;
 case 15:
-//#line 63 "term.y"
-{ yyval = b.termHole(null, val_peek(0)); }
+//#line 98 "term.y"
+{ yyval = b.seq(null, (String)val_peek(0)); }
 break;
 case 16:
-//#line 64 "term.y"
-{ yyval = b.termHole(val_peek(1),   val_peek(0)); }
+//#line 99 "term.y"
+{ yyval = b.seq(null, "."); }
 break;
 case 17:
-//#line 68 "term.y"
-{ yyval = b.functor(null, val_peek(0)); }
+//#line 100 "term.y"
+{ yyval = b.argGroup(val_peek(2), (String)val_peek(0)); }
 break;
 case 18:
-//#line 69 "term.y"
-{ yyval = b.functor(val_peek(0), null); }
+//#line 101 "term.y"
+{ %% = b.unpack(val_peek(0)); }
 break;
 case 19:
-//#line 70 "term.y"
-{ yyval = b.functor(val_peek(2), val_peek(0)); }
+//#line 105 "term.y"
+{ yyval = "?"; }
 break;
 case 20:
-//#line 71 "term.y"
-{ yyval = b.functor(val_peek(2), val_peek(0)); }
+//#line 106 "term.y"
+{ yyval = "+"; }
 break;
 case 21:
-//#line 75 "term.y"
-{ yyval = b.functorHole(val_peek(0)); }
+//#line 107 "term.y"
+{ yyval = "*"; }
 break;
+case 22:
+//#line 111 "term.y"
+{ yyval = b.tag((AstroToken)val_peek(0)); }
+break;
+case 23:
+//#line 112 "term.y"
+{ yyval = b.litChar((AstroToken)val_peek(0)); }
+break;
+case 24:
+//#line 113 "term.y"
+{ yyval = b.litInteger((AstroToken)val_peek(0)); }
+break;
+case 25:
+//#line 114 "term.y"
+{ yyval = b.litFloat64((AstroToken)val_peek(0)); }
+break;
 case 26:
-//#line 86 "term.y"
-{ yyval = b.dollarHole(val_peek(1)); }
+//#line 115 "term.y"
+{ yyval = b.litString((AstroToken)val_peek(0)); }
 break;
 case 27:
-//#line 87 "term.y"
-{ yyval = b.atHole(val_peek(1)); }
+//#line 122 "term.y"
+{ yyval = b.dollarHole((AstroToken)val_peek(1)); }
+break;
+case 28:
+//#line 123 "term.y"
+{ yyval = b.atHole((AstroToken)val_peek(1)); }
 break;
-//#line 576 "TermParser.java"
+//#line 610 "TermParser.java"
 //########## END OF USER-SUPPLIED ACTIONS ##########
     }//switch
     //#### Now let's reduce... ####



1.3       +2 -1      e/src/jsrc/org/quasiliteral/term/ToFunctor.java

Index: ToFunctor.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/ToFunctor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ToFunctor.java	2001/11/21 14:21:32	1.2
+++ ToFunctor.java	2001/11/27 07:27:54	1.3
@@ -4,6 +4,7 @@
 import org.erights.e.elib.prim.Thrower;
 import org.erights.e.elib.tables.Twine;
 import org.erights.e.elib.tables.ConstList;
+import org.erights.e.elib.tables.EmptyTwine;
 import org.erights.e.elib.util.OneArgFunc;
 import org.erights.e.elib.ref.Ref;
 import org.erights.e.elib.base.ClassDesc;
@@ -75,7 +76,7 @@
             //It's literal data
             String tag = (String)typeNames.get(ttype);
             return new Functor(tag,
-                               Twine.fromString(""),
+                               EmptyTwine.THE_ONE,
                                specimen);
         } else if (-1 == ttype) {
             throw Thrower.toEject(optEjector, "Functor must not be null");



1.3       +2 -1      e/src/jsrc/org/quasiliteral/term/ToLiteral.java

Index: ToLiteral.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/ToLiteral.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ToLiteral.java	2001/11/21 14:21:32	1.2
+++ ToLiteral.java	2001/11/27 07:27:54	1.3
@@ -5,6 +5,7 @@
 import org.erights.e.elib.prim.Thrower;
 import org.erights.e.elib.tables.Twine;
 import org.erights.e.elib.tables.ConstList;
+import org.erights.e.elib.tables.EmptyTwine;
 import org.erights.e.elib.base.ClassDesc;
 import org.erights.e.elib.util.OneArgFunc;
 import org.erights.e.elib.ref.Ref;
@@ -80,7 +81,7 @@
             //It's literal data
             String tag = (String)typeNames.get(ttype);
             return new Functor(tag,
-                               Twine.fromString(""),
+                               EmptyTwine.THE_ONE,
                                specimen);
         } else if (-1 == ttype) {
             return null;



1.3       +2 -1      e/src/jsrc/org/quasiliteral/term/ToTerm.java

Index: ToTerm.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/ToTerm.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ToTerm.java	2001/11/21 14:21:32	1.2
+++ ToTerm.java	2001/11/27 07:27:54	1.3
@@ -6,6 +6,7 @@
 import org.erights.e.elib.util.OneArgFunc;
 import org.erights.e.elib.tables.ConstList;
 import org.erights.e.elib.tables.Twine;
+import org.erights.e.elib.tables.EmptyTwine;
 import org.quasiliteral.astro.AstroToken;
 import antlr.collections.AST;
 
@@ -73,7 +74,7 @@
         AstroToken optToken = null;
         if (null != myOptTag) {
             optToken = new AstroToken(TermParser.ID,
-                                      Twine.fromString(""),
+                                      EmptyTwine.THE_ONE,
                                       myOptTag);
         }
         Object functorHole = builder.functorHole(litHole);



1.3       +2 -1      e/src/jsrc/org/quasiliteral/term/ToTermList.java

Index: ToTermList.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/ToTermList.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ToTermList.java	2001/11/21 14:21:32	1.2
+++ ToTermList.java	2001/11/27 07:27:54	1.3
@@ -8,6 +8,7 @@
 import org.erights.e.elib.tables.ConstList;
 import org.erights.e.elib.tables.FlexList;
 import org.erights.e.elib.tables.Twine;
+import org.erights.e.elib.tables.EmptyTwine;
 import org.quasiliteral.astro.AstroToken;
 
 /**
@@ -96,7 +97,7 @@
             optTermHole = toTerm.qbuild(builder, litHole);
         }
         AstroToken quant = new AstroToken((int)myQuant.charValue(),
-                                          Twine.fromString(""),
+                                          EmptyTwine.THE_ONE,
                                           null);
         return builder.argHole(optTermHole, quant);
     }



1.7       +72 -34    e/src/jsrc/org/quasiliteral/term/term.y

Index: term.y
===================================================================
RCS file: /cvs/e/src/jsrc/org/quasiliteral/term/term.y,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- term.y	2001/11/20 12:32:07	1.6
+++ term.y	2001/11/27 07:27:54	1.7
@@ -15,6 +15,7 @@
 %}
 
 %token ID               //Like E: [0-9a-zA-Z_][a-zA-Z_]*
+                        //i.e., like Java IDs without "$"s.
 
 %token LiteralChar      //like Java & E: unicode
 %token LiteralInteger   //like Java & E: precision unlimited
@@ -24,12 +25,55 @@
 %%
 
 /**
- * Represents a single Term
+ * The starting production represents a single Term.
+ * <p>
+ * To understand what these productions mean, see {@link TermBuilder}.
+ * <p>
+ * It's worth noting that the pure literal (or non-quasi) subset of
+ * this grammar is simply:<pre>
+ *
+ *     term:
+ *             functor
+ *      |      functor '(' argList ')'
+ *      ;
+ *     
+ *     argList:
+ *             //empty
+ *      |      args
+ *      ;
+ *     
+ *     args:
+ *             seq
+ *      |      args ',' seq
+ *      ;
+ *
+ *     seq:
+ *             term
+ *      |      '^' LiteralString
+ *     
+ *     functor:
+ *             ID
+ *      |      LiteralChar
+ *      |      LiteralInteger
+ *      |      LiteralFloat64
+ *      |      LiteralString
+ *      ;
+ *
+ * </pre>
  */
 start:
         term                            { myOptResult = $1; }
 ;
 
+term:
+        functor                         { $$ = b.term($1, b.argList()); }
+ |      functor     '(' argList ')'     { $$ = b.term($1, $3); }
+ |      functorHole '(' argList ')'     { $$ = b.term($1, $3); }
+
+ |         functorHole                  { $$ = b.termHole(null, $1); }
+ |      ID functorHole                  { $$ = b.termHole((AstroToken)$1, $2);}
+ ;
+
 argList:
         /* empty */                     { $$ = b.argList(); }
  |      args
@@ -40,54 +84,48 @@
  |      args ',' arg                    { $$ = b.argList($1, $3); }
  ;
 
-/**
- * Each arg represents some number of Terms
- */
 arg:
-        term
- |      term quant                      { $$ = b.argHole(  $1, $2); }
- |           quant                      { $$ = b.argHole(null, $1); }
+        seq
+ |      arg '|' seq                     { $$ = b.alt($1, $3); }
  ;
 
-quant:
-        '?'
- |      '+'
- |      '*'
+/**
+ * Each seq represents some number of Terms
+ */
+seq:
+        term                            { $$ = b.seq(  $1, "."); }
+ |      term quant                      { $$ = b.seq(  $1, (String)$2); }
+ |           quant                      { $$ = b.seq(null, (String)$1); }
+ |           '.'                        { $$ = b.seq(null, "."); }
+ |      '(' args ')' quant              { $$ = b.argGroup($2, (String)$4); }
+ |      '^' LiteralString               { %% = b.unpack($2); }
  ;
 
-term:
-        functor                         { $$ = b.term($1, b.argList()); }
- |      functor     '(' argList ')'     { $$ = b.term($1, $3); }
- |      functorHole '(' argList ')'     { $$ = b.term($1, $3); }
-
- |         functorHole                  { $$ = b.termHole(null, $1); }
- |      ID functorHole                  { $$ = b.termHole($1,   $2); }
+quant:
+        '?'                             { $$ = "?"; }
+ |      '+'                             { $$ = "+"; }
+ |      '*'                             { $$ = "*"; }
  ;
 
 functor:
-               literal                  { $$ = b.functor(null, $1); }
- |      ID                              { $$ = b.functor($1, null); }
- |      ID ':' literal                  { $$ = b.functor($1, $3); }
- |      ID ':' litHole                  { $$ = b.functor($1, $3); }
+        ID                              { $$ = b.tag((AstroToken)$1); }
+ |      LiteralChar                     { $$ = b.litChar((AstroToken)$1); }
+ |      LiteralInteger                  { $$ = b.litInteger((AstroToken)$1); }
+ |      LiteralFloat64                  { $$ = b.litFloat64((AstroToken)$1); }
+ |      LiteralString                   { $$ = b.litString((AstroToken)$1); }
  ;
 
+/**
+ * Starts off as a hole for a Functor, but may get promoted.
+ */
 functorHole:
-        litHole                         { $$ = b.functorHole($1); }
- ;
-
-literal:
-        LiteralChar
- |      LiteralInteger
- |      LiteralFloat64
- |      LiteralString
+        '$' '{' LiteralInteger '}'      { $$ = b.dollarHole((AstroToken)$3); }
+ |      '@' '{' LiteralInteger '}'      { $$ = b.atHole((AstroToken)$3); }
  ;
 
-litHole:
-        '$' '{' LiteralInteger '}'      { $$ = b.dollarHole($3); }
- |      '@' '{' LiteralInteger '}'      { $$ = b.atHole($3); }
- ;
 
 %%
+
 
 /**
  * contains all the tokens after yylval