From: kpouer Date: Fri, 21 Mar 2003 17:16:21 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.phpeclipse.com *** empty log message *** --- diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java index 21a701e..8cb0143 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -2658,11 +2658,31 @@ final StringBuffer buff = new StringBuffer(); } static final public void SwitchStatement() throws ParseException { + Token breakToken = null; + int line; jj_consume_token(SWITCH); - jj_consume_token(LPAREN); + try { + jj_consume_token(LPAREN); + } catch (ParseException e) { + errorMessage = "'(' expected after 'switch'"; + errorLevel = ERROR; + {if (true) throw e;} + } Expression(); - jj_consume_token(RPAREN); - jj_consume_token(LBRACE); + try { + jj_consume_token(RPAREN); + } catch (ParseException e) { + errorMessage = "')' expected"; + errorLevel = ERROR; + {if (true) throw e;} + } + try { + jj_consume_token(LBRACE); + } catch (ParseException e) { + errorMessage = "'{' expected"; + errorLevel = ERROR; + {if (true) throw e;} + } label_28: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2674,7 +2694,7 @@ final StringBuffer buff = new StringBuffer(); jj_la1[91] = jj_gen; break label_28; } - SwitchLabel(); + line = SwitchLabel(); label_29: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2727,26 +2747,74 @@ final StringBuffer buff = new StringBuffer(); } BlockStatement(); } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BREAK: + breakToken = jj_consume_token(BREAK); + break; + default: + jj_la1[93] = jj_gen; + ; + } + try { + if (breakToken == null) { + setMarker(fileToParse, + "You should use put a 'break' at the end of your statement", + line, + INFO, + "Line " + line); + } + } catch (CoreException e) { + PHPeclipsePlugin.log(e); + } + } + try { + jj_consume_token(RBRACE); + } catch (ParseException e) { + errorMessage = "'}' expected"; + errorLevel = ERROR; + {if (true) throw e;} } - jj_consume_token(RBRACE); } - static final public void SwitchLabel() throws ParseException { + static final public int SwitchLabel() throws ParseException { + final Token token; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case CASE: - jj_consume_token(CASE); - Expression(); - jj_consume_token(COLON); + token = jj_consume_token(CASE); + try { + Expression(); + } catch (ParseException e) { + if (errorMessage != null) {if (true) throw e;} + errorMessage = "expression expected after 'case' keyword"; + errorLevel = ERROR; + {if (true) throw e;} + } + try { + jj_consume_token(COLON); + } catch (ParseException e) { + errorMessage = "':' expected after case expression"; + errorLevel = ERROR; + {if (true) throw e;} + } + {if (true) return token.beginLine;} break; case _DEFAULT: - jj_consume_token(_DEFAULT); - jj_consume_token(COLON); + token = jj_consume_token(_DEFAULT); + try { + jj_consume_token(COLON); + } catch (ParseException e) { + errorMessage = "':' expected after 'default' keyword"; + errorLevel = ERROR; + {if (true) throw e;} + } + {if (true) return token.beginLine;} break; default: - jj_la1[93] = jj_gen; + jj_la1[94] = jj_gen; jj_consume_token(-1); throw new ParseException(); } + throw new Error("Missing return statement in function"); } static final public void IfStatement() throws ParseException { @@ -2824,7 +2892,7 @@ final StringBuffer buff = new StringBuffer(); ; break; default: - jj_la1[94] = jj_gen; + jj_la1[95] = jj_gen; break label_30; } Statement(); @@ -2836,7 +2904,7 @@ final StringBuffer buff = new StringBuffer(); ; break; default: - jj_la1[95] = jj_gen; + jj_la1[96] = jj_gen; break label_31; } ElseIfStatementColon(); @@ -2846,7 +2914,7 @@ final StringBuffer buff = new StringBuffer(); ElseStatementColon(); break; default: - jj_la1[96] = jj_gen; + jj_la1[97] = jj_gen; ; } try { @@ -2921,7 +2989,7 @@ final StringBuffer buff = new StringBuffer(); ; break; default: - jj_la1[97] = jj_gen; + jj_la1[98] = jj_gen; break label_32; } ElseIfStatement(); @@ -2932,12 +3000,12 @@ final StringBuffer buff = new StringBuffer(); Statement(); break; default: - jj_la1[98] = jj_gen; + jj_la1[99] = jj_gen; ; } break; default: - jj_la1[99] = jj_gen; + jj_la1[100] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -2992,7 +3060,7 @@ final StringBuffer buff = new StringBuffer(); ; break; default: - jj_la1[100] = jj_gen; + jj_la1[101] = jj_gen; break label_33; } Statement(); @@ -3047,7 +3115,7 @@ final StringBuffer buff = new StringBuffer(); ; break; default: - jj_la1[101] = jj_gen; + jj_la1[102] = jj_gen; break label_34; } Statement(); @@ -3117,7 +3185,7 @@ final StringBuffer buff = new StringBuffer(); ; break; default: - jj_la1[102] = jj_gen; + jj_la1[103] = jj_gen; break label_35; } Statement(); @@ -3148,7 +3216,7 @@ final StringBuffer buff = new StringBuffer(); jj_consume_token(138); break; default: - jj_la1[103] = jj_gen; + jj_la1[104] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3200,7 +3268,7 @@ final StringBuffer buff = new StringBuffer(); Statement(); break; default: - jj_la1[104] = jj_gen; + jj_la1[105] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3220,7 +3288,7 @@ final StringBuffer buff = new StringBuffer(); jj_consume_token(138); break; default: - jj_la1[105] = jj_gen; + jj_la1[106] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3253,7 +3321,7 @@ final StringBuffer buff = new StringBuffer(); VariableSuffix(); break; default: - jj_la1[106] = jj_gen; + jj_la1[107] = jj_gen; ; } try { @@ -3276,7 +3344,7 @@ final StringBuffer buff = new StringBuffer(); Expression(); break; default: - jj_la1[107] = jj_gen; + jj_la1[108] = jj_gen; ; } try { @@ -3318,7 +3386,7 @@ final int pos = jj_input_stream.bufpos; ForInit(); break; default: - jj_la1[108] = jj_gen; + jj_la1[109] = jj_gen; ; } jj_consume_token(SEMICOLON); @@ -3347,7 +3415,7 @@ final int pos = jj_input_stream.bufpos; Expression(); break; default: - jj_la1[109] = jj_gen; + jj_la1[110] = jj_gen; ; } jj_consume_token(SEMICOLON); @@ -3362,7 +3430,7 @@ final int pos = jj_input_stream.bufpos; ForUpdate(); break; default: - jj_la1[110] = jj_gen; + jj_la1[111] = jj_gen; ; } jj_consume_token(RPAREN); @@ -3455,7 +3523,7 @@ final int pos = jj_input_stream.bufpos; ; break; default: - jj_la1[111] = jj_gen; + jj_la1[112] = jj_gen; break label_36; } Statement(); @@ -3486,7 +3554,7 @@ final int pos = jj_input_stream.bufpos; } break; default: - jj_la1[112] = jj_gen; + jj_la1[113] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3507,7 +3575,7 @@ final int pos = jj_input_stream.bufpos; StatementExpressionList(); break; default: - jj_la1[113] = jj_gen; + jj_la1[114] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -3523,7 +3591,7 @@ final int pos = jj_input_stream.bufpos; ; break; default: - jj_la1[114] = jj_gen; + jj_la1[115] = jj_gen; break label_37; } jj_consume_token(COMMA); @@ -3542,7 +3610,7 @@ final int pos = jj_input_stream.bufpos; jj_consume_token(IDENTIFIER); break; default: - jj_la1[115] = jj_gen; + jj_la1[116] = jj_gen; ; } jj_consume_token(SEMICOLON); @@ -3555,7 +3623,7 @@ final int pos = jj_input_stream.bufpos; jj_consume_token(IDENTIFIER); break; default: - jj_la1[116] = jj_gen; + jj_la1[117] = jj_gen; ; } jj_consume_token(SEMICOLON); @@ -3588,7 +3656,7 @@ final int pos = jj_input_stream.bufpos; Expression(); break; default: - jj_la1[117] = jj_gen; + jj_la1[118] = jj_gen; ; } jj_consume_token(SEMICOLON); @@ -4374,6 +4442,12 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3_7() { + if (jj_3R_45()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_178() { if (jj_scan_token(INCR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4697,12 +4771,6 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3_7() { - if (jj_3R_45()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_65() { if (jj_scan_token(LIST)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5155,7 +5223,7 @@ final int pos = jj_input_stream.bufpos; static public boolean lookingAhead = false; static private boolean jj_semLA; static private int jj_gen; - static final private int[] jj_la1 = new int[118]; + static final private int[] jj_la1 = new int[119]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; @@ -5169,19 +5237,19 @@ final int pos = jj_input_stream.bufpos; jj_la1_4(); } private static void jj_la1_0() { - jj_la1_0 = new int[] {0xfe58001e,0x0,0x6,0x6,0xfe58001e,0xfe580000,0x0,0x300000,0x300000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000000,0x0,0xa000000,0x0,0x0,0x0,0x0,0x0,0x0,0xa000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000000,0x0,0x2000000,0x0,0x2000000,0x0,0x0,0x0,0x0,0x2000000,0x0,0x0,0x0,0xa000000,0x0,0x0,0x0,0xa000000,0x0,0x10,0x0,0xf6400000,0x0,0x0,0x0,0x0,0xe0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe580000,0xfe580000,0x0,0x0,0x0,0x0,0x2000000,0x0,0xfe580000,0x0,0xfe400000,0x800000,0x1000000,0x800000,0x1000000,0xfe400000,0xfe400000,0xfe400000,0xfe400000,0x0,0xfe400000,0x0,0x0,0x0,0x2000000,0xa000000,0x2000000,0xfe400000,0xfe400000,0x2000000,0x0,0x0,0x0,0xa000000,}; + jj_la1_0 = new int[] {0xfe58001e,0x0,0x6,0x6,0xfe58001e,0xfe580000,0x0,0x300000,0x300000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000000,0x0,0xa000000,0x0,0x0,0x0,0x0,0x0,0x0,0xa000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000000,0x0,0x2000000,0x0,0x2000000,0x0,0x0,0x0,0x0,0x2000000,0x0,0x0,0x0,0xa000000,0x0,0x0,0x0,0xa000000,0x0,0x10,0x0,0xf6400000,0x0,0x0,0x0,0x0,0xe0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe580000,0xfe580000,0x0,0x0,0x0,0x0,0x2000000,0x0,0xfe580000,0x4000000,0x0,0xfe400000,0x800000,0x1000000,0x800000,0x1000000,0xfe400000,0xfe400000,0xfe400000,0xfe400000,0x0,0xfe400000,0x0,0x0,0x0,0x2000000,0xa000000,0x2000000,0xfe400000,0xfe400000,0x2000000,0x0,0x0,0x0,0xa000000,}; } private static void jj_la1_1() { - jj_la1_1 = new int[] {0x8ebaa47,0x0,0x0,0x0,0x8ebaa47,0x8ebaa47,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x610000,0x20,0x618040,0x0,0x0,0x0,0x0,0xe0000000,0x0,0x618040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x618000,0x0,0x618000,0x0,0x618000,0x0,0x0,0x8,0x8,0x8000,0x8000,0x0,0x8,0x618040,0x8,0x610000,0x600000,0x618040,0x0,0x0,0x0,0x88aaa07,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8ebaa47,0x8ebaa47,0x0,0x0,0x0,0x0,0x8000,0x480,0x8ebaa47,0x480,0x8ebaa47,0x0,0x0,0x0,0x0,0x8ebaa47,0x8ebaa47,0x8ebaa47,0x8ebaa47,0x0,0x8ebaa47,0x0,0x8,0x20,0x8000,0x618040,0x8000,0x8ebaa47,0x8ebaa47,0x8000,0x0,0x0,0x0,0x618040,}; + jj_la1_1 = new int[] {0x8ebaa47,0x0,0x0,0x0,0x8ebaa47,0x8ebaa47,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x610000,0x20,0x618040,0x0,0x0,0x0,0x0,0xe0000000,0x0,0x618040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x618000,0x0,0x618000,0x0,0x618000,0x0,0x0,0x8,0x8,0x8000,0x8000,0x0,0x8,0x618040,0x8,0x610000,0x600000,0x618040,0x0,0x0,0x0,0x88aaa07,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8ebaa47,0x8ebaa47,0x0,0x0,0x0,0x0,0x8000,0x480,0x8ebaa47,0x0,0x480,0x8ebaa47,0x0,0x0,0x0,0x0,0x8ebaa47,0x8ebaa47,0x8ebaa47,0x8ebaa47,0x0,0x8ebaa47,0x0,0x8,0x20,0x8000,0x618040,0x8000,0x8ebaa47,0x8ebaa47,0x8000,0x0,0x0,0x0,0x618040,}; } private static void jj_la1_2() { - jj_la1_2 = new int[] {0x11445100,0x10000000,0x0,0x0,0x11445100,0x11445100,0x0,0x0,0x0,0x20000000,0x0,0x1000000,0x0,0x1000000,0x1040000,0x1040000,0x1100,0x1100,0x45100,0x0,0x445100,0x0,0x20000000,0x0,0x0,0x3f,0x0,0x445100,0x0,0x0,0x40,0x40,0x80,0x80,0x40000000,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x445100,0x0,0x445100,0x0,0x445100,0x0,0x0,0x4400000,0x4400000,0x40000,0x40000,0x40000,0x4400000,0x445100,0x4000000,0x5100,0x0,0x445100,0x20000000,0x10000000,0x0,0x11040000,0x10000000,0x10000000,0x10000000,0x10000000,0x0,0x0,0x0,0x20000000,0x10000000,0x20000000,0x10000000,0x20000000,0x10000000,0x11445100,0x11445100,0x20000000,0x0,0x0,0x0,0x40000,0x0,0x11445100,0x0,0x11445100,0x0,0x0,0x0,0x0,0x11445100,0x11445100,0x11445100,0x11445100,0x10000000,0x11445100,0x10000000,0x4000000,0x0,0x40000,0x445100,0x40000,0x11445100,0x11445100,0x40000,0x20000000,0x40000,0x40000,0x445100,}; + jj_la1_2 = new int[] {0x11445100,0x10000000,0x0,0x0,0x11445100,0x11445100,0x0,0x0,0x0,0x20000000,0x0,0x1000000,0x0,0x1000000,0x1040000,0x1040000,0x1100,0x1100,0x45100,0x0,0x445100,0x0,0x20000000,0x0,0x0,0x3f,0x0,0x445100,0x0,0x0,0x40,0x40,0x80,0x80,0x40000000,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x445100,0x0,0x445100,0x0,0x445100,0x0,0x0,0x4400000,0x4400000,0x40000,0x40000,0x40000,0x4400000,0x445100,0x4000000,0x5100,0x0,0x445100,0x20000000,0x10000000,0x0,0x11040000,0x10000000,0x10000000,0x10000000,0x10000000,0x0,0x0,0x0,0x20000000,0x10000000,0x20000000,0x10000000,0x20000000,0x10000000,0x11445100,0x11445100,0x20000000,0x0,0x0,0x0,0x40000,0x0,0x11445100,0x0,0x0,0x11445100,0x0,0x0,0x0,0x0,0x11445100,0x11445100,0x11445100,0x11445100,0x10000000,0x11445100,0x10000000,0x4000000,0x0,0x40000,0x445100,0x40000,0x11445100,0x11445100,0x40000,0x20000000,0x40000,0x40000,0x445100,}; } private static void jj_la1_3() { - jj_la1_3 = new int[] {0x3c380000,0x0,0x0,0x0,0x3c380000,0x3c380000,0x0,0x0,0x0,0x0,0x100,0x0,0x100000,0x0,0x100000,0x100000,0x0,0x0,0x30000000,0x0,0x3c380000,0x0,0x0,0x100000,0x0,0x0,0x7ff00,0x3c380000,0x7ff00,0x400000,0x1000000,0x1000000,0x2000000,0x2000000,0x0,0x0,0x0,0x0,0xf2,0xf2,0xd,0xd,0x0,0x0,0x30000000,0x30000000,0xc0000000,0xc0000000,0x80000,0x3c380000,0x30000000,0x3c300000,0x200000,0x100000,0xc000000,0xc000000,0x0,0x0,0x100000,0x100000,0x100000,0x0,0x3c380000,0x0,0x0,0x0,0x3c380000,0x0,0x0,0x80000,0xc180000,0x0,0x0,0x0,0x0,0x0,0x100000,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x3c380000,0x3c380000,0x0,0x100,0xc07ff00,0xc07ff00,0xc100000,0x0,0x3c380000,0x0,0x3c380000,0x0,0x0,0x0,0x0,0x3cb80000,0x3c380000,0x3c380000,0x3c380000,0x0,0x3cb80000,0x0,0x0,0x0,0xc100000,0x3c380000,0xc100000,0x3c380000,0x3cb80000,0xc100000,0x0,0x0,0x0,0x3c380000,}; + jj_la1_3 = new int[] {0x3c380000,0x0,0x0,0x0,0x3c380000,0x3c380000,0x0,0x0,0x0,0x0,0x100,0x0,0x100000,0x0,0x100000,0x100000,0x0,0x0,0x30000000,0x0,0x3c380000,0x0,0x0,0x100000,0x0,0x0,0x7ff00,0x3c380000,0x7ff00,0x400000,0x1000000,0x1000000,0x2000000,0x2000000,0x0,0x0,0x0,0x0,0xf2,0xf2,0xd,0xd,0x0,0x0,0x30000000,0x30000000,0xc0000000,0xc0000000,0x80000,0x3c380000,0x30000000,0x3c300000,0x200000,0x100000,0xc000000,0xc000000,0x0,0x0,0x100000,0x100000,0x100000,0x0,0x3c380000,0x0,0x0,0x0,0x3c380000,0x0,0x0,0x80000,0xc180000,0x0,0x0,0x0,0x0,0x0,0x100000,0x100000,0x0,0x0,0x0,0x0,0x0,0x0,0x3c380000,0x3c380000,0x0,0x100,0xc07ff00,0xc07ff00,0xc100000,0x0,0x3c380000,0x0,0x0,0x3c380000,0x0,0x0,0x0,0x0,0x3cb80000,0x3c380000,0x3c380000,0x3c380000,0x0,0x3cb80000,0x0,0x0,0x0,0xc100000,0x3c380000,0xc100000,0x3c380000,0x3cb80000,0xc100000,0x0,0x0,0x0,0x3c380000,}; } private static void jj_la1_4() { - jj_la1_4 = new int[] {0x201,0x0,0x0,0x0,0x201,0x201,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x200,0x200,0x0,0x0,0x0,0x0,0x201,0x1,0x0,0x201,0x1,0x0,0x180,0x201,0x180,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x4,0x1,0x0,0x0,0x0,0x0,0x70,0x70,0x0,0x0,0x8,0x8,0x0,0x201,0x0,0x200,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x200,0x200,0x0,0x201,0x0,0x0,0x0,0x201,0x0,0x0,0x0,0x200,0x400,0x400,0x400,0x400,0x0,0x200,0x200,0x0,0x400,0x0,0x400,0x0,0x400,0x201,0x201,0x0,0x0,0x180,0x180,0x200,0x0,0x201,0x0,0x201,0x0,0x0,0x0,0x0,0x201,0x201,0x201,0x201,0x400,0x201,0x400,0x0,0x0,0x200,0x201,0x200,0x201,0x201,0x200,0x0,0x0,0x0,0x201,}; + jj_la1_4 = new int[] {0x201,0x0,0x0,0x0,0x201,0x201,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x200,0x200,0x0,0x0,0x0,0x0,0x201,0x1,0x0,0x201,0x1,0x0,0x180,0x201,0x180,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x4,0x1,0x0,0x0,0x0,0x0,0x70,0x70,0x0,0x0,0x8,0x8,0x0,0x201,0x0,0x200,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x200,0x200,0x0,0x201,0x0,0x0,0x0,0x201,0x0,0x0,0x0,0x200,0x400,0x400,0x400,0x400,0x0,0x200,0x200,0x0,0x400,0x0,0x400,0x0,0x400,0x201,0x201,0x0,0x0,0x180,0x180,0x200,0x0,0x201,0x0,0x0,0x201,0x0,0x0,0x0,0x0,0x201,0x201,0x201,0x201,0x400,0x201,0x400,0x0,0x0,0x200,0x201,0x200,0x201,0x201,0x200,0x0,0x0,0x0,0x201,}; } static final private JJCalls[] jj_2_rtns = new JJCalls[7]; static private boolean jj_rescan = false; @@ -5200,7 +5268,7 @@ final int pos = jj_input_stream.bufpos; token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 118; i++) jj_la1[i] = -1; + for (int i = 0; i < 119; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -5210,7 +5278,7 @@ final int pos = jj_input_stream.bufpos; token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 118; i++) jj_la1[i] = -1; + for (int i = 0; i < 119; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -5227,7 +5295,7 @@ final int pos = jj_input_stream.bufpos; token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 118; i++) jj_la1[i] = -1; + for (int i = 0; i < 119; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -5237,7 +5305,7 @@ final int pos = jj_input_stream.bufpos; token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 118; i++) jj_la1[i] = -1; + for (int i = 0; i < 119; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -5253,7 +5321,7 @@ final int pos = jj_input_stream.bufpos; token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 118; i++) jj_la1[i] = -1; + for (int i = 0; i < 119; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -5262,7 +5330,7 @@ final int pos = jj_input_stream.bufpos; token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 118; i++) jj_la1[i] = -1; + for (int i = 0; i < 119; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -5377,7 +5445,7 @@ final int pos = jj_input_stream.bufpos; la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 118; i++) { + for (int i = 0; i < 119; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1< Expression() - ( SwitchLabel() ( BlockStatement() )* )* - + Token breakToken = null; + int line; +} +{ + + try { + + } catch (ParseException e) { + errorMessage = "'(' expected after 'switch'"; + errorLevel = ERROR; + throw e; + } + Expression() + try { + + } catch (ParseException e) { + errorMessage = "')' expected"; + errorLevel = ERROR; + throw e; + } + try { + + } catch (ParseException e) { + errorMessage = "'{' expected"; + errorLevel = ERROR; + throw e; + } + ( + line = SwitchLabel() + ( BlockStatement() )* + [ breakToken = ] + { + try { + if (breakToken == null) { + setMarker(fileToParse, + "You should use put a 'break' at the end of your statement", + line, + INFO, + "Line " + line); + } + } catch (CoreException e) { + PHPeclipsePlugin.log(e); + } + } + )* + try { + + } catch (ParseException e) { + errorMessage = "'}' expected"; + errorLevel = ERROR; + throw e; + } } -void SwitchLabel() : -{} +int SwitchLabel() : { - Expression() + final Token token; +} +{ + token = + try { + Expression() + } catch (ParseException e) { + if (errorMessage != null) throw e; + errorMessage = "expression expected after 'case' keyword"; + errorLevel = ERROR; + throw e; + } + try { + + } catch (ParseException e) { + errorMessage = "':' expected after case expression"; + errorLevel = ERROR; + throw e; + } + {return token.beginLine;} | - <_DEFAULT> + token = <_DEFAULT> + try { + + } catch (ParseException e) { + errorMessage = "':' expected after 'default' keyword"; + errorLevel = ERROR; + throw e; + } + {return token.beginLine;} } void IfStatement() : diff --git a/net.sourceforge.phpeclipse/src/test/PHPParserSuperclass.java b/net.sourceforge.phpeclipse/src/test/PHPParserSuperclass.java index c500582..1dee6aa 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParserSuperclass.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParserSuperclass.java @@ -181,6 +181,40 @@ public abstract class PHPParserSuperclass { * This will set a marker. * @param file the file that generated the marker * @param message the message + * @param line the line number + * @param errorLevel the error level ({@link PHPParserSuperclass#ERROR}, + * {@link PHPParserSuperclass#INFO},{@link PHPParserSuperclass#WARNING}) + * @throws CoreException an exception throwed by the MarkerUtilities + */ + public static void setMarker(final IFile file, + final String message, + final int line, + final int errorLevel, + final String location) + throws CoreException { + if (file != null) { + final Hashtable attributes = new Hashtable(); + MarkerUtilities.setMessage(attributes, message); + switch (errorLevel) { + case Parser.ERROR : + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR)); + break; + case Parser.WARNING : + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING)); + break; + case Parser.INFO : + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO)); + break; + } + attributes.put(IMarker.LOCATION,location); + MarkerUtilities.setLineNumber(attributes, line); + MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM); + } + } + /** + * This will set a marker. + * @param file the file that generated the marker + * @param message the message * @param charStart the starting character * @param charEnd the end character * @param errorLevel the error level ({@link PHPParserSuperclass#ERROR},