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 2de24e2..21cdb6f 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.jj +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -280,7 +280,7 @@ PARSER_END(PHPParser) SPECIAL_TOKEN : { - "//" : IN_SINGLE_LINE_COMMENT + "//" | "#" : IN_SINGLE_LINE_COMMENT | <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT | @@ -832,7 +832,17 @@ void MethodDeclaration() : final PHPFunctionDeclaration functionDeclaration; } { - functionDeclaration = MethodDeclarator() + + try { + functionDeclaration = MethodDeclarator() + } catch (ParseException e) { + if (errorMessage != null) { + throw e; + } + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected"; + errorLevel = ERROR; + throw e; + } { if (currentSegment != null) { currentSegment.add(functionDeclaration); @@ -1422,7 +1432,14 @@ String VariableSuffix() : String expr = null; } { - expr = VariableName() + + try { + expr = VariableName() + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function call or field access expected"; + errorLevel = ERROR; + throw e; + } {return "->" + expr;} | [ expr = Expression() ] @@ -1489,7 +1506,7 @@ String expr = null; try { } catch (ParseException e) { - errorMessage = "')' expected to close the argument list"; + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected to close the argument list"; errorLevel = ERROR; throw e; } @@ -1524,10 +1541,9 @@ final StringBuffer buff = new StringBuffer(); {return buff.toString();} } -/* - * Statement syntax follows. +/** + * A Statement without break */ - void StatementNoBreak() : {} { @@ -1582,6 +1598,9 @@ void StatementNoBreak() : GlobalStatement() } +/** + * A Normal statement + */ void Statement() : {} { @@ -1676,19 +1695,37 @@ String ListExpression() : String expr; } { - + + try { + + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected"; + errorLevel = ERROR; + throw e; + } [ expr = VariableDeclaratorId() {buff.append(expr);} ] - - {buff.append(",");} [ + try { + + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ',' expected"; + errorLevel = ERROR; + throw e; + } expr = VariableDeclaratorId() - {buff.append(expr);} + {buff.append(",").append(expr);} ] {buff.append(")");} - + try { + + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected"; + errorLevel = ERROR; + throw e; + } [ expr = Expression() {buff.append("(").append(expr);}] {return buff.toString();} } @@ -1752,7 +1789,7 @@ void Block() : try { } catch (ParseException e) { - errorMessage = "unexpected token : "+ e.currentToken.image +", '}' expected"; + errorMessage = "unexpected token : '"+ e.currentToken.image +"', '}' expected"; errorLevel = ERROR; throw e; } @@ -1768,6 +1805,9 @@ void BlockStatement() : MethodDeclaration() } +/** + * A Block statement that will not contain any 'break' + */ void BlockStatementNoBreak() : {} {