Skip to content

Commit 35bdbb1

Browse files
committed
Move to Antlr 4.5.3
1 parent 3b48e20 commit 35bdbb1

File tree

14 files changed

+743
-473
lines changed

14 files changed

+743
-473
lines changed

compile.antlr.cmd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
REM Run from src/main/resources/grammar
22
@echo off
3-
antlr -listener -lib . -o ..\..\..\..\src\main\java\com\github\odiszapc\nginxparser\antlr -visitor Nginx.g4
3+
antlr -listener -lib . -o ..\..\..\..\src\main\java\com\github\odiszapc\nginxparser\antlr -visitor Nginx.g4
4+
5+
REM Or:
6+
REM java -jar c:\antlr\antlr-4.5.3-complete.jar -listener -lib . -o ..\..\..\..\src\main\java\com\github\odiszapc\nginxparser\antlr -visitor Nginx.g4

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<dependency>
7272
<groupId>org.antlr</groupId>
7373
<artifactId>antlr4-runtime</artifactId>
74-
<version>4.3</version>
74+
<version>4.5.3</version>
7575
</dependency>
7676

7777
<dependency>
Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
1+
T__0=1
2+
T__1=2
3+
T__2=3
4+
T__3=4
5+
T__4=5
6+
T__5=6
7+
T__6=7
8+
T__7=8
9+
T__8=9
10+
T__9=10
11+
T__10=11
12+
T__11=12
13+
T__12=13
14+
T__13=14
115
Value=15
2-
WS=20
3-
Comment=17
4-
T__12=2
5-
T__11=3
6-
T__13=1
7-
T__1=13
8-
T__0=14
9-
T__10=4
10-
T__3=11
11-
T__2=12
12-
QUOTED_STRING=18
13-
SINGLE_QUOTED=19
14-
T__9=5
15-
T__8=6
16-
T__7=7
1716
STR_EXT=16
18-
T__6=8
19-
T__5=9
20-
T__4=10
21-
'rewrite'=14
22-
';'=13
23-
'}'=12
24-
'\\.'=11
25-
'if'=10
26-
'('=9
27-
'break'=8
28-
'location'=7
17+
Comment=17
18+
REGEXP_PREFIXED=18
19+
QUOTED_STRING=19
20+
SINGLE_QUOTED=20
21+
WS=21
22+
';'=1
23+
'{'=2
24+
'}'=3
25+
'if'=4
26+
'('=5
2927
')'=6
30-
'{'=5
31-
'last'=4
32-
'^'=3
33-
'permanent'=2
34-
'redirect'=1
28+
'\\.'=7
29+
'^'=8
30+
'location'=9
31+
'rewrite'=10
32+
'last'=11
33+
'break'=12
34+
'redirect'=13
35+
'permanent'=14
Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
// Generated from Nginx.g4 by ANTLR 4.3
1+
// Generated from Nginx.g4 by ANTLR 4.5.3
22

33
package com.github.odiszapc.nginxparser.antlr;
44
import com.github.odiszapc.nginxparser.*;
55

66

77
import org.antlr.v4.runtime.ParserRuleContext;
8-
import org.antlr.v4.runtime.misc.NotNull;
98
import org.antlr.v4.runtime.tree.ErrorNode;
109
import org.antlr.v4.runtime.tree.TerminalNode;
1110

@@ -20,153 +19,156 @@ public class NginxBaseListener implements NginxListener {
2019
*
2120
* <p>The default implementation does nothing.</p>
2221
*/
23-
@Override public void enterStatement(@NotNull NginxParser.StatementContext ctx) { }
22+
@Override public void enterConfig(NginxParser.ConfigContext ctx) { }
2423
/**
2524
* {@inheritDoc}
2625
*
2726
* <p>The default implementation does nothing.</p>
2827
*/
29-
@Override public void exitStatement(@NotNull NginxParser.StatementContext ctx) { }
30-
28+
@Override public void exitConfig(NginxParser.ConfigContext ctx) { }
3129
/**
3230
* {@inheritDoc}
3331
*
3432
* <p>The default implementation does nothing.</p>
3533
*/
36-
@Override public void enterIf_body(@NotNull NginxParser.If_bodyContext ctx) { }
34+
@Override public void enterStatement(NginxParser.StatementContext ctx) { }
3735
/**
3836
* {@inheritDoc}
3937
*
4038
* <p>The default implementation does nothing.</p>
4139
*/
42-
@Override public void exitIf_body(@NotNull NginxParser.If_bodyContext ctx) { }
43-
40+
@Override public void exitStatement(NginxParser.StatementContext ctx) { }
4441
/**
4542
* {@inheritDoc}
4643
*
4744
* <p>The default implementation does nothing.</p>
4845
*/
49-
@Override public void enterGenericBlockHeader(@NotNull NginxParser.GenericBlockHeaderContext ctx) { }
46+
@Override public void enterGenericStatement(NginxParser.GenericStatementContext ctx) { }
5047
/**
5148
* {@inheritDoc}
5249
*
5350
* <p>The default implementation does nothing.</p>
5451
*/
55-
@Override public void exitGenericBlockHeader(@NotNull NginxParser.GenericBlockHeaderContext ctx) { }
56-
52+
@Override public void exitGenericStatement(NginxParser.GenericStatementContext ctx) { }
5753
/**
5854
* {@inheritDoc}
5955
*
6056
* <p>The default implementation does nothing.</p>
6157
*/
62-
@Override public void enterIf_statement(@NotNull NginxParser.If_statementContext ctx) { }
58+
@Override public void enterRegexHeaderStatement(NginxParser.RegexHeaderStatementContext ctx) { }
6359
/**
6460
* {@inheritDoc}
6561
*
6662
* <p>The default implementation does nothing.</p>
6763
*/
68-
@Override public void exitIf_statement(@NotNull NginxParser.If_statementContext ctx) { }
69-
64+
@Override public void exitRegexHeaderStatement(NginxParser.RegexHeaderStatementContext ctx) { }
7065
/**
7166
* {@inheritDoc}
7267
*
7368
* <p>The default implementation does nothing.</p>
7469
*/
75-
@Override public void enterBlock(@NotNull NginxParser.BlockContext ctx) { }
70+
@Override public void enterBlock(NginxParser.BlockContext ctx) { }
7671
/**
7772
* {@inheritDoc}
7873
*
7974
* <p>The default implementation does nothing.</p>
8075
*/
81-
@Override public void exitBlock(@NotNull NginxParser.BlockContext ctx) { }
82-
76+
@Override public void exitBlock(NginxParser.BlockContext ctx) { }
8377
/**
8478
* {@inheritDoc}
8579
*
8680
* <p>The default implementation does nothing.</p>
8781
*/
88-
@Override public void enterConfig(@NotNull NginxParser.ConfigContext ctx) { }
82+
@Override public void enterGenericBlockHeader(NginxParser.GenericBlockHeaderContext ctx) { }
8983
/**
9084
* {@inheritDoc}
9185
*
9286
* <p>The default implementation does nothing.</p>
9387
*/
94-
@Override public void exitConfig(@NotNull NginxParser.ConfigContext ctx) { }
95-
88+
@Override public void exitGenericBlockHeader(NginxParser.GenericBlockHeaderContext ctx) { }
9689
/**
9790
* {@inheritDoc}
9891
*
9992
* <p>The default implementation does nothing.</p>
10093
*/
101-
@Override public void enterRewriteStatement(@NotNull NginxParser.RewriteStatementContext ctx) { }
94+
@Override public void enterIf_statement(NginxParser.If_statementContext ctx) { }
10295
/**
10396
* {@inheritDoc}
10497
*
10598
* <p>The default implementation does nothing.</p>
10699
*/
107-
@Override public void exitRewriteStatement(@NotNull NginxParser.RewriteStatementContext ctx) { }
108-
100+
@Override public void exitIf_statement(NginxParser.If_statementContext ctx) { }
109101
/**
110102
* {@inheritDoc}
111103
*
112104
* <p>The default implementation does nothing.</p>
113105
*/
114-
@Override public void enterGenericStatement(@NotNull NginxParser.GenericStatementContext ctx) { }
106+
@Override public void enterIf_body(NginxParser.If_bodyContext ctx) { }
115107
/**
116108
* {@inheritDoc}
117109
*
118110
* <p>The default implementation does nothing.</p>
119111
*/
120-
@Override public void exitGenericStatement(@NotNull NginxParser.GenericStatementContext ctx) { }
121-
112+
@Override public void exitIf_body(NginxParser.If_bodyContext ctx) { }
122113
/**
123114
* {@inheritDoc}
124115
*
125116
* <p>The default implementation does nothing.</p>
126117
*/
127-
@Override public void enterRegexp(@NotNull NginxParser.RegexpContext ctx) { }
118+
@Override public void enterRegexp(NginxParser.RegexpContext ctx) { }
128119
/**
129120
* {@inheritDoc}
130121
*
131122
* <p>The default implementation does nothing.</p>
132123
*/
133-
@Override public void exitRegexp(@NotNull NginxParser.RegexpContext ctx) { }
134-
124+
@Override public void exitRegexp(NginxParser.RegexpContext ctx) { }
125+
/**
126+
* {@inheritDoc}
127+
*
128+
* <p>The default implementation does nothing.</p>
129+
*/
130+
@Override public void enterLocationBlockHeader(NginxParser.LocationBlockHeaderContext ctx) { }
131+
/**
132+
* {@inheritDoc}
133+
*
134+
* <p>The default implementation does nothing.</p>
135+
*/
136+
@Override public void exitLocationBlockHeader(NginxParser.LocationBlockHeaderContext ctx) { }
135137
/**
136138
* {@inheritDoc}
137139
*
138140
* <p>The default implementation does nothing.</p>
139141
*/
140-
@Override public void enterLocationBlockHeader(@NotNull NginxParser.LocationBlockHeaderContext ctx) { }
142+
@Override public void enterRewriteStatement(NginxParser.RewriteStatementContext ctx) { }
141143
/**
142144
* {@inheritDoc}
143145
*
144146
* <p>The default implementation does nothing.</p>
145147
*/
146-
@Override public void exitLocationBlockHeader(@NotNull NginxParser.LocationBlockHeaderContext ctx) { }
148+
@Override public void exitRewriteStatement(NginxParser.RewriteStatementContext ctx) { }
147149

148150
/**
149151
* {@inheritDoc}
150152
*
151153
* <p>The default implementation does nothing.</p>
152154
*/
153-
@Override public void enterEveryRule(@NotNull ParserRuleContext ctx) { }
155+
@Override public void enterEveryRule(ParserRuleContext ctx) { }
154156
/**
155157
* {@inheritDoc}
156158
*
157159
* <p>The default implementation does nothing.</p>
158160
*/
159-
@Override public void exitEveryRule(@NotNull ParserRuleContext ctx) { }
161+
@Override public void exitEveryRule(ParserRuleContext ctx) { }
160162
/**
161163
* {@inheritDoc}
162164
*
163165
* <p>The default implementation does nothing.</p>
164166
*/
165-
@Override public void visitTerminal(@NotNull TerminalNode node) { }
167+
@Override public void visitTerminal(TerminalNode node) { }
166168
/**
167169
* {@inheritDoc}
168170
*
169171
* <p>The default implementation does nothing.</p>
170172
*/
171-
@Override public void visitErrorNode(@NotNull ErrorNode node) { }
173+
@Override public void visitErrorNode(ErrorNode node) { }
172174
}
Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
// Generated from Nginx.g4 by ANTLR 4.3
1+
// Generated from Nginx.g4 by ANTLR 4.5.3
22

33
package com.github.odiszapc.nginxparser.antlr;
44
import com.github.odiszapc.nginxparser.*;
55

6-
import org.antlr.v4.runtime.misc.NotNull;
76
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
87

98
/**
@@ -21,77 +20,75 @@ public class NginxBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements
2120
* <p>The default implementation returns the result of calling
2221
* {@link #visitChildren} on {@code ctx}.</p>
2322
*/
24-
@Override public T visitStatement(@NotNull NginxParser.StatementContext ctx) { return visitChildren(ctx); }
25-
23+
@Override public T visitConfig(NginxParser.ConfigContext ctx) { return visitChildren(ctx); }
2624
/**
2725
* {@inheritDoc}
2826
*
2927
* <p>The default implementation returns the result of calling
3028
* {@link #visitChildren} on {@code ctx}.</p>
3129
*/
32-
@Override public T visitIf_body(@NotNull NginxParser.If_bodyContext ctx) { return visitChildren(ctx); }
33-
30+
@Override public T visitStatement(NginxParser.StatementContext ctx) { return visitChildren(ctx); }
3431
/**
3532
* {@inheritDoc}
3633
*
3734
* <p>The default implementation returns the result of calling
3835
* {@link #visitChildren} on {@code ctx}.</p>
3936
*/
40-
@Override public T visitGenericBlockHeader(@NotNull NginxParser.GenericBlockHeaderContext ctx) { return visitChildren(ctx); }
41-
37+
@Override public T visitGenericStatement(NginxParser.GenericStatementContext ctx) { return visitChildren(ctx); }
4238
/**
4339
* {@inheritDoc}
4440
*
4541
* <p>The default implementation returns the result of calling
4642
* {@link #visitChildren} on {@code ctx}.</p>
4743
*/
48-
@Override public T visitIf_statement(@NotNull NginxParser.If_statementContext ctx) { return visitChildren(ctx); }
49-
44+
@Override public T visitRegexHeaderStatement(NginxParser.RegexHeaderStatementContext ctx) { return visitChildren(ctx); }
5045
/**
5146
* {@inheritDoc}
5247
*
5348
* <p>The default implementation returns the result of calling
5449
* {@link #visitChildren} on {@code ctx}.</p>
5550
*/
56-
@Override public T visitBlock(@NotNull NginxParser.BlockContext ctx) { return visitChildren(ctx); }
57-
51+
@Override public T visitBlock(NginxParser.BlockContext ctx) { return visitChildren(ctx); }
5852
/**
5953
* {@inheritDoc}
6054
*
6155
* <p>The default implementation returns the result of calling
6256
* {@link #visitChildren} on {@code ctx}.</p>
6357
*/
64-
@Override public T visitConfig(@NotNull NginxParser.ConfigContext ctx) { return visitChildren(ctx); }
65-
58+
@Override public T visitGenericBlockHeader(NginxParser.GenericBlockHeaderContext ctx) { return visitChildren(ctx); }
6659
/**
6760
* {@inheritDoc}
6861
*
6962
* <p>The default implementation returns the result of calling
7063
* {@link #visitChildren} on {@code ctx}.</p>
7164
*/
72-
@Override public T visitRewriteStatement(@NotNull NginxParser.RewriteStatementContext ctx) { return visitChildren(ctx); }
73-
65+
@Override public T visitIf_statement(NginxParser.If_statementContext ctx) { return visitChildren(ctx); }
7466
/**
7567
* {@inheritDoc}
7668
*
7769
* <p>The default implementation returns the result of calling
7870
* {@link #visitChildren} on {@code ctx}.</p>
7971
*/
80-
@Override public T visitGenericStatement(@NotNull NginxParser.GenericStatementContext ctx) { return visitChildren(ctx); }
81-
72+
@Override public T visitIf_body(NginxParser.If_bodyContext ctx) { return visitChildren(ctx); }
8273
/**
8374
* {@inheritDoc}
8475
*
8576
* <p>The default implementation returns the result of calling
8677
* {@link #visitChildren} on {@code ctx}.</p>
8778
*/
88-
@Override public T visitRegexp(@NotNull NginxParser.RegexpContext ctx) { return visitChildren(ctx); }
89-
79+
@Override public T visitRegexp(NginxParser.RegexpContext ctx) { return visitChildren(ctx); }
80+
/**
81+
* {@inheritDoc}
82+
*
83+
* <p>The default implementation returns the result of calling
84+
* {@link #visitChildren} on {@code ctx}.</p>
85+
*/
86+
@Override public T visitLocationBlockHeader(NginxParser.LocationBlockHeaderContext ctx) { return visitChildren(ctx); }
9087
/**
9188
* {@inheritDoc}
9289
*
9390
* <p>The default implementation returns the result of calling
9491
* {@link #visitChildren} on {@code ctx}.</p>
9592
*/
96-
@Override public T visitLocationBlockHeader(@NotNull NginxParser.LocationBlockHeaderContext ctx) { return visitChildren(ctx); }
93+
@Override public T visitRewriteStatement(NginxParser.RewriteStatementContext ctx) { return visitChildren(ctx); }
9794
}

0 commit comments

Comments
 (0)