MCPcopy Create free account
hub / github.com/chibash/stone / readLine

Method readLine

src/stone/Lexer.java:42–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

fillQueueMethod · 0.95

Calls 4

addTokenMethod · 0.95
getLineNumberMethod · 0.80
lengthMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected