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 10ba3a9..14f1716 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.jj +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -788,8 +788,8 @@ void PhpBlock() : } 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); } } @@ -894,8 +894,8 @@ Token token; } 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) )* @@ -905,8 +905,8 @@ 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); return PHPParser.token.sourceEnd; } @@ -943,7 +943,6 @@ FieldDeclaration FieldDeclaration() : token = variableDeclaration = VariableDeclaratorNoSuffix() { arrayList.add(variableDeclaration); - outlineInfo.addVariable(variableDeclaration.name()); pos = variableDeclaration.sourceEnd; } ( @@ -1088,8 +1087,8 @@ AbstractVariable VariableDeclaratorId() : } 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; } } @@ -1125,7 +1124,10 @@ Variable Var() : } | token = - {return new Variable(token.image,token.sourceStart,token.sourceEnd);} + { + outlineInfo.addVariable("$" + token.image); + return new Variable(token.image,token.sourceStart,token.sourceEnd); + } } Expression VariableInitializer() : @@ -1211,8 +1213,8 @@ MethodDeclaration MethodDeclaration() : 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;} @@ -1231,7 +1233,7 @@ MethodDeclaration MethodDeclarator(final int start) : { Token identifier = null; Token reference = null; - final Hashtable formalParameters = new Hashtable(); + final ArrayList formalParameters = new ArrayList(); String identifierChar = SYNTAX_ERROR_CHAR; int end = start; } @@ -1280,7 +1282,7 @@ MethodDeclaration MethodDeclarator(final int start) : * FormalParameters follows method identifier. * (FormalParameter()) */ -int FormalParameters(final Hashtable parameters) : +int FormalParameters(final ArrayList parameters) : { VariableDeclaration var; final Token token; @@ -1300,10 +1302,10 @@ int FormalParameters(final Hashtable parameters) : } [ var = FormalParameter() - {parameters.put(var.name(),var);end = var.sourceEnd;} + {parameters.add(var);end = var.sourceEnd;} ( var = FormalParameter() - {parameters.put(var.name(),var);end = var.sourceEnd;} + {parameters.add(var);end = var.sourceEnd;} )* ] try { @@ -1331,6 +1333,7 @@ VariableDeclaration FormalParameter() : { [token = ] variableDeclaration = VariableDeclaratorNoSuffix() { + outlineInfo.addVariable("$"+variableDeclaration.name()); if (token != null) { variableDeclaration.setReference(true); } @@ -2250,8 +2253,8 @@ HTMLBlock htmlBlock() : } catch (ParseException e) { errorMessage = "unexpected end of file , ' - {return expr;} } catch (ParseException e) { errorMessage = "':' expected after case expression"; errorLevel = ERROR; @@ -2854,6 +2856,7 @@ Expression SwitchLabel() : errorEnd = expr.sourceEnd+1; processParseExceptionDebug(e); } + {return expr;} | token = <_DEFAULT> try { @@ -2967,8 +2970,8 @@ IfStatement IfStatement0(final Expression condition, final int start,final int e } 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 { @@ -2976,8 +2979,8 @@ IfStatement IfStatement0(final Expression condition, final int start,final int e } 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; } { @@ -3017,8 +3020,8 @@ IfStatement IfStatement0(final Expression condition, final int start,final int 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; } ] @@ -3118,8 +3121,8 @@ Statement WhileStatement0(final int start, final int end) : } 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 { @@ -3131,8 +3134,8 @@ Statement WhileStatement0(final int start, final int end) : } 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; } | @@ -3185,8 +3188,8 @@ ForeachStatement ForeachStatement() : } 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;} } @@ -3196,8 +3199,8 @@ ForeachStatement ForeachStatement() : } catch (ParseException e) { errorMessage = "variable expected"; errorLevel = ERROR; - errorStart = pos; - errorEnd = pos; + errorStart = e.currentToken.sourceStart; + errorEnd = e.currentToken.sourceEnd; processParseExceptionDebug(e); } try { @@ -3206,8 +3209,8 @@ ForeachStatement ForeachStatement() : } catch (ParseException e) { errorMessage = "'as' expected"; errorLevel = ERROR; - errorStart = pos; - errorEnd = pos; + errorStart = e.currentToken.sourceStart; + errorEnd = e.currentToken.sourceEnd; processParseExceptionDebug(e); } try { @@ -3217,8 +3220,8 @@ ForeachStatement ForeachStatement() : 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 { @@ -3227,8 +3230,8 @@ ForeachStatement ForeachStatement() : } 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 { @@ -3238,8 +3241,8 @@ ForeachStatement ForeachStatement() : 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,