diff options
author | Sven Gothel <[email protected]> | 2023-08-10 10:39:47 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-08-10 10:39:47 +0200 |
commit | b5ec911572aa0c07228fcb02976a8e848cc90391 (patch) | |
tree | a692955ec9fa91605dd710aa82f6b26d7c156fb1 /src/antlr | |
parent | 07c57a0d36c375f55e93f0caf7dd57e7c0afe271 (diff) |
ANTLR Syntax: Add debugging facility for GnuCParser.g and StdCParser.g
Diffstat (limited to 'src/antlr')
-rw-r--r-- | src/antlr/com/jogamp/gluegen/cgram/GnuCParser.g | 20 | ||||
-rw-r--r-- | src/antlr/com/jogamp/gluegen/cgram/StdCParser.g | 18 |
2 files changed, 29 insertions, 9 deletions
diff --git a/src/antlr/com/jogamp/gluegen/cgram/GnuCParser.g b/src/antlr/com/jogamp/gluegen/cgram/GnuCParser.g index bf01b12..88dbc1e 100644 --- a/src/antlr/com/jogamp/gluegen/cgram/GnuCParser.g +++ b/src/antlr/com/jogamp/gluegen/cgram/GnuCParser.g @@ -35,7 +35,9 @@ options exportVocab = GNUC; buildAST = true; ASTLabelType = "TNode"; - + + genHashLines = true; + // Copied following options from java grammar. codeGenMakeSwitchThreshold = 2; codeGenBitsetTestThreshold = 3; @@ -51,7 +53,7 @@ options // source for names to unnamed scopes protected int unnamedScopeCounter = 0; - + public boolean isTypedefName(String name) { boolean returnValue = false; TNode node = symbolTable.lookupNameInCurrentScope(name); @@ -77,6 +79,16 @@ options symbolTable.popScope(); } + protected boolean debugging = false; + + public boolean getDebug() { + return debugging; + } + + public void setDebug(boolean debug) { + this.debugging = debug; + } + int traceDepth = 0; public void reportError(RecognitionException ex) { try { @@ -94,9 +106,7 @@ options public void reportWarning(String s) { System.err.println("ANTLR Parsing Warning from String: " + s); } - public void match(int t) throws MismatchedTokenException { - boolean debugging = false; - + public void match(int t) throws MismatchedTokenException { if ( debugging ) { for (int x=0; x<traceDepth; x++) System.out.print(" "); try { diff --git a/src/antlr/com/jogamp/gluegen/cgram/StdCParser.g b/src/antlr/com/jogamp/gluegen/cgram/StdCParser.g index 26da996..3279826 100644 --- a/src/antlr/com/jogamp/gluegen/cgram/StdCParser.g +++ b/src/antlr/com/jogamp/gluegen/cgram/StdCParser.g @@ -64,10 +64,12 @@ options exportVocab = STDC; buildAST = true; ASTLabelType = "TNode"; + + genHashLines = true; // Copied following options from java grammar. codeGenMakeSwitchThreshold = 2; - codeGenBitsetTestThreshold = 3; + codeGenBitsetTestThreshold = 3; } @@ -80,7 +82,7 @@ options // source for names to unnamed scopes protected int unnamedScopeCounter = 0; - + public boolean isTypedefName(String name) { boolean returnValue = false; TNode node = symbolTable.lookupNameInCurrentScope(name); @@ -106,6 +108,16 @@ options symbolTable.popScope(); } + protected boolean debugging = false; + + public boolean getDebug() { + return debugging; + } + + public void setDebug(boolean debug) { + this.debugging = debug; + } + int traceDepth = 0; public void reportError(RecognitionException ex) { try { @@ -124,8 +136,6 @@ options System.err.println("ANTLR Parsing Warning from String: " + s); } public void match(int t) throws MismatchedTokenException { - boolean debugging = false; - if ( debugging ) { for (int x=0; x<traceDepth; x++) System.out.print(" "); try { |