()
| 40 | return true; |
| 41 | } |
| 42 | protected void readLine() throws ParseException { |
| 43 | String line; |
| 44 | try { |
| 45 | line = reader.readLine(); |
| 46 | } catch (IOException e) { |
| 47 | throw new ParseException(e); |
| 48 | } |
| 49 | if (line == null) { |
| 50 | hasMore = false; |
| 51 | return; |
| 52 | } |
| 53 | int lineNo = reader.getLineNumber(); |
| 54 | Matcher matcher = pattern.matcher(line); |
| 55 | matcher.useTransparentBounds(true).useAnchoringBounds(false); |
| 56 | int pos = 0; |
| 57 | int endPos = line.length(); |
| 58 | while (pos < endPos) { |
| 59 | matcher.region(pos, endPos); |
| 60 | if (matcher.lookingAt()) { |
| 61 | addToken(lineNo, matcher); |
| 62 | pos = matcher.end(); |
| 63 | } |
| 64 | else |
| 65 | throw new ParseException("bad token at line " + lineNo); |
| 66 | } |
| 67 | queue.add(new IdToken(lineNo, Token.EOL)); |
| 68 | } |
| 69 | protected void addToken(int lineNo, Matcher matcher) { |
| 70 | String m = matcher.group(1); |
| 71 | if (m != null) // if not a space |
no test coverage detected