Lookahead for the enhanced for statement. Expect "for" "(" and then see whether we hit ":" or a ";" first.
()
| 94 | Expect "for" "(" and then see whether we hit ":" or a ";" first. |
| 95 | */ |
| 96 | boolean isRegularForStatement() |
| 97 | { |
| 98 | int curTok = 1; |
| 99 | Token tok; |
| 100 | tok = getToken(curTok++); |
| 101 | if ( tok.kind != FOR ) return false; |
| 102 | tok = getToken(curTok++); |
| 103 | if ( tok.kind != LPAREN ) return false; |
| 104 | while (true) |
| 105 | { |
| 106 | tok = getToken(curTok++); |
| 107 | switch (tok.kind) { |
| 108 | case COLON: |
| 109 | return false; |
| 110 | case SEMICOLON: |
| 111 | return true; |
| 112 | case EOF: |
| 113 | return false; |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | Generate a ParseException with the specified message, pointing to the |