diff options
Diffstat (limited to 'src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java')
-rw-r--r-- | src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java index 6105a4b..508ceeb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.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,9 +35,11 @@ */ 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.RegexResult; @@ -49,20 +51,27 @@ public class CommandIfLegacy1 extends SingleLineCommand2<ActivityDiagram3> { super(getRegexConcat()); } - static RegexConcat getRegexConcat() { - return new RegexConcat(new RegexLeaf("^"), // + static IRegex getRegexConcat() { + return RegexConcat.build(CommandIfLegacy1.class.getName(), RegexLeaf.start(), // new RegexLeaf("if"), // - new RegexLeaf("[%s]*"), // - new RegexLeaf("TEST", "\\((.+?)\\)"), // - new RegexLeaf("[%s]*"), // - new RegexLeaf("WHEN", "then[%s]when[%s]+(.*)"), // - new RegexLeaf(";?$")); + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("\\("), // + new RegexLeaf("TEST", "(.+?)"), // + new RegexLeaf("\\)"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("then"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("when"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("WHEN", "(.*)"), // + new RegexLeaf(";?"), // + RegexLeaf.end()); } @Override - protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) { + protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { - diagram.startIf(Display.getWithNewlines(arg.get("TEST", 0)), Display.getWithNewlines(arg.get("WHEN", 0)), null); + diagram.startIf(Display.getWithNewlines(arg.get("TEST", 0)), Display.getWithNewlines(arg.get("WHEN", 0)), null, null); return CommandExecutionResult.ok(); } |