Skip to content

Commit 9fd19a3

Browse files
committed
The proper way to override the trace methods...
1 parent 666c7b7 commit 9fd19a3

28 files changed

+118
-182
lines changed

src/main/antlr/JPTreeParser.g

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@ options {
6565
// This is added to top of the class definitions
6666
{
6767
68+
@Override
69+
public void traceIndent() {
70+
//super.traceIndent();
71+
}
72+
73+
@Override
74+
public void traceIn(String s, AST ast) {
75+
//super.traceIn(s, ast);
76+
}
77+
78+
@Override
79+
public void traceOut(String s, AST ast) {
80+
//super.traceOut(s, ast);
81+
}
82+
6883
// Where did the tree parser leave off parsing -- might give us at least a bit
6984
// of an idea where things left off if an exception was thrown.
7085
// See antlr/TreeParser and the generated code.

src/main/antlr/TreeParser01.g

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,21 @@ options {
5252
// This is added to top of the class definitions
5353
{
5454

55+
@Override
56+
public void traceIn(String s, AST ast) {
57+
//super.traceIn(s, ast);
58+
}
59+
60+
@Override
61+
public void traceOut(String s, AST ast) {
62+
//super.traceOut(s, ast);
63+
}
64+
65+
@Override
66+
public void traceIndent() {
67+
//super.traceIndent();
68+
}
69+
5570
// --- The following are required in all tree parsers ---
5671

5772
// Where did the tree parser leave off parsing -- might give us at least a bit

src/main/antlr/proeval.g

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,32 @@ package com.joanju.proparse;
1515
import static com.joanju.proparse.ProEvalSupport.*;
1616
}
1717

18-
options {
19-
}
20-
2118
class ProEval extends TreeParser;
19+
2220
options {
2321
importVocab = Base;
2422
defaultErrorHandler = false;
2523
}
2624

25+
{
26+
27+
@Override
28+
public void traceIn(String s, AST ast) {
29+
//super.traceIn(s, ast);
30+
}
31+
32+
@Override
33+
public void traceOut(String s, AST ast) {
34+
//super.traceOut(s, ast);
35+
}
36+
37+
@Override
38+
public void traceIndent() {
39+
//super.traceIndent();
40+
}
41+
42+
}
43+
2744

2845
///////////////////////////////////////////////////////////////////////////////////////////////////
2946
// Begin grammar

src/main/antlr/proparse.g

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ options {
4646
4747
// Additional methods and members.
4848
{
49+
50+
@Override
51+
public void traceIndent() {
52+
//super.traceIndent();
53+
}
54+
55+
@Override
56+
public void traceIn(String s) throws TokenStreamException {
57+
//super.traceIn(s);
58+
}
59+
60+
@Override
61+
public void traceOut(String s) throws TokenStreamException {
62+
//super.traceOut(s);
63+
}
64+
4965
private boolean schemaTablePriority = false;
5066
public ParserSupport support;
5167
public DoParse doParse;
@@ -65,7 +81,6 @@ options {
6581
to.setHiddenBefore(from.getHiddenBefore());
6682
}
6783
68-
6984
/** Override antlr parser getFilename(). */
7085
@Override
7186
public String getFilename() {

src/main/java/com/joanju/proparse/DoParse.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public DoParse(String fileName) {
4040
int nextNodeNum;
4141
BufferedReader inStream;
4242
private Environment env = Environment.instance();
43-
ProParserCust parser;
43+
ProParser parser;
4444
String fileName;
4545
TokenVectorIterator tvi;
4646

@@ -131,7 +131,7 @@ public void doParse()
131131
}
132132

133133
// Create the parser, with the filter as the input.
134-
parser = new ProParserCust(filter);
134+
parser = new ProParser(filter);
135135
parser.init(this);
136136

137137
if (justLex) {
@@ -162,11 +162,11 @@ public void doParse()
162162
// - just doing a regular parse
163163
if (proEval) {
164164
parser.program();
165-
ProEvalCust proEval = new ProEvalCust();
165+
ProEval proEval = new ProEval();
166166
proEval.program(parser.getAST());
167167
} else if (preProcessCondition) {
168168
parser.expression();
169-
ProEvalCust proEval = new ProEvalCust();
169+
ProEval proEval = new ProEval();
170170
preProcessConditionResult = proEval.preproIfEval(parser.getAST());
171171
} else {
172172
parser.program();

src/main/java/com/joanju/proparse/NodeTypes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void add(int type, int minAbbrev, String fullText, int flags) {
8383
ti.fullText = fullText;
8484
if (ti.bitset==0)
8585
ti.bitset = flags;
86-
nameNums.put(ProParserCust._tokenNames[type], type);
86+
nameNums.put(ProParser._tokenNames[type], type);
8787
}
8888

8989

@@ -124,7 +124,7 @@ public static String getFullText(String text) {
124124
public static String getTypeName(int n) {
125125
if (n > Last_Token_Number || n < 1)
126126
return null;
127-
String ret = ProParserCust._tokenNames[n];
127+
String ret = ProParser._tokenNames[n];
128128
if (ret.endsWith("_KW"))
129129
ret = ret.substring(0, ret.length()-3);
130130
return ret;

src/main/java/com/joanju/proparse/ParserSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ void setStoreType(JPNode node, SymbolScope.FieldType tabletype) {
355355
}
356356

357357

358-
/* Called by ProParserCust at the *end* of the parse. */
358+
/* Called by ProParser at the *end* of the parse. */
359359
void setTopNode(JPNode refTopNode) { topNode = refTopNode; }
360360

361361

src/main/java/com/joanju/proparse/ProEvalCust.java

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/main/java/com/joanju/proparse/ProParserCust.java

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/main/java/org/prorefactor/core/CustomTreeParser.java

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)