You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/08/28 13:28:29 UTC

[groovy] branch master updated: Allow disabling SLL mode by setting `groovy.antlr4.sll.threshold` to `0`

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new e4a14c7  Allow disabling SLL mode by setting `groovy.antlr4.sll.threshold` to `0`
e4a14c7 is described below

commit e4a14c73351825fd98ad898600ba0641916c56cd
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Aug 28 21:26:05 2021 +0800

    Allow disabling SLL mode by setting `groovy.antlr4.sll.threshold` to `0`
---
 src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java b/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index 83d635f..c6078cb 100644
--- a/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ b/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -405,10 +405,10 @@ public class AstBuilder extends GroovyParserBaseVisitor<Object> {
             // parsing have to wait util clearing is complete.
             AtnManager.READ_LOCK.lock();
             try {
-                if (SLL_THRESHOLD > 0 && parser.getInputStream().size() > SLL_THRESHOLD) {
+                if (SLL_THRESHOLD >= 0 && parser.getInputStream().size() > SLL_THRESHOLD) {
                     // The more tokens to parse, the more possibility SLL will fail and the more parsing time will waste.
                     // The option `groovy.antlr4.sll.threshold` could be tuned for better parsing performance, but it is disabled by default.
-                    // if the token count is greater than `groovy.antlr4.sll.threshold`, use ALL directly.
+                    // If the token count is greater than `groovy.antlr4.sll.threshold`, use ALL directly.
                     result = buildCST(PredictionMode.LL);
                 } else {
                     try {