X-Git-Url: http://git.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java
index eac7b50..c4cc3b5 100644
--- a/net.sourceforge.phpeclipse/src/test/PHPParser.java
+++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java
@@ -64,7 +64,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
/** The cursor in expression stack. */
private static int nodePtr;
- public static final boolean PARSER_DEBUG = true;
+ public static final boolean PARSER_DEBUG = false;
public final void setFileToParse(final IFile fileToParse) {
PHPParser.fileToParse = fileToParse;
@@ -78,24 +78,26 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
PHPParser.fileToParse = fileToParse;
}
- public static final void phpParserTester(final String strEval) throws ParseException {
+ public final void phpParserTester(final String strEval) throws ParseException {
final StringReader stream = new StringReader(strEval);
if (jj_input_stream == null) {
jj_input_stream = new SimpleCharStream(stream, 1, 1);
+ token_source = new PHPParserTokenManager(jj_input_stream);
}
ReInit(new StringReader(strEval));
init();
phpDocument = new PHPDocument(null,"_root".toCharArray());
currentSegment = phpDocument;
outlineInfo = new PHPOutlineInfo(null, currentSegment);
- PHPParserTokenManager.SwitchTo(PHPParserTokenManager.PHPPARSING);
+ token_source.SwitchTo(PHPParserTokenManager.PHPPARSING);
phpTest();
}
- public static final void htmlParserTester(final File fileName) throws FileNotFoundException, ParseException {
+ public final void htmlParserTester(final File fileName) throws FileNotFoundException, ParseException {
final Reader stream = new FileReader(fileName);
if (jj_input_stream == null) {
jj_input_stream = new SimpleCharStream(stream, 1, 1);
+ token_source = new PHPParserTokenManager(jj_input_stream);
}
ReInit(stream);
init();
@@ -105,10 +107,11 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
phpFile();
}
- public static final void htmlParserTester(final String strEval) throws ParseException {
+ public final void htmlParserTester(final String strEval) throws ParseException {
final StringReader stream = new StringReader(strEval);
if (jj_input_stream == null) {
jj_input_stream = new SimpleCharStream(stream, 1, 1);
+ token_source = new PHPParserTokenManager(jj_input_stream);
}
ReInit(stream);
init();
@@ -151,6 +154,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
final StringReader stream = new StringReader(s);
if (jj_input_stream == null) {
jj_input_stream = new SimpleCharStream(stream, 1, 1);
+ token_source = new PHPParserTokenManager(jj_input_stream);
}
ReInit(stream);
init();
@@ -209,14 +213,14 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
e.currentToken.sourceStart,
e.currentToken.sourceEnd,
errorLevel,
- "Line " + e.currentToken.beginLine+", "+e.currentToken.sourceStart+":"+e.currentToken.sourceEnd);
+ "Line " + e.currentToken.beginLine+", "+e.currentToken.sourceStart+':'+e.currentToken.sourceEnd);
} else {
setMarker(fileToParse,
errorMessage,
errorStart,
errorEnd,
errorLevel,
- "Line " + e.currentToken.beginLine+", "+errorStart+":"+errorEnd);
+ "Line " + e.currentToken.beginLine+", "+errorStart+':'+errorEnd);
errorStart = -1;
errorEnd = -1;
}
@@ -270,6 +274,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
final StringReader stream = new StringReader(s);
if (jj_input_stream == null) {
jj_input_stream = new SimpleCharStream(stream, 1, 1);
+ token_source = new PHPParserTokenManager(jj_input_stream);
}
ReInit(stream);
init();
@@ -305,52 +310,51 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
/**
* Put a new html block in the stack.
*/
- public static final void createNewHTMLCode() {
+ public final void createNewHTMLCode() {
final int currentPosition = token.sourceStart;
if (currentPosition == htmlStart ||
currentPosition < htmlStart ||
- currentPosition > SimpleCharStream.currentBuffer.length()) {
+ currentPosition > jj_input_stream.getCurrentBuffer().length()) {
return;
}
- final char[] chars = SimpleCharStream.currentBuffer.substring(htmlStart,
- currentPosition).toCharArray();
- pushOnAstNodes(new HTMLCode(chars, htmlStart,currentPosition));
+ final String html = jj_input_stream.getCurrentBuffer().substring(htmlStart, currentPosition);
+ pushOnAstNodes(new HTMLCode(html, htmlStart,currentPosition));
}
/** Create a new task. */
- public static final void createNewTask(final int todoStart) {
- final String todo = SimpleCharStream.currentBuffer.substring(todoStart,
- SimpleCharStream.currentBuffer.indexOf("\n",
+ public final void createNewTask(final int todoStart) {
+ final String todo = jj_input_stream.getCurrentBuffer().substring(todoStart,
+ jj_input_stream.getCurrentBuffer().indexOf("\n",
todoStart)-1);
if (!PARSER_DEBUG) {
try {
setMarker(fileToParse,
todo,
- SimpleCharStream.getBeginLine(),
+ jj_input_stream.getBeginLine(),
TASK,
- "Line "+SimpleCharStream.getBeginLine());
+ "Line "+jj_input_stream.getBeginLine());
} catch (CoreException e) {
PHPeclipsePlugin.log(e);
}
}
}
- private static final void parse() throws ParseException {
+ private final void parse() throws ParseException {
phpFile();
}
- static final public void todo() throws ParseException {
+ final public void todo() throws ParseException {
Token todoToken;
todoToken = jj_consume_token(23);
createNewTask(todoToken.sourceStart);
}
- static final public void phpTest() throws ParseException {
+ final public void phpTest() throws ParseException {
Php();
jj_consume_token(0);
}
- static final public void phpFile() throws ParseException {
+ final public void phpFile() throws ParseException {
try {
label_1:
while (true) {
@@ -396,6 +400,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
case DOLLAR:
case IDENTIFIER:
case LPAREN:
@@ -409,11 +414,11 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
}
PhpBlock();
}
- PHPParser.createNewHTMLCode();
+ createNewHTMLCode();
} catch (TokenMgrError e) {
PHPeclipsePlugin.log(e);
- errorStart = SimpleCharStream.beginOffset;
- errorEnd = SimpleCharStream.endOffset;
+ errorStart = jj_input_stream.getBeginOffset();
+ errorEnd = jj_input_stream.getEndOffset();
errorMessage = e.getMessage();
errorLevel = ERROR;
{if (true) throw generateParseException();}
@@ -425,7 +430,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
* or
* or somephpcode ?>
*/
- static final public void PhpBlock() throws ParseException {
+ final public void PhpBlock() throws ParseException {
final PHPEchoBlock phpEchoBlock;
final Token token,phpEnd;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -473,6 +478,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
case DOLLAR:
case IDENTIFIER:
case LPAREN:
@@ -508,7 +514,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
jj_la1[2] = jj_gen;
;
}
- PHPParser.createNewHTMLCode();
+ createNewHTMLCode();
Php();
try {
phpEnd = jj_consume_token(PHPEND);
@@ -516,8 +522,8 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
} catch (ParseException e) {
errorMessage = "'?>' expected";
errorLevel = ERROR;
- errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
- errorEnd = SimpleCharStream.getPosition() + 1;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
processParseExceptionDebug(e);
}
break;
@@ -528,12 +534,12 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
}
}
- static final public PHPEchoBlock phpEchoBlock() throws ParseException {
+ final public PHPEchoBlock phpEchoBlock() throws ParseException {
final Expression expr;
final PHPEchoBlock echoBlock;
final Token token, token2;
token = jj_consume_token(PHPECHOSTART);
- PHPParser.createNewHTMLCode();
+ createNewHTMLCode();
expr = Expression();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SEMICOLON:
@@ -552,7 +558,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
throw new Error("Missing return statement in function");
}
- static final public void Php() throws ParseException {
+ final public void Php() throws ParseException {
label_2:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -593,6 +599,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
case DOLLAR:
case IDENTIFIER:
case LPAREN:
@@ -608,7 +615,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
}
}
- static final public ClassDeclaration ClassDeclaration() throws ParseException {
+ final public ClassDeclaration ClassDeclaration() throws ParseException {
final ClassDeclaration classDeclaration;
Token className = null;
final Token superclassName, token, extendsToken;
@@ -676,15 +683,15 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
throw new Error("Missing return statement in function");
}
- static final public int ClassBody(final ClassDeclaration classDeclaration) throws ParseException {
+ final public int ClassBody(final ClassDeclaration classDeclaration) throws ParseException {
Token token;
try {
jj_consume_token(LBRACE);
} catch (ParseException e) {
errorMessage = "unexpected token : '"+ e.currentToken.next.image + "'. '{' expected";
errorLevel = ERROR;
- errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
- errorEnd = SimpleCharStream.getPosition() + 1;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
processParseExceptionDebug(e);
}
label_3:
@@ -706,10 +713,10 @@ Token token;
} catch (ParseException e) {
errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. 'var', 'function' or '}' expected";
errorLevel = ERROR;
- errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
- errorEnd = SimpleCharStream.getPosition() + 1;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
processParseExceptionDebug(e);
- {if (true) return PHPParser.token.sourceEnd;}
+ {if (true) return this.token.sourceEnd;}
}
throw new Error("Missing return statement in function");
}
@@ -717,7 +724,7 @@ Token token;
/**
* A class can contain only methods and fields.
*/
- static final public void ClassBodyDeclaration(final ClassDeclaration classDeclaration) throws ParseException {
+ final public void ClassBodyDeclaration(final ClassDeclaration classDeclaration) throws ParseException {
final MethodDeclaration method;
final FieldDeclaration field;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -741,7 +748,7 @@ Token token;
* A class field declaration : it's var VariableDeclarator() (, VariableDeclarator())*;.
* it is only used by ClassBodyDeclaration()
*/
- static final public FieldDeclaration FieldDeclaration() throws ParseException {
+ final public FieldDeclaration FieldDeclaration() throws ParseException {
VariableDeclaration variableDeclaration;
final VariableDeclaration[] list;
final ArrayList arrayList = new ArrayList();
@@ -751,7 +758,6 @@ Token token;
token = jj_consume_token(VAR);
variableDeclaration = VariableDeclaratorNoSuffix();
arrayList.add(variableDeclaration);
- outlineInfo.addVariable(variableDeclaration.name());
pos = variableDeclaration.sourceEnd;
label_4:
while (true) {
@@ -797,7 +803,7 @@ Token token;
* a strict variable declarator : there cannot be a suffix here.
* It will be used by fields and formal parameters
*/
- static final public VariableDeclaration VariableDeclaratorNoSuffix() throws ParseException {
+ final public VariableDeclaration VariableDeclaratorNoSuffix() throws ParseException {
final Token token, lbrace,rbrace;
Expression expr, initializer = null;
Token assignToken;
@@ -853,7 +859,7 @@ Token token;
/**
* this will be used by static statement
*/
- static final public VariableDeclaration VariableDeclarator() throws ParseException {
+ final public VariableDeclaration VariableDeclarator() throws ParseException {
final AbstractVariable variable;
Expression initializer = null;
final Token token;
@@ -893,9 +899,8 @@ Token token;
* A Variable name.
* @return the variable name (with suffix)
*/
- static final public AbstractVariable VariableDeclaratorId() throws ParseException {
- final Variable var;
- AbstractVariable expression = null;
+ final public AbstractVariable VariableDeclaratorId() throws ParseException {
+ AbstractVariable var;
try {
var = Variable();
label_5:
@@ -905,23 +910,20 @@ Token token;
} else {
break label_5;
}
- expression = VariableSuffix(var);
+ var = VariableSuffix(var);
}
- if (expression == null) {
- {if (true) return var;}
- }
- {if (true) return expression;}
+ {if (true) return var;}
} catch (ParseException e) {
errorMessage = "'$' expected for variable identifier";
errorLevel = ERROR;
- errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
- errorEnd = SimpleCharStream.getPosition() + 1;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
{if (true) throw e;}
}
throw new Error("Missing return statement in function");
}
- static final public Variable Variable() throws ParseException {
+ final public Variable Variable() throws ParseException {
Variable variable = null;
final Token token;
token = jj_consume_token(DOLLAR);
@@ -930,7 +932,7 @@ Token token;
throw new Error("Missing return statement in function");
}
- static final public Variable Var() throws ParseException {
+ final public Variable Var() throws ParseException {
Variable variable = null;
final Token token,token2;
ConstantIdentifier constant;
@@ -951,6 +953,7 @@ Token token;
break;
case IDENTIFIER:
token = jj_consume_token(IDENTIFIER);
+ outlineInfo.addVariable('$' + token.image);
{if (true) return new Variable(token.image,token.sourceStart,token.sourceEnd);}
break;
default:
@@ -961,7 +964,7 @@ Token token;
throw new Error("Missing return statement in function");
}
- static final public Expression VariableInitializer() throws ParseException {
+ final public Expression VariableInitializer() throws ParseException {
final Expression expr;
final Token token, token2;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -971,6 +974,7 @@ Token token;
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
expr = Literal();
{if (true) return expr;}
break;
@@ -1026,7 +1030,7 @@ Token token;
throw new Error("Missing return statement in function");
}
- static final public ArrayVariableDeclaration ArrayVariable() throws ParseException {
+ final public ArrayVariableDeclaration ArrayVariable() throws ParseException {
final Expression expr,expr2;
expr = Expression();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -1039,11 +1043,11 @@ final Expression expr,expr2;
jj_la1[17] = jj_gen;
;
}
- {if (true) return new ArrayVariableDeclaration(expr,SimpleCharStream.getPosition());}
+ {if (true) return new ArrayVariableDeclaration(expr,jj_input_stream.getPosition());}
throw new Error("Missing return statement in function");
}
- static final public ArrayVariableDeclaration[] ArrayInitializer() throws ParseException {
+ final public ArrayVariableDeclaration[] ArrayInitializer() throws ParseException {
ArrayVariableDeclaration expr;
final ArrayList list = new ArrayList();
jj_consume_token(LPAREN);
@@ -1066,6 +1070,7 @@ final Expression expr,expr2;
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
case DOLLAR:
case IDENTIFIER:
case LPAREN:
@@ -1107,7 +1112,7 @@ final Expression expr,expr2;
* A Method Declaration.
* function MetodDeclarator() Block()
*/
- static final public MethodDeclaration MethodDeclaration() throws ParseException {
+ final public MethodDeclaration MethodDeclaration() throws ParseException {
final MethodDeclaration functionDeclaration;
final Block block;
final OutlineableWithChildren seg = currentSegment;
@@ -1120,8 +1125,8 @@ final Expression expr,expr2;
if (errorMessage != null) {if (true) throw e;}
errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected";
errorLevel = ERROR;
- errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
- errorEnd = SimpleCharStream.getPosition() + 1;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
{if (true) throw e;}
}
currentSegment = functionDeclaration;
@@ -1137,10 +1142,10 @@ final Expression expr,expr2;
* [&] IDENTIFIER(parameters ...).
* @return a function description for the outline
*/
- static final public MethodDeclaration MethodDeclarator(final int start) throws ParseException {
+ final public MethodDeclaration MethodDeclarator(final int start) throws ParseException {
Token identifier = null;
Token reference = null;
- final Hashtable formalParameters = new Hashtable();
+ final ArrayList formalParameters = new ArrayList();
String identifierChar = SYNTAX_ERROR_CHAR;
int end = start;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -1192,10 +1197,10 @@ final Expression expr,expr2;
* FormalParameters follows method identifier.
* (FormalParameter())
*/
- static final public int FormalParameters(final Hashtable parameters) throws ParseException {
+ final public int FormalParameters(final ArrayList parameters) throws ParseException {
VariableDeclaration var;
final Token token;
- Token tok = PHPParser.token;
+ Token tok = this.token;
int end = tok.sourceEnd;
try {
tok = jj_consume_token(LPAREN);
@@ -1211,7 +1216,7 @@ final Expression expr,expr2;
case BIT_AND:
case DOLLAR:
var = FormalParameter();
- parameters.put(var.name(),var);end = var.sourceEnd;
+ parameters.add(var);end = var.sourceEnd;
label_7:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -1224,7 +1229,7 @@ final Expression expr,expr2;
}
jj_consume_token(COMMA);
var = FormalParameter();
- parameters.put(var.name(),var);end = var.sourceEnd;
+ parameters.add(var);end = var.sourceEnd;
}
break;
default:
@@ -1249,7 +1254,7 @@ final Expression expr,expr2;
* A formal parameter.
* $varname[=value] (,$varname[=value])
*/
- static final public VariableDeclaration FormalParameter() throws ParseException {
+ final public VariableDeclaration FormalParameter() throws ParseException {
final VariableDeclaration variableDeclaration;
Token token = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -1261,6 +1266,7 @@ final Expression expr,expr2;
;
}
variableDeclaration = VariableDeclaratorNoSuffix();
+ outlineInfo.addVariable('$'+variableDeclaration.name());
if (token != null) {
variableDeclaration.setReference(true);
}
@@ -1268,7 +1274,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public ConstantIdentifier Type() throws ParseException {
+ final public ConstantIdentifier Type() throws ParseException {
final Token token;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case STRING:
@@ -1315,7 +1321,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression Expression() throws ParseException {
+ final public Expression Expression() throws ParseException {
final Expression expr;
Expression initializer = null;
int assignOperator = -1;
@@ -1336,6 +1342,7 @@ final Expression expr,expr2;
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
case DOLLAR:
case IDENTIFIER:
case LPAREN:
@@ -1363,7 +1370,7 @@ final Expression expr,expr2;
}
errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected";
errorLevel = ERROR;
- errorEnd = SimpleCharStream.getPosition();
+ errorEnd = jj_input_stream.getPosition();
{if (true) throw e;}
}
break;
@@ -1402,7 +1409,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression ExpressionWBang() throws ParseException {
+ final public Expression ExpressionWBang() throws ParseException {
final Expression expr;
final Token token;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -1424,7 +1431,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression ExpressionNoBang() throws ParseException {
+ final public Expression ExpressionNoBang() throws ParseException {
Expression expr;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LIST:
@@ -1447,7 +1454,7 @@ final Expression expr,expr2;
* Any assignement operator.
* @return the assignement operator id
*/
- static final public int AssignmentOperator() throws ParseException {
+ final public int AssignmentOperator() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ASSIGN:
jj_consume_token(ASSIGN);
@@ -1509,7 +1516,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression ConditionalExpression() throws ParseException {
+ final public Expression ConditionalExpression() throws ParseException {
final Expression expr;
Expression expr2 = null;
Expression expr3 = null;
@@ -1532,7 +1539,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression ConditionalOrExpression() throws ParseException {
+ final public Expression ConditionalOrExpression() throws ParseException {
Expression expr,expr2;
int operator;
expr = ConditionalAndExpression();
@@ -1568,7 +1575,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression ConditionalAndExpression() throws ParseException {
+ final public Expression ConditionalAndExpression() throws ParseException {
Expression expr,expr2;
int operator;
expr = ConcatExpression();
@@ -1604,7 +1611,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression ConcatExpression() throws ParseException {
+ final public Expression ConcatExpression() throws ParseException {
Expression expr,expr2;
expr = InclusiveOrExpression();
label_10:
@@ -1625,7 +1632,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression InclusiveOrExpression() throws ParseException {
+ final public Expression InclusiveOrExpression() throws ParseException {
Expression expr,expr2;
expr = ExclusiveOrExpression();
label_11:
@@ -1646,7 +1653,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression ExclusiveOrExpression() throws ParseException {
+ final public Expression ExclusiveOrExpression() throws ParseException {
Expression expr,expr2;
expr = AndExpression();
label_12:
@@ -1667,7 +1674,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression AndExpression() throws ParseException {
+ final public Expression AndExpression() throws ParseException {
Expression expr,expr2;
expr = EqualityExpression();
label_13:
@@ -1688,7 +1695,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression EqualityExpression() throws ParseException {
+ final public Expression EqualityExpression() throws ParseException {
Expression expr,expr2;
int operator;
Token token;
@@ -1752,7 +1759,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression RelationalExpression() throws ParseException {
+ final public Expression RelationalExpression() throws ParseException {
Expression expr,expr2;
int operator;
expr = ShiftExpression();
@@ -1798,7 +1805,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression ShiftExpression() throws ParseException {
+ final public Expression ShiftExpression() throws ParseException {
Expression expr,expr2;
int operator;
expr = AdditiveExpression();
@@ -1839,7 +1846,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression AdditiveExpression() throws ParseException {
+ final public Expression AdditiveExpression() throws ParseException {
Expression expr,expr2;
int operator;
expr = MultiplicativeExpression();
@@ -1875,17 +1882,17 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression MultiplicativeExpression() throws ParseException {
+ final public Expression MultiplicativeExpression() throws ParseException {
Expression expr,expr2;
int operator;
try {
expr = UnaryExpression();
} catch (ParseException e) {
if (errorMessage != null) {if (true) throw e;}
- errorMessage = "unexpected token '"+e.currentToken.next.image+"'";
+ errorMessage = "unexpected token '"+e.currentToken.next.image+'\'';
errorLevel = ERROR;
- errorStart = PHPParser.token.sourceStart;
- errorEnd = PHPParser.token.sourceEnd;
+ errorStart = this.token.sourceStart;
+ errorEnd = this.token.sourceEnd;
{if (true) throw e;}
}
label_18:
@@ -1928,7 +1935,7 @@ final Expression expr,expr2;
/**
* An unary expression starting with @, & or nothing
*/
- static final public Expression UnaryExpression() throws ParseException {
+ final public Expression UnaryExpression() throws ParseException {
final Expression expr;
/* expr = UnaryExpressionNoPrefix() //why did I had that ?
{return new PrefixedUnaryExpression(expr,OperatorIds.AND,pos);}
@@ -1938,7 +1945,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression AtNotTildeUnaryExpression() throws ParseException {
+ final public Expression AtNotTildeUnaryExpression() throws ParseException {
final Expression expr;
final Token token;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -1970,6 +1977,7 @@ final Expression expr,expr2;
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
case DOLLAR:
case IDENTIFIER:
case LPAREN:
@@ -1988,7 +1996,7 @@ final Expression expr,expr2;
* An expression prefixed (or not) by one or more @ and !.
* @return the expression
*/
- static final public Expression AtNotUnaryExpression() throws ParseException {
+ final public Expression AtNotUnaryExpression() throws ParseException {
final Expression expr;
final Token token;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -2015,6 +2023,7 @@ final Expression expr,expr2;
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
case DOLLAR:
case IDENTIFIER:
case LPAREN:
@@ -2029,7 +2038,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression UnaryExpressionNoPrefix() throws ParseException {
+ final public Expression UnaryExpressionNoPrefix() throws ParseException {
final Expression expr;
final Token token;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -2061,6 +2070,7 @@ final Expression expr,expr2;
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
case DOLLAR:
case IDENTIFIER:
case LPAREN:
@@ -2075,7 +2085,7 @@ final Expression expr,expr2;
throw new Error("Missing return statement in function");
}
- static final public Expression PreIncDecExpression() throws ParseException {
+ final public Expression PreIncDecExpression() throws ParseException {
final Expression expr;
final int operator;
final Token token;
@@ -2098,7 +2108,7 @@ final Token token;
throw new Error("Missing return statement in function");
}
- static final public Expression UnaryExpressionNotPlusMinus() throws ParseException {
+ final public Expression UnaryExpressionNotPlusMinus() throws ParseException {
final Expression expr;
if (jj_2_3(2147483647)) {
expr = CastExpression();
@@ -2119,6 +2129,7 @@ final Token token;
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
expr = Literal();
{if (true) return expr;}
break;
@@ -2145,7 +2156,7 @@ final Token token;
throw new Error("Missing return statement in function");
}
- static final public CastExpression CastExpression() throws ParseException {
+ final public CastExpression CastExpression() throws ParseException {
final ConstantIdentifier type;
final Expression expr;
final Token token,token1;
@@ -2177,7 +2188,7 @@ final Token token,token1;
throw new Error("Missing return statement in function");
}
- static final public Expression PostfixExpression() throws ParseException {
+ final public Expression PostfixExpression() throws ParseException {
final Expression expr;
int operator = -1;
Token token = null;
@@ -2211,7 +2222,7 @@ final Token token,token1;
throw new Error("Missing return statement in function");
}
- static final public Expression PrimaryExpression() throws ParseException {
+ final public Expression PrimaryExpression() throws ParseException {
Expression expr;
Token token = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -2242,7 +2253,7 @@ final Token token,token1;
throw new Error("Missing return statement in function");
}
- static final public Expression refPrimaryExpression(final Token reference) throws ParseException {
+ final public Expression refPrimaryExpression(final Token reference) throws ParseException {
Expression expr;
Expression expr2 = null;
final Token identifier;
@@ -2334,18 +2345,18 @@ final Token token,token1;
* array(vars)
* @return an array
*/
- static final public ArrayInitializer ArrayDeclarator() throws ParseException {
+ final public ArrayInitializer ArrayDeclarator() throws ParseException {
final ArrayVariableDeclaration[] vars;
final Token token;
token = jj_consume_token(ARRAY);
vars = ArrayInitializer();
{if (true) return new ArrayInitializer(vars,
token.sourceStart,
- PHPParser.token.sourceEnd);}
+ this.token.sourceEnd);}
throw new Error("Missing return statement in function");
}
- static final public Expression ClassIdentifier() throws ParseException {
+ final public Expression ClassIdentifier() throws ParseException {
final Expression expr;
final Token token;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -2380,7 +2391,7 @@ final Token token,token1;
/**
* Used by Variabledeclaratorid and primarysuffix
*/
- static final public AbstractVariable VariableSuffix(final AbstractVariable prefix) throws ParseException {
+ final public AbstractVariable VariableSuffix(final AbstractVariable prefix) throws ParseException {
Expression expression = null;
final Token classAccessToken,lbrace,rbrace;
Token token;
@@ -2452,6 +2463,7 @@ final Token token,token1;
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
case DOLLAR:
case IDENTIFIER:
case LPAREN:
@@ -2474,6 +2486,7 @@ final Token token,token1;
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
case DOLLAR:
case IDENTIFIER:
case LPAREN:
@@ -2545,6 +2558,7 @@ final Token token,token1;
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
case DOLLAR:
case IDENTIFIER:
case LPAREN:
@@ -2567,6 +2581,7 @@ final Token token,token1;
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
case DOLLAR:
case IDENTIFIER:
case LPAREN:
@@ -2615,8 +2630,9 @@ final Token token,token1;
throw new Error("Missing return statement in function");
}
- static final public Literal Literal() throws ParseException {
+ final public Literal Literal() throws ParseException {
final Token token;
+ StringLiteral literal;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case INTEGER_LITERAL:
token = jj_consume_token(INTEGER_LITERAL);
@@ -2642,6 +2658,10 @@ final Token token,token1;
token = jj_consume_token(NULL);
{if (true) return new NullLiteral(token);}
break;
+ case DOUBLEQUOTE:
+ literal = evaluableString();
+ {if (true) return literal;}
+ break;
default:
jj_la1[71] = jj_gen;
jj_consume_token(-1);
@@ -2650,10 +2670,59 @@ final Token token,token1;
throw new Error("Missing return statement in function");
}
- static final public FunctionCall Arguments(final Expression func) throws ParseException {
+ final public StringLiteral evaluableString() throws ParseException {
+ ArrayList list = new ArrayList();
+ Token start,end;
+ Token token,lbrace,rbrace;
+ AbstractVariable var;
+ Expression expr;
+ start = jj_consume_token(DOUBLEQUOTE);
+ label_20:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case DOLLARS:
+ ;
+ break;
+ default:
+ jj_la1[72] = jj_gen;
+ break label_20;
+ }
+ jj_consume_token(DOLLARS);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case IDENTIFIER:
+ token = jj_consume_token(IDENTIFIER);
+ list.add(new Variable(token.image,
+ token.sourceStart,
+ token.sourceEnd));
+ break;
+ case LBRACE1:
+ lbrace = jj_consume_token(LBRACE1);
+ token = jj_consume_token(ID);
+ list.add(new Variable(token.image,
+ token.sourceStart,
+ token.sourceEnd));
+ rbrace = jj_consume_token(RBRACE1);
+ break;
+ default:
+ jj_la1[73] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ end = jj_consume_token(DOUBLEQUOTE2);
+ AbstractVariable[] vars = new AbstractVariable[list.size()];
+ list.toArray(vars);
+ {if (true) return new StringLiteral(jj_input_stream.getCurrentBuffer().substring(start.sourceEnd,end.sourceStart),
+ start.sourceStart,
+ end.sourceEnd,
+ vars);}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public FunctionCall Arguments(final Expression func) throws ParseException {
Expression[] args = null;
-final Token token;
- jj_consume_token(LPAREN);
+final Token token,lparen;
+ lparen = jj_consume_token(LPAREN);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ARRAY:
case LIST:
@@ -2673,13 +2742,14 @@ final Token token;
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
case DOLLAR:
case IDENTIFIER:
case LPAREN:
args = ArgumentList();
break;
default:
- jj_la1[72] = jj_gen;
+ jj_la1[74] = jj_gen;
;
}
try {
@@ -2688,11 +2758,17 @@ final Token token;
} catch (ParseException e) {
errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected to close the argument list";
errorLevel = ERROR;
- errorStart = args[args.length-1].sourceEnd+1;
- errorEnd = args[args.length-1].sourceEnd+1;
+ if (args == null) {
+ errorStart = lparen.sourceEnd+1;
+ errorEnd = lparen.sourceEnd+2;
+ } else {
+ errorStart = args[args.length-1].sourceEnd+1;
+ errorEnd = args[args.length-1].sourceEnd+2;
+ }
processParseExceptionDebug(e);
}
- {if (true) return new FunctionCall(func,args,args[args.length-1].sourceEnd);}
+ int sourceEnd = (args == null && args.length != 0) ? lparen.sourceEnd+1 : args[args.length-1].sourceEnd;
+ {if (true) return new FunctionCall(func,args,sourceEnd);}
throw new Error("Missing return statement in function");
}
@@ -2701,22 +2777,22 @@ final Token token;
* argumentDeclaration() (, argumentDeclaration)*
* @return an array of arguments
*/
- static final public Expression[] ArgumentList() throws ParseException {
+ final public Expression[] ArgumentList() throws ParseException {
Expression arg;
final ArrayList list = new ArrayList();
int pos;
Token token;
arg = Expression();
list.add(arg);pos = arg.sourceEnd;
- label_20:
+ label_21:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
- jj_la1[73] = jj_gen;
- break label_20;
+ jj_la1[75] = jj_gen;
+ break label_21;
}
token = jj_consume_token(COMMA);
pos = token.sourceEnd;
@@ -2742,7 +2818,7 @@ Token token;
* A Statement without break.
* @return a statement
*/
- static final public Statement StatementNoBreak() throws ParseException {
+ final public Statement StatementNoBreak() throws ParseException {
final Statement statement;
Token token = null;
if (jj_2_4(2)) {
@@ -2808,7 +2884,7 @@ Token token;
token = jj_consume_token(AT);
break;
default:
- jj_la1[74] = jj_gen;
+ jj_la1[76] = jj_gen;
;
}
statement = IncludeStatement();
@@ -2831,7 +2907,7 @@ Token token;
currentSegment.add((Outlineable)statement);{if (true) return statement;}
break;
default:
- jj_la1[75] = jj_gen;
+ jj_la1[77] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
@@ -2844,7 +2920,7 @@ Token token;
* expression ;
* @return an expression
*/
- static final public Statement expressionStatement() throws ParseException {
+ final public Statement expressionStatement() throws ParseException {
final Statement statement;
final Token token;
statement = Expression();
@@ -2864,7 +2940,7 @@ Token token;
throw new Error("Missing return statement in function");
}
- static final public Define defineStatement() throws ParseException {
+ final public Define defineStatement() throws ParseException {
Expression defineName,defineValue;
final Token defineToken;
Token token;
@@ -2934,7 +3010,7 @@ Token token;
/**
* A Normal statement.
*/
- static final public Statement Statement() throws ParseException {
+ final public Statement Statement() throws ParseException {
final Statement statement;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IF:
@@ -2971,6 +3047,7 @@ Token token;
case INTEGER_LITERAL:
case FLOATING_POINT_LITERAL:
case STRING_LITERAL:
+ case DOUBLEQUOTE:
case DOLLAR:
case IDENTIFIER:
case LPAREN:
@@ -2984,7 +3061,7 @@ Token token;
{if (true) return statement;}
break;
default:
- jj_la1[76] = jj_gen;
+ jj_la1[78] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
@@ -2994,22 +3071,22 @@ Token token;
/**
* An html block inside a php syntax.
*/
- static final public HTMLBlock htmlBlock() throws ParseException {
+ final public HTMLBlock htmlBlock() throws ParseException {
final int startIndex = nodePtr;
final AstNode[] blockNodes;
final int nbNodes;
final Token phpEnd;
phpEnd = jj_consume_token(PHPEND);
htmlStart = phpEnd.sourceEnd;
- label_21:
+ label_22:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PHPECHOSTART:
;
break;
default:
- jj_la1[77] = jj_gen;
- break label_21;
+ jj_la1[79] = jj_gen;
+ break label_22;
}
phpEchoBlock();
}
@@ -3022,16 +3099,16 @@ Token token;
jj_consume_token(PHPSTARTSHORT);
break;
default:
- jj_la1[78] = jj_gen;
+ jj_la1[80] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
- PHPParser.createNewHTMLCode();
+ createNewHTMLCode();
} catch (ParseException e) {
errorMessage = "unexpected end of file , '= 100) return;
if (pos == jj_endpos + 1) {
jj_lasttokens[jj_endpos++] = kind;
@@ -7328,17 +7462,17 @@ final ArrayList list = new ArrayList();
}
}
- static public ParseException generateParseException() {
+ public ParseException generateParseException() {
jj_expentries.removeAllElements();
- boolean[] la1tokens = new boolean[148];
- for (int i = 0; i < 148; i++) {
+ boolean[] la1tokens = new boolean[160];
+ for (int i = 0; i < 160; i++) {
la1tokens[i] = false;
}
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
- for (int i = 0; i < 126; i++) {
+ for (int i = 0; i < 128; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if ((jj_la1_0[i] & (1< jj_gen) {
if (p.next == null) { p = p.next = new JJCalls(); break; }