net.sourceforge.plantuml.tim.EaterAffectation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-mit Show documentation
Show all versions of plantuml-mit Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.tim;
import net.sourceforge.plantuml.text.StringLocated;
import net.sourceforge.plantuml.tim.expression.TValue;
public class EaterAffectation extends Eater {
public EaterAffectation(StringLocated sl) {
super(sl.getTrimmed());
}
@Override
public void analyze(TContext context, TMemory memory) throws EaterException, EaterExceptionLocated {
skipSpaces();
checkAndEatChar("!");
skipSpaces();
String varname = eatAndGetVarname();
TVariableScope scope = TVariableScope.lazzyParse(varname);
if (scope != null) {
skipSpaces();
if (peekChar() == '?' || peekChar() == '=') {
// The variable itself is "local" or "glocal", which is not a good idea by the way
scope = null;
} else
varname = eatAndGetVarname();
}
skipSpaces();
boolean conditional = false;
if (peekChar() == '?') {
checkAndEatChar('?');
conditional = true;
}
checkAndEatChar('=');
if (conditional)
if (memory.getVariable(varname) != null)
return;
skipSpaces();
final TValue value = eatExpression(context, memory);
memory.putVariable(varname, value, scope);
}
}