public LexerSource(Reader r, boolean ppvalid) { this.reader = new JoinReader(r); this.ppvalid = ppvalid; this.bol = true; this.include = false; this.digraphs = true; this.ucount = 0; this.line = 1; this.column = 0; this.lastcolumn = -1; this.cr = false; }
public int read(char cbuf[], int off, int len) throws IOException, LexerException { for (int i = 0; i < len; i++) { int ch = read(); if (ch == -1) return i; cbuf[off + i] = (char) ch; } return len; }
private int _read() throws IOException, LexerException { int c = __read(); if (c == '?' && (trigraphs || warnings)) { int d = __read(); if (d == '?') { int e = __read(); switch (e) { case '(': return trigraph('(', '['); case ')': return trigraph(')', ']'); case '<': return trigraph('<', '{'); case '>': return trigraph('>', '}'); case '=': return trigraph('=', '#'); case '/': return trigraph('/', '\\'); case '\'': return trigraph('\'', '^'); case '!': return trigraph('!', '|'); case '-': return trigraph('-', '~'); } _unread(e); } _unread(d); } return c; }
private void testJoinReader(String in, String out, boolean tg) throws Exception { System.out.println("Testing " + in + " => " + out); StringReader r = new StringReader(in); JoinReader j = new JoinReader(r, tg); for (int i = 0; i < out.length(); i++) { int c = j.read(); System.out.println("At offset " + i + ": " + (char) c); assertEquals(out.charAt(i), c); } assertEquals(-1, j.read()); assertEquals(-1, j.read()); }
@Override /* pp */ void init(Preprocessor pp) { super.init(pp); this.digraphs = pp.getFeature(Feature.DIGRAPHS); this.reader.init(pp, this); }
/* pp */ void init(Preprocessor pp, LexerSource s) { this.listener = pp.getListener(); this.source = s; setTrigraphs(pp.getFeature(Feature.TRIGRAPHS), pp.getWarning(Warning.TRIGRAPHS)); }
public void close() throws IOException { if (reader != null) { reader.close(); reader = null; } super.close(); }
private void testJoinReader(String in, String out, boolean tg) throws Exception { System.out.println("Testing " + in + " => " + out); StringReader r = new StringReader(in); JoinReader j = new JoinReader(r, tg); for (int i = 0; i < out.length(); i++) { int c = j.read(); System.out.println("At offset " + i + ": " + (char)c); assertEquals((char)out.charAt(i), c); } assertEquals(-1, j.read()); assertEquals(-1, j.read()); }
@Override /* pp */ void init(Preprocessor pp) { super.init(pp); this.digraphs = pp.getFeature(Feature.DIGRAPHS); this.reader.init(pp, this); }
/* pp */ void init(Preprocessor pp, LexerSource s) { this.listener = pp.getListener(); this.source = s; setTrigraphs(pp.getFeature(Feature.TRIGRAPHS), pp.getWarning(Warning.TRIGRAPHS)); }
public void close() throws IOException { if (reader != null) { reader.close(); reader = null; } super.close(); }
private int _read() throws IOException, LexerException { int c = __read(); if (c == '?' && (trigraphs || warnings)) { int d = __read(); if (d == '?') { int e = __read(); switch (e) { case '(': return trigraph('(', '['); case ')': return trigraph(')', ']'); case '<': return trigraph('<', '{'); case '>': return trigraph('>', '}'); case '=': return trigraph('=', '#'); case '/': return trigraph('/', '\\'); case '\'': return trigraph('\'', '^'); case '!': return trigraph('!', '|'); case '-': return trigraph('-', '~'); } _unread(e); } _unread(d); } return c; }
public int read(char cbuf[], int off, int len) throws IOException, LexerException { for (int i = 0; i < len; i++) { int ch = read(); if (ch == -1) return i; cbuf[off + i] = (char)ch; } return len; }
public LexerSource(Reader r, boolean ppvalid) { this.reader = new JoinReader(r); this.ppvalid = ppvalid; this.bol = true; this.include = false; this.digraphs = true; this.ucount = 0; this.line = 1; this.column = 0; this.lastcolumn = -1; this.cr = false; }