/* pp */ final void error(String msg) throws LexerException { _error(msg, true); }
private Token invalid(StringBuilder text, String reason) throws IOException, LexerException { int d = read(); while (!isLineSeparator(d)) { text.append((char)d); d = read(); } unread(d); return new Token(INVALID, text.toString(), reason); }
int c = read(); int d; do { nls++; d = read(); } while (d == '\n'); unread(d); char[] text = new char[nls]; for (int i = 0; i < text.length; i++) tok = cond('=', NE, '!'); break; tok = new Token(HASH); else tok = cond('#', PASTE, '#'); break; d = read(); if (d == '+') tok = new Token(INC); tok = new Token(PLUS_EQ); else unread(d); break; case '-': d = read();
int c = read(); int d; do { nls++; d = read(); } while (d == '\n'); unread(d); char[] text = new char[nls]; for (int i = 0; i < text.length; i++) tok = cond('=', NE, '!'); break; tok = new Token(HASH); else tok = cond('#', PASTE, '#'); break; d = read(); if (d == '+') tok = new Token(INC); tok = new Token(PLUS_EQ); else unread(d); break; case '-': d = read();
LexerException { StringBuilder text = new StringBuilder("'"); int d = read(); if (d == '\\') { text.append('\\'); d = escape(text); else if (isLineSeparator(d)) { unread(d); return new Token(INVALID, text.toString(), "Unterminated character literal"); return invalid(text, "Illegal unicode character literal"); int e = read(); if (e != '\'') { if (isLineSeparator(e)) { unread(e); break; if (e == '\'') break; e = read();
private void unread(int c) throws IOException { /* XXX Must unread newlines. */ if (c != -1) { if (isLineSeparator(c)) { line--; column = lastcolumn; cr = false; } else { column--; } switch (ucount) { case 0: u0 = c; ucount = 1; break; case 1: u1 = c; ucount = 2; break; default: throw new IllegalStateException( "Cannot unget another character!" ); } // reader.unread(c); } }
public void setUp() throws Exception { final PipedOutputStream po = new PipedOutputStream(); writer = new OutputStreamWriter(po); p = new Preprocessor(); p.addInput( new LexerSource( new InputStreamReader( new PipedInputStream(po) ), true ) ); }
int c = read(); int d; do { nls++; d = read(); } while (d == '\n'); unread(d); char[] text = new char[nls]; for (int i = 0; i < text.length; i++) tok = cond('=', NE, '!'); break; tok = new Token(HASH); else tok = cond('#', PASTE, '#'); break; d = read(); if (d == '+') tok = new Token(INC); tok = new Token(PLUS_EQ); else unread(d); break; case '-': d = read();
int c = read(); if (c == close) { break; text.append('\\'); if (!include) { char d = (char)escape(text); buf.append(d); unread(c); else if (isLineSeparator(c)) { unread(c);
private void unread(int c) throws IOException { /* XXX Must unread newlines. */ if (c != -1) { if (isLineSeparator(c)) { line--; column = lastcolumn; cr = false; } else { column--; } switch (ucount) { case 0: u0 = c; ucount = 1; break; case 1: u1 = c; ucount = 2; break; default: throw new IllegalStateException( "Cannot unget another character!" ); } // reader.unread(c); } }
@Before public void setUp() throws Exception { final PipedOutputStream po = new PipedOutputStream(); writer = new OutputStreamWriter(po); p = new Preprocessor(); p.addInput( new LexerSource( new InputStreamReader( new PipedInputStream(po) ), true ) ); }
int c = read(); if (c == close) { break; text.append('\\'); if (!include) { char d = (char)escape(text); buf.append(d); unread(c); else if (isLineSeparator(c)) { unread(c);
private Token invalid(StringBuilder text, String reason) throws IOException, LexerException { int d = read(); while (!isLineSeparator(d)) { text.append((char)d); d = read(); } unread(d); return new Token(INVALID, text.toString(), reason); }
/* pp */ final void error(String msg) throws LexerException { _error(msg, true); }
private void unread(int c) throws IOException { /* XXX Must unread newlines. */ if (c != -1) { if (isLineSeparator(c)) { line--; column = lastcolumn; cr = false; } else { column--; } switch (ucount) { case 0: u0 = c; ucount = 1; break; case 1: u1 = c; ucount = 2; break; default: throw new IllegalStateException( "Cannot unget another character!" ); } // reader.unread(c); } }
LexerException { StringBuilder text = new StringBuilder("'"); int d = read(); if (d == '\\') { text.append('\\'); d = escape(text); else if (isLineSeparator(d)) { unread(d); return new Token(INVALID, text.toString(), "Unterminated character literal"); return invalid(text, "Illegal unicode character literal"); int e = read(); if (e != '\'') { if (isLineSeparator(e)) { unread(e); break; if (e == '\'') break; e = read();
private Token cppcomment() throws IOException, LexerException { StringBuilder text = new StringBuilder("//"); int d = read(); while (!isLineSeparator(d)) { text.append((char)d); d = read(); } unread(d); return new Token(CPPCOMMENT, text.toString()); }
/* pp */ final void warning(String msg) throws LexerException { _error(msg, false); }
LexerException { StringBuilder text = new StringBuilder("'"); int d = read(); if (d == '\\') { text.append('\\'); d = escape(text); } else if (isLineSeparator(d)) { unread(d); return new Token(INVALID, text.toString(), "Unterminated character literal"); } else if (!Character.isDefined(d)) { text.append('?'); return invalid(text, "Illegal unicode character literal"); } else { text.append((char) d); int e = read(); if (e != '\'') { if (isLineSeparator(e)) { unread(e); break; if (e == '\'') break; e = read();
@Nonnull private Token invalid(StringBuilder text, String reason) throws IOException, LexerException { int d = read(); while (!isLineSeparator(d)) { text.append((char) d); d = read(); } unread(d); return new Token(INVALID, text.toString(), reason); }