diff options
Diffstat (limited to 'src/main/java/org/anarres/cpp/LexerSource.java')
-rw-r--r-- | src/main/java/org/anarres/cpp/LexerSource.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/org/anarres/cpp/LexerSource.java b/src/main/java/org/anarres/cpp/LexerSource.java index 7e39a21..cf4296f 100644 --- a/src/main/java/org/anarres/cpp/LexerSource.java +++ b/src/main/java/org/anarres/cpp/LexerSource.java @@ -16,6 +16,7 @@ */ package org.anarres.cpp; +import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import javax.annotation.Nonnull; @@ -24,6 +25,13 @@ import static org.anarres.cpp.Token.*; /** Does not handle digraphs. */ public class LexerSource extends Source { + @Nonnull + protected static BufferedReader toBufferedReader(@Nonnull Reader r) { + if (r instanceof BufferedReader) + return (BufferedReader) r; + return new BufferedReader(r); + } + private static final boolean DEBUG = false; private JoinReader reader; |