You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "vieiro (via GitHub)" <gi...@apache.org> on 2023/09/06 18:43:29 UTC

[GitHub] [netbeans] vieiro opened a new pull request, #6414: RustLanguageLexer: do not throw exceptions.

vieiro opened a new pull request, #6414:
URL: https://github.com/apache/netbeans/pull/6414

   Antlr ErrorListener was throwing exceptions interferring with the EDT.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] vieiro merged pull request #6414: RustLanguageLexer: do not throw exceptions.

Posted by "vieiro (via GitHub)" <gi...@apache.org>.
vieiro merged PR #6414:
URL: https://github.com/apache/netbeans/pull/6414


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] lkishalmi commented on a diff in pull request #6414: RustLanguageLexer: do not throw exceptions.

Posted by "lkishalmi (via GitHub)" <gi...@apache.org>.
lkishalmi commented on code in PR #6414:
URL: https://github.com/apache/netbeans/pull/6414#discussion_r1317693432


##########
rust/rust.grammar/src/org/netbeans/modules/rust/grammar/RustLanguageLexer.java:
##########
@@ -41,35 +40,55 @@ public class RustLanguageLexer extends AbstractAntlrLexerBridge<RustLexer, RustT
 
     private static final Logger LOG = Logger.getLogger(RustLanguageLexer.class.getName());
 
-    private static String formatMessage(String kind, Recognizer<?, ?> recognizer, Object o, int line, int charPositionInLine, String message, RecognitionException ex) {
-        return String.format("%s @%3d:%-3d %s", kind, line, charPositionInLine, message);
-    }
-
+    /**
+     * A BaseErrorListener that listens for errors in the lexer. We avoid
+     * throuing exceptions, since AbstractAntlrLexerBridge doesn't know how to
+     * handle them and this may interfere with the EDT. We enable logginf of
+     * errors instead, for debugging and enhancement purposes.
+     */
     private static final class RustLanguageLexerErrorListener extends BaseErrorListener {
 
+        private static final Level LEVEL = Level.FINE;

Review Comment:
   Is `Level.FINE` intentional here, or leftover from your debugging sessions?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] vieiro commented on a diff in pull request #6414: RustLanguageLexer: do not throw exceptions.

Posted by "vieiro (via GitHub)" <gi...@apache.org>.
vieiro commented on code in PR #6414:
URL: https://github.com/apache/netbeans/pull/6414#discussion_r1317757530


##########
rust/rust.grammar/src/org/netbeans/modules/rust/grammar/RustLanguageLexer.java:
##########
@@ -41,35 +40,55 @@ public class RustLanguageLexer extends AbstractAntlrLexerBridge<RustLexer, RustT
 
     private static final Logger LOG = Logger.getLogger(RustLanguageLexer.class.getName());
 
-    private static String formatMessage(String kind, Recognizer<?, ?> recognizer, Object o, int line, int charPositionInLine, String message, RecognitionException ex) {
-        return String.format("%s @%3d:%-3d %s", kind, line, charPositionInLine, message);
-    }
-
+    /**
+     * A BaseErrorListener that listens for errors in the lexer. We avoid
+     * throuing exceptions, since AbstractAntlrLexerBridge doesn't know how to
+     * handle them and this may interfere with the EDT. We enable logginf of
+     * errors instead, for debugging and enhancement purposes.
+     */
     private static final class RustLanguageLexerErrorListener extends BaseErrorListener {
 
+        private static final Level LEVEL = Level.FINE;

Review Comment:
   D'oh! It's a leftover from my debugging sessions and because of doing commits being tired :-D. Will push in a minute. Thanks for the review!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] vieiro commented on a diff in pull request #6414: RustLanguageLexer: do not throw exceptions.

Posted by "vieiro (via GitHub)" <gi...@apache.org>.
vieiro commented on code in PR #6414:
URL: https://github.com/apache/netbeans/pull/6414#discussion_r1317757530


##########
rust/rust.grammar/src/org/netbeans/modules/rust/grammar/RustLanguageLexer.java:
##########
@@ -41,35 +40,55 @@ public class RustLanguageLexer extends AbstractAntlrLexerBridge<RustLexer, RustT
 
     private static final Logger LOG = Logger.getLogger(RustLanguageLexer.class.getName());
 
-    private static String formatMessage(String kind, Recognizer<?, ?> recognizer, Object o, int line, int charPositionInLine, String message, RecognitionException ex) {
-        return String.format("%s @%3d:%-3d %s", kind, line, charPositionInLine, message);
-    }
-
+    /**
+     * A BaseErrorListener that listens for errors in the lexer. We avoid
+     * throuing exceptions, since AbstractAntlrLexerBridge doesn't know how to
+     * handle them and this may interfere with the EDT. We enable logginf of
+     * errors instead, for debugging and enhancement purposes.
+     */
     private static final class RustLanguageLexerErrorListener extends BaseErrorListener {
 
+        private static final Level LEVEL = Level.FINE;

Review Comment:
   D'oh! It's a leftover from my debugging sessions and because of doing commits being tired :-D. 
   
   But let's leave it as is, so we'll have to explicitly enable this log level in the logger in case we want to see syntax errors details.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists