This commit was generated by cvs2svn to compensate for changes in r4,

which included commits to RCS files with non-trunk default branches.
This commit is contained in:
hns 2000-12-29 17:58:10 +00:00
parent af35ca5581
commit ee13186158
148 changed files with 34934 additions and 0 deletions

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTAllocationExpression.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTAllocationExpression extends SimpleNode {
public ASTAllocationExpression(int id) {
super(id);
}
public ASTAllocationExpression(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTAllocationExpression(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTAllocationExpression(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTAndExpressionSequence.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTAndExpressionSequence extends SimpleNode {
public ASTAndExpressionSequence(int id) {
super(id);
}
public ASTAndExpressionSequence(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTAndExpressionSequence(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTAndExpressionSequence(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTAssignmentExpression.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTAssignmentExpression extends SimpleNode {
public ASTAssignmentExpression(int id) {
super(id);
}
public ASTAssignmentExpression(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTAssignmentExpression(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTAssignmentExpression(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTBinaryExpressionSequence.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTBinaryExpressionSequence extends SimpleNode {
public ASTBinaryExpressionSequence(int id) {
super(id);
}
public ASTBinaryExpressionSequence(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTBinaryExpressionSequence(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTBinaryExpressionSequence(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTBreakStatement.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTBreakStatement extends SimpleNode {
public ASTBreakStatement(int id) {
super(id);
}
public ASTBreakStatement(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTBreakStatement(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTBreakStatement(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTCompositeReference.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTCompositeReference extends SimpleNode {
public ASTCompositeReference(int id) {
super(id);
}
public ASTCompositeReference(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTCompositeReference(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTCompositeReference(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTConditionalExpression.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTConditionalExpression extends SimpleNode {
public ASTConditionalExpression(int id) {
super(id);
}
public ASTConditionalExpression(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTConditionalExpression(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTConditionalExpression(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTContinueStatement.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTContinueStatement extends SimpleNode {
public ASTContinueStatement(int id) {
super(id);
}
public ASTContinueStatement(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTContinueStatement(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTContinueStatement(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTEmptyExpression.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTEmptyExpression extends SimpleNode {
public ASTEmptyExpression(int id) {
super(id);
}
public ASTEmptyExpression(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTEmptyExpression(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTEmptyExpression(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTExpressionList.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTExpressionList extends SimpleNode {
public ASTExpressionList(int id) {
super(id);
}
public ASTExpressionList(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTExpressionList(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTExpressionList(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTForInStatement.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTForInStatement extends SimpleNode {
public ASTForInStatement(int id) {
super(id);
}
public ASTForInStatement(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTForInStatement(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTForInStatement(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTForStatement.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTForStatement extends SimpleNode {
public ASTForStatement(int id) {
super(id);
}
public ASTForStatement(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTForStatement(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTForStatement(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTForVarInStatement.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTForVarInStatement extends SimpleNode {
public ASTForVarInStatement(int id) {
super(id);
}
public ASTForVarInStatement(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTForVarInStatement(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTForVarInStatement(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTForVarStatement.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTForVarStatement extends SimpleNode {
public ASTForVarStatement(int id) {
super(id);
}
public ASTForVarStatement(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTForVarStatement(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTForVarStatement(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,39 @@
/* Generated By:JJTree: Do not edit this line. ASTFormalParameterList.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTFormalParameterList extends SimpleNode {
public ASTFormalParameterList(int id) {
super(id);
}
public ASTFormalParameterList(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTFormalParameterList(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTFormalParameterList(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
// JMCL
public String [] getArguments() {
int n = jjtGetNumChildren();
String [] args = new String[n];
for (int i=0; i<n; i++) {
ASTIdentifier idNode = (ASTIdentifier) (jjtGetChild(i));
args[i]=idNode.getName();
}
return args;
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTFunctionCallParameters.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTFunctionCallParameters extends SimpleNode {
public ASTFunctionCallParameters(int id) {
super(id);
}
public ASTFunctionCallParameters(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTFunctionCallParameters(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTFunctionCallParameters(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,38 @@
/* Generated By:JJTree: Do not edit this line. ASTFunctionDeclaration.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTFunctionDeclaration extends SimpleNode {
private String sourceString = null;
public ASTFunctionDeclaration(int id) {
super(id);
}
public ASTFunctionDeclaration(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTFunctionDeclaration(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTFunctionDeclaration(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
public void setSourceString(String sourceString) {
this.sourceString = sourceString;
}
public String getSourceString() {
return sourceString;
}
}

View file

@ -0,0 +1,50 @@
/* Generated By:JJTree: Do not edit this line. ASTIdentifier.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTIdentifier extends SimpleNode {
private String identifierName = null;
private int hash = 0;
public ASTIdentifier(int id) {
super(id);
}
public ASTIdentifier(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTIdentifier(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTIdentifier(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
// JMCL
public void setName(String identifierName) {
this.identifierName = identifierName.intern(); // to lower number of strings
this.hash = identifierName.hashCode();
}
public int hashCode() {
return hash;
}
public String getName() {
return identifierName;
}
public String toString() {
return "<" + identifierName + ">";
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTIfStatement.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTIfStatement extends SimpleNode {
public ASTIfStatement(int id) {
super(id);
}
public ASTIfStatement(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTIfStatement(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTIfStatement(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,210 @@
/* Generated By:JJTree: Do not edit this line. ASTLiteral.java */
package FESI.AST;
import FESI.Parser.*;
import FESI.Data.*;
import FESI.Exceptions.*;
public class ASTLiteral extends SimpleNode {
private ESValue theValue = null;
public ASTLiteral(int id) {
super(id);
}
public ASTLiteral(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTLiteral(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTLiteral(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
// JMCL
public ESValue getValue() {
return theValue;
}
static final int hexval(char c) throws ProgrammingError {
switch(c)
{
case '0' :
return 0;
case '1' :
return 1;
case '2' :
return 2;
case '3' :
return 3;
case '4' :
return 4;
case '5' :
return 5;
case '6' :
return 6;
case '7' :
return 7;
case '8' :
return 8;
case '9' :
return 9;
case 'a' :
case 'A' :
return 10;
case 'b' :
case 'B' :
return 11;
case 'c' :
case 'C' :
return 12;
case 'd' :
case 'D' :
return 13;
case 'e' :
case 'E' :
return 14;
case 'f' :
case 'F' :
return 15;
}
throw new ProgrammingError("Illegal hex or unicode constant"); // Should never come here
}
static final int octval(char c) throws ProgrammingError {
switch(c)
{
case '0' :
return 0;
case '1' :
return 1;
case '2' :
return 2;
case '3' :
return 3;
case '4' :
return 4;
case '5' :
return 5;
case '6' :
return 6;
case '7' :
return 7;
case '8' :
return 8;
case '9' :
return 9;
case 'a' :
case 'A' :
return 10;
case 'b' :
case 'B' :
return 11;
case 'c' :
case 'C' :
return 12;
case 'd' :
case 'D' :
return 13;
case 'e' :
case 'E' :
return 14;
case 'f' :
case 'F' :
return 15;
}
throw new ProgrammingError("Illegal octal constant"); // Should never come here
}
public void setStringValue(String image) {
int l = image.length();
StringBuffer sb = new StringBuffer(l);
for (int i=0; i<l; i++) {
char c = image.charAt(i);
if ((c == '\\') && (i+1<l)){
i++;
c = image.charAt(i);
if (c=='n') c='\n';
else if (c=='b') c = '\b';
else if (c=='f') c = '\f';
else if (c=='r') c = '\r';
else if (c=='t') c = '\t';
else if (c =='x') {
c = (char)(hexval(image.charAt(i+1)) << 4 |
hexval(image.charAt(i+1)));
i +=2;
} else if (c =='u') {
c = (char)(hexval(image.charAt(i+1)) << 12 |
hexval(image.charAt(i+2)) << 8 |
hexval(image.charAt(i+3)) << 4 |
hexval(image.charAt(i+4)));
i +=4;
} else if (c >='0' && c <= '7') {
c = (char)(octval(image.charAt(i)));
if ((image.length()>i) &&
(image.charAt(i+1)>='0') && (image.charAt(i+1)<='7')) {
i++;
c = (char) ((c<<4) | octval(image.charAt(i)));
}
}
}
sb.append(c);
}
theValue = new ESString(sb.toString());
}
public void setDecimalValue(String image) {
try {
theValue = new ESNumber(Long.parseLong(image));
} catch (NumberFormatException e) {
Double value = new Double(image);
theValue = new ESNumber(value.doubleValue());
}
}
public void setOctalValue(String image) {
try {
String imageWithout0 = image.substring(1);
theValue = new ESNumber(Long.parseLong(imageWithout0,8));
} catch (NumberFormatException e) {
Double value = new Double(image);
theValue = new ESNumber(value.doubleValue());
}
}
public void setHexValue(String image) {
try {
String imageWithout0x = image.substring(2);
theValue = new ESNumber(Long.parseLong(imageWithout0x,16));
} catch (NumberFormatException e) {
Double value = new Double(image);
theValue = new ESNumber(value.doubleValue());
}
}
public void setFloatingPointValue(String image) {
Double value = new Double(image);
theValue = new ESNumber(value.doubleValue());
}
public void setBooleanValue(boolean value) {
theValue = ESBoolean.makeBoolean(value);
}
public void setNullValue() {
theValue = ESNull.theNull;
}
public String toString() {
return "[" + theValue.toString() + "]";
}
}

View file

@ -0,0 +1,44 @@
/* Generated By:JJTree: Do not edit this line. ASTOperator.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTOperator extends SimpleNode {
private int operatorCode = EOF;
public ASTOperator(int id) {
super(id);
}
public ASTOperator(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTOperator(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTOperator(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
// JMCL
public void setOperator(int operatorCode) {
this.operatorCode = operatorCode;
}
public int getOperator() {
return operatorCode;
}
public String toString() {
return "<" + tokenImage[operatorCode] + ">";
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTOrExpressionSequence.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTOrExpressionSequence extends SimpleNode {
public ASTOrExpressionSequence(int id) {
super(id);
}
public ASTOrExpressionSequence(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTOrExpressionSequence(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTOrExpressionSequence(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTPostfixExpression.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTPostfixExpression extends SimpleNode {
public ASTPostfixExpression(int id) {
super(id);
}
public ASTPostfixExpression(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTPostfixExpression(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTPostfixExpression(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTProgram.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTProgram extends SimpleNode {
public ASTProgram(int id) {
super(id);
}
public ASTProgram(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTProgram(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTProgram(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTPropertyIdentifierReference.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTPropertyIdentifierReference extends SimpleNode {
public ASTPropertyIdentifierReference(int id) {
super(id);
}
public ASTPropertyIdentifierReference(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTPropertyIdentifierReference(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTPropertyIdentifierReference(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTPropertyValueReference.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTPropertyValueReference extends SimpleNode {
public ASTPropertyValueReference(int id) {
super(id);
}
public ASTPropertyValueReference(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTPropertyValueReference(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTPropertyValueReference(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTReturnStatement.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTReturnStatement extends SimpleNode {
public ASTReturnStatement(int id) {
super(id);
}
public ASTReturnStatement(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTReturnStatement(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTReturnStatement(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTStatement.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTStatement extends SimpleNode {
public ASTStatement(int id) {
super(id);
}
public ASTStatement(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTStatement(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTStatement(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTStatementList.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTStatementList extends SimpleNode {
public ASTStatementList(int id) {
super(id);
}
public ASTStatementList(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTStatementList(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTStatementList(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTThisReference.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTThisReference extends SimpleNode {
public ASTThisReference(int id) {
super(id);
}
public ASTThisReference(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTThisReference(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTThisReference(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTUnaryExpression.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTUnaryExpression extends SimpleNode {
public ASTUnaryExpression(int id) {
super(id);
}
public ASTUnaryExpression(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTUnaryExpression(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTUnaryExpression(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTVariableDeclaration.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTVariableDeclaration extends SimpleNode {
public ASTVariableDeclaration(int id) {
super(id);
}
public ASTVariableDeclaration(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTVariableDeclaration(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTVariableDeclaration(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,28 @@
/* Generated By:JJTree: Do not edit this line. ASTWhileStatement.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTWhileStatement extends SimpleNode {
public ASTWhileStatement(int id) {
super(id);
}
public ASTWhileStatement(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTWhileStatement(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTWhileStatement(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
}

View file

@ -0,0 +1,40 @@
/* Generated By:JJTree: Do not edit this line. ASTWithStatement.java */
package FESI.AST;
import FESI.Parser.*;
public class ASTWithStatement extends SimpleNode {
Object evaluationSource = null;
public ASTWithStatement(int id) {
super(id);
}
public ASTWithStatement(EcmaScript p, int id) {
super(p, id);
}
public static Node jjtCreate(int id) {
return new ASTWithStatement(id);
}
public static Node jjtCreate(EcmaScript p, int id) {
return new ASTWithStatement(p, id);
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
// JMCL
public void setEvaluationSource(Object evaluationSource) {
this.evaluationSource = evaluationSource;
}
public Object getEvaluationSource() {
return evaluationSource;
}
}

View file

@ -0,0 +1,263 @@
package FESI.AST;
import FESI.Parser.*;
public class EcmaScriptDumpVisitor implements EcmaScriptVisitor
{
private int indent = 0;
private String indentString() {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < indent; ++i) {
sb.append(" ");
}
return sb.toString();
}
public Object visit(SimpleNode node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTProgram node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTStatementList node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTFunctionDeclaration node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTFormalParameterList node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTStatement node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTVariableDeclaration node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTIfStatement node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTWhileStatement node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTForStatement node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTForInStatement node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTForVarStatement node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTForVarInStatement node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTContinueStatement node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTBreakStatement node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTReturnStatement node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTWithStatement node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTThisReference node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTCompositeReference node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTFunctionCallParameters node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTPropertyIdentifierReference node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTPropertyValueReference node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTAllocationExpression node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTOperator node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTPostfixExpression node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTUnaryExpression node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTBinaryExpressionSequence node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTOrExpressionSequence node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTAndExpressionSequence node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTConditionalExpression node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTAssignmentExpression node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTExpressionList node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTEmptyExpression node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTLiteral node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
public Object visit(ASTIdentifier node, Object data) {
System.out.println(indentString() + node);
++indent;
data = node.childrenAccept(this, data);
--indent;
return data;
}
}

View file

@ -0,0 +1,81 @@
/* Generated By:JJTree: Do not edit this line. EcmaScriptTreeConstants.java */
package FESI.AST;
public interface EcmaScriptTreeConstants
{
public int JJTLITERAL = 0;
public int JJTIDENTIFIER = 1;
public int JJTVOID = 2;
public int JJTTHISREFERENCE = 3;
public int JJTCOMPOSITEREFERENCE = 4;
public int JJTFUNCTIONCALLPARAMETERS = 5;
public int JJTPROPERTYVALUEREFERENCE = 6;
public int JJTPROPERTYIDENTIFIERREFERENCE = 7;
public int JJTALLOCATIONEXPRESSION = 8;
public int JJTOPERATOR = 9;
public int JJTPOSTFIXEXPRESSION = 10;
public int JJTUNARYEXPRESSION = 11;
public int JJTBINARYEXPRESSIONSEQUENCE = 12;
public int JJTANDEXPRESSIONSEQUENCE = 13;
public int JJTOREXPRESSIONSEQUENCE = 14;
public int JJTCONDITIONALEXPRESSION = 15;
public int JJTASSIGNMENTEXPRESSION = 16;
public int JJTEXPRESSIONLIST = 17;
public int JJTSTATEMENT = 18;
public int JJTSTATEMENTLIST = 19;
public int JJTVARIABLEDECLARATION = 20;
public int JJTIFSTATEMENT = 21;
public int JJTWHILESTATEMENT = 22;
public int JJTFORSTATEMENT = 23;
public int JJTEMPTYEXPRESSION = 24;
public int JJTFORVARSTATEMENT = 25;
public int JJTFORINSTATEMENT = 26;
public int JJTFORVARINSTATEMENT = 27;
public int JJTCONTINUESTATEMENT = 28;
public int JJTBREAKSTATEMENT = 29;
public int JJTRETURNSTATEMENT = 30;
public int JJTWITHSTATEMENT = 31;
public int JJTFUNCTIONDECLARATION = 32;
public int JJTFORMALPARAMETERLIST = 33;
public int JJTPROGRAM = 34;
public String[] jjtNodeName = {
"Literal",
"Identifier",
"void",
"ThisReference",
"CompositeReference",
"FunctionCallParameters",
"PropertyValueReference",
"PropertyIdentifierReference",
"AllocationExpression",
"Operator",
"PostfixExpression",
"UnaryExpression",
"BinaryExpressionSequence",
"AndExpressionSequence",
"OrExpressionSequence",
"ConditionalExpression",
"AssignmentExpression",
"ExpressionList",
"Statement",
"StatementList",
"VariableDeclaration",
"IfStatement",
"WhileStatement",
"ForStatement",
"EmptyExpression",
"ForVarStatement",
"ForInStatement",
"ForVarInStatement",
"ContinueStatement",
"BreakStatement",
"ReturnStatement",
"WithStatement",
"FunctionDeclaration",
"FormalParameterList",
"Program",
};
}

View file

@ -0,0 +1,42 @@
/* Generated By:JJTree: Do not edit this line. EcmaScriptVisitor.java */
package FESI.AST;
public interface EcmaScriptVisitor
{
public Object visit(SimpleNode node, Object data);
public Object visit(ASTLiteral node, Object data);
public Object visit(ASTIdentifier node, Object data);
public Object visit(ASTThisReference node, Object data);
public Object visit(ASTCompositeReference node, Object data);
public Object visit(ASTFunctionCallParameters node, Object data);
public Object visit(ASTPropertyValueReference node, Object data);
public Object visit(ASTPropertyIdentifierReference node, Object data);
public Object visit(ASTAllocationExpression node, Object data);
public Object visit(ASTOperator node, Object data);
public Object visit(ASTPostfixExpression node, Object data);
public Object visit(ASTUnaryExpression node, Object data);
public Object visit(ASTBinaryExpressionSequence node, Object data);
public Object visit(ASTAndExpressionSequence node, Object data);
public Object visit(ASTOrExpressionSequence node, Object data);
public Object visit(ASTConditionalExpression node, Object data);
public Object visit(ASTAssignmentExpression node, Object data);
public Object visit(ASTExpressionList node, Object data);
public Object visit(ASTStatement node, Object data);
public Object visit(ASTStatementList node, Object data);
public Object visit(ASTVariableDeclaration node, Object data);
public Object visit(ASTIfStatement node, Object data);
public Object visit(ASTWhileStatement node, Object data);
public Object visit(ASTForStatement node, Object data);
public Object visit(ASTEmptyExpression node, Object data);
public Object visit(ASTForVarStatement node, Object data);
public Object visit(ASTForInStatement node, Object data);
public Object visit(ASTForVarInStatement node, Object data);
public Object visit(ASTContinueStatement node, Object data);
public Object visit(ASTBreakStatement node, Object data);
public Object visit(ASTReturnStatement node, Object data);
public Object visit(ASTWithStatement node, Object data);
public Object visit(ASTFunctionDeclaration node, Object data);
public Object visit(ASTFormalParameterList node, Object data);
public Object visit(ASTProgram node, Object data);
}

View file

@ -0,0 +1,123 @@
/* Generated By:JJTree: Do not edit this line. JJTEcmaScriptState.java */
package FESI.AST;
public class JJTEcmaScriptState {
private java.util.Stack nodes;
private java.util.Stack marks;
private int sp; // number of nodes on stack
private int mk; // current mark
private boolean node_created;
public JJTEcmaScriptState() {
nodes = new java.util.Stack();
marks = new java.util.Stack();
sp = 0;
mk = 0;
}
/* Determines whether the current node was actually closed and
pushed. This should only be called in the final user action of a
node scope. */
public boolean nodeCreated() {
return node_created;
}
/* Call this to reinitialize the node stack. It is called
automatically by the parser's ReInit() method. */
public void reset() {
nodes.removeAllElements();
marks.removeAllElements();
sp = 0;
mk = 0;
}
/* Returns the root node of the AST. It only makes sense to call
this after a successful parse. */
public Node rootNode() {
return (Node)nodes.elementAt(0);
}
/* Pushes a node on to the stack. */
public void pushNode(Node n) {
nodes.push(n);
++sp;
}
/* Returns the node on the top of the stack, and remove it from the
stack. */
public Node popNode() {
if (--sp < mk) {
mk = ((Integer)marks.pop()).intValue();
}
return (Node)nodes.pop();
}
/* Returns the node currently on the top of the stack. */
public Node peekNode() {
return (Node)nodes.peek();
}
/* Returns the number of children on the stack in the current node
scope. */
public int nodeArity() {
return sp - mk;
}
public void clearNodeScope(Node n) {
while (sp > mk) {
popNode();
}
mk = ((Integer)marks.pop()).intValue();
}
public void openNodeScope(Node n) {
marks.push(new Integer(mk));
mk = sp;
n.jjtOpen();
}
/* A definite node is constructed from a specified number of
children. That number of nodes are popped from the stack and
made the children of the definite node. Then the definite node
is pushed on to the stack. */
public void closeNodeScope(Node n, int num) {
mk = ((Integer)marks.pop()).intValue();
while (num-- > 0) {
Node c = popNode();
c.jjtSetParent(n);
n.jjtAddChild(c, num);
}
n.jjtClose();
pushNode(n);
node_created = true;
}
/* A conditional node is constructed if its condition is true. All
the nodes that have been pushed since the node was opened are
made children of the the conditional node, which is then pushed
on to the stack. If the condition is false the node is not
constructed and they are left on the stack. */
public void closeNodeScope(Node n, boolean condition) {
if (condition) {
int a = nodeArity();
mk = ((Integer)marks.pop()).intValue();
while (a-- > 0) {
Node c = popNode();
c.jjtSetParent(n);
n.jjtAddChild(c, a);
}
n.jjtClose();
pushNode(n);
node_created = true;
} else {
mk = ((Integer)marks.pop()).intValue();
node_created = false;
}
}
}

37
src/FESI/AST/Node.java Normal file
View file

@ -0,0 +1,37 @@
/* Generated By:JJTree: Do not edit this line. Node.java */
package FESI.AST;
/* All AST nodes must implement this interface. It provides basic
machinery for constructing the parent and child relationships
between nodes. */
public interface Node {
/** This method is called after the node has been made the current
node. It indicates that child nodes can now be added to it. */
public void jjtOpen();
/** This method is called after all the child nodes have been
added. */
public void jjtClose();
/** This pair of methods are used to inform the node of its
parent. */
public void jjtSetParent(Node n);
public Node jjtGetParent();
/** This method tells the node to add its argument to the node's
list of children. */
public void jjtAddChild(Node n, int i);
/** This method returns a child node. The children are numbered
from zero, left to right. */
public Node jjtGetChild(int i);
/** Return the number of children the node has. */
public int jjtGetNumChildren();
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data);
}

View file

@ -0,0 +1,129 @@
/* Generated By:JJTree: Do not edit this line. SimpleNode.java */
package FESI.AST;
import FESI.Parser.*;
import FESI.Exceptions.*;
public abstract class SimpleNode implements Node, EcmaScriptConstants {
protected Node parent;
protected Node[] children;
protected int id;
protected EcmaScript parser;
protected int line = 0; // JMCL
public SimpleNode(int i) {
id = i;
}
public SimpleNode(EcmaScript p, int i) {
this(i);
parser = p;
}
public void jjtOpen() {
}
public void jjtClose() {
}
public void jjtSetParent(Node n) { parent = n; }
public Node jjtGetParent() { return parent; }
public void jjtAddChild(Node n, int i) {
if (children == null) {
children = new Node[i + 1];
} else if (i >= children.length) {
Node c[] = new Node[i + 1];
System.arraycopy(children, 0, c, 0, children.length);
children = c;
}
children[i] = n;
}
public Node jjtGetChild(int i) {
return children[i];
}
public int jjtGetNumChildren() {
return (children == null) ? 0 : children.length;
}
/** Accept the visitor. **/
public Object jjtAccept(EcmaScriptVisitor visitor, Object data) {
return visitor.visit(this, data);
}
/** Accept the visitor. **/
public Object childrenAccept(EcmaScriptVisitor visitor, Object data) {
if (children != null) {
for (int i = 0; i < children.length; ++i) {
children[i].jjtAccept(visitor, data);
}
}
return data;
}
/* You can override these two methods in subclasses of SimpleNode to
customize the way the node appears when the tree is dumped. If
your output uses more than one line you should override
toString(String), otherwise overriding toString() is probably all
you need to do. */
// JMCL
public String toString() {
return EcmaScriptTreeConstants.jjtNodeName[id];
}
public String toString(String prefix) { return prefix + toString(); }
/* Override this method if you want to customize how the node dumps
out its children. */
public void dump(String prefix) {
System.out.println(toString(prefix));
if (children != null) {
for (int i = 0; i < children.length; ++i) {
SimpleNode n = (SimpleNode)children[i];
if (n != null) {
n.dump(prefix + " ");
}
}
}
}
// JMCL
public void setLineNumber(int line) {
this.line = line;
}
public int getLineNumber() {
return line;
}
public void assertNoChildren() {
if (jjtGetNumChildren()>0) {
throw new ProgrammingError("AST Should have no children");
}
}
public void assertOneChild() {
if (jjtGetNumChildren()!=1) {
throw new ProgrammingError("AST Should have 1 child");
}
}
public void assertTwoChildren() {
if (jjtGetNumChildren()!=2) {
throw new ProgrammingError("AST Should have 2 children");
}
}
public void assertThreeChildren() {
if (jjtGetNumChildren()!=3) {
throw new ProgrammingError("AST Should have 3 children");
}
}
public void assertFourChildren() {
if (jjtGetNumChildren()!=4) {
throw new ProgrammingError("AST Should have 4 children");
}
}
}