X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.jj b/net.sourceforge.phpeclipse/src/test/PHPParser.jj index 0f04260..3156846 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.jj +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -159,11 +159,11 @@ public final class PHPParser extends PHPParserSuperclass { } setMarker(e); errorMessage = null; - if (PHPeclipsePlugin.DEBUG) PHPeclipsePlugin.log(e); + // if (PHPeclipsePlugin.DEBUG) PHPeclipsePlugin.log(e); } /** - * Create marker for the parse error + * Create marker for the parse error. * @param e the ParseException */ private static void setMarker(final ParseException e) { @@ -195,12 +195,12 @@ public final class PHPParser extends PHPParserSuperclass { final int indx, final int brIndx) throws CoreException { String current; - StringBuffer lineNumberBuffer = new StringBuffer(10); + final StringBuffer lineNumberBuffer = new StringBuffer(10); char ch; current = output.substring(indx, brIndx); if (current.indexOf(PARSE_WARNING_STRING) != -1 || current.indexOf(PARSE_ERROR_STRING) != -1) { - int onLine = current.indexOf("on line "); + final int onLine = current.indexOf("on line "); if (onLine != -1) { lineNumberBuffer.delete(0, lineNumberBuffer.length()); for (int i = onLine; i < current.length(); i++) { @@ -210,9 +210,9 @@ public final class PHPParser extends PHPParserSuperclass { } } - int lineNumber = Integer.parseInt(lineNumberBuffer.toString()); + final int lineNumber = Integer.parseInt(lineNumberBuffer.toString()); - Hashtable attributes = new Hashtable(); + final Hashtable attributes = new Hashtable(); current = current.replaceAll("\n", ""); current = current.replaceAll("", ""); @@ -279,17 +279,16 @@ public final class PHPParser extends PHPParserSuperclass { pushOnAstNodes(new HTMLCode(chars, htmlStart,currentPosition)); } - /** - * Create a new task. - */ + /** Create a new task. */ public static final void createNewTask() { final int currentPosition = SimpleCharStream.getPosition(); - final String todo = SimpleCharStream.currentBuffer.substring(currentPosition+1, + final String todo = SimpleCharStream.currentBuffer.substring(currentPosition-3, SimpleCharStream.currentBuffer.indexOf("\n", currentPosition)-1); + PHPeclipsePlugin.log(1,SimpleCharStream.currentBuffer.toString()); try { setMarker(fileToParse, - "todo : " + todo, + todo, SimpleCharStream.getBeginLine(), TASK, "Line "+SimpleCharStream.getBeginLine()); @@ -718,21 +717,21 @@ void ClassBody(final ClassDeclaration classDeclaration) : try { } catch (ParseException e) { - errorMessage = "unexpected token : '"+ e.currentToken.next.image + "', '{' expected"; + errorMessage = "unexpected token : '"+ e.currentToken.next.image + "'. '{' expected"; errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + processParseException(e); } ( ClassBodyDeclaration(classDeclaration) )* try { } catch (ParseException e) { - errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', 'var', 'function' or '}' expected"; + 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; - throw e; + processParseException(e); } } @@ -802,7 +801,7 @@ VariableDeclaration VariableDeclarator() : errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + processParseException(e); } ] { @@ -1140,8 +1139,7 @@ Expression Expression() : expr = ConditionalExpression() [ assignOperator = AssignmentOperator() try { - {final int errorStart = SimpleCharStream.getPosition();} - initializer = Expression() + initializer = Expression() } catch (ParseException e) { if (errorMessage != null) { throw e; @@ -1536,15 +1534,14 @@ Expression PostfixExpression() : Expression PrimaryExpression() : { - final Token identifier; Expression expr; - final int pos = SimpleCharStream.getPosition(); } { expr = PrimaryPrefix() ( LOOKAHEAD(PrimarySuffix()) - expr = PrimarySuffix(expr))* + expr = PrimarySuffix(expr) + )* {return expr;} | expr = ArrayDeclarator()