groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [groovy] 02/03: GROOVY-8987: Support profiling parser(closes #876)
Date Mon, 11 Feb 2019 14:47:53 GMT
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

commit 0c472d47fd9751a6e9b8b2da0ba229b97b19d1ea
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Mon Feb 11 22:46:03 2019 +0800

    GROOVY-8987: Support profiling parser(closes #876)
---
 .../java/org/apache/groovy/parser/antlr4/GroovyLangParser.java   | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/GroovyLangParser.java
b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/GroovyLangParser.java
index d004a70..0b87657 100644
--- a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/GroovyLangParser.java
+++ b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/GroovyLangParser.java
@@ -16,19 +16,28 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
+
 package org.apache.groovy.parser.antlr4;
 
 import org.antlr.v4.runtime.TokenStream;
 import org.antlr.v4.runtime.atn.ParserATNSimulator;
 import org.apache.groovy.parser.antlr4.internal.atnmanager.ParserAtnManager;
+import org.apache.groovy.util.SystemUtil;
 
 /**
  * The parser for Groovy programming language, which is based on the parser generated by
Antlr4
  */
 public class GroovyLangParser extends GroovyParser {
+    private static final boolean GROOVY_PARSER_PROFILING_ENABLED = SystemUtil.getBooleanSafe("groovy.antlr4.profile");
+
     public GroovyLangParser(TokenStream input) {
         super(input);
 
         this.setInterpreter(new ParserATNSimulator(this, ParserAtnManager.INSTANCE.getATN()));
+
+        if (GROOVY_PARSER_PROFILING_ENABLED) {
+            this.setProfile(true);
+        }
     }
+
 }


Mime
View raw message