From eae617720a8d805232d76f062bdbe9c23cbf823a Mon Sep 17 00:00:00 2001 From: dgelessus <dgelessus@users.noreply.github.com> Date: Fri, 10 Nov 2023 16:18:08 +0100 Subject: [PATCH] Deprecate Lexer.unread because of hard to fix newline counting problems We don't use Lexer.unread anywhere, so it's not worth putting in the effort to fix this properly. --- src/main/java/org/sablecc/sablecc/lexer/Lexer.java | 6 ++++++ src/main/resources/org/sablecc/sablecc/lexer.txt | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/org/sablecc/sablecc/lexer/Lexer.java b/src/main/java/org/sablecc/sablecc/lexer/Lexer.java index f2f11b9..43c6fda 100644 --- a/src/main/java/org/sablecc/sablecc/lexer/Lexer.java +++ b/src/main/java/org/sablecc/sablecc/lexer/Lexer.java @@ -593,6 +593,12 @@ 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. + */ + @Deprecated protected void unread(Token token) throws IOException { String text = token.getText(); diff --git a/src/main/resources/org/sablecc/sablecc/lexer.txt b/src/main/resources/org/sablecc/sablecc/lexer.txt index 95e85f0..5960c9f 100644 --- a/src/main/resources/org/sablecc/sablecc/lexer.txt +++ b/src/main/resources/org/sablecc/sablecc/lexer.txt @@ -292,6 +292,12 @@ 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. + */ + @Deprecated protected void unread(Token token) throws IOException { String text = token.getText(); -- GitLab