Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 9, 2025. It is now read-only.
/SRL-JavaPublic archive

Commit63c74a4

Browse files
author
Samuel Tebbs
committed
Fixed issues making tests fail
1 parentc23271a commit63c74a4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎src/main/java/com/github/simpleregex/SRLParseTreeListener.java‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
importcom.github.simpleregex.parser.SRLBaseListener;
44
importcom.github.simpleregex.parser.SRLParser;
55
importorg.antlr.v4.runtime.ParserRuleContext;
6-
importorg.antlr.v4.runtime.tree.ParseTreeWalker;
76
importorg.antlr.v4.runtime.tree.TerminalNode;
87

9-
importjava.util.Arrays;
108
importjava.util.LinkedList;
119
importjava.util.List;
1210
importjava.util.function.Consumer;
13-
importjava.util.regex.Pattern;
1411

1512
/**
1613
* Created by samtebbs on 06/09/2016.
@@ -44,7 +41,7 @@ enum RegexElement {
4441
ALL_LAZY("U"),
4542
MULTI_LINE("m"),
4643
END_OF_STRING("$"),
47-
START_OF_STRING("^"),
44+
BEGINS_WITH("^"),
4845
IF_FOLLOWED("(?=",")"),
4946
IF_NOT_FOLLOWED("(?!",")"),
5047
IF_HAD("(?<=",")"),
@@ -131,7 +128,6 @@ public void enterStmt(SRLParser.StmtContext ctx) {
131128
@Override
132129
publicvoidenterQuantifier(SRLParser.QuantifierContextctx) {
133130
booleanoptional =ctx.KEYW_OPTIONAL() !=null;
134-
if(optional)addRegexStart(RegexElement.OPTIONAL);
135131
visit(ctx.at_least(),this::enterAt_least);
136132
visit(ctx.between(),this::enterBetween);
137133
visit(ctx.exactly(),this::enterExactly);
@@ -194,8 +190,10 @@ public void enterFlag(SRLParser.FlagContext ctx) {
194190
@Override
195191
publicvoidenterAnchor(SRLParser.AnchorContextctx) {
196192
if(ctx.KEYW_END() !=null)addRegexVal(RegexElement.END_OF_STRING);
197-
elseif(ctx.KEYW_BEGINS() !=null |ctx.KEYW_STARTS() !=null)addRegexVal(RegexElement.START_OF_STRING);
198-
visit(ctx.block(),this::enterBlock);
193+
elseif(ctx.KEYW_BEGINS() !=null |ctx.KEYW_STARTS() !=null) {
194+
addRegexVal(RegexElement.BEGINS_WITH);
195+
visit(ctx.block(),this::enterBlock);
196+
}
199197
}
200198

201199
@Override
@@ -302,7 +300,9 @@ public void enterCapture(SRLParser.CaptureContext ctx) {
302300

303301
@Override
304302
publicvoidenterBracketed_stmts(SRLParser.Bracketed_stmtsContextctx) {
303+
addRegexStart(RegexElement.GROUP);
305304
ctx.stmt().forEach(this::enterStmt);
305+
addRegexEnd(RegexElement.GROUP);
306306
}
307307

308308
@Override

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp