1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-20 09:02:20 +00:00

Add new affectation

This commit is contained in:
Arnaud Roques 2021-03-18 14:38:17 +01:00
parent 82c57e1b54
commit 266e8b6497
3 changed files with 13 additions and 2 deletions

View File

@ -51,12 +51,23 @@ public class EaterAffectation extends Eater {
String varname = eatAndGetVarname();
TVariableScope scope = null;
skipSpaces();
boolean conditional = false;
if (peekChar() == '?') {
checkAndEatChar('?');
conditional = true;
}
if (peekChar() != '=') {
scope = TVariableScope.valueOf(varname.toUpperCase());
varname = eatAndGetVarname();
skipSpaces();
}
checkAndEatChar('=');
if (conditional) {
final TValue already = memory.getVariable(varname);
if (already != null) {
return;
}
}
skipSpaces();
final TValue value = eatExpression(context, memory);
memory.putVariable(varname, value, scope);

View File

@ -62,7 +62,7 @@ public enum TLineType {
if (s.matches("^\\s*!define\\s+[\\p{L}_][\\p{L}_0-9]*\\b.*")) {
return AFFECTATION_DEFINE;
}
if (s.matches("^\\s*!\\s*(local|global)?\\s*\\$?[\\p{L}_][\\p{L}_0-9]*\\s*=.*")) {
if (s.matches("^\\s*!\\s*(local|global)?\\s*\\$?[\\p{L}_][\\p{L}_0-9]*\\s*\\??=.*")) {
return AFFECTATION;
}
if (s.matches("^\\s*'.*")) {

View File

@ -80,7 +80,7 @@ public class Version {
}
public static int beta() {
final int beta = 6;
final int beta = 7;
return beta;
}