summaryrefslogtreecommitdiff
path: root/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java')
-rw-r--r--src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java46
1 files changed, 30 insertions, 16 deletions
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java
index 8e79490..2f9fccb 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandRepeatWhile3.java
@@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator
* ========================================================================
*
- * (C) Copyright 2009-2017, Arnaud Roques
+ * (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
@@ -35,15 +35,18 @@
*/
package net.sourceforge.plantuml.activitydiagram3.command;
+import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
+import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
+import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.graphic.Rainbow;
public class CommandRepeatWhile3 extends SingleLineCommand2<ActivityDiagram3> {
@@ -52,41 +55,52 @@ public class CommandRepeatWhile3 extends SingleLineCommand2<ActivityDiagram3> {
super(getRegexConcat());
}
- static RegexConcat getRegexConcat() {
- return new RegexConcat(//
- new RegexLeaf("^"), //
- new RegexLeaf("repeat[%s]?while"), //
- new RegexLeaf("[%s]*"), //
+ static IRegex getRegexConcat() {
+ return RegexConcat.build(CommandRepeatWhile3.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("repeat"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("while"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexOr(//
new RegexConcat(new RegexLeaf("TEST3", "\\((.*?)\\)"), //
- new RegexLeaf("[%s]*(is|equals?)[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("(is|equals?)"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("WHEN3", "\\((.+?)\\)"), //
- new RegexLeaf("[%s]*(not)[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("(not)"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("OUT3", "\\((.+?)\\)")), //
new RegexConcat(new RegexLeaf("TEST4", "\\((.*?)\\)"), //
- new RegexLeaf("[%s]*(not)[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("(not)"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("OUT4", "\\((.+?)\\)")), //
new RegexConcat(new RegexLeaf("TEST2", "\\((.*?)\\)"), //
- new RegexLeaf("[%s]*(is|equals?)[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("(is|equals?)"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("WHEN2", "\\((.+?)\\)") //
), //
- new RegexLeaf("TEST1", "(?:\\((.*)\\))?") //
+ new RegexOptional(new RegexLeaf("TEST1", "\\((.*)\\)")) //
), //
- new RegexLeaf("[%s]*"), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexConcat( //
new RegexOr(//
new RegexLeaf("->"), //
- new RegexLeaf("COLOR", CommandArrow3.STYLE_COLORS)), //
- new RegexLeaf("[%s]*"), //
+ new RegexLeaf("COLOR", CommandLinkElement.STYLE_COLORS_MULTIPLES)), //
+ RegexLeaf.spaceZeroOrMore(), //
new RegexOr(//
new RegexLeaf("LABEL", "(.*)"), //
new RegexLeaf("")) //
)), //
- new RegexLeaf(";?$"));
+ new RegexLeaf(";?"), //
+ RegexLeaf.end());
}
@Override
- protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
+ protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
final Display test = Display.getWithNewlines(arg.getLazzy("TEST", 0));
final Display yes = Display.getWithNewlines(arg.getLazzy("WHEN", 0));
final Display out = Display.getWithNewlines(arg.getLazzy("OUT", 0));