mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-16 02:07:08 +00:00
Add new affectation
This commit is contained in:
parent
82c57e1b54
commit
266e8b6497
@ -51,12 +51,23 @@ public class EaterAffectation extends Eater {
|
|||||||
String varname = eatAndGetVarname();
|
String varname = eatAndGetVarname();
|
||||||
TVariableScope scope = null;
|
TVariableScope scope = null;
|
||||||
skipSpaces();
|
skipSpaces();
|
||||||
|
boolean conditional = false;
|
||||||
|
if (peekChar() == '?') {
|
||||||
|
checkAndEatChar('?');
|
||||||
|
conditional = true;
|
||||||
|
}
|
||||||
if (peekChar() != '=') {
|
if (peekChar() != '=') {
|
||||||
scope = TVariableScope.valueOf(varname.toUpperCase());
|
scope = TVariableScope.valueOf(varname.toUpperCase());
|
||||||
varname = eatAndGetVarname();
|
varname = eatAndGetVarname();
|
||||||
skipSpaces();
|
skipSpaces();
|
||||||
}
|
}
|
||||||
checkAndEatChar('=');
|
checkAndEatChar('=');
|
||||||
|
if (conditional) {
|
||||||
|
final TValue already = memory.getVariable(varname);
|
||||||
|
if (already != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
skipSpaces();
|
skipSpaces();
|
||||||
final TValue value = eatExpression(context, memory);
|
final TValue value = eatExpression(context, memory);
|
||||||
memory.putVariable(varname, value, scope);
|
memory.putVariable(varname, value, scope);
|
||||||
|
@ -62,7 +62,7 @@ public enum TLineType {
|
|||||||
if (s.matches("^\\s*!define\\s+[\\p{L}_][\\p{L}_0-9]*\\b.*")) {
|
if (s.matches("^\\s*!define\\s+[\\p{L}_][\\p{L}_0-9]*\\b.*")) {
|
||||||
return AFFECTATION_DEFINE;
|
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;
|
return AFFECTATION;
|
||||||
}
|
}
|
||||||
if (s.matches("^\\s*'.*")) {
|
if (s.matches("^\\s*'.*")) {
|
||||||
|
@ -80,7 +80,7 @@ public class Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int beta() {
|
public static int beta() {
|
||||||
final int beta = 6;
|
final int beta = 7;
|
||||||
return beta;
|
return beta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user