[e-cvs] cvs commit: e/src/jsrc/org/erights/e/elang/syntax EBuilder.java ELexer.java EParser.java URI.java e.y Identifier.java Literal.java QuasiPart.java Token.java
markm@eros.cs.jhu.edu
markm@eros.cs.jhu.edu
Thu, 1 Nov 2001 12:42:30 -0500
markm 01/11/01 12:42:30
Modified: src/bin/resources/org/erights/e/elang/syntax
ParserTables.data
src/esrc/com/skyhunter/eBrowser analyzeOutlineFunc.emaker
src/jsrc/org/erights/e/elang/syntax EBuilder.java
ELexer.java EParser.java URI.java e.y
Removed: src/jsrc/org/erights/e/elang/syntax Identifier.java
Literal.java QuasiPart.java Token.java
Log:
switched ELexer over to MilkToken, but still need to fix URI
Revision Changes Path
1.25 +14 -14 e/src/bin/resources/org/erights/e/elang/syntax/ParserTables.data
Index: ParserTables.data
===================================================================
RCS file: /cvs/e/src/bin/resources/org/erights/e/elang/syntax/ParserTables.data,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
Binary files /tmp/cvstNXfWP and /tmp/cvsQWommv differ
1.2 +44 -44 e/src/esrc/com/skyhunter/eBrowser/analyzeOutlineFunc.emaker
Index: analyzeOutlineFunc.emaker
===================================================================
RCS file: /cvs/e/src/esrc/com/skyhunter/eBrowser/analyzeOutlineFunc.emaker,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- analyzeOutlineFunc.emaker 2001/08/08 06:00:20 1.1
+++ analyzeOutlineFunc.emaker 2001/11/01 17:42:29 1.2
@@ -2,52 +2,52 @@
def elex := <unsafe:org.erights.e.elang.syntax.ELexer>
def sourceAnalyzer {
- #returns [outlineList,outlineIndices,varLineList,varLineIndices]
- #suitable for being passed to textModel setLines method
- to makeOutline(sourceText) :pbc {
- def computeIndent(leadString) :any {
- var spaceCount := 0
- var indentCount := 0
- for each in leadString {
- if (each == '\t') {
- indentCount += 1
- } else if (each == ' ') {
- spaceCount += 1
- }
- }
- indentCount := indentCount + (spaceCount _/ 4)
- " " * (indentCount + 1)
+ #returns [outlineList,outlineIndices,varLineList,varLineIndices]
+ #suitable for being passed to textModel setLines method
+ to makeOutline(sourceText) :pbc {
+ def computeIndent(leadString) :any {
+ var spaceCount := 0
+ var indentCount := 0
+ for each in leadString {
+ if (each == '\t') {
+ indentCount += 1
+ } else if (each == ' ') {
+ spaceCount += 1
}
- def newFuncList := [] diverge()
- def funcLineIndices := [] diverge()
- def newVarList := []diverge()
- def varLineIndices := [] diverge()
- for eachIndex => each in sourceText lines() {
- #does this line have a "def" in it?
- if (each =~ `@{leader1}def@{postDef}`) {
- def testComment := leader1 trim()
- #is the line a commented out def? If not, continue analysis
- if (testComment size() == 0 || (testComment[0] != '#' && testComment[0] != '/')) {
- #if this is a def, is it an object definition with a "{"?
- try {
- if (each =~ `@{leader}def@{defineSuffix} @{name}${"{"}@{theEnd}` ?
- (elex isIdentifierStart(name[0]) && (defineSuffix == "" || defineSuffix == "ine"))) {
- newFuncList push("*" + computeIndent(leader) + "def " + name)
- funcLineIndices push(eachIndex)
- #otherwise, is this a define of a variable?
- } else if (each =~ `@{leader}def@{defineSuffix} @{name}${":="}@{theEnd}` ?
- (elex isIdentifierStart(name[0]) && (defineSuffix == "" || defineSuffix == "ine"))) {
- newVarList push("*" + computeIndent(leader) + name)
- varLineIndices push(eachIndex)
- }
- }catch innerDefE {println("caught inner def e " + innerDefE + "\nOn: " + each)}
+ }
+ indentCount := indentCount + (spaceCount _/ 4)
+ " " * (indentCount + 1)
+ }
+ def newFuncList := [] diverge()
+ def funcLineIndices := [] diverge()
+ def newVarList := []diverge()
+ def varLineIndices := [] diverge()
+ for eachIndex => each in sourceText lines() {
+ #does this line have a "def" in it?
+ if (each =~ `@{leader1}def@{postDef}`) {
+ def testComment := leader1 trim()
+ #is the line a commented out def? If not, continue analysis
+ if (testComment size() == 0 || (testComment[0] != '#' && testComment[0] != '/')) {
+ #if this is a def, is it an object definition with a "{"?
+ try {
+ if (each =~ `@{leader}def@{defineSuffix} @{name}${"{"}@{theEnd}` ?
+ (elex isIdentifierStart(name[0]) && (defineSuffix == "" || defineSuffix == "ine"))) {
+ newFuncList push("*" + computeIndent(leader) + "def " + name)
+ funcLineIndices push(eachIndex)
+ #otherwise, is this a define of a variable?
+ } else if (each =~ `@{leader}def@{defineSuffix} @{name}${":="}@{theEnd}` ?
+ (elex isIdentifierStart(name[0]) && (defineSuffix == "" || defineSuffix == "ine"))) {
+ newVarList push("*" + computeIndent(leader) + name)
+ varLineIndices push(eachIndex)
}
- } else if (each =~ `@{leader}to @{name}${"{"}@{theEnd}` ?
- (elex isIdentifierStart(name[0]))) {
- newFuncList push("*" + computeIndent(leader) + "to " + name)
- funcLineIndices push(eachIndex)
- }
+ } catch innerDefE {println("caught inner def e " + innerDefE + "\nOn: " + each)}
}
- [newFuncList,funcLineIndices,newVarList,varLineIndices]
+ } else if (each =~ `@{leader}to @{name}${"{"}@{theEnd}` ?
+ (elex isIdentifierStart(name[0]))) {
+ newFuncList push("*" + computeIndent(leader) + "to " + name)
+ funcLineIndices push(eachIndex)
}
+ }
+ [newFuncList,funcLineIndices,newVarList,varLineIndices]
+ }
}
1.79 +35 -24 e/src/jsrc/org/erights/e/elang/syntax/EBuilder.java
Index: EBuilder.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/syntax/EBuilder.java,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- EBuilder.java 2001/11/01 06:32:24 1.78
+++ EBuilder.java 2001/11/01 17:42:29 1.79
@@ -60,6 +60,7 @@
import org.erights.e.elib.tables.EList;
import org.erights.e.elib.tables.FlexList;
import org.erights.e.elib.tables.FlexMap;
+import org.quasiliteral.astro.MilkToken;
/**
* Build E parse-trees. As a notational hack, EParser inherits from
@@ -232,8 +233,8 @@
/*package*/ EExpr update(Object lValue, Object verb, Object rnValue) {
String verbName;
- if (verb instanceof Token) {
- verbName = ((Token)verb).getText();
+ if (verb instanceof MilkToken) {
+ verbName = ((MilkToken)verb).getText();
} else {
verbName = (String)verb;
}
@@ -324,7 +325,7 @@
*
*/
/*package*/ EExpr doMeta(Object keyword, Object verb, Object args) {
- String kword = ((Token)keyword).getText().intern();
+ String kword = ((MilkToken)keyword).getText().intern();
String vrb = ((String)verb).intern();
EExpr[] exprs = exprs(args);
if ("meta" == kword) {
@@ -393,7 +394,7 @@
*
*/
/*package*/ EExpr doMetaSend(Object keyword, Object verb, Object args) {
- String kword = ((Token)keyword).getText().intern();
+ String kword = ((MilkToken)keyword).getText().intern();
String vrb = ((String)verb).intern();
EExpr[] exprs = exprs(args);
if ("meta" == kword) {
@@ -600,7 +601,7 @@
* When an at-hole is '@<ident>' or '@_'
*/
/*package*/ Pattern atNoun(Object token) {
- String str = ((Token)token).getText();
+ String str = ((MilkToken)token).getText();
if (str.charAt(0) != '@') {
throw new RuntimeException("internal: \"" + str +
"\" needs initial @");
@@ -657,7 +658,7 @@
* When a dollar-hole is '$<ident>'
*/
/*package*/ EExpr dollarNoun(Object token) {
- String str = ((Token)token).getText();
+ String str = ((MilkToken)token).getText();
if (str.charAt(0) != '$') {
throw new RuntimeException("internal: \"" + str +
"\" needs initial $");
@@ -959,8 +960,8 @@
*
*/
/*package*/ LiteralExpr literal(Object token) {
- Literal tokn = (Literal)token;
- return new LiteralExpr(tokn.value());
+ MilkToken tokn = (MilkToken)token;
+ return new LiteralExpr(tokn.getOptValue());
}
/**
@@ -1132,9 +1133,9 @@
(NounExpr[])typedArray(auditors,
NounExpr.class),
eScript);
- } else if (optOName instanceof Literal) {
+ } else if (isLiteralToken(optOName)) {
return object(docComment,
- ((Literal)optOName).value(),
+ ((MilkToken)optOName).getOptValue(),
auditors,
eScript);
@@ -1195,8 +1196,8 @@
FlexList exprs = FlexList.make();
for (int i = 0; i < qList.length; i++) {
- if (qList[i] instanceof QuasiPart) {
- buf.append(((QuasiPart)qList[i]).value());
+ if (isQuasiPart(qList[i])) {
+ buf.append(((MilkToken)qList[i]).getOptValue());
} else {
EExpr eExpr = (EExpr)qList[i];
@@ -1221,8 +1222,8 @@
*
*/
/*package*/ QuasiLiteralExpr quasiLiteralExpr(Object litIndex) {
- Literal lit = (Literal)litIndex;
- int index = ((Number)lit.value()).intValue();
+ MilkToken lit = (MilkToken)litIndex;
+ int index = ((Number)lit.getOptValue()).intValue();
return new QuasiLiteralExpr(index);
}
@@ -1230,8 +1231,8 @@
*
*/
/*package*/ QuasiLiteralPatt quasiLiteralPatt(Object litIndex) {
- Literal lit = (Literal)litIndex;
- int index = ((Number)lit.value()).intValue();
+ MilkToken lit = (MilkToken)litIndex;
+ int index = ((Number)lit.getOptValue()).intValue();
return new QuasiLiteralPatt(index);
}
@@ -1250,8 +1251,8 @@
String tempName = newTemp("q");
for (int i = 0; i < qList.length; i++) {
- if (qList[i] instanceof QuasiPart) {
- buf.append(((QuasiPart)qList[i]).value());
+ if (isQuasiPart(qList[i])) {
+ buf.append(((MilkToken)qList[i]).getOptValue());
} else if (qList[i] instanceof EExpr) {
EExpr eExpr = (EExpr)qList[i];
@@ -1279,8 +1280,8 @@
*
*/
/*package*/ QuasiPatternExpr quasiPatternExpr(Object litIndex) {
- Literal lit = (Literal)litIndex;
- int index = ((Number)lit.value()).intValue();
+ MilkToken lit = (MilkToken)litIndex;
+ int index = ((Number)lit.getOptValue()).intValue();
return new QuasiPatternExpr(index);
}
@@ -1288,8 +1289,8 @@
*
*/
/*package*/ QuasiPatternPatt quasiPatternPatt(Object litIndex) {
- Literal lit = (Literal)litIndex;
- int index = ((Number)lit.value()).intValue();
+ MilkToken lit = (MilkToken)litIndex;
+ int index = ((Number)lit.getOptValue()).intValue();
return new QuasiPatternPatt(index);
}
@@ -1750,9 +1751,9 @@
auditors,
mTypes);
- } else if (optOName instanceof Literal) {
+ } else if (isLiteralToken(optOName)) {
return oType(docComment,
- ((Literal)optOName).value(),
+ ((MilkToken)optOName).getOptValue(),
auditors,
mTypes);
@@ -1811,4 +1812,14 @@
"new",
list(nameExpr, optType));
}
+
+ /**
+ *
+ */
+ /*package*/ abstract boolean isLiteralToken(Object tok);
+
+ /**
+ *
+ */
+ /*package*/ abstract boolean isQuasiPart(Object tok);
}
1.58 +128 -124 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.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- ELexer.java 2001/11/01 06:56:50 1.57
+++ ELexer.java 2001/11/01 17:42:29 1.58
@@ -22,6 +22,7 @@
import org.erights.e.develop.exception.PrintStreamWriter;
import org.erights.e.elib.eio.TextWriter;
import org.erights.e.elib.tables.Twine;
+import org.quasiliteral.astro.MilkToken;
import java.io.BufferedReader;
import java.io.FileReader;
@@ -247,8 +248,8 @@
/**
*
*/
- public Token nextToken() throws IOException, SyntaxException {
- Token result;
+ public MilkToken nextToken() throws IOException, SyntaxException {
+ MilkToken result;
try {
result = getNextToken();
} finally {
@@ -265,7 +266,7 @@
/**
* Separated out for use by '>'
*/
- private Token continuer(Token result) throws IOException {
+ private MilkToken continuer(MilkToken result) throws IOException {
if (isWhite(myPos, myLData.length)) {
myContinueFlag = true;
skipLine();
@@ -385,7 +386,7 @@
/**
*
*/
- private Token getNextToken() throws IOException, SyntaxException {
+ private MilkToken getNextToken() throws IOException, SyntaxException {
if (myDelayedNextChar) {
nextChar();
myDelayedNextChar = false;
@@ -406,12 +407,12 @@
case '?': {
char c = (char)myChar;
nextChar();
- return new Token(endToken(), c);
+ return new MilkToken(c, endToken());
} case EOFCHAR: {
- return new Token(Twine.fromString(""), EParser.EOFTOK);
+ return new MilkToken(EParser.EOFTOK, Twine.fromString(""));
} case '\n': {
myDelayedNextChar = true;
- return new Token(endToken(), EParser.EOL);
+ return new MilkToken(EParser.EOL, endToken());
} case '(': {
return openBracket(')');
} case ')': {
@@ -446,9 +447,9 @@
syntaxError(key + " is a keyword");
}
myIndenter.pop('$', name);
- return new Token(name, EParser.DollarIdent);
+ return new MilkToken(EParser.DollarIdent, name);
}
- return new Token(endToken(), '$');
+ return new MilkToken('$', endToken());
} case '@': {
nextChar();
if (myChar == '{') {
@@ -463,7 +464,7 @@
nextChar();
Twine name = endToken();
myIndenter.pop('@', name);
- return new Token(name, EParser.AtIdent);
+ return new MilkToken(EParser.AtIdent, name);
} else if (myChar != EOFCHAR &&
isIdentifierStart((char)myChar)) {
//A '@<ident>' closes a '@'
@@ -478,108 +479,108 @@
syntaxError(key + " is a keyword");
}
myIndenter.pop('@', name);
- return new Token(name, EParser.AtIdent);
+ return new MilkToken(EParser.AtIdent, name);
}
- return new Token(endToken(), '@');
+ return new MilkToken('@', endToken());
} case '.': {
nextChar();
if (myChar == '.') {
nextChar();
if (myChar == '!') {
nextChar();
- return new Token(endToken(), EParser.OpTill);
+ return new MilkToken(EParser.OpTill, endToken());
}
- return new Token(endToken(), EParser.OpThru);
+ return new MilkToken(EParser.OpThru, endToken());
}
- return new Token(endToken(), '.');
+ return new MilkToken('.', endToken());
} case '^': {
nextChar();
if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpAssXor);
+ return new MilkToken(EParser.OpAssXor, endToken());
}
- return new Token(endToken(), '^');
+ return new MilkToken('^', endToken());
} case '+': {
nextChar();
if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpAssAdd);
+ return new MilkToken(EParser.OpAssAdd, endToken());
} else if (myChar == '+') {
nextChar();
- syntaxError("Token \"++\" is reserved");
+ syntaxError("token \"++\" is reserved");
return null; //keep compiler happy
}
- return new Token(endToken(), '+');
+ return new MilkToken('+', endToken());
} case '-': {
nextChar();
if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpAssSub);
+ return new MilkToken(EParser.OpAssSub, endToken());
} else if (myChar == '>') {
nextChar();
- return new Token(endToken(), EParser.OpWhen);
+ return new MilkToken(EParser.OpWhen, endToken());
} else if (myChar == '-') {
nextChar();
- syntaxError("Token \"--\" is reserved");
+ syntaxError("token \"--\" is reserved");
return null; //keep compiler happy
}
- return new Token(endToken(), '-');
+ return new MilkToken('-', endToken());
} case ':': {
nextChar();
if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpAss);
+ return new MilkToken(EParser.OpAss, endToken());
} else if (myChar == ':') {
nextChar();
- return new Token(endToken(), EParser.Audit);
+ return new MilkToken(EParser.Audit, endToken());
}
- return new Token(endToken(), ':');
+ return new MilkToken(':', endToken());
} case '<': {
nextChar();
if (myChar == '-') {
nextChar();
if (myChar == '*') {
nextChar();
- syntaxError("Token \"<-*\" is reserved");
+ syntaxError("token \"<-*\" is reserved");
return null; //keep compiler happy
}
- return new Token(endToken(), EParser.Send);
+ return new MilkToken(EParser.Send, endToken());
} else if (myChar == '=') {
nextChar();
if (myChar == '>') {
nextChar();
- return new Token(endToken(), EParser.OpABA);
+ return new MilkToken(EParser.OpABA, endToken());
}
- return new Token(endToken(), EParser.OpLeq);
+ return new MilkToken(EParser.OpLeq, endToken());
} else if (myChar == '<') {
nextChar();
if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpAssAsl);
+ return new MilkToken(EParser.OpAssAsl, endToken());
}
- return new Token(endToken(), EParser.OpAsl);
+ return new MilkToken(EParser.OpAsl, endToken());
} else if (isIdentifierStart((char)myChar)) {
- Token optResult = optUri();
+ MilkToken optResult = optUri();
if (null != optResult) {
return optResult;
}
}
- return new Token(endToken(), '<');
+ return new MilkToken('<', endToken());
} case '>': {
nextChar();
if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpGeq);
+ return new MilkToken(EParser.OpGeq, endToken());
} else if (myChar == '>') {
nextChar();
if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpAssAsr);
+ return new MilkToken(EParser.OpAssAsr, endToken());
}
- return new Token(endToken(), EParser.OpAsr);
+ return new MilkToken(EParser.OpAsr, endToken());
}
Twine closer = endToken();
- Token result = new Token(closer, '>');
+ MilkToken result = new MilkToken('>', closer);
if (myIndenter.getCloser() == '>') {
myIndenter.pop('>', closer);
return result;
@@ -592,42 +593,42 @@
nextChar();
if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpAssPow);
+ return new MilkToken(EParser.OpAssPow, endToken());
}
- return new Token(endToken(), EParser.OpPow);
+ return new MilkToken(EParser.OpPow, endToken());
} else if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpAssMul);
+ return new MilkToken(EParser.OpAssMul, endToken());
} else if (myChar == '-' && peekChar('>')) {
nextChar();
nextChar();
- syntaxError("Token \"*->\" is reserved");
+ syntaxError("token \"*->\" is reserved");
return null; //keep compiler happy
} else if (myChar == '/') {
nextChar();
syntaxError("'/*..*/' comments are reserved. " +
"Use '#' or '//' on each line instead");
}
- return new Token(endToken(), '*');
+ return new MilkToken('*', endToken());
} case '/': {
nextChar();
if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpAssAprxDiv);
+ return new MilkToken(EParser.OpAssAprxDiv, endToken());
} else if (myChar == '/') {
// Skip comment to end of line
skipLine();
- return new Token(endToken(), EParser.EOL);
+ return new MilkToken(EParser.EOL, endToken());
} else if (myChar == '*') {
nextChar();
syntaxError("'/*..*/' comments are reserved. " +
"Use '#' or '//' on each line instead");
}
- return new Token(endToken(), '/');
+ return new MilkToken('/', endToken());
} case '#': {
// Skip comment to end of line (as in "//" case above).
skipLine();
- return new Token(endToken(), EParser.EOL);
+ return new MilkToken(EParser.EOL, endToken());
} case '\\': {
nextChar();
if (myChar == 'u' || myChar == 'U') {
@@ -641,7 +642,7 @@
myContinueFlag = true;
skipLine();
stopToken();
- Token result = getNextToken();
+ MilkToken result = getNextToken();
if (result.getType() == EParser.EOFTOK) {
needMore("continued line");
return null; //make compiler happy
@@ -657,35 +658,35 @@
nextChar();
if (myChar == '=') { // check for "%%="
nextChar();
- return new Token(endToken(), EParser.OpAssMod);
+ return new MilkToken(EParser.OpAssMod, endToken());
}
- return new Token(endToken(), EParser.OpMod);
+ return new MilkToken(EParser.OpMod, endToken());
} else if (myChar == '=') { // check for "%="
nextChar();
- return new Token(endToken(), EParser.OpAssRemdr);
+ return new MilkToken(EParser.OpAssRemdr, endToken());
}
- return new Token(endToken(), '%');
+ return new MilkToken('%', endToken());
} case '!': {
nextChar();
if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpNSame);
+ return new MilkToken(EParser.OpNSame, endToken());
} else if (myChar == '~') {
nextChar();
- return new Token(endToken(), EParser.MisMatch);
+ return new MilkToken(EParser.MisMatch, endToken());
}
- return new Token(endToken(), '!');
+ return new MilkToken('!', endToken());
} case '=': {
nextChar();
if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpSame);
+ return new MilkToken(EParser.OpSame, endToken());
} else if (myChar == '>') {
nextChar();
- return new Token(endToken(), EParser.MapsTo);
+ return new MilkToken(EParser.MapsTo, endToken());
} else if (myChar == '~') {
nextChar();
- return new Token(endToken(), EParser.MatchBind);
+ return new MilkToken(EParser.MatchBind, endToken());
}
syntaxError("use ':=' for assignment, or '==' for equality");
return null; //keep compiler happy
@@ -693,25 +694,25 @@
nextChar();
if (myChar == '&') {
nextChar();
- return new Token(endToken(), EParser.OpLAnd);
+ return new MilkToken(EParser.OpLAnd, endToken());
} else if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpAssAnd);
+ return new MilkToken(EParser.OpAssAnd, endToken());
} else if (myChar == '!') {
nextChar();
- return new Token(endToken(), EParser.OpButNot);
+ return new MilkToken(EParser.OpButNot, endToken());
}
- return new Token(endToken(), '&');
+ return new MilkToken('&', endToken());
} case '|': {
nextChar();
if (myChar == '|') {
nextChar();
- return new Token(endToken(), EParser.OpLOr);
+ return new MilkToken(EParser.OpLOr, endToken());
} else if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpAssOr);
+ return new MilkToken(EParser.OpAssOr, endToken());
}
- return new Token(endToken(), '|');
+ return new MilkToken('|', endToken());
} case '\'': {
return charLiteral();
} case '"': {
@@ -746,11 +747,11 @@
nextChar();
if (myChar == '=') {
nextChar();
- return new Token(endToken(), EParser.OpAssFlrDiv);
+ return new MilkToken(EParser.OpAssFlrDiv, endToken());
}
- return new Token(endToken(), EParser.OpFlrDiv);
+ return new MilkToken(EParser.OpFlrDiv, endToken());
}
- return new Token(endToken(), '_');
+ return new MilkToken(EParser._, endToken());
} default: {
if (isIdentifierStart((char)myChar)) {
@@ -767,7 +768,7 @@
/**
*
*/
- private Token openBracket(char closer) throws IOException {
+ private MilkToken openBracket(char closer) throws IOException {
int tokenType = myChar;
nextChar();
Twine openner = endToken();
@@ -777,7 +778,7 @@
/**
*
*/
- private Token openBracket(int tokenType, Twine openner, char closer)
+ private MilkToken openBracket(int tokenType, Twine openner, char closer)
throws IOException {
if (isWhite(myPos, myLData.length)) {
myIndenter.nest(openner, closer);
@@ -785,20 +786,20 @@
//Indent the next line to right after the open.
myIndenter.push(openner, closer, myPos);
}
- return new Token(openner, tokenType);
+ return new MilkToken(tokenType, openner);
}
/**
*
*/
- private Token closeBracket() throws IOException {
+ private MilkToken closeBracket() throws IOException {
char closerChar = (char)myChar;
nextChar();
Twine closer = endToken();
//on mismatched close, throws SyntaxError at openner
//on unmatched close, throws Syntax error at closer
myIndenter.pop(closerChar, closer);
- return new Token(closer, closerChar);
+ return new MilkToken(closerChar, closer);
}
/**
@@ -851,7 +852,7 @@
/**
*
*/
- private Token charLiteral() throws IOException, SyntaxException {
+ private MilkToken charLiteral() throws IOException, SyntaxException {
nextChar();
char value = charConstant();
nextChar();
@@ -859,24 +860,29 @@
syntaxError("char constant must end in \"'\"");
}
nextChar();
- return new Literal(endToken(),
- EParser.LiteralChar,
- new Character(value));
+ return new MilkToken(EParser.LiteralChar,
+ endToken(),
+ new Character(value));
}
/**
* Called with myChar as the first character of the identifier.
*/
- private Token identifier() throws IOException, SyntaxException {
+ private MilkToken identifier() throws IOException, SyntaxException {
do {
nextChar();
} while (myChar != EOFCHAR && isIdentifierPart((char)myChar));
if ('=' == myChar) {
nextChar();
- return new Token(endToken(), EParser.VerbAss);
+ return new MilkToken(EParser.VerbAss, endToken());
}
- return Identifier.make(endToken());
+ Twine source = endToken();
+ int ttype = EParser.tokenType(source.toLowerCase());
+ if (-1 == ttype) {
+ ttype = EParser.Identifier;
+ }
+ return new MilkToken(ttype, source);
}
/** pretty self explanatory */
@@ -907,34 +913,32 @@
return Character.isJavaIdentifierPart(ch) && ch != '$';
}
- /**
- * A legal E identifier is a string whose first character
- * isIdentifierStart, the rest of whose characters are
- * isIdentifierPart, with the exception that the string "_" is not
- * considered an identifier.
- */
- static public boolean isIdentifier(String str) {
- int len = str.length();
- if (len == 0) {
- return false;
- } else if (! isIdentifierStart(str.charAt(0))) {
- return false;
- } else if ("_".equals(str)) {
- return false;
- } else {
- for (int i = 0; i < len; i++) {
- if (! isIdentifierPart(str.charAt(i))) {
- return false;
- }
- }
- return true;
- }
- }
+// /**
+// * A legal E identifier is a non-keyword string whose first character
+// * isIdentifierStart, the rest of whose characters are
+// * isIdentifierPart.
+// */
+// static public boolean isIdentifier(String str) {
+// int len = str.length();
+// if (len == 0) {
+// return false;
+// } else if (! isIdentifierStart(str.charAt(0))) {
+// return false;
+// } else {
+// for (int i = 1; i < len; i++) {
+// if (! isIdentifierPart(str.charAt(i))) {
+// return false;
+// }
+// }
+// //if it's not a keyword, it's an identifier
+// return -1 == EParser.tokenType(str.toLowerCase());
+// }
+// }
/**
*
*/
- private Token numberLiteral()
+ private MilkToken numberLiteral()
throws IOException, SyntaxException {
// Now handles floating point numbers as well as integers
boolean floating = false;
@@ -972,17 +976,17 @@
tok = tok.replaceAll("_", "");
String str = tok.bare();
if (floating) {
- return new Literal(tok,
- EParser.LiteralFloat64,
- Double.valueOf(str));
+ return new MilkToken(EParser.LiteralFloat64,
+ tok,
+ Double.valueOf(str));
} else {
if (radix == 16) {
//remove the leading "0x" to make BigInteger happy
str = str.substring(2);
}
- return new Literal(tok,
- EParser.LiteralInteger,
- new BigInteger(str, radix));
+ return new MilkToken(EParser.LiteralInteger,
+ tok,
+ new BigInteger(str, radix));
}
}
@@ -1021,7 +1025,7 @@
/**
*
*/
- private Token quasiPart() throws IOException, SyntaxException {
+ private MilkToken quasiPart() throws IOException, SyntaxException {
StringBuffer buf = new StringBuffer();
while (true) {
while (QUASI_ENDER.indexOf(myChar) == -1) {
@@ -1051,8 +1055,8 @@
nextChar();
Twine closer = endToken();
myIndenter.pop('`', closer);
- return new QuasiPart(closer,
- EParser.QuasiClose,
+ return new MilkToken(EParser.QuasiClose,
+ closer,
buf.toString());
} else if (peekChar('`')) {
@@ -1076,8 +1080,8 @@
myIndenter.nest(openner, (char)myChar);
//interpolated '$' or '@' is neither eaten nor added to the
//value of the resulting QuasiOpen token.
- return new QuasiPart(openner,
- EParser.QuasiOpen,
+ return new MilkToken(EParser.QuasiOpen,
+ openner,
buf.toString());
}
}
@@ -1142,7 +1146,7 @@
/**
*
*/
- private Token stringLiteral() throws IOException, SyntaxException {
+ private MilkToken stringLiteral() throws IOException, SyntaxException {
nextChar();
Twine openner = (Twine)myLTwine.run(myOptStartPos, myPos);
myIndenter.push(openner, '"', 0);
@@ -1157,9 +1161,9 @@
nextChar();
Twine closer = endToken();
myIndenter.pop('"', closer);
- return new Literal(closer,
- EParser.LiteralString,
- value.toString());
+ return new MilkToken(EParser.LiteralString,
+ closer,
+ value.toString());
}
/**
@@ -1168,7 +1172,7 @@
* is not immediately followed by a ":", return null and cause no side
* effects -- in particular, do not effect the current position.
*/
- private Token optUri() throws IOException, SyntaxException {
+ private MilkToken optUri() throws IOException, SyntaxException {
int len = myLData.length;
int pos = myPos + 1;
while (pos < len && isIdentifierPart(myLData[pos])) {
@@ -1187,7 +1191,7 @@
//Indent the next line to right after the open, even if
//there remains only whitespace on this line
myIndenter.push(openner, '>', myPos);
- return URI.make(openner, EParser.URIStart);
+ return URI.make(EParser.URIStart, openner);
} else {
syntaxError("Can't use \"" + (char)myChar +
"\" to start a URI body");
@@ -1201,7 +1205,7 @@
"\" in a URI body");
}
nextChar();
- return URI.make(endToken(), EParser.URI);
+ return URI.make(EParser.URI, endToken());
}
/**
@@ -1228,7 +1232,7 @@
ELexer lex = new ELexer(lr, false, false);
while (true) {
try {
- Token t;
+ MilkToken t;
do {
t = lex.nextToken();
stdout.println(t);
1.95 +594 -547 e/src/jsrc/org/erights/e/elang/syntax/EParser.java
Index: EParser.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/syntax/EParser.java,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- EParser.java 2001/11/01 06:56:50 1.94
+++ EParser.java 2001/11/01 17:42:29 1.95
@@ -27,7 +27,8 @@
import org.erights.e.elib.tables.IdentityCacheTable;
import org.erights.e.elib.tables.IntTable;
import org.erights.e.elib.tables.Twine;
-//#line 28 "EParser.java"
+ import org.quasiliteral.astro.MilkToken;
+//#line 29 "EParser.java"
@@ -198,130 +199,131 @@
public final static short VAR=294;
public final static short WHEN=295;
public final static short WHILE=296;
-public final static short DEFINE=297;
-public final static short ON=298;
-public final static short SELECT=299;
-public final static short TYPEDEF=300;
-public final static short ABSTRACT=301;
-public final static short AN=302;
-public final static short AS=303;
-public final static short ATTRIBUTE=304;
-public final static short BE=305;
-public final static short BEGIN=306;
-public final static short BEHALF=307;
-public final static short BELIEF=308;
-public final static short BELIEVE=309;
-public final static short BELIEVES=310;
-public final static short CASE=311;
-public final static short CONST=312;
-public final static short CONSTRUCTOR=313;
-public final static short CONTEXT=314;
-public final static short DECLARE=315;
-public final static short DEFAULT=316;
-public final static short DEFMACRO=317;
-public final static short DEPRECATED=318;
-public final static short DISPATCH=319;
-public final static short DO=320;
-public final static short ENCAPSULATE=321;
-public final static short ENCAPSULATED=322;
-public final static short ENCAPSULATES=323;
-public final static short END=324;
-public final static short ENSURE=325;
-public final static short ENUM=326;
-public final static short EVENTUAL=327;
-public final static short EVENTUALLY=328;
-public final static short EXPORT=329;
-public final static short EXTENDS=330;
-public final static short FACET=331;
-public final static short FORALL=332;
-public final static short FUNCTION=333;
-public final static short GIVEN=334;
-public final static short HIDDEN=335;
-public final static short HIDES=336;
-public final static short IMPLEMENTS=337;
-public final static short INTERFACE=338;
-public final static short IS=339;
-public final static short KNOW=340;
-public final static short KNOWS=341;
-public final static short LAMBDA=342;
-public final static short LET=343;
-public final static short METHOD=344;
-public final static short METHODS=345;
-public final static short MODULE=346;
-public final static short NAMESPACE=347;
-public final static short NATIVE=348;
-public final static short OBEYS=349;
-public final static short OCTET=350;
-public final static short ONEWAY=351;
-public final static short PACKAGE=352;
-public final static short PRIVATE=353;
-public final static short PROTECTED=354;
-public final static short PUBLIC=355;
-public final static short RAISES=356;
-public final static short RELIANCE=357;
-public final static short RELIANT=358;
-public final static short RELIES=359;
-public final static short RELY=360;
-public final static short REVEAL=361;
-public final static short SAKE=362;
-public final static short SIGNED=363;
-public final static short STATIC=364;
-public final static short STRUCT=365;
-public final static short SUCHTHAT=366;
-public final static short SUPPORTS=367;
-public final static short SUSPECT=368;
-public final static short SUSPECTS=369;
-public final static short SYNCHRONIZED=370;
-public final static short THIS=371;
-public final static short THROWS=372;
-public final static short TRANSIENT=373;
-public final static short TRUNCATABLE=374;
-public final static short UNSIGNED=375;
-public final static short UNUM=376;
-public final static short USES=377;
-public final static short USING=378;
-public final static short UTF8=379;
-public final static short UTF16=380;
-public final static short VALUETYPE=381;
-public final static short VIRTUAL=382;
-public final static short VOLATILE=383;
-public final static short WSTRING=384;
-public final static short EOL=385;
-public final static short OpLAnd=386;
-public final static short OpLOr=387;
-public final static short OpSame=388;
-public final static short OpNSame=389;
-public final static short OpButNot=390;
-public final static short OpLeq=391;
-public final static short OpABA=392;
-public final static short OpGeq=393;
-public final static short OpThru=394;
-public final static short OpTill=395;
-public final static short OpAsl=396;
-public final static short OpAsr=397;
-public final static short OpFlrDiv=398;
-public final static short OpMod=399;
-public final static short OpPow=400;
-public final static short OpAss=401;
-public final static short OpAssAdd=402;
-public final static short OpAssAnd=403;
-public final static short OpAssAprxDiv=404;
-public final static short OpAssFlrDiv=405;
-public final static short OpAssAsl=406;
-public final static short OpAssAsr=407;
-public final static short OpAssRemdr=408;
-public final static short OpAssMod=409;
-public final static short OpAssMul=410;
-public final static short OpAssOr=411;
-public final static short OpAssPow=412;
-public final static short OpAssSub=413;
-public final static short OpAssXor=414;
-public final static short Send=415;
-public final static short OpWhen=416;
-public final static short MapsTo=417;
-public final static short MatchBind=418;
-public final static short MisMatch=419;
-public final static short Audit=420;
+public final static short _=297;
+public final static short DEFINE=298;
+public final static short ON=299;
+public final static short SELECT=300;
+public final static short TYPEDEF=301;
+public final static short ABSTRACT=302;
+public final static short AN=303;
+public final static short AS=304;
+public final static short ATTRIBUTE=305;
+public final static short BE=306;
+public final static short BEGIN=307;
+public final static short BEHALF=308;
+public final static short BELIEF=309;
+public final static short BELIEVE=310;
+public final static short BELIEVES=311;
+public final static short CASE=312;
+public final static short CONST=313;
+public final static short CONSTRUCTOR=314;
+public final static short CONTEXT=315;
+public final static short DECLARE=316;
+public final static short DEFAULT=317;
+public final static short DEFMACRO=318;
+public final static short DEPRECATED=319;
+public final static short DISPATCH=320;
+public final static short DO=321;
+public final static short ENCAPSULATE=322;
+public final static short ENCAPSULATED=323;
+public final static short ENCAPSULATES=324;
+public final static short END=325;
+public final static short ENSURE=326;
+public final static short ENUM=327;
+public final static short EVENTUAL=328;
+public final static short EVENTUALLY=329;
+public final static short EXPORT=330;
+public final static short EXTENDS=331;
+public final static short FACET=332;
+public final static short FORALL=333;
+public final static short FUNCTION=334;
+public final static short GIVEN=335;
+public final static short HIDDEN=336;
+public final static short HIDES=337;
+public final static short IMPLEMENTS=338;
+public final static short INTERFACE=339;
+public final static short IS=340;
+public final static short KNOW=341;
+public final static short KNOWS=342;
+public final static short LAMBDA=343;
+public final static short LET=344;
+public final static short METHOD=345;
+public final static short METHODS=346;
+public final static short MODULE=347;
+public final static short NAMESPACE=348;
+public final static short NATIVE=349;
+public final static short OBEYS=350;
+public final static short OCTET=351;
+public final static short ONEWAY=352;
+public final static short PACKAGE=353;
+public final static short PRIVATE=354;
+public final static short PROTECTED=355;
+public final static short PUBLIC=356;
+public final static short RAISES=357;
+public final static short RELIANCE=358;
+public final static short RELIANT=359;
+public final static short RELIES=360;
+public final static short RELY=361;
+public final static short REVEAL=362;
+public final static short SAKE=363;
+public final static short SIGNED=364;
+public final static short STATIC=365;
+public final static short STRUCT=366;
+public final static short SUCHTHAT=367;
+public final static short SUPPORTS=368;
+public final static short SUSPECT=369;
+public final static short SUSPECTS=370;
+public final static short SYNCHRONIZED=371;
+public final static short THIS=372;
+public final static short THROWS=373;
+public final static short TRANSIENT=374;
+public final static short TRUNCATABLE=375;
+public final static short UNSIGNED=376;
+public final static short UNUM=377;
+public final static short USES=378;
+public final static short USING=379;
+public final static short UTF8=380;
+public final static short UTF16=381;
+public final static short VALUETYPE=382;
+public final static short VIRTUAL=383;
+public final static short VOLATILE=384;
+public final static short WSTRING=385;
+public final static short EOL=386;
+public final static short OpLAnd=387;
+public final static short OpLOr=388;
+public final static short OpSame=389;
+public final static short OpNSame=390;
+public final static short OpButNot=391;
+public final static short OpLeq=392;
+public final static short OpABA=393;
+public final static short OpGeq=394;
+public final static short OpThru=395;
+public final static short OpTill=396;
+public final static short OpAsl=397;
+public final static short OpAsr=398;
+public final static short OpFlrDiv=399;
+public final static short OpMod=400;
+public final static short OpPow=401;
+public final static short OpAss=402;
+public final static short OpAssAdd=403;
+public final static short OpAssAnd=404;
+public final static short OpAssAprxDiv=405;
+public final static short OpAssFlrDiv=406;
+public final static short OpAssAsl=407;
+public final static short OpAssAsr=408;
+public final static short OpAssRemdr=409;
+public final static short OpAssMod=410;
+public final static short OpAssMul=411;
+public final static short OpAssOr=412;
+public final static short OpAssPow=413;
+public final static short OpAssSub=414;
+public final static short OpAssXor=415;
+public final static short Send=416;
+public final static short OpWhen=417;
+public final static short MapsTo=418;
+public final static short MatchBind=419;
+public final static short MisMatch=420;
+public final static short Audit=421;
public final static short YYERRCODE=256;
final static short yylhs[] = { -1,
0, 0, 0, 4, 4, 2, 6, 5, 5, 7,
@@ -409,15 +411,15 @@
};
final static short yydefred[] = { 0,
244, 0, 0, 0, 2, 0, 260, 0, 0, 0,
- 313, 314, 0, 317, 318, 319, 320, 321, 322, 323,
- 324, 325, 326, 327, 328, 329, 330, 331, 332, 333,
- 334, 335, 336, 337, 338, 339, 340, 341, 342, 343,
- 344, 345, 346, 347, 348, 349, 350, 351, 352, 353,
- 354, 355, 356, 357, 358, 359, 360, 361, 362, 363,
- 364, 365, 366, 367, 368, 369, 370, 371, 372, 373,
- 374, 375, 376, 377, 378, 379, 380, 381, 382, 383,
- 384, 385, 386, 387, 388, 389, 390, 391, 392, 393,
- 394, 395, 396, 397, 398, 399, 400, 0, 0, 0,
+ 313, 314, 0, 0, 317, 318, 319, 320, 321, 322,
+ 323, 324, 325, 326, 327, 328, 329, 330, 331, 332,
+ 333, 334, 335, 336, 337, 338, 339, 340, 341, 342,
+ 343, 344, 345, 346, 347, 348, 349, 350, 351, 352,
+ 353, 354, 355, 356, 357, 358, 359, 360, 361, 362,
+ 363, 364, 365, 366, 367, 368, 369, 370, 371, 372,
+ 373, 374, 375, 376, 377, 378, 379, 380, 381, 382,
+ 383, 384, 385, 386, 387, 388, 389, 390, 391, 392,
+ 393, 394, 395, 396, 397, 398, 399, 400, 0, 0,
0, 0, 3, 0, 192, 193, 0, 0, 0, 177,
0, 170, 175, 261, 97, 98, 99, 100, 101, 0,
0, 103, 0, 315, 315, 0, 0, 4, 0, 0,
@@ -426,8 +428,8 @@
0, 0, 30, 0, 0, 0, 0, 0, 62, 0,
0, 94, 0, 80, 0, 102, 0, 106, 0, 114,
115, 116, 117, 125, 0, 0, 245, 0, 0, 0,
- 259, 0, 0, 0, 0, 176, 189, 0, 247, 0,
- 0, 156, 0, 0, 0, 161, 0, 0, 0, 0,
+ 259, 0, 0, 0, 0, 0, 176, 189, 0, 247,
+ 0, 0, 156, 0, 0, 0, 161, 0, 0, 0,
0, 0, 0, 179, 178, 0, 0, 0, 0, 0,
0, 0, 0, 218, 219, 0, 0, 0, 0, 201,
200, 0, 0, 206, 315, 0, 0, 0, 315, 0,
@@ -441,8 +443,8 @@
0, 0, 0, 0, 0, 0, 0, 0, 0, 258,
0, 0, 0, 0, 0, 0, 150, 105, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 109, 0,
- 0, 126, 278, 279, 0, 194, 195, 0, 0, 208,
- 209, 166, 0, 0, 0, 157, 0, 0, 160, 191,
+ 0, 126, 278, 279, 0, 194, 195, 0, 0, 191,
+ 208, 209, 166, 0, 0, 0, 157, 0, 0, 160,
0, 10, 149, 187, 0, 0, 154, 185, 0, 0,
183, 181, 184, 0, 180, 168, 118, 121, 104, 146,
145, 0, 0, 0, 0, 202, 203, 129, 0, 0,
@@ -481,22 +483,22 @@
316, 0, 143, 142, 223, 225, 221, 0, 226,
};
final static short yydgoto[] = { 3,
- 198, 5, 545, 185, 143, 381, 351, 144, 6, 352,
+ 198, 5, 545, 186, 143, 381, 351, 144, 6, 352,
146, 147, 148, 413, 443, 149, 277, 312, 105, 106,
152, 153, 154, 422, 155, 156, 157, 437, 158, 441,
159, 445, 160, 452, 161, 162, 163, 164, 241, 390,
107, 165, 166, 167, 318, 168, 242, 169, 329, 387,
570, 509, 575, 170, 171, 172, 173, 232, 174, 175,
332, 479, 222, 469, 228, 510, 372, 568, 569, 319,
- 361, 191, 192, 193, 194, 195, 196, 110, 111, 112,
+ 361, 192, 193, 194, 195, 196, 197, 110, 111, 112,
113, 205, 206, 362, 363, 223, 224, 176, 225, 486,
244, 608, 675, 693, 333, 334, 230, 577, 578, 511,
245, 114, 581, 554, 610, 573, 592, 391, 593, 520,
516, 585, 586,
};
-final static short yysindex[] = { -318,
- 0,15796, 0,14020, 0, -306, 0, -166, -162,19647,
- 0, 0,19647, 0, 0, 0, 0, 0, 0, 0,
+final static short yysindex[] = { -310,
+ 0,15951, 0,14168, 0, -280, 0, -127, -122,19458,
+ 0, 0,19458, 87, 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,
@@ -504,71 +506,72 @@
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,16398,19647,11865,
- 52, -267, 0, 64, 0, 0, 0, 90, 21, 0,
- 72, 0, 0, 0, 0, 0, 0, 0, 0, -116,
- -112, 0,14372, 0, 0,19647,19057, 0,19647,16870,
- 0, 90,19057,19647,16398,16398,16398, -325, 6, -99,
- -267,14977, -267, 0, 0, 116, 0, 0, 782, -222,
- -216, -197, 0, 74, 3, -154, 248, -22, 0, -188,
-12451, 0, 153, 0,12112, 0, 63, 0, -12, 0,
- 0, 0, 0, 0, 100, -158, 0, 121, 129, 208,
- 0, 232,19647,19647,19057, 0, 0,16745, 0, -123,
- 209, 0, -30, 217, -26, 0,14372,14020, 276,14372,
- -267, -87, 390, 0, 0, 70,14372, 195, 212, 104,
-15919,15919, 208, 0, 0, 88, 93,19647,19647, 0,
- 0, 224, -64, 0, 0, 232, -267, 224, 0, -63,
- 238, 0,17929, 0, 0, 0, 0,19647,14020, -54,
- 273, 28, 0, 326, 0, 0, 0, 0, 337, 125,
- 131,19647,19647, 52, -4, 64, 0, 0,12579,14020,
- 153,14372,14020, 0, 0, 0, 0, 0,14020, 0,
- 0, 0, 0, 0, 0, 0,14500,14020,14020,14372,
-14372,14372,14852,15796,15796,14852,14852,14852,14372,14372,
-14372,14372,14372,14372,14372,14852,14372,14852,14852,14852,
-14852,14852,14852,14852,14852,18643, -267,19647, 153, 0,
- -267, -174,18643, -174, 153, 39, 0, 0, 78,15796,
-11989, 90, 90, 224, 224, 90,18052, -267, 0, -267,
-17461, 0, 0, 0,19647, 0, 0,14372,14372, 0,
- 0, 0,15796, 356, -267, 0, 278, -267, 0, 0,
- -267, 0, 0, 0, 366,15796, 0, 0, -267,15796,
- 0, 0, 0, 390, 0, 0, 0, 0, 0, 0,
- 0, 224, 100, 301, 306, 0, 0, 0,19647, 395,
- 0, 158, 0, 402,19057, -267, 0, -267, -267, 56,
- 58, 0, -267, 0, 0, -325, -267, 0, 320, 324,
- 208, 232,14020, 0,14977, 0, -174, -197, 0, 0,
- -25, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, -16, -16, 0, 248, 0, 248, 0, -22,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, -174, 153, 357, 153, -174, 411, -44, 0,
- -174, 153, -174, 0, 39, 0, 224, -123, 168, 0,
- 224, 238, 0, 0, 224,15447, 59, 0, 224,13892,
- 0, 224,15796, 224, 0, 414, 0, 0, 0,16266,
-15796,16266,11989, 0,12579, 0, 0, 330, 334, 0,
- 198, -125, 0, 0, 0, 414,15447, 0, 0, 0,
- 0, -267, 0, 0,19356, 434, -142, -267,19647, 0,
- 0, 0, -54, 0, 0, 0, 0, 0, 64, 0,
- 211, -174, 0, -174, 0, -174, 0, 0,14020, 197,
- 0, 0, 0, 0, 0, 435,15447,14372, 0, 0,
- 0, -267, 0, 0, 0, 224, 0, -267, 0, 0,
- 0, -123, 0, 0, 0, 0, 0, 0, 206, 198,
- 439, 210, 0, 213, 0, 81, 223, 0, 463, 0,
- 379, 456, 456, 0, -20, 0, 456, -267,18766,18766,
- 0, 391, -267, 474, 0, -267, 0, 0, 0, -107,
- 0, 464, 484, 0, 0, 408, -114, -267, 0, 409,
- 0,19647,15919, 0, 0, 464,15796, 224,15796, 464,
- -267,15796, 0, 240, -267, 0, 0, -267, 0, 0,
- 0, 0, 0, 0, 0, -214, 456, 230, 224, -52,
- 0, 0, 464, 0, 90,18889,18889, 0, -267, 0,
- 0, 100,15919, 0, 224, 0, 0, 0, 0, 236,
- 0,19356, -267,18766,18766, 0, 0, 0, 0, 0,
- 0, -106,15447, -9, 224, 102, 224, 0, 0, 224,
- 0, 464, 0, 0, 0, 0, 0, 90, 0, 495,
-14020,15447, 0, 0, 0, 198, 198, 0, 0, 464,
- 0, 496, 0, 0, 0, 0, 0, 464, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,16556,19458,
+12002, -229, 0, 104, 0, 0, 0, 163, -95, 0,
+ 142, 0, 0, 0, 0, 0, 0, 0, 0, -44,
+ 6, 0,14521, 0, 0,19458,19086, 0,19458,16806,
+ 0, 163,19086,19458,16556,16556,16556, -306, -9, 8,
+ -229,15129, -229, 0, 0, 190, 0, 0, 735, -125,
+ -109, -107, 0, -24, 76, 66, 52, 2, 0, -84,
+12592, 0, 265, 0,12252, 0, -23, 0, 694, 0,
+ 0, 0, 0, 0, 197, -93, 0, 201, 216, 285,
+ 0, 290,14521,19458,19458,19086, 0, 0,16680, 0,
+ -48, 260, 0, -27, 284, -26, 0,14168, 332,14521,
+ -229, -40, 456, 0, 0, 46,14521, 255, 257, 49,
+16075,16075, 285, 0, 0, 127, 131,19458,19458, 0,
+ 0, 271, -14, 0, 0, 290, -229, 271, 0, -20,
+ 289, 0,17870, 0, 0, 0, 0,19458,14168, -5,
+ 323, 17, 0, 373, 0, 0, 0, 0, 379, 164,
+ 176,19458,19458, 87, 32, 104, 0, 0,12721,14168,
+ 265,14521,14168, 0, 0, 0, 0, 0,14168, 0,
+ 0, 0, 0, 0, 0, 0,14650,14168,14168,14521,
+14521,14521,15003,15951,15951,15003,15003,15003,14521,14521,
+14521,14521,14521,14521,14521,15003,14521,15003,15003,15003,
+15003,15003,15003,15003,15003,18588, -229,19458, 265, 0,
+ -229, 147,18588, 147, 265, -152, 0, 0, 58,15951,
+12127, 163, 163, 271, 271, 163,17994, -229, 0, -229,
+17400, 0, 0, 0,19458, 0, 0,14521,14521, 0,
+ 0, 0, 0,15951, 396, -229, 0, 325, -229, 0,
+ -229, 0, 0, 0, 409,15951, 0, 0, -229,15951,
+ 0, 0, 0, 456, 0, 0, 0, 0, 0, 0,
+ 0, 271, 197, 327, 333, 0, 0, 0,19458, 419,
+ 0, 40, 0, 431,19086, -229, 0, -229, -229, 61,
+ 86, 0, -229, 0, 0, -306, -229, 0, 348, 350,
+ 285, 290,14168, 0,15129, 0, 147, -107, 0, 0,
+ -12, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -96, -96, 0, 52, 0, 52, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 147, 265, 383, 265, 147, 437, -126, 0,
+ 147, 265, 147, 0, -152, 0, 271, -48, 193, 0,
+ 271, 289, 0, 0, 271,15601, 89, 0, 271,14039,
+ 0, 271,15951, 271, 0, 436, 0, 0, 0,16423,
+15951,16423,12127, 0,12721, 0, 0, 357, 358, 0,
+ 210, -112, 0, 0, 0, 436,15601, 0, 0, 0,
+ 0, -229, 0, 0,19210, 445, -184, -229,19458, 0,
+ 0, 0, -5, 0, 0, 0, 0, 0, 104, 0,
+ 102, 147, 0, 147, 0, 147, 0, 0,14168, 206,
+ 0, 0, 0, 0, 0, 451,15601,14521, 0, 0,
+ 0, -229, 0, 0, 0, 271, 0, -229, 0, 0,
+ 0, -48, 0, 0, 0, 0, 0, 0, 220, 210,
+ 455, 221, 0, 214, 0, 90, 179, 0, 463, 0,
+ 381, 446, 446, 0, -10, 0, 446, -229,18712,18712,
+ 0, 390, -229, 477, 0, -229, 0, 0, 0, -103,
+ 0, 462, 480, 0, 0, 397, -133, -229, 0, 400,
+ 0,19458,16075, 0, 0, 462,15951, 271,15951, 462,
+ -229,15951, 0, 242, -229, 0, 0, -229, 0, 0,
+ 0, 0, 0, 0, 0, -213, 446, 213, 271, -64,
+ 0, 0, 462, 0, 163,18836,18836, 0, -229, 0,
+ 0, 197,16075, 0, 271, 0, 0, 0, 0, 230,
+ 0,19210, -229,18712,18712, 0, 0, 0, 0, 0,
+ 0, -111,15601, -30, 271, 114, 271, 0, 0, 271,
+ 0, 462, 0, 0, 0, 0, 0, 163, 0, 489,
+14168,15601, 0, 0, 0, 210, 210, 0, 0, 462,
+ 0, 497, 0, 0, 0, 0, 0, 462, 0,
};
-final static short yyrindex[] = { 9523,
- 0, 145, 0, 501, 0, 8628, 0, 0, 0, 0,
+final static short yyrindex[] = { 9616,
+ 0, 81, 0, 645, 0, 8526, 0, 0, 0, 0,
+ 0, 0, 0, 8650, 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,
@@ -576,85 +579,84 @@
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,
- 0, 0, 0, 0, 0, 0, 0, 661, 0, -38,
- 8750,13540, 0, 8786, 0, 0, 950, 0, 0, 0,
- 719, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 661, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 661, 661, 661,12932, 0, 0,
-13540, 145, 540, 0, 0, 44, 0, 0, 113, 0,
- 0, 9287, 0, 7381, 8292, 7852, 7640, 7200, 0, 7164,
- 7128, 0, 5394, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,17584,17215, 0, 0, 0, 9017,
- 0, 9053, 0, 0, 0, 0, 0, 0, 0, -37,
- 0, 0, 23, 0, 451, 0, 661, 661, 0, 661,
-13540, 0, 0, 0, 0, 0, 661, 0, 0, 0,
- -61, 152,11050, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,18397, 0, 0,11395,13540, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1334, 36,
+ 0, 0, 0, 0, 0, 0, 0, 0, 821, 0,
+ 20,13686, 0, 8916, 0, 0, 969, 0, 0, 0,
+ 9219, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 821, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 821, 821, 821,13075, 0, 0,
+13686, 81, 540, 0, 0, 25, 0, 0, 779, 0,
+ 0, 9416, 0, 9379, 8346, 7962, 7503, 7330, 0, 7291,
+ 6907, 0, 5168, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,17524,17152, 0, 0, 0, 8951,
+ 0, 8984, 821, 0, 0, 0, 0, 0, 0, 0,
+ -35, 0, 0, 30, 0, 449, 0, 821, 0, 821,
+13686, 0, 0, 0, 0, 0, 821, 0, 0, 0,
+ -88, -86,11183, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,18340, 0, 0,11529,13686, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 661, 29,
0, 0, 0, 33, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 9646, 0, 1371, 0, 0, 881, 1108,
- 0, 661, 661, 0, 0, 0, 0, 0, 661, 0,
- 0, 0, 0, 0, 0, 0, 661, 661, 661, 661,
- 661, 661, 661, 145, 145, 661, 661, 661, 661, 661,
- 661, 661, 661, 661, 661, 661, 661, 661, 661, 661,
- 661, 661, 661, 661, 661, 0,12932, 0, 5552, 0,
-13060, 1498, 0, 3082, 5972, 0, 0, 0, 0, 145,
- 145, 0, 0, 0, 0, 0, 0,13412, 0, 305,
- 0, 0, 0, 0, 0, 0, 0, 661, 661, 0,
- 0, 0, 145, 9086,15324, 0, 9254,11518, 0, 0,
- -32, 0, 0, 0, 0, 145, 0, 0,13540, 145,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, -31, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, -50, 0,19233, -73, -93,
- 0, 0,13540, 0, 0,13540,13540, 1918, 0, 0,
- 9991,10114, 661, 0, 145, 0, 679, 9323, 0, 0,
-13540, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 8157, 8234, 0, 7717, 0, 7775, 0, 7335,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 3240, 6130, 0, 6550, 2076, 0, 0, 0,
- 3660, 6708, 3818, 0, 0, 0, 0, 260, 0, 0,
- 0, 0, 0, 0, 0, 4, 424, 0, 0, 661,
- 0, 0, 145, 0, 0,17338, 0, 0, 0, 145,
- 145, 145, 145, 0, 1347, 0, 0, 0, 0, 0,
- 279, 0, 0, 0, 0,18520, 4, 0, 0, 2496,
- 0,13540, 0, 0, 508, 0, 426,19233, 0, 0,
- 0, 0, 0, 0, 0,10459,10582, 0,10927, 0,
- 0, 4238, 0, 4396, 0, 4816, 0, 0, 661, 4974,
- 0, 2662, 0, 0, 0, 0, 4, 661, 0, 0,
- 0, 429, 0, 438, 0, 0, 0,19770, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 279,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 269, -18, -18, 0, 516, 0, -93, 429, 0, 0,
- 0, 0, 429, 0, 0,13540, 0, 0, 0, 0,
- 0, 424, 0, 0, 0, 0, 0, 305, -72, 0,
- 0, 0, 152, 0, 0, 424, 145, 0, 145, 424,
-13540, 145, 0, 0, -67, 0, 0,19524, 0, 0,
- 0, 0, 0, 0, 0, 433, -93, 0, 0, 0,
- 0, 0, 424, 0, 0, 0, 0, 0, 429, 0,
- 0, -31, -61, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 9773, 0, 1135, 0, 0, 791, 391,
+ 0, 821, 821, 0, 0, 0, 0, 0, 821, 0,
+ 0, 0, 0, 0, 0, 0, 821, 821, 821, 821,
+ 821, 821, 821, 81, 81, 821, 821, 821, 821, 821,
+ 821, 821, 821, 821, 821, 821, 821, 821, 821, 821,
+ 821, 821, 821, 821, 821, 0,13075, 0, 5589, 0,
+13204, 1522, 0, 2848, 5748, 0, 0, 0, 0, 81,
+ 81, 0, 0, 0, 0, 0, 0,13557, 0, -80,
+ 0, 0, 0, 0, 0, 0, 0, 821, 821, 0,
+ 0, 0, 0, 81, 9142,15477, 0, 9182,11654, 0,
+ -8, 0, 0, 0, 0, 81, 0, 0,13686, 81,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -94, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, -60, 0,18960, -37, -105,
+ 0, 0,13686, 0, 0,13686,13686, 1681, 0, 0,
+10119,10243, 821, 0, 81, 0, 746, 9449, 0, 0,
+13686, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 8193, 8269, 0, 7809, 0, 7886, 0, 7367,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 3269, 6169, 0, 6328, 2102, 0, 0, 0,
+ 3428, 6749, 3849, 0, 0, 0, 0, 261, 0, 0,
+ 0, 0, 0, 0, 0, 5, 423, 0, 0, 821,
+ 0, 0, 81, 0, 0,17276, 0, 0, 0, 81,
+ 81, 81, 81, 0, -18, 0, 0, 0, 0, 0,
+ 276, 0, 0, 0, 0,18464, 5, 0, 0, 2261,
+ 0,13686, 0, 0, 511, 0, 426,18960, 0, 0,
+ 0, 0, 0, 0, 0,10589,10713, 0,11059, 0,
+ 0, 4008, 0, 4429, 0, 4588, 0, 0, 821, 5009,
+ 0, 2682, 0, 0, 0, 0, 5, 821, 0, 0,
+ 0, 429, 0, 280, 0, 0, 0,19582, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 276,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 270, 7, 7, 0, 517, 0, -105, 429, 0, 0,
+ 0, 0, 429, 0, 0,13686, 0, 0, 0, 0,
+ 0, 423, 0, 0, 0, 0, 0, -80, -69, 0,
+ 0, 0, -86, 0, 0, 423, 81, 0, 81, 423,
+13686, 81, 0, 0, -65, 0, 0,19334, 0, 0,
+ 0, 0, 0, 0, 0, 440, -105, 0, 0, 0,
+ 0, 0, 423, 0, 0, 0, 0, 0, 429, 0,
+ 0, -94, -88, 0, 0, 0, 0, 0, 0, 0,
0, 0, 429, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 4, 424, 0, 424, 0, 0, 0, 0,
- 0, 424, 0, 0, 0, 0, 0, 0, 0, 0,
- 661, 4, 0, 0, 0, 279, 279, 0, 0, 424,
- 0, 0, 0, 0, 0, 0, 0, 424, 0,
+ 0, 0, 5, 423, 0, 423, 0, 0, 0, 0,
+ 0, 423, 0, 0, 0, 0, 0, 0, 0, 0,
+ 821, 5, 0, 0, 0, 276, 276, 0, 0, 423,
+ 0, 0, 0, 0, 0, 0, 0, 423, 0,
};
final static short yygindex[] = { 0,
- 1, 0, 222, 37, 0, -98, 80, 302, -137, -1,
- 0, -250, -2, 0, 616, 0, 0, -118, 159, 188,
- 307, 290, 532, 86, 179, 118, -75, 0, 122, 272,
- 182, 374, 268, 0, 0, 189, 0, 0, -217, -126,
- 570, 48, -168, 19, 0, -78, 0, 375, 385, 105,
- -13, 107, 42, 0, 0, -19, 0, 0, 111, 0,
- -351, 256, 0, 0, 0, 114, -207, -532, 0, 0,
- -247, -439, -79, -24, 0, 0, -264, 413, -169, 0,
- 0, 0, 0, 226, 0, -96, 0, 0, -97, 220,
- -225, 0, -45, -443, -494, -3, 0, 0, -7, -408,
- 216, 0, 51, 0, 0, 0, 0, -513, 0, -501,
- 98, 0, -43,
+ 1, 0, 243, 37, 0, -98, 91, 302, -137, -1,
+ 0, -247, -2, 0, 903, 0, 0, 295, 159, 188,
+ 307, 293, -49, 143, 45, 67, -71, 0, 57, 275,
+ 233, 457, 272, 0, 0, -46, 0, 0, -67, -146,
+ 580, 48, -231, 19, 0, -70, 0, 510, 322, 98,
+ 51, 106, 36, 0, 0, -17, 0, 0, 310, 0,
+ -331, 251, 0, 0, 0, 110, -207, -498, 0, 0,
+ -269, -343, -83, -34, 0, 0, -257, 407, -301, 0,
+ 0, 0, 0, 234, 0, -118, 0, 0, -76, 218,
+ -225, 0, -62, -414, -488, -4, 0, 0, -21, -190,
+ 211, 0, 59, 0, 0, 0, 0, -512, 0, -500,
+ 88, 0, -50,
};
-final static int YYTABLESIZE=20154;
+final static int YYTABLESIZE=19967;
//These two tables are not statically initialized, but rather
//initialized on first use, so that a failure to initialize them
@@ -676,7 +678,7 @@
yytable = (short[])obInp.readObject();
yycheck = (short[])obInp.readObject();
long hash = EYaccFixer.checkhash(yytable, yycheck);
- if (hash != 878073795554571773L) {
+ if (hash != -4408874519322207609L) {
throw new RuntimeException(rName + " bad checkhash: " +
hash);
}
@@ -686,7 +688,7 @@
}
final static short YYFINAL=3;
-final static short YYMAXTOKEN=420;
+final static short YYMAXTOKEN=421;
final static String yyname[] = {
"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,
@@ -694,7 +696,7 @@
"','","'-'","'.'","'/'",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,
@@ -709,7 +711,7 @@
"QuasiClose","DollarIdent","AtIdent","DollarOpen","AtOpen","URI","URIStart",
"BodyStartWord","BodyNextWord","VTableStartWord","VTableNextWord","BIND",
"CATCH","CLASS","DEF","DELEGATE","ELSE","ESCAPE","FINALLY","FOR","IF","IN",
-"MATCH","META","PRAGMA","SWITCH","THUNK","TO","TRY","VAR","WHEN","WHILE",
+"MATCH","META","PRAGMA","SWITCH","THUNK","TO","TRY","VAR","WHEN","WHILE","_",
"DEFINE","ON","SELECT","TYPEDEF","ABSTRACT","AN","AS","ATTRIBUTE","BE","BEGIN",
"BEHALF","BELIEF","BELIEVE","BELIEVES","CASE","CONST","CONSTRUCTOR","CONTEXT",
"DECLARE","DEFAULT","DEFMACRO","DEPRECATED","DISPATCH","DO","ENCAPSULATE",
@@ -858,8 +860,8 @@
"object : defAudits begin funcHead body",
"object : begin THUNK body",
"object : CLASS classHead body",
-"object : begin '_' funcHead body",
-"object : begin '_' body",
+"object : begin _ funcHead body",
+"object : begin _ body",
"nounExpr : noun",
"parenExpr : '(' eExpr ')'",
"ifExpr : begin IF parenExpr body",
@@ -918,8 +920,8 @@
"namer : noun ':' order",
"namer : noun",
"namer : '&' noun",
-"namer : '_'",
-"namer : '_' ':' order",
+"namer : _",
+"namer : _ ':' order",
"namer : binder",
"namer : varNamer",
"namer : DollarOpen LiteralInteger '}'",
@@ -929,7 +931,7 @@
"varNamer : VAR noun ':' order",
"varNamer : VAR noun",
"oName : noun",
-"oName : '_'",
+"oName : _",
"oName : BIND noun",
"oName : VAR noun",
"oName : DollarOpen LiteralInteger '}'",
@@ -1038,7 +1040,7 @@
"pTypes : pType",
"pTypes : pTypes ',' br pType",
"pType : noun optType",
-"pType : '_' optType",
+"pType : _ optType",
"optType :",
"optType : ':' nounExpr",
"metaoid : META",
@@ -1131,7 +1133,7 @@
"reserved : WSTRING",
};
-//#line 1181 "e.y"
+//#line 1182 "e.y"
/**
*
@@ -1301,7 +1303,7 @@
*
*/
private int yylex() {
- Token token = null;
+ MilkToken token = null;
try {
token = myLexer.nextToken();
} catch (IOException ex) {
@@ -1316,7 +1318,7 @@
*
*/
private void yyerror(String s) throws SyntaxException {
- int ttype = ((Token)yylval).getType();
+ int ttype = ((MilkToken)yylval).getType();
if (EParser.EOFTOK == ttype && "syntax error".equals(s)) {
myLexer.needMore("Unexpected EOF");
@@ -1347,6 +1349,50 @@
}
+/**
+ *
+ */
+private boolean isTokenKind(Object tok, int[] members) {
+ if (! (tok instanceof MilkToken)) {
+ return false;
+ }
+ int ttype = ((MilkToken)tok).getType();
+ for (int i = 0; i < members.length; i++) {
+ if (ttype == members[i]) {
+ return true;
+ }
+ }
+ return false;
+}
+
+static private final int[] LiteralTypes = {
+ LiteralInteger,
+ LiteralFloat64,
+ LiteralChar,
+ LiteralString,
+ LiteralTwine
+};
+
+/**
+ *
+ */
+/*package*/ boolean isLiteralToken(Object tok) {
+ return isTokenKind(tok, LiteralTypes);
+}
+
+static private final int[] QuasiTypes = {
+ QuasiOpen,
+ QuasiClose
+};
+
+/**
+ *
+ */
+/*package*/ boolean isQuasiPart(Object tok) {
+ return isTokenKind(tok, QuasiTypes);
+}
+
+
/*********************************/
@@ -1410,6 +1456,7 @@
TheTokens[VAR] = "var";
TheTokens[WHEN] = "when";
TheTokens[WHILE] = "while";
+ TheTokens[_] = "_";
/* pseudo-reserved keywords */
TheTokens[DEFINE] = "define";
@@ -1653,7 +1700,7 @@
static public boolean isContinuer(int tokenType) {
return TheContinuers[tokenType];
}
-//#line 5610 "EParser.java"
+//#line 5619 "EParser.java"
//###############################################################
// method: yylexdebug : check lexer state
//###############################################################
@@ -1800,400 +1847,400 @@
{
//########## USER-SUPPLIED ACTIONS ##########
case 1:
-//#line 153 "e.y"
+//#line 154 "e.y"
{ myEscape.run(null); }
break;
case 2:
-//#line 154 "e.y"
+//#line 155 "e.y"
{ myEscape.run(val_peek(0)); }
break;
case 3:
-//#line 156 "e.y"
+//#line 157 "e.y"
{ myEscape.run(val_peek(0)); }
break;
case 5:
-//#line 164 "e.y"
+//#line 165 "e.y"
{ pocket("define"); }
break;
case 6:
-//#line 173 "e.y"
+//#line 174 "e.y"
{ yyval = val_peek(1); }
break;
case 7:
-//#line 177 "e.y"
+//#line 178 "e.y"
{ yyval = val_peek(1); }
break;
case 9:
-//#line 188 "e.y"
+//#line 189 "e.y"
{ yyval = sequence(val_peek(2), val_peek(0)); }
break;
case 11:
-//#line 193 "e.y"
+//#line 194 "e.y"
{ yyval = sequence(val_peek(2), val_peek(0)); }
break;
case 12:
-//#line 201 "e.y"
+//#line 202 "e.y"
{ yyval = oneExpr(val_peek(0)); }
break;
case 16:
-//#line 216 "e.y"
+//#line 217 "e.y"
{ yyval = sequence(val_peek(2), val_peek(0)); }
break;
case 17:
-//#line 217 "e.y"
+//#line 218 "e.y"
{ yyval = forward(val_peek(0)); }
break;
case 18:
-//#line 232 "e.y"
+//#line 233 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 21:
-//#line 237 "e.y"
+//#line 238 "e.y"
{ yyval = assign(val_peek(2), val_peek(0)); }
break;
case 22:
-//#line 238 "e.y"
+//#line 239 "e.y"
{ yyval = update(val_peek(2), val_peek(1), val_peek(0)); }
break;
case 23:
-//#line 239 "e.y"
+//#line 240 "e.y"
{ yyval = assAsr(val_peek(2), val_peek(0)); }
break;
case 24:
-//#line 240 "e.y"
+//#line 241 "e.y"
{ yyval = update(val_peek(2), val_peek(1), val_peek(0)); }
break;
case 25:
-//#line 242 "e.y"
+//#line 243 "e.y"
{ yyval = define(val_peek(2), val_peek(0)); }
break;
case 26:
-//#line 243 "e.y"
+//#line 244 "e.y"
{ yyval = define(val_peek(2), val_peek(0)); }
break;
case 27:
-//#line 244 "e.y"
+//#line 245 "e.y"
{ yyval = define(val_peek(2), val_peek(0)); }
break;
case 29:
-//#line 253 "e.y"
+//#line 254 "e.y"
{ yyval = condOr(val_peek(2), val_peek(0)); }
break;
case 31:
-//#line 262 "e.y"
+//#line 263 "e.y"
{ yyval = condAnd(val_peek(2), val_peek(0)); }
break;
case 33:
-//#line 271 "e.y"
+//#line 272 "e.y"
{ yyval = same(val_peek(2), val_peek(0)); }
break;
case 34:
-//#line 272 "e.y"
+//#line 273 "e.y"
{ yyval = not(same(val_peek(2), val_peek(0))); }
break;
case 35:
-//#line 273 "e.y"
+//#line 274 "e.y"
{ yyval = call(val_peek(2), "and", val_peek(0)); }
break;
case 36:
-//#line 274 "e.y"
+//#line 275 "e.y"
{ yyval = call(val_peek(2), "or", val_peek(0)); }
break;
case 37:
-//#line 275 "e.y"
+//#line 276 "e.y"
{ yyval = call(val_peek(2), "xor", val_peek(0)); }
break;
case 38:
-//#line 276 "e.y"
+//#line 277 "e.y"
{ yyval = call(val_peek(2), "butNot", val_peek(0)); }
break;
case 39:
-//#line 278 "e.y"
+//#line 279 "e.y"
{ yyval = matchBind(val_peek(2), val_peek(0)); }
break;
case 40:
-//#line 279 "e.y"
+//#line 280 "e.y"
{ yyval = not(matchBind(val_peek(2), val_peek(0))); }
break;
case 41:
-//#line 291 "e.y"
+//#line 292 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 44:
-//#line 296 "e.y"
+//#line 297 "e.y"
{ yyval = lessThan(val_peek(2), val_peek(0)); }
break;
case 45:
-//#line 297 "e.y"
+//#line 298 "e.y"
{ yyval = leq(val_peek(2), val_peek(0)); }
break;
case 46:
-//#line 298 "e.y"
+//#line 299 "e.y"
{ yyval = asBigAs(val_peek(2), val_peek(0)); }
break;
case 47:
-//#line 299 "e.y"
+//#line 300 "e.y"
{ yyval = geq(val_peek(2), val_peek(0)); }
break;
case 48:
-//#line 300 "e.y"
+//#line 301 "e.y"
{ yyval = greaterThan(val_peek(2), val_peek(0)); }
break;
case 50:
-//#line 309 "e.y"
+//#line 310 "e.y"
{ yyval = thru(val_peek(2), val_peek(0)); }
break;
case 51:
-//#line 310 "e.y"
+//#line 311 "e.y"
{ yyval = till(val_peek(2), val_peek(0)); }
break;
case 53:
-//#line 319 "e.y"
+//#line 320 "e.y"
{ yyval = call(val_peek(2), "shiftLeft", val_peek(0)); }
break;
case 54:
-//#line 320 "e.y"
+//#line 321 "e.y"
{ yyval = call(val_peek(2), "shiftLeft",
list(call(val_peek(0), "negate", list())));
}
break;
case 55:
-//#line 330 "e.y"
+//#line 331 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 58:
-//#line 335 "e.y"
+//#line 336 "e.y"
{ yyval = call(val_peek(2), "add", val_peek(0)); }
break;
case 59:
-//#line 336 "e.y"
+//#line 337 "e.y"
{ yyval = call(val_peek(2), "subtract", val_peek(0)); }
break;
case 60:
-//#line 344 "e.y"
+//#line 345 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 63:
-//#line 349 "e.y"
+//#line 350 "e.y"
{ yyval = call(val_peek(2), "multiply", val_peek(0)); }
break;
case 64:
-//#line 350 "e.y"
+//#line 351 "e.y"
{ yyval = call(val_peek(2), "approxDivide", val_peek(0)); }
break;
case 65:
-//#line 351 "e.y"
+//#line 352 "e.y"
{ yyval = call(val_peek(2), "floorDivide", val_peek(0)); }
break;
case 66:
-//#line 352 "e.y"
+//#line 353 "e.y"
{ yyval = call(val_peek(2), "remainder", val_peek(0)); }
break;
case 67:
-//#line 353 "e.y"
+//#line 354 "e.y"
{ yyval = mod(val_peek(2), val_peek(0)); }
break;
case 68:
-//#line 361 "e.y"
+//#line 362 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 71:
-//#line 366 "e.y"
+//#line 367 "e.y"
{ yyval = call(val_peek(2), "pow", val_peek(0)); }
break;
case 72:
-//#line 375 "e.y"
+//#line 376 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 75:
-//#line 380 "e.y"
+//#line 381 "e.y"
{ yyval = call(val_peek(0), "not", list()); }
break;
case 76:
-//#line 381 "e.y"
+//#line 382 "e.y"
{ yyval = call(val_peek(0), "complement", list());}
break;
case 77:
-//#line 382 "e.y"
+//#line 383 "e.y"
{ yyval = call(val_peek(0), "negate", list()); }
break;
case 78:
-//#line 383 "e.y"
+//#line 384 "e.y"
{ yyval = slotExpr(val_peek(0)); }
break;
case 81:
-//#line 395 "e.y"
+//#line 396 "e.y"
{ yyval = call(val_peek(3), "get", val_peek(1)); }
break;
case 82:
-//#line 396 "e.y"
+//#line 397 "e.y"
{ yyval = send(val_peek(3), val_peek(1), val_peek(0)); }
break;
case 83:
-//#line 397 "e.y"
+//#line 398 "e.y"
{ yyval = send(val_peek(2), "run", val_peek(0)); }
break;
case 84:
-//#line 399 "e.y"
+//#line 400 "e.y"
{ pocket("no-paren-call");
yyval = send(val_peek(2), val_peek(0), list()); }
break;
case 85:
-//#line 401 "e.y"
+//#line 402 "e.y"
{ pocket("no-paren-call");
yyval = call(val_peek(1), val_peek(0), list()); }
break;
case 86:
-//#line 403 "e.y"
+//#line 404 "e.y"
{ pocket("dot-props");
yyval = property(val_peek(2), val_peek(0), list()); }
break;
case 87:
-//#line 405 "e.y"
+//#line 406 "e.y"
{ pocket("dot-props");
yyval = property(val_peek(3), val_peek(1), val_peek(0)); }
break;
case 88:
-//#line 413 "e.y"
+//#line 414 "e.y"
{ yyval = doMeta(val_peek(1), "run", val_peek(0)); }
break;
case 89:
-//#line 414 "e.y"
+//#line 415 "e.y"
{ yyval = doMeta(val_peek(2), val_peek(1), val_peek(0)); }
break;
case 90:
-//#line 415 "e.y"
+//#line 416 "e.y"
{ yyval = doMetaSend(val_peek(2), "run", val_peek(0)); }
break;
case 91:
-//#line 416 "e.y"
+//#line 417 "e.y"
{ yyval = doMetaSend(val_peek(3), val_peek(1), val_peek(0)); }
break;
case 92:
-//#line 418 "e.y"
+//#line 419 "e.y"
{ pocket("no-paren-call");
yyval = doMeta(val_peek(1), val_peek(0), list()); }
break;
case 93:
-//#line 420 "e.y"
+//#line 421 "e.y"
{ pocket("no-paren-call");
yyval = doMetaSend(val_peek(2), val_peek(0), list()); }
break;
case 95:
-//#line 434 "e.y"
+//#line 435 "e.y"
{ yyval = call(val_peek(1), "run", val_peek(0)); }
break;
case 96:
-//#line 435 "e.y"
+//#line 436 "e.y"
{ yyval = call(val_peek(2), val_peek(1), val_peek(0)); }
break;
case 97:
-//#line 443 "e.y"
+//#line 444 "e.y"
{ yyval = literal(val_peek(0)); }
break;
case 98:
-//#line 444 "e.y"
+//#line 445 "e.y"
{ yyval = literal(val_peek(0)); }
break;
case 99:
-//#line 445 "e.y"
+//#line 446 "e.y"
{ yyval = literal(val_peek(0)); }
break;
case 100:
-//#line 446 "e.y"
+//#line 447 "e.y"
{ yyval = literal(val_peek(0)); }
break;
case 101:
-//#line 447 "e.y"
+//#line 448 "e.y"
{ yyval = literal(val_peek(0)); }
break;
case 103:
-//#line 451 "e.y"
+//#line 452 "e.y"
{ yyval = uriExpr(val_peek(0)); }
break;
case 104:
-//#line 452 "e.y"
+//#line 453 "e.y"
{ yyval = uriExpr(val_peek(2),val_peek(1)); }
break;
case 105:
-//#line 454 "e.y"
+//#line 455 "e.y"
{ yyval = quasiExpr(val_peek(1),val_peek(0)); }
break;
case 107:
-//#line 457 "e.y"
+//#line 458 "e.y"
{ yyval = tuple(val_peek(1)); }
break;
case 108:
-//#line 458 "e.y"
+//#line 459 "e.y"
{ yyval = map(val_peek(1)); }
break;
case 109:
-//#line 460 "e.y"
+//#line 461 "e.y"
{ yyval = hide(val_peek(0)); }
break;
case 110:
-//#line 462 "e.y"
+//#line 463 "e.y"
{ yyval = escape(val_peek(1),val_peek(0)); }
break;
case 111:
-//#line 464 "e.y"
+//#line 465 "e.y"
{ yyval = whilex(val_peek(1),val_peek(0)); }
break;
case 112:
-//#line 466 "e.y"
+//#line 467 "e.y"
{ yyval = switchx(val_peek(2),val_peek(1)); }
break;
case 113:
-//#line 468 "e.y"
+//#line 469 "e.y"
{ yyval = tryx(val_peek(2),val_peek(1),val_peek(0)); }
break;
case 118:
-//#line 476 "e.y"
+//#line 477 "e.y"
{ yyval = quasiLiteralExpr(val_peek(1)); }
break;
case 119:
-//#line 477 "e.y"
+//#line 478 "e.y"
{ yyval = quasiLiteralExpr(val_peek(0)); }
break;
case 120:
-//#line 478 "e.y"
+//#line 479 "e.y"
{ yyval = quasiLiteralExpr(); }
break;
case 121:
-//#line 479 "e.y"
+//#line 480 "e.y"
{ yyval = quasiPatternExpr(val_peek(1)); }
break;
case 122:
-//#line 480 "e.y"
+//#line 481 "e.y"
{ yyval = quasiPatternExpr(val_peek(0)); }
break;
case 123:
-//#line 483 "e.y"
+//#line 484 "e.y"
{ reserved("select"); }
break;
case 124:
-//#line 484 "e.y"
+//#line 485 "e.y"
{ pocket("typedef");
yyval = val_peek(0); }
break;
case 126:
-//#line 493 "e.y"
+//#line 494 "e.y"
{ yyval = object(val_peek(1), val_peek(0)); }
break;
case 127:
-//#line 494 "e.y"
+//#line 495 "e.y"
{ yyval = methObject(val_peek(3),val_peek(1),val_peek(0)); }
break;
case 128:
-//#line 495 "e.y"
+//#line 496 "e.y"
{ yyval = thunk(val_peek(0)); }
break;
case 129:
-//#line 497 "e.y"
+//#line 498 "e.y"
{ yyval = classExpr(val_peek(1),val_peek(0)); }
break;
case 130:
-//#line 499 "e.y"
+//#line 500 "e.y"
{ pocket("anon-lambda");
yyval = methObject(audits(ignore(),
list()),
@@ -2201,626 +2248,626 @@
val_peek(0)); }
break;
case 131:
-//#line 504 "e.y"
+//#line 505 "e.y"
{ pocket("anon-lambda");
yyval = thunk(val_peek(0)); }
break;
case 132:
-//#line 512 "e.y"
+//#line 513 "e.y"
{ yyval = noun(val_peek(0)); }
break;
case 133:
-//#line 521 "e.y"
+//#line 522 "e.y"
{ yyval = val_peek(1); }
break;
case 134:
-//#line 530 "e.y"
+//#line 531 "e.y"
{ yyval = ifx(val_peek(1), val_peek(0)); }
break;
case 135:
-//#line 531 "e.y"
+//#line 532 "e.y"
{ yyval = ifx(val_peek(3), val_peek(2), val_peek(0)); }
break;
case 136:
-//#line 532 "e.y"
+//#line 533 "e.y"
{ yyval = ifx(val_peek(4), val_peek(3), val_peek(0)); }
break;
case 137:
-//#line 540 "e.y"
+//#line 541 "e.y"
{ yyval = forx(val_peek(5),val_peek(3),val_peek(1)); }
break;
case 138:
-//#line 548 "e.y"
+//#line 549 "e.y"
{ yyval = when(val_peek(3),val_peek(2),val_peek(1),val_peek(0)); }
break;
case 139:
-//#line 558 "e.y"
+//#line 559 "e.y"
{ yyval = macro(val_peek(4), val_peek(2), val_peek(1), val_peek(0)); }
break;
case 140:
-//#line 560 "e.y"
+//#line 561 "e.y"
{ yyval = macro(val_peek(5), val_peek(3), val_peek(2), val_peek(0)); }
break;
case 141:
-//#line 564 "e.y"
+//#line 565 "e.y"
{ yyval = null; }
break;
case 142:
-//#line 566 "e.y"
+//#line 567 "e.y"
{ yyval = macro(val_peek(5), val_peek(3), val_peek(2), val_peek(1)); }
break;
case 143:
-//#line 568 "e.y"
+//#line 569 "e.y"
{ yyval = macro(val_peek(5), val_peek(3), val_peek(2), val_peek(0)); }
break;
case 144:
-//#line 576 "e.y"
+//#line 577 "e.y"
{ yyval = null; }
break;
case 147:
-//#line 583 "e.y"
+//#line 584 "e.y"
{ yyval = noun("simple__quasiParser"); }
break;
case 148:
-//#line 584 "e.y"
+//#line 585 "e.y"
{ yyval = noun(val_peek(0) + "__quasiParser"); }
break;
case 149:
-//#line 585 "e.y"
+//#line 586 "e.y"
{ yyval = val_peek(1); }
break;
case 150:
-//#line 589 "e.y"
+//#line 590 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 151:
-//#line 590 "e.y"
+//#line 591 "e.y"
{ yyval = with(val_peek(1), val_peek(0)); }
break;
case 152:
-//#line 594 "e.y"
+//#line 595 "e.y"
{ yyval = list(val_peek(1), val_peek(0)); }
break;
case 153:
-//#line 595 "e.y"
+//#line 596 "e.y"
{ yyval = with(with(val_peek(2), val_peek(1)), val_peek(0)); }
break;
case 154:
-//#line 599 "e.y"
+//#line 600 "e.y"
{ yyval = dollarNoun(val_peek(0)); }
break;
case 155:
-//#line 600 "e.y"
+//#line 601 "e.y"
{ yyval = val_peek(1); }
break;
case 158:
-//#line 618 "e.y"
+//#line 619 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 159:
-//#line 619 "e.y"
+//#line 620 "e.y"
{ yyval = with(val_peek(3), val_peek(0)); }
break;
case 161:
-//#line 629 "e.y"
+//#line 630 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 162:
-//#line 630 "e.y"
+//#line 631 "e.y"
{ yyval = with(val_peek(3), val_peek(0)); }
break;
case 163:
-//#line 637 "e.y"
+//#line 638 "e.y"
{ yyval = new Assoc(ignore(), val_peek(0)); }
break;
case 165:
-//#line 642 "e.y"
+//#line 643 "e.y"
{ yyval = new Assoc(val_peek(2), val_peek(0)); }
break;
case 166:
-//#line 643 "e.y"
+//#line 644 "e.y"
{ reserved("var-extract-pattern"); }
break;
case 168:
-//#line 648 "e.y"
+//#line 649 "e.y"
{ yyval = suchThat(val_peek(2), val_peek(0)); }
break;
case 169:
-//#line 650 "e.y"
+//#line 651 "e.y"
{ reserved("meta pattern"); }
break;
case 171:
-//#line 655 "e.y"
+//#line 656 "e.y"
{ yyval = listPattern(val_peek(1)); }
break;
case 172:
-//#line 656 "e.y"
+//#line 657 "e.y"
{ yyval = cdrPattern(val_peek(3), val_peek(0)); }
break;
case 173:
-//#line 658 "e.y"
+//#line 659 "e.y"
{ reserved("map pattern"); }
break;
case 174:
-//#line 659 "e.y"
+//#line 660 "e.y"
{ reserved("map pattern"); }
break;
case 176:
-//#line 664 "e.y"
+//#line 665 "e.y"
{ yyval = patternEquals(val_peek(0)); }
break;
case 178:
-//#line 669 "e.y"
+//#line 670 "e.y"
{ yyval = quasiPattern(val_peek(1), val_peek(0)); }
break;
case 179:
-//#line 673 "e.y"
+//#line 674 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 180:
-//#line 674 "e.y"
+//#line 675 "e.y"
{ yyval = with(val_peek(1), val_peek(0)); }
break;
case 181:
-//#line 678 "e.y"
+//#line 679 "e.y"
{ yyval = list(val_peek(1), val_peek(0)); }
break;
case 182:
-//#line 679 "e.y"
+//#line 680 "e.y"
{ yyval = with(with(val_peek(2), val_peek(1)), val_peek(0));}
break;
case 185:
-//#line 688 "e.y"
+//#line 689 "e.y"
{ yyval = atNoun(val_peek(0)); }
break;
case 186:
-//#line 689 "e.y"
+//#line 690 "e.y"
{ yyval = val_peek(1); }
break;
case 187:
-//#line 702 "e.y"
+//#line 703 "e.y"
{ yyval = finalPattern(val_peek(2), val_peek(0)); }
break;
case 188:
-//#line 703 "e.y"
+//#line 704 "e.y"
{ yyval = finalPattern(val_peek(0)); }
break;
case 189:
-//#line 704 "e.y"
+//#line 705 "e.y"
{ yyval = slotDefiner(val_peek(0)); }
break;
case 190:
-//#line 705 "e.y"
+//#line 706 "e.y"
{ yyval = ignore(); }
break;
case 191:
-//#line 706 "e.y"
+//#line 707 "e.y"
{ reserved("anon guard"); }
break;
case 194:
-//#line 710 "e.y"
+//#line 711 "e.y"
{ yyval = quasiLiteralPatt(val_peek(1)); }
break;
case 195:
-//#line 711 "e.y"
+//#line 712 "e.y"
{ yyval = quasiPatternPatt(val_peek(1)); }
break;
case 196:
-//#line 715 "e.y"
+//#line 716 "e.y"
{ yyval = bindDefiner(val_peek(2), val_peek(0)); }
break;
case 197:
-//#line 716 "e.y"
+//#line 717 "e.y"
{ yyval = bindDefiner(val_peek(0)); }
break;
case 198:
-//#line 720 "e.y"
+//#line 721 "e.y"
{ yyval = varPattern(val_peek(2), val_peek(0)); }
break;
case 199:
-//#line 721 "e.y"
+//#line 722 "e.y"
{ yyval = varPattern(val_peek(0)); }
break;
case 200:
-//#line 730 "e.y"
+//#line 731 "e.y"
{ yyval = finalPattern(val_peek(0)); }
break;
case 201:
-//#line 731 "e.y"
+//#line 732 "e.y"
{ yyval = ignore(); }
break;
case 202:
-//#line 732 "e.y"
+//#line 733 "e.y"
{ yyval = bindDefiner(val_peek(0)); }
break;
case 203:
-//#line 733 "e.y"
+//#line 734 "e.y"
{ yyval = varPattern(val_peek(0)); }
break;
case 204:
-//#line 734 "e.y"
+//#line 735 "e.y"
{ yyval = quasiLiteralPatt(val_peek(1)); }
break;
case 205:
-//#line 735 "e.y"
+//#line 736 "e.y"
{ yyval = quasiPatternPatt(val_peek(1)); }
break;
case 207:
-//#line 752 "e.y"
+//#line 753 "e.y"
{ yyval = val_peek(0); }
break;
case 208:
-//#line 753 "e.y"
+//#line 754 "e.y"
{ yyval = bindDefiner(val_peek(0)); }
break;
case 209:
-//#line 754 "e.y"
+//#line 755 "e.y"
{ yyval = varPattern(val_peek(0)); }
break;
case 210:
-//#line 761 "e.y"
+//#line 762 "e.y"
{ yyval = audits(val_peek(0), list()); }
break;
case 211:
-//#line 762 "e.y"
+//#line 763 "e.y"
{ pocket("auditors");
yyval = audits(val_peek(2), val_peek(0)); }
break;
case 212:
-//#line 770 "e.y"
+//#line 771 "e.y"
{ yyval = audits(val_peek(0), list()); }
break;
case 213:
-//#line 771 "e.y"
+//#line 772 "e.y"
{ pocket("auditors");
yyval = audits(val_peek(2), val_peek(0)); }
break;
case 214:
-//#line 776 "e.y"
+//#line 777 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 215:
-//#line 777 "e.y"
+//#line 778 "e.y"
{ yyval = with(val_peek(3), val_peek(0)); }
break;
case 216:
-//#line 789 "e.y"
+//#line 790 "e.y"
{ yyval = list(); }
break;
case 217:
-//#line 790 "e.y"
+//#line 791 "e.y"
{ yyval = append(list(val_peek(3)),val_peek(1)); }
break;
case 220:
-//#line 804 "e.y"
+//#line 805 "e.y"
{ yyval = method(val_peek(1), val_peek(0)); }
break;
case 221:
-//#line 806 "e.y"
+//#line 807 "e.y"
{ reserved("fields"); }
break;
case 222:
-//#line 807 "e.y"
+//#line 808 "e.y"
{ reserved("on event"); }
break;
case 223:
-//#line 808 "e.y"
+//#line 809 "e.y"
{ reserved("sealed meta"); }
break;
case 224:
-//#line 809 "e.y"
+//#line 810 "e.y"
{ reserved("sealed meta"); }
break;
case 225:
-//#line 817 "e.y"
+//#line 818 "e.y"
{ yyval = methHead("run", val_peek(2), val_peek(0)); }
break;
case 226:
-//#line 818 "e.y"
+//#line 819 "e.y"
{ yyval = methHead(val_peek(4), val_peek(2), val_peek(0)); }
break;
case 227:
-//#line 820 "e.y"
+//#line 821 "e.y"
{ pocket("no-paren-method");
yyval = methHead(val_peek(1), list(), val_peek(0)); }
break;
case 228:
-//#line 829 "e.y"
+//#line 830 "e.y"
{ yyval = methHead("run", val_peek(2), val_peek(0)); }
break;
case 229:
-//#line 831 "e.y"
+//#line 832 "e.y"
{ pocket("one-method-object");
yyval = methHead(val_peek(4), val_peek(2), val_peek(0)); }
break;
case 230:
-//#line 833 "e.y"
+//#line 834 "e.y"
{ pocket("no-paren-method");
yyval = methHead(val_peek(1), list(), val_peek(0)); }
break;
case 231:
-//#line 842 "e.y"
+//#line 843 "e.y"
{ yyval = list(val_peek(5), val_peek(2), val_peek(0)); }
break;
case 232:
-//#line 852 "e.y"
+//#line 853 "e.y"
{ yyval = matcher(val_peek(1), val_peek(0)); }
break;
case 233:
-//#line 861 "e.y"
+//#line 862 "e.y"
{ yyval = delegatex(val_peek(0)); }
break;
case 234:
-//#line 868 "e.y"
+//#line 869 "e.y"
{ yyval = VOID; }
break;
case 235:
-//#line 869 "e.y"
+//#line 870 "e.y"
{ yyval = val_peek(0); }
break;
case 236:
-//#line 873 "e.y"
+//#line 874 "e.y"
{ yyval = val_peek(1); }
break;
case 237:
-//#line 882 "e.y"
+//#line 883 "e.y"
{ yyval = list(val_peek(7), val_peek(5), val_peek(2), val_peek(0)); }
break;
case 238:
-//#line 885 "e.y"
+//#line 886 "e.y"
{ pocket("when-clauses");
yyval = list(val_peek(5), val_peek(2), val_peek(0)); }
break;
case 239:
-//#line 890 "e.y"
+//#line 891 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 240:
-//#line 891 "e.y"
+//#line 892 "e.y"
{ yyval = with(val_peek(2), val_peek(0)); }
break;
case 241:
-//#line 895 "e.y"
+//#line 896 "e.y"
{ list(val_peek(2), val_peek(0)); }
break;
case 246:
-//#line 913 "e.y"
+//#line 914 "e.y"
{ yyval = list(); }
break;
case 247:
-//#line 917 "e.y"
+//#line 918 "e.y"
{ yyval = list(); }
break;
case 248:
-//#line 922 "e.y"
+//#line 923 "e.y"
{ yyval = val_peek(1); }
break;
case 249:
-//#line 927 "e.y"
+//#line 928 "e.y"
{ pocket("lambda-args");
yyval = with(val_peek(1), val_peek(0)); }
break;
case 252:
-//#line 937 "e.y"
+//#line 938 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 253:
-//#line 938 "e.y"
+//#line 939 "e.y"
{ yyval = with(val_peek(2), val_peek(0)); }
break;
case 254:
-//#line 943 "e.y"
+//#line 944 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 255:
-//#line 944 "e.y"
+//#line 945 "e.y"
{ yyval = with(val_peek(2), val_peek(0)); }
break;
case 256:
-//#line 948 "e.y"
+//#line 949 "e.y"
{ yyval = new Assoc(val_peek(2), val_peek(0)); }
break;
case 257:
-//#line 949 "e.y"
+//#line 950 "e.y"
{ reserved("export binding"); }
break;
case 259:
-//#line 964 "e.y"
+//#line 965 "e.y"
{ yyval = hilbert(val_peek(0)); }
break;
case 260:
-//#line 971 "e.y"
-{ yyval = ((Identifier)val_peek(0)).getText(); }
+//#line 972 "e.y"
+{ yyval = ((MilkToken)val_peek(0)).getText(); }
break;
case 261:
-//#line 972 "e.y"
+//#line 973 "e.y"
{ reserved("keyword \"" +
- ((Token)val_peek(0)).getText() +
+ ((MilkToken)val_peek(0)).getText() +
"\""); }
break;
case 262:
-//#line 988 "e.y"
+//#line 989 "e.y"
{ yyval = "add"; }
break;
case 263:
-//#line 989 "e.y"
+//#line 990 "e.y"
{ yyval = "and"; }
break;
case 264:
-//#line 990 "e.y"
+//#line 991 "e.y"
{ yyval = "approxDivide"; }
break;
case 265:
-//#line 991 "e.y"
+//#line 992 "e.y"
{ yyval = "floorDivide"; }
break;
case 266:
-//#line 992 "e.y"
+//#line 993 "e.y"
{ yyval = "shiftLeft"; }
break;
case 267:
-//#line 993 "e.y"
+//#line 994 "e.y"
{ yyval = "remainder"; }
break;
case 268:
-//#line 994 "e.y"
+//#line 995 "e.y"
{ yyval = "mod"; }
break;
case 269:
-//#line 995 "e.y"
+//#line 996 "e.y"
{ yyval = "multiply"; }
break;
case 270:
-//#line 996 "e.y"
+//#line 997 "e.y"
{ yyval = "or"; }
break;
case 271:
-//#line 997 "e.y"
+//#line 998 "e.y"
{ yyval = "pow"; }
break;
case 272:
-//#line 998 "e.y"
+//#line 999 "e.y"
{ yyval = "subtract"; }
break;
case 273:
-//#line 999 "e.y"
+//#line 1000 "e.y"
{ yyval = "xor"; }
break;
case 274:
-//#line 1008 "e.y"
+//#line 1009 "e.y"
{ yyval = NULL; }
break;
case 275:
-//#line 1009 "e.y"
+//#line 1010 "e.y"
{ yyval = val_peek(3); }
break;
case 276:
-//#line 1013 "e.y"
+//#line 1014 "e.y"
{ yyval = val_peek(1); }
break;
case 277:
-//#line 1018 "e.y"
+//#line 1019 "e.y"
{ yyval = eScript(val_peek(2), optMatcher(val_peek(1))); }
break;
case 278:
-//#line 1020 "e.y"
+//#line 1021 "e.y"
{ pocket("plumbing");
yyval = eScript(null, val_peek(0)); }
break;
case 279:
-//#line 1022 "e.y"
+//#line 1023 "e.y"
{ pocket("plumbing");
yyval = eScript(null, val_peek(0)); }
break;
case 281:
-//#line 1032 "e.y"
+//#line 1033 "e.y"
{ yyval = with(val_peek(2), val_peek(1)); }
break;
case 283:
-//#line 1037 "e.y"
+//#line 1038 "e.y"
{ yyval = with(val_peek(2), val_peek(1)); }
break;
case 285:
-//#line 1042 "e.y"
+//#line 1043 "e.y"
{ yyval = with(val_peek(2), val_peek(1)); }
break;
case 288:
-//#line 1059 "e.y"
+//#line 1060 "e.y"
{ yyval = with(val_peek(1), val_peek(0)); }
break;
case 289:
-//#line 1063 "e.y"
+//#line 1064 "e.y"
{ yyval = matcher(val_peek(1), val_peek(0)); }
break;
case 290:
-//#line 1070 "e.y"
+//#line 1071 "e.y"
{ yyval = null; }
break;
case 291:
-//#line 1071 "e.y"
+//#line 1072 "e.y"
{ yyval = val_peek(0); }
break;
case 292:
-//#line 1082 "e.y"
+//#line 1083 "e.y"
{ yyval = oType(val_peek(4), val_peek(1)); }
break;
case 293:
-//#line 1083 "e.y"
+//#line 1084 "e.y"
{ yyval = oType(val_peek(2), list(val_peek(1))); }
break;
case 297:
-//#line 1090 "e.y"
+//#line 1091 "e.y"
{ yyval = with(val_peek(3),val_peek(1)); }
break;
case 298:
-//#line 1094 "e.y"
+//#line 1095 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 299:
-//#line 1095 "e.y"
+//#line 1096 "e.y"
{ yyval = with(val_peek(3),val_peek(0)); }
break;
case 300:
-//#line 1097 "e.y"
+//#line 1098 "e.y"
{ reserved("on event"); }
break;
case 301:
-//#line 1098 "e.y"
+//#line 1099 "e.y"
{ reserved("on event"); }
break;
case 302:
-//#line 1105 "e.y"
+//#line 1106 "e.y"
{ yyval = mType(val_peek(1),list(),val_peek(0)); }
break;
case 303:
-//#line 1106 "e.y"
+//#line 1107 "e.y"
{ yyval = mType(val_peek(4),val_peek(2),val_peek(0)); }
break;
case 304:
-//#line 1107 "e.y"
+//#line 1108 "e.y"
{ yyval = mType("run",val_peek(2),val_peek(0)); }
break;
case 305:
-//#line 1111 "e.y"
+//#line 1112 "e.y"
{ yyval = val_peek(0); }
break;
case 306:
-//#line 1112 "e.y"
+//#line 1113 "e.y"
{ yyval = val_peek(1); }
break;
case 307:
-//#line 1116 "e.y"
+//#line 1117 "e.y"
{ yyval = list(val_peek(0)); }
break;
case 308:
-//#line 1117 "e.y"
+//#line 1118 "e.y"
{ yyval = with(val_peek(3),val_peek(0)); }
break;
case 309:
-//#line 1124 "e.y"
+//#line 1125 "e.y"
{ yyval = pType(val_peek(1),val_peek(0)); }
break;
case 310:
-//#line 1125 "e.y"
+//#line 1126 "e.y"
{ yyval = pType(null,val_peek(0)); }
break;
case 311:
-//#line 1129 "e.y"
+//#line 1130 "e.y"
{ yyval = null; }
break;
case 312:
-//#line 1130 "e.y"
+//#line 1131 "e.y"
{ yyval = val_peek(0); }
break;
case 315:
-//#line 1146 "e.y"
+//#line 1147 "e.y"
{ begin(); }
break;
case 316:
-//#line 1153 "e.y"
+//#line 1154 "e.y"
{ end(); }
break;
-//#line 6774 "EParser.java"
+//#line 6783 "EParser.java"
//########## END OF USER-SUPPLIED ACTIONS ##########
}//switch
//#### Now let's reduce... ####
1.15 +9 -5 e/src/jsrc/org/erights/e/elang/syntax/URI.java
Index: URI.java
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/syntax/URI.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- URI.java 2001/11/01 06:32:25 1.14
+++ URI.java 2001/11/01 17:42:30 1.15
@@ -20,6 +20,7 @@
*/
import org.erights.e.elib.tables.Twine;
+import org.quasiliteral.astro.MilkToken;
/**
* A URI is an E token and an E expression. <p> <pre>
@@ -28,6 +29,9 @@
* URIStart ::=
* '<' Identifier ':'
* </pre>
+ * XXX This class should probably not define a separate subclass of
+ * MilkToken, but rather just provide some static conveniences for dealing
+ * with MilkTokens that are of type URI or URIStart.
*
* @see org.erights.e.elang.syntax.Identifier
* @see org.erights.e.elang.syntax.URI#isURICStart
@@ -35,7 +39,7 @@
*
* @author <a href="mailto:markm@erights.org">Mark S. Miller</a>
*/
-public class URI extends Token {
+public class URI extends MilkToken {
static private boolean URICs[] = new boolean[128];
@@ -60,8 +64,8 @@
/**
*
*/
- private URI(Twine source, int tokenType) {
- super(source, tokenType);
+ private URI(int tokenType, Twine source) {
+ super(tokenType, source);
String text = source.bare();
int i = text.indexOf(':');
if (text.charAt(0) != '<') {
@@ -88,9 +92,9 @@
/**
*
*/
- static public URI make(Twine source, int tokenType) {
+ static public MilkToken make(int tokenType, Twine source) {
source = source.replaceAll("\\","/").replaceAll("|",":");
- return new URI(source, tokenType);
+ return new URI(tokenType, source);
}
/**
1.89 +58 -12 e/src/jsrc/org/erights/e/elang/syntax/e.y
Index: e.y
===================================================================
RCS file: /cvs/e/src/jsrc/org/erights/e/elang/syntax/e.y,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- e.y 2001/11/01 06:56:50 1.88
+++ e.y 2001/11/01 17:42:30 1.89
@@ -44,6 +44,7 @@
import org.erights.e.elib.tables.IdentityCacheTable;
import org.erights.e.elib.tables.IntTable;
import org.erights.e.elib.tables.Twine;
+ import org.quasiliteral.astro.MilkToken;
%}
/* Categorical terminals */
@@ -53,7 +54,7 @@
%token LiteralString /* Double quoted */
%token LiteralTwine /* quasi-quoted without holes. Not yet used */
-%token Identifier /* like Java, but no "$"s, and not "_" or keyword */
+%token Identifier /* like Java, but no "$"s, and not keyword */
%token VerbAss /* Identifier "=" */
%token QuasiOpen /* ("`" char*) | (char*), up to hole */
%token QuasiClose /* QuasiOpen "`" */
@@ -72,7 +73,7 @@
%token BIND CATCH CLASS DEF DELEGATE
%token ELSE ESCAPE FINALLY FOR IF IN
%token MATCH META PRAGMA SWITCH
-%token THUNK TO TRY VAR WHEN WHILE
+%token THUNK TO TRY VAR WHEN WHILE _
/* Pseudo-reserved (Reserved, but used in reserved productions) */
%token DEFINE ON SELECT TYPEDEF
@@ -496,12 +497,12 @@
| CLASS classHead body { $$ = classExpr($2,$3); }
- | begin '_' funcHead body { pocket("anon-lambda");
+ | begin _ funcHead body { pocket("anon-lambda");
$$ = methObject(audits(ignore(),
list()),
$3,
$4); }
- | begin '_' body { pocket("anon-lambda");
+ | begin _ body { pocket("anon-lambda");
$$ = thunk($3); }
;
@@ -702,8 +703,8 @@
noun ':' order { $$ = finalPattern($1, $3); }
| noun { $$ = finalPattern($1); }
| '&' noun { $$ = slotDefiner($2); }
- | '_' { $$ = ignore(); }
- | '_' ':' order { reserved("anon guard"); }
+ | _ { $$ = ignore(); }
+ | _ ':' order { reserved("anon guard"); }
| binder
| varNamer
@@ -728,7 +729,7 @@
*/
oName:
noun { $$ = finalPattern($1); }
- | '_' { $$ = ignore(); }
+ | _ { $$ = ignore(); }
| BIND noun { $$ = bindDefiner($2); }
| VAR noun { $$ = varPattern($2); }
| DollarOpen LiteralInteger '}' { $$ = quasiLiteralPatt($2); }
@@ -968,9 +969,9 @@
* A non-reserved Identifier (as a String)
*/
ident:
- Identifier { $$ = ((Identifier)$1).getText(); }
+ Identifier { $$ = ((MilkToken)$1).getText(); }
| reserved { reserved("keyword \"" +
- ((Token)$1).getText() +
+ ((MilkToken)$1).getText() +
"\""); }
;
@@ -1122,7 +1123,7 @@
*/
pType:
noun optType { $$ = pType($1,$2); }
- | '_' optType { $$ = pType(null,$2); }
+ | _ optType { $$ = pType(null,$2); }
;
optType:
@@ -1347,7 +1348,7 @@
*
*/
private int yylex() {
- Token token = null;
+ MilkToken token = null;
try {
token = myLexer.nextToken();
} catch (IOException ex) {
@@ -1362,7 +1363,7 @@
*
*/
private void yyerror(String s) throws SyntaxException {
- int ttype = ((Token)yylval).getType();
+ int ttype = ((MilkToken)yylval).getType();
if (EParser.EOFTOK == ttype && "syntax error".equals(s)) {
myLexer.needMore("Unexpected EOF");
@@ -1393,6 +1394,50 @@
}
+/**
+ *
+ */
+private boolean isTokenKind(Object tok, int[] members) {
+ if (! (tok instanceof MilkToken)) {
+ return false;
+ }
+ int ttype = ((MilkToken)tok).getType();
+ for (int i = 0; i < members.length; i++) {
+ if (ttype == members[i]) {
+ return true;
+ }
+ }
+ return false;
+}
+
+static private final int[] LiteralTypes = {
+ LiteralInteger,
+ LiteralFloat64,
+ LiteralChar,
+ LiteralString,
+ LiteralTwine
+};
+
+/**
+ *
+ */
+/*package*/ boolean isLiteralToken(Object tok) {
+ return isTokenKind(tok, LiteralTypes);
+}
+
+static private final int[] QuasiTypes = {
+ QuasiOpen,
+ QuasiClose
+};
+
+/**
+ *
+ */
+/*package*/ boolean isQuasiPart(Object tok) {
+ return isTokenKind(tok, QuasiTypes);
+}
+
+
/*********************************/
@@ -1456,6 +1501,7 @@
TheTokens[VAR] = "var";
TheTokens[WHEN] = "when";
TheTokens[WHILE] = "while";
+ TheTokens[_] = "_";
/* pseudo-reserved keywords */
TheTokens[DEFINE] = "define";