} 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);
}
}
} 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);
}
( ClassBodyDeclaration(classDeclaration) )*
} 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);
return PHPParser.token.sourceEnd;
}
token = <VAR> variableDeclaration = VariableDeclaratorNoSuffix()
{
arrayList.add(variableDeclaration);
- outlineInfo.addVariable(variableDeclaration.name());
pos = variableDeclaration.sourceEnd;
}
(
} 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;
throw e;
}
}
}
|
token = <IDENTIFIER>
- {return new Variable(token.image,token.sourceStart,token.sourceEnd);}
+ {
+ outlineInfo.addVariable("$" + token.image);
+ return new Variable(token.image,token.sourceStart,token.sourceEnd);
+ }
}
Expression VariableInitializer() :
if (errorMessage != null) 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;
throw e;
}
{currentSegment = functionDeclaration;}
{
Token identifier = null;
Token reference = null;
- final Hashtable formalParameters = new Hashtable();
+ final ArrayList formalParameters = new ArrayList();
String identifierChar = SYNTAX_ERROR_CHAR;
int end = start;
}
* FormalParameters follows method identifier.
* (FormalParameter())
*/
-int FormalParameters(final Hashtable parameters) :
+int FormalParameters(final ArrayList parameters) :
{
VariableDeclaration var;
final Token token;
}
[
var = FormalParameter()
- {parameters.put(var.name(),var);end = var.sourceEnd;}
+ {parameters.add(var);end = var.sourceEnd;}
(
<COMMA> var = FormalParameter()
- {parameters.put(var.name(),var);end = var.sourceEnd;}
+ {parameters.add(var);end = var.sourceEnd;}
)*
]
try {
{
[token = <BIT_AND>] variableDeclaration = VariableDeclaratorNoSuffix()
{
+ outlineInfo.addVariable("$"+variableDeclaration.name());
if (token != null) {
variableDeclaration.setReference(true);
}
} catch (ParseException e) {
errorMessage = "unexpected end of file , '<?php' expected";
errorLevel = ERROR;
- errorStart = SimpleCharStream.getPosition();
- errorEnd = SimpleCharStream.getPosition();
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
throw e;
}
{
Statement statement;
final ArrayList stmts = new ArrayList();
final Token token = PHPParser.token;
+ final int start = PHPParser.token.next.sourceStart;
}
{
expr = SwitchLabel()
final Statement[] stmtsArray = new Statement[listSize];
stmts.toArray(stmtsArray);
if (expr == null) {//it's a default
- return new DefaultCase(stmtsArray,token.sourceStart,stmtsArray[listSize-1].sourceEnd);
+ final int end = PHPParser.token.next.sourceStart;
+ return new DefaultCase(stmtsArray,start,end);
}
if (listSize != 0) {
return new Case(expr,stmtsArray,expr.sourceStart,stmtsArray[listSize-1].sourceEnd);
} catch (ParseException e) {
errorMessage = "'endif' expected";
errorLevel = ERROR;
- errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
- errorEnd = SimpleCharStream.getPosition() + 1;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
throw e;
}
try {
} catch (ParseException e) {
errorMessage = "';' expected after 'endif' keyword";
errorLevel = ERROR;
- errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
- errorEnd = SimpleCharStream.getPosition() + 1;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
throw e;
}
{
}
errorMessage = "unexpected token '"+e.currentToken.next.image+"', a statement was expected";
errorLevel = ERROR;
- errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
- errorEnd = SimpleCharStream.getPosition() + 1;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
throw e;
}
]
} catch (ParseException e) {
errorMessage = "'endwhile' expected";
errorLevel = ERROR;
- errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
- errorEnd = SimpleCharStream.getPosition() + 1;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
throw e;
}
try {
} catch (ParseException e) {
errorMessage = "';' expected after 'endwhile' keyword";
errorLevel = ERROR;
- errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
- errorEnd = SimpleCharStream.getPosition() + 1;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
throw e;
}
|
} catch (ParseException e) {
errorMessage = "'(' expected after 'foreach' keyword";
errorLevel = ERROR;
- errorStart = foreachToken.sourceEnd+1;
- errorEnd = foreachToken.sourceEnd+1;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
processParseExceptionDebug(e);
{pos = foreachToken.sourceEnd+1;}
}
} catch (ParseException e) {
errorMessage = "variable expected";
errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
processParseExceptionDebug(e);
}
try {
} catch (ParseException e) {
errorMessage = "'as' expected";
errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
processParseExceptionDebug(e);
}
try {
if (errorMessage != null) throw e;
errorMessage = "variable expected";
errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
processParseExceptionDebug(e);
}
try {
} catch (ParseException e) {
errorMessage = "')' expected after 'foreach' keyword";
errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
processParseExceptionDebug(e);
}
try {
if (errorMessage != null) throw e;
errorMessage = "statement expected";
errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
+ errorStart = e.currentToken.sourceStart;
+ errorEnd = e.currentToken.sourceEnd;
processParseExceptionDebug(e);
}
{return new ForeachStatement(expression,