Skip to content
Snippets Groups Projects
Commit 8ad5bb4c authored by dgelessus's avatar dgelessus
Browse files

Un-deprecate generated Lexer.unread and instead detect problematic case

Our parsers actually do use this method in a few cases that aren't easy
to replace.
parent d20dbed7
Branches
Tags
No related merge requests found
......@@ -390,17 +390,17 @@ public class Lexer
}
/**
* @deprecated This method doesn't restore line/column info correctly in some cases
* (if a token begins in the middle of a CRLF newline pair).
* There is no planned replacement.
* @param tok the token to push back onto the input
* @throws IOException when thrown by {@link PushbackReader#unread(int)}
*/
@Deprecated
protected void unread(Token tok) throws IOException
{
String tokenText = tok.getText();
int length = tokenText.length();
if(this.cr || (length > 0 && tokenText.charAt(0) == '\n'))
{
throw new IOException("Cannot unread a token containing a partial newline");
}
for(int i = length - 1; i >= 0; i--)
{
......
......@@ -284,17 +284,17 @@ Macro:LexerBody
}
/**
* @deprecated This method doesn't restore line/column info correctly in some cases
* (if a token begins in the middle of a CRLF newline pair).
* There is no planned replacement.
* @param tok the token to push back onto the input
* @throws IOException when thrown by {@link PushbackReader#unread(int)}
*/
@Deprecated
protected void unread(Token tok) throws IOException
{
String tokenText = tok.getText();
int length = tokenText.length();
if(this.cr || (length > 0 && tokenText.charAt(0) == '\n'))
{
throw new IOException("Cannot unread a token containing a partial newline");
}
for(int i = length - 1; i >= 0; i--)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment