private static int errorStart = -1;
private static int errorEnd = -1;
private static PHPDocument phpDocument;
+
+ private static final char[] SYNTAX_ERROR_CHAR = {'s','y','n','t','a','x',' ','e','r','r','o','r'};
/**
* The point where html starts.
* It will be used by the token manager to create HTMLCode objects
errorLevel = ERROR;
errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
errorEnd = SimpleCharStream.getPosition() + 1;
- throw e;
+ processParseException(e);
}
}
final Token className;
Token superclassName = null;
final int pos;
+ char[] classNameImage = SYNTAX_ERROR_CHAR;
+ char[] superclassNameImage = null;
}
{
<CLASS>
+ {pos = SimpleCharStream.getPosition();}
try {
- {pos = SimpleCharStream.getPosition();}
className = <IDENTIFIER>
+ {classNameImage = className.image.toCharArray();}
} catch (ParseException e) {
errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected";
errorLevel = ERROR;
errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
errorEnd = SimpleCharStream.getPosition() + 1;
- throw e;
+ processParseException(e);
}
[
<EXTENDS>
try {
superclassName = <IDENTIFIER>
+ {superclassNameImage = superclassName .image.toCharArray();}
} catch (ParseException e) {
errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected";
errorLevel = ERROR;
errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
errorEnd = SimpleCharStream.getPosition() + 1;
- throw e;
+ processParseException(e);
+ superclassNameImage = SYNTAX_ERROR_CHAR;
}
]
{
- if (superclassName == null) {
+ if (superclassNameImage == null) {
classDeclaration = new ClassDeclaration(currentSegment,
- className.image.toCharArray(),
+ classNameImage,
pos,
0);
} else {
classDeclaration = new ClassDeclaration(currentSegment,
- className.image.toCharArray(),
- superclassName.image.toCharArray(),
+ classNameImage,
+ superclassNameImage,
pos,
0);
}
Token reference = null;
final Hashtable formalParameters;
final int pos = SimpleCharStream.getPosition();
+ char[] identifierChar = SYNTAX_ERROR_CHAR;
}
{
- [reference = <BIT_AND>] identifier = <IDENTIFIER>
+ [reference = <BIT_AND>]
+ try {
+ identifier = <IDENTIFIER>
+ {identifierChar = identifier.image.toCharArray();}
+ } catch (ParseException 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;
+ processParseException(e);
+ }
formalParameters = FormalParameters()
{return new MethodDeclaration(currentSegment,
- identifier.image.toCharArray(),
+ identifierChar,
formalParameters,
reference != null,
pos,
condition = Expression()
try {
<RPAREN>
- {return condition;}
} catch (ParseException e) {
errorMessage = "')' expected after " + keyword + " keyword";
errorLevel = ERROR;
errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
errorEnd = SimpleCharStream.getPosition() + 1;
- throw e;
+ processParseException(e);
}
+ {return condition;}
}
IfStatement IfStatement0(Expression condition, final int start,final int end) :