mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-22 04:55:10 +00:00
refactor: prepare preprocessor error improvement (in progress)
https://github.com/plantuml/plantuml/pull/1668
This commit is contained in:
parent
35909a50c7
commit
436fb37f1a
@ -1,4 +1,4 @@
|
||||
# Warning, "version" should be the same in gradle.properties and Version.java
|
||||
# Any idea anyone how to magically synchronize those :-) ?
|
||||
version = 1.2024.4beta1
|
||||
version = 1.2024.4beta2
|
||||
org.gradle.workers.max = 3
|
@ -158,4 +158,8 @@ final public class StringLocated {
|
||||
return s.length();
|
||||
}
|
||||
|
||||
public char charAt(int i) {
|
||||
return s.charAt(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,20 +50,18 @@ import net.sourceforge.plantuml.utils.LineLocation;
|
||||
public abstract class Eater {
|
||||
|
||||
private int i = 0;
|
||||
private final String s;
|
||||
private final LineLocation lineLocation;
|
||||
private final StringLocated stringLocated;
|
||||
|
||||
public Eater(StringLocated sl) {
|
||||
this(sl.getString(), sl.getLocation());
|
||||
}
|
||||
|
||||
protected Eater(String s, LineLocation lineLocation) {
|
||||
this.s = s;
|
||||
this.lineLocation = lineLocation;
|
||||
public Eater(StringLocated stringLocated) {
|
||||
this.stringLocated = stringLocated;
|
||||
}
|
||||
|
||||
public final LineLocation getLineLocation() {
|
||||
return lineLocation;
|
||||
return stringLocated.getLocation();
|
||||
}
|
||||
|
||||
public final StringLocated getStringLocated() {
|
||||
return stringLocated;
|
||||
}
|
||||
|
||||
public abstract void analyze(TContext context, TMemory memory) throws EaterException, EaterExceptionLocated;
|
||||
@ -73,8 +71,8 @@ public abstract class Eater {
|
||||
}
|
||||
|
||||
final protected String eatAllToEnd() throws EaterException {
|
||||
final String result = s.substring(i);
|
||||
i = s.length();
|
||||
final String result = stringLocated.getString().substring(i);
|
||||
i = stringLocated.length();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -88,7 +86,7 @@ public abstract class Eater {
|
||||
return TValue.fromJson(json);
|
||||
}
|
||||
final TokenStack tokenStack = eatTokenStack();
|
||||
return tokenStack.getResult(getLineLocation(), context, memory);
|
||||
return tokenStack.getResult(getStringLocated(), context, memory);
|
||||
}
|
||||
|
||||
final protected TokenStack eatTokenStack() throws EaterException {
|
||||
@ -104,7 +102,7 @@ public abstract class Eater {
|
||||
throws EaterException, EaterExceptionLocated {
|
||||
final TokenStack tokenStack = new TokenStack();
|
||||
addIntoTokenStack(tokenStack, true);
|
||||
return tokenStack.getResult(getLineLocation(), context, memory);
|
||||
return tokenStack.getResult(getStringLocated(), context, memory);
|
||||
}
|
||||
|
||||
final protected void addIntoTokenStack(TokenStack tokenStack, boolean stopAtColon) throws EaterException {
|
||||
@ -208,56 +206,56 @@ public abstract class Eater {
|
||||
}
|
||||
|
||||
final public void skipSpaces() {
|
||||
while (i < s.length() && Character.isWhitespace(s.charAt(i)))
|
||||
while (i < stringLocated.length() && Character.isWhitespace(stringLocated.charAt(i)))
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
final protected void skipUntilChar(char ch) {
|
||||
while (i < s.length() && s.charAt(i) != ch)
|
||||
while (i < stringLocated.length() && stringLocated.charAt(i) != ch)
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
final public char peekChar() {
|
||||
if (i >= s.length())
|
||||
if (i >= stringLocated.length())
|
||||
return 0;
|
||||
|
||||
return s.charAt(i);
|
||||
return stringLocated.charAt(i);
|
||||
}
|
||||
|
||||
final public boolean matchAffectation() {
|
||||
final String tmp = s.substring(i);
|
||||
final String tmp = stringLocated.getString().substring(i);
|
||||
final boolean result = tmp.matches("^\\$?[_\\p{L}][_\\p{L}0-9]*\\s*=.*");
|
||||
return result;
|
||||
}
|
||||
|
||||
final public char peekCharN2() {
|
||||
if (i + 1 >= s.length())
|
||||
if (i + 1 >= stringLocated.length())
|
||||
return 0;
|
||||
|
||||
return s.charAt(i + 1);
|
||||
return stringLocated.charAt(i + 1);
|
||||
}
|
||||
|
||||
final protected boolean hasNextChar() {
|
||||
return i < s.length();
|
||||
return i < stringLocated.length();
|
||||
}
|
||||
|
||||
final public char eatOneChar() {
|
||||
final char ch = s.charAt(i);
|
||||
final char ch = stringLocated.charAt(i);
|
||||
i++;
|
||||
return ch;
|
||||
}
|
||||
|
||||
final protected void checkAndEatChar(char ch) throws EaterException {
|
||||
if (i >= s.length() || s.charAt(i) != ch)
|
||||
if (i >= stringLocated.length() || stringLocated.charAt(i) != ch)
|
||||
throw EaterException.located("a001");
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
final protected boolean safeCheckAndEatChar(char ch) throws EaterException {
|
||||
if (i >= s.length() || s.charAt(i) != ch)
|
||||
if (i >= stringLocated.length() || stringLocated.charAt(i) != ch)
|
||||
return false;
|
||||
|
||||
i++;
|
||||
@ -265,10 +263,10 @@ public abstract class Eater {
|
||||
}
|
||||
|
||||
final protected void optionallyEatChar(char ch) throws EaterException {
|
||||
if (i >= s.length() || s.charAt(i) != ch)
|
||||
if (i >= stringLocated.length() || stringLocated.charAt(i) != ch)
|
||||
return;
|
||||
|
||||
assert s.charAt(i) == ch;
|
||||
assert stringLocated.charAt(i) == ch;
|
||||
i++;
|
||||
}
|
||||
|
||||
@ -279,8 +277,8 @@ public abstract class Eater {
|
||||
}
|
||||
|
||||
final protected void addUpToLastLetterOrUnderscoreOrDigit(StringBuilder sb) {
|
||||
while (i < s.length()) {
|
||||
final char ch = s.charAt(i);
|
||||
while (i < stringLocated.length()) {
|
||||
final char ch = stringLocated.charAt(i);
|
||||
if (TLineType.isLetterOrUnderscoreOrDigit(ch) == false)
|
||||
return;
|
||||
|
||||
@ -290,7 +288,7 @@ public abstract class Eater {
|
||||
}
|
||||
|
||||
final protected void addUpTo(char separator, StringBuilder sb) {
|
||||
while (i < s.length()) {
|
||||
while (i < stringLocated.length()) {
|
||||
final char ch = peekChar();
|
||||
if (ch == separator)
|
||||
return;
|
||||
@ -323,7 +321,7 @@ public abstract class Eater {
|
||||
eatOneChar();
|
||||
final TokenStack def = TokenStack.eatUntilCloseParenthesisOrComma(this);
|
||||
def.guessFunctions();
|
||||
defValue = def.getResult(getLineLocation(), context, memory);
|
||||
defValue = def.getResult(getStringLocated(), context, memory);
|
||||
// System.err.println("result=" + defValue);
|
||||
} else {
|
||||
defValue = null;
|
||||
|
@ -53,7 +53,8 @@ public class EaterAffectation extends Eater {
|
||||
if (scope != null) {
|
||||
skipSpaces();
|
||||
if (peekChar() == '?' || peekChar() == '=') {
|
||||
// The variable itself is "local" or "glocal", which is not a good idea by the way
|
||||
// The variable itself is "local" or "glocal", which is not a good idea by the
|
||||
// way
|
||||
scope = null;
|
||||
} else
|
||||
varname = eatAndGetVarname();
|
||||
|
@ -51,7 +51,7 @@ public class EaterAffectationDefine extends Eater {
|
||||
final String varname = eatAndGetVarname();
|
||||
skipSpaces();
|
||||
final String tmp = eatAllToEnd();
|
||||
final String tmp2 = context.applyFunctionsAndVariables(memory, getLineLocation(), tmp);
|
||||
final String tmp2 = context.applyFunctionsAndVariables(memory, new StringLocated(tmp, getLineLocation()));
|
||||
final TValue value = TValue.fromString(tmp2);
|
||||
// if (memory instanceof TMemoryLocal) {
|
||||
// memory = ((TMemoryLocal) memory).getGlobalForInternalUseOnly();
|
||||
|
@ -70,7 +70,8 @@ public class EaterFunctionCall extends Eater {
|
||||
skipSpaces();
|
||||
if (isLegacyDefine) {
|
||||
final String read = eatAndGetOptionalQuotedString();
|
||||
final String value = context.applyFunctionsAndVariables(memory, getLineLocation(), read);
|
||||
final String value = context.applyFunctionsAndVariables(memory,
|
||||
new StringLocated(read, getLineLocation()));
|
||||
final TValue result = TValue.fromString(value);
|
||||
values.add(result);
|
||||
} else if (unquoted) {
|
||||
@ -80,12 +81,14 @@ public class EaterFunctionCall extends Eater {
|
||||
checkAndEatChar('=');
|
||||
skipSpaces();
|
||||
final String read = eatAndGetOptionalQuotedString();
|
||||
final String value = context.applyFunctionsAndVariables(memory, getLineLocation(), read);
|
||||
final String value = context.applyFunctionsAndVariables(memory,
|
||||
new StringLocated(read, getLineLocation()));
|
||||
final TValue result = TValue.fromString(value);
|
||||
namedArguments.put(varname, result);
|
||||
} else {
|
||||
final String read = eatAndGetOptionalQuotedString();
|
||||
final String value = context.applyFunctionsAndVariables(memory, getLineLocation(), read);
|
||||
final String value = context.applyFunctionsAndVariables(memory,
|
||||
new StringLocated(read, getLineLocation()));
|
||||
final TValue result = TValue.fromString(value);
|
||||
values.add(result);
|
||||
}
|
||||
@ -98,12 +101,12 @@ public class EaterFunctionCall extends Eater {
|
||||
skipSpaces();
|
||||
final TokenStack tokens = TokenStack.eatUntilCloseParenthesisOrComma(this).withoutSpace();
|
||||
tokens.guessFunctions();
|
||||
final TValue result = tokens.getResult(getLineLocation(), context, memory);
|
||||
final TValue result = tokens.getResult(getStringLocated(), context, memory);
|
||||
namedArguments.put(varname, result);
|
||||
} else {
|
||||
final TokenStack tokens = TokenStack.eatUntilCloseParenthesisOrComma(this).withoutSpace();
|
||||
tokens.guessFunctions();
|
||||
final TValue result = tokens.getResult(getLineLocation(), context, memory);
|
||||
final TValue result = tokens.getResult(getStringLocated(), context, memory);
|
||||
values.add(result);
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ import net.sourceforge.plantuml.text.StringLocated;
|
||||
|
||||
public class EaterImport extends Eater {
|
||||
|
||||
private String location;
|
||||
private String what;
|
||||
|
||||
public EaterImport(StringLocated s) {
|
||||
super(s);
|
||||
@ -49,12 +49,13 @@ public class EaterImport extends Eater {
|
||||
skipSpaces();
|
||||
checkAndEatChar("!import");
|
||||
skipSpaces();
|
||||
this.location = context.applyFunctionsAndVariables(memory, getLineLocation(), this.eatAllToEnd());
|
||||
this.what = context.applyFunctionsAndVariables(memory,
|
||||
new StringLocated(this.eatAllToEnd(), getLineLocation()));
|
||||
|
||||
}
|
||||
|
||||
public final String getLocation() {
|
||||
return location;
|
||||
public final String getWhat() {
|
||||
return what;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -65,7 +65,8 @@ public class EaterInclude extends Eater {
|
||||
}
|
||||
}
|
||||
skipSpaces();
|
||||
this.location = context.applyFunctionsAndVariables(memory, getLineLocation(), this.eatAllToEnd());
|
||||
this.location = context.applyFunctionsAndVariables(memory,
|
||||
new StringLocated(this.eatAllToEnd(), getLineLocation()));
|
||||
// final TValue value = eatExpression(context, memory);
|
||||
// this.location = value.toString();
|
||||
|
||||
|
@ -49,7 +49,8 @@ public class EaterIncludeDef extends Eater {
|
||||
skipSpaces();
|
||||
checkAndEatChar("!includedef");
|
||||
skipSpaces();
|
||||
this.location = context.applyFunctionsAndVariables(memory, getLineLocation(), this.eatAllToEnd());
|
||||
this.location = context.applyFunctionsAndVariables(memory,
|
||||
new StringLocated(this.eatAllToEnd(), getLineLocation()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,8 @@ public class EaterIncludesub extends Eater {
|
||||
skipSpaces();
|
||||
checkAndEatChar("!includesub");
|
||||
skipSpaces();
|
||||
this.location = context.applyFunctionsAndVariables(memory, getLineLocation(), this.eatAllToEnd());
|
||||
this.location = context.applyFunctionsAndVariables(memory,
|
||||
new StringLocated(this.eatAllToEnd(), getLineLocation()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,8 @@ public class EaterLog extends Eater {
|
||||
skipSpaces();
|
||||
checkAndEatChar("!log");
|
||||
skipSpaces();
|
||||
final String logData = context.applyFunctionsAndVariables(memory, getLineLocation(), this.eatAllToEnd());
|
||||
final String logData = context.applyFunctionsAndVariables(memory,
|
||||
new StringLocated(this.eatAllToEnd(), getLineLocation()));
|
||||
Log.error("[Log] " + logData);
|
||||
}
|
||||
|
||||
|
@ -76,12 +76,12 @@ public class EaterTheme extends Eater {
|
||||
final int x = this.name.toLowerCase().indexOf(" from ");
|
||||
if (x != -1) {
|
||||
final String fromTmp = this.name.substring(x + " from ".length()).trim();
|
||||
this.from = context.applyFunctionsAndVariables(memory, getLineLocation(), fromTmp);
|
||||
this.from = context.applyFunctionsAndVariables(memory, new StringLocated(fromTmp, getLineLocation()));
|
||||
this.name = this.name.substring(0, x).trim();
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
this.realName = context.applyFunctionsAndVariables(memory, getLineLocation(), this.name);
|
||||
this.realName = context.applyFunctionsAndVariables(memory, new StringLocated(this.name, getLineLocation()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.tim;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.tim.expression.TokenStack;
|
||||
import net.sourceforge.plantuml.tim.iterator.CodePosition;
|
||||
@ -59,7 +60,7 @@ public class ExecutionContextWhile {
|
||||
return new ExecutionContextWhile(whileExpression, codePosition);
|
||||
}
|
||||
|
||||
public TValue conditionValue(LineLocation location, TContext context, TMemory memory)
|
||||
public TValue conditionValue(StringLocated location, TContext context, TMemory memory)
|
||||
throws EaterException, EaterExceptionLocated {
|
||||
return whileExpression.getResult(location, context, memory);
|
||||
}
|
||||
|
@ -34,10 +34,12 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.tim;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
|
||||
public class StringEater extends Eater {
|
||||
|
||||
public StringEater(String s) {
|
||||
super(s, null);
|
||||
super(new StringLocated(s, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -252,7 +252,7 @@ public class TContext {
|
||||
|
||||
private TValue fromJson(TMemory memory, String name, LineLocation location)
|
||||
throws EaterException, EaterExceptionLocated {
|
||||
final String result = applyFunctionsAndVariables(memory, location, name);
|
||||
final String result = applyFunctionsAndVariables(memory, new StringLocated(name, location));
|
||||
try {
|
||||
final JsonValue json = Json.parse(result);
|
||||
return TValue.fromJson(json);
|
||||
@ -428,7 +428,7 @@ public class TContext {
|
||||
if (memory.isEmpty() && functionsSet.size() == 0)
|
||||
return new StringLocated[] { located };
|
||||
|
||||
final String result = applyFunctionsAndVariables(memory, located.getLocation(), located.getString());
|
||||
final String result = applyFunctionsAndVariables(memory, located);
|
||||
if (result == null)
|
||||
return null;
|
||||
|
||||
@ -442,7 +442,7 @@ public class TContext {
|
||||
|
||||
private String pendingAdd = null;
|
||||
|
||||
public String applyFunctionsAndVariables(TMemory memory, LineLocation location, final String str)
|
||||
public String applyFunctionsAndVariables(TMemory memory, final StringLocated str)
|
||||
throws EaterException, EaterExceptionLocated {
|
||||
// https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore%E2%80%93Horspool_algorithm
|
||||
// https://stackoverflow.com/questions/1326682/java-replacing-multiple-different-substring-in-a-string-at-once-or-in-the-most
|
||||
@ -450,15 +450,15 @@ public class TContext {
|
||||
// https://www.quora.com/What-is-the-most-efficient-algorithm-to-replace-all-occurrences-of-a-pattern-P-in-a-string-with-a-pattern-P
|
||||
// https://en.wikipedia.org/wiki/Trie
|
||||
if (memory.isEmpty() && functionsSet.size() == 0)
|
||||
return str;
|
||||
return str.getString();
|
||||
|
||||
final StringBuilder result = new StringBuilder();
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
final char c = str.charAt(i);
|
||||
final String presentFunction = getFunctionNameAt(str, i);
|
||||
final String presentFunction = getFunctionNameAt(str.getString(), i);
|
||||
if (presentFunction != null) {
|
||||
final String sub = str.substring(i);
|
||||
final EaterFunctionCall call = new EaterFunctionCall(new StringLocated(sub, location),
|
||||
final String sub = str.getString().substring(i);
|
||||
final EaterFunctionCall call = new EaterFunctionCall(new StringLocated(sub, str.getLocation()),
|
||||
isLegacyDefine(presentFunction), isUnquoted(presentFunction));
|
||||
call.analyze(this, memory);
|
||||
final TFunctionSignature signature = new TFunctionSignature(presentFunction, call.getValues().size(),
|
||||
@ -469,27 +469,27 @@ public class TContext {
|
||||
|
||||
if (function.getFunctionType() == TFunctionType.PROCEDURE) {
|
||||
this.pendingAdd = result.toString();
|
||||
executeVoid3(location, memory, sub, function, call);
|
||||
executeVoid3(str, memory, function, call);
|
||||
i += call.getCurrentPosition();
|
||||
final String remaining = str.substring(i);
|
||||
final String remaining = str.getString().substring(i);
|
||||
if (remaining.length() > 0)
|
||||
appendToLastResult(remaining);
|
||||
|
||||
return null;
|
||||
}
|
||||
if (function.getFunctionType() == TFunctionType.LEGACY_DEFINELONG) {
|
||||
this.pendingAdd = str.substring(0, i);
|
||||
executeVoid3(location, memory, sub, function, call);
|
||||
this.pendingAdd = str.getString().substring(0, i);
|
||||
executeVoid3(str, memory, function, call);
|
||||
return null;
|
||||
}
|
||||
assert function.getFunctionType() == TFunctionType.RETURN_FUNCTION
|
||||
|| function.getFunctionType() == TFunctionType.LEGACY_DEFINE;
|
||||
final TValue functionReturn = function.executeReturnFunction(this, memory, location, call.getValues(),
|
||||
final TValue functionReturn = function.executeReturnFunction(this, memory, str, call.getValues(),
|
||||
call.getNamedArguments());
|
||||
result.append(functionReturn.toString());
|
||||
i += call.getCurrentPosition() - 1;
|
||||
} else if (new VariableManager(this, memory, location).getVarnameAt(str, i) != null) {
|
||||
i = new VariableManager(this, memory, location).replaceVariables(str, i, result);
|
||||
} else if (new VariableManager(this, memory, str.getLocation()).getVarnameAt(str.getString(), i) != null) {
|
||||
i = new VariableManager(this, memory, str.getLocation()).replaceVariables(str.getString(), i, result);
|
||||
} else {
|
||||
result.append(c);
|
||||
}
|
||||
@ -502,11 +502,9 @@ public class TContext {
|
||||
this.resultList.set(this.resultList.size() - 1, last.append(remaining));
|
||||
}
|
||||
|
||||
private void executeVoid3(LineLocation location, TMemory memory, String s, TFunction function,
|
||||
EaterFunctionCall call) throws EaterException, EaterExceptionLocated {
|
||||
function.executeProcedureInternal(this, memory, call.getValues(), call.getNamedArguments());
|
||||
// function.executeProcedure(this, memory, location, s, call.getValues(),
|
||||
// call.getNamedArguments());
|
||||
private void executeVoid3(StringLocated location, TMemory memory, TFunction function, EaterFunctionCall call)
|
||||
throws EaterException, EaterExceptionLocated {
|
||||
function.executeProcedureInternal(this, memory, location, call.getValues(), call.getNamedArguments());
|
||||
}
|
||||
|
||||
private void executeImport(TMemory memory, StringLocated s) throws EaterException, EaterExceptionLocated {
|
||||
@ -514,8 +512,8 @@ public class TContext {
|
||||
_import.analyze(this, memory);
|
||||
|
||||
try {
|
||||
final SFile file = FileSystem.getInstance()
|
||||
.getFile(applyFunctionsAndVariables(memory, s.getLocation(), _import.getLocation()));
|
||||
final SFile file = FileSystem.getInstance().getFile(
|
||||
applyFunctionsAndVariables(memory, new StringLocated(_import.getWhat(), s.getLocation())));
|
||||
if (file.exists() && file.isDirectory() == false) {
|
||||
importedFiles.add(file);
|
||||
return;
|
||||
|
@ -38,8 +38,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public interface TFunction {
|
||||
|
||||
@ -49,11 +49,11 @@ public interface TFunction {
|
||||
|
||||
public TFunctionType getFunctionType();
|
||||
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> args,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> args,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated;
|
||||
|
||||
public void executeProcedureInternal(TContext context, TMemory memory, List<TValue> args, Map<String, TValue> named)
|
||||
throws EaterException, EaterExceptionLocated;
|
||||
public void executeProcedureInternal(TContext context, TMemory memory, StringLocated location, List<TValue> args,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated;
|
||||
|
||||
public boolean isUnquoted();
|
||||
|
||||
|
@ -132,8 +132,8 @@ public class TFunctionImpl implements TFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeProcedureInternal(TContext context, TMemory memory, List<TValue> args, Map<String, TValue> named)
|
||||
throws EaterException, EaterExceptionLocated {
|
||||
public void executeProcedureInternal(TContext context, TMemory memory, StringLocated location, List<TValue> args,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
if (functionType != TFunctionType.PROCEDURE && functionType != TFunctionType.LEGACY_DEFINELONG)
|
||||
throw new IllegalStateException();
|
||||
|
||||
@ -142,10 +142,10 @@ public class TFunctionImpl implements TFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location,
|
||||
List<TValue> args, Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> args,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
if (functionType == TFunctionType.LEGACY_DEFINE)
|
||||
return executeReturnLegacyDefine(location, context, memory, args);
|
||||
return executeReturnLegacyDefine(location.getLocation(), context, memory, args);
|
||||
|
||||
if (functionType != TFunctionType.RETURN_FUNCTION)
|
||||
throw EaterException.unlocated("Illegal call here. Is there a return directive in your function?");
|
||||
@ -164,7 +164,7 @@ public class TFunctionImpl implements TFunction {
|
||||
throw new IllegalStateException();
|
||||
|
||||
final TMemory copy = getNewMemory(memory, args, Collections.<String, TValue>emptyMap());
|
||||
final String tmp = context.applyFunctionsAndVariables(copy, location, legacyDefinition);
|
||||
final String tmp = context.applyFunctionsAndVariables(copy, new StringLocated(legacyDefinition, location));
|
||||
if (tmp == null)
|
||||
return TValue.fromString("");
|
||||
|
||||
|
@ -37,6 +37,7 @@ package net.sourceforge.plantuml.tim;
|
||||
import net.sourceforge.plantuml.json.JsonArray;
|
||||
import net.sourceforge.plantuml.json.JsonObject;
|
||||
import net.sourceforge.plantuml.json.JsonValue;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.text.TLineType;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
@ -111,7 +112,8 @@ public class VariableManager {
|
||||
inBracket.append(str.charAt(i));
|
||||
i++;
|
||||
}
|
||||
final String nbString = context.applyFunctionsAndVariables(memory, location, inBracket.toString());
|
||||
final String nbString = context.applyFunctionsAndVariables(memory,
|
||||
new StringLocated(inBracket.toString(), location));
|
||||
if (jsonValue instanceof JsonArray) {
|
||||
final int nb = Integer.parseInt(nbString);
|
||||
jsonValue = ((JsonArray) jsonValue).get(nb);
|
||||
|
@ -40,6 +40,7 @@ import java.util.Collections;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
@ -58,7 +59,7 @@ public class ReversePolishInterpretor {
|
||||
this(null, queue, knowledge, memory, context);
|
||||
}
|
||||
|
||||
public ReversePolishInterpretor(LineLocation location, TokenStack queue, Knowledge knowledge, TMemory memory,
|
||||
public ReversePolishInterpretor(StringLocated location, TokenStack queue, Knowledge knowledge, TMemory memory,
|
||||
TContext context) throws EaterException, EaterExceptionLocated {
|
||||
|
||||
final Deque<TValue> stack = new ArrayDeque<>();
|
||||
|
@ -42,6 +42,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.Eater;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
@ -210,9 +211,9 @@ public class TokenStack {
|
||||
return new InternalIterator();
|
||||
}
|
||||
|
||||
public TValue getResult(LineLocation location, TContext context, TMemory memory)
|
||||
public TValue getResult(StringLocated location, TContext context, TMemory memory)
|
||||
throws EaterException, EaterExceptionLocated {
|
||||
final Knowledge knowledge = context.asKnowledge(memory, location);
|
||||
final Knowledge knowledge = context.asKnowledge(memory, location.getLocation());
|
||||
final TokenStack tmp = withoutSpace();
|
||||
tmp.guessFunctions();
|
||||
final TokenIterator it = tmp.tokenIterator();
|
||||
|
@ -90,10 +90,10 @@ public class CodeIteratorWhile extends AbstractCodeIterator {
|
||||
continue;
|
||||
} else if (result.getType() == TLineType.ENDWHILE) {
|
||||
logs.add(result);
|
||||
if (currentWhile == null) {
|
||||
if (currentWhile == null)
|
||||
throw EaterException.located("No while related to this endwhile");
|
||||
}
|
||||
final TValue value = currentWhile.conditionValue(result.getLocation(), context, memory);
|
||||
|
||||
final TValue value = currentWhile.conditionValue(result, context, memory);
|
||||
if (value.toBoolean()) {
|
||||
source.jumpToCodePosition(currentWhile.getStartWhile());
|
||||
} else {
|
||||
@ -113,10 +113,10 @@ public class CodeIteratorWhile extends AbstractCodeIterator {
|
||||
final TokenStack whileExpression = condition.getWhileExpression();
|
||||
final ExecutionContextWhile theWhile = ExecutionContextWhile.fromValue(whileExpression,
|
||||
source.getCodePosition());
|
||||
final TValue value = theWhile.conditionValue(s.getLocation(), context, memory);
|
||||
if (value.toBoolean() == false) {
|
||||
final TValue value = theWhile.conditionValue(s, context, memory);
|
||||
if (value.toBoolean() == false)
|
||||
theWhile.skipMe();
|
||||
}
|
||||
|
||||
memory.addWhile(theWhile);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Provides classes used to manage
|
||||
* <a href="https://plantuml.com/preprocessing" target="_top">
|
||||
* Preprocessing</a> of PlantUML input.
|
||||
* <a href="https://plantuml.com/preprocessing" target="_top"> Preprocessing</a>
|
||||
* of PlantUML input.
|
||||
*
|
||||
* @see net.sourceforge.plantuml.text.TLineType
|
||||
* @see net.sourceforge.plantuml.preproc
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class AlwaysFalse extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class AlwaysFalse extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
return TValue.fromBoolean(false);
|
||||
}
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class AlwaysTrue extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class AlwaysTrue extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
return TValue.fromBoolean(true);
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
@ -45,7 +46,6 @@ import net.sourceforge.plantuml.tim.TFunction;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class CallUserFunction extends SimpleReturnFunction {
|
||||
|
||||
@ -59,7 +59,7 @@ public class CallUserFunction extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String fname = values.get(0).toString();
|
||||
final List<TValue> args = values.subList(1, values.size());
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Chr extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class Chr extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
try {
|
||||
final String value = String.valueOf(Character.toChars(values.get(0).toInt()));
|
||||
|
@ -41,13 +41,13 @@ import java.util.Set;
|
||||
import net.sourceforge.plantuml.klimt.color.HColor;
|
||||
import net.sourceforge.plantuml.klimt.color.HColorSet;
|
||||
import net.sourceforge.plantuml.klimt.color.NoSuchColorException;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Darken extends SimpleReturnFunction {
|
||||
|
||||
@ -62,7 +62,7 @@ public class Darken extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String colorString = values.get(0).toString();
|
||||
final int ratio = values.get(1).toInt();
|
||||
|
@ -40,13 +40,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class DateFunction extends SimpleReturnFunction {
|
||||
|
||||
@ -60,7 +60,7 @@ public class DateFunction extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
if (values.size() == 0)
|
||||
return TValue.fromString(new Date().toString());
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Dec2hex extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class Dec2hex extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
try {
|
||||
return TValue.fromString("" + Integer.toHexString(values.get(0).toInt()));
|
||||
|
@ -39,13 +39,13 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.preproc.Defines;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Dirpath extends SimpleReturnFunction {
|
||||
|
||||
@ -65,11 +65,11 @@ public class Dirpath extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
if (value == null) {
|
||||
if (value == null)
|
||||
return TValue.fromString("");
|
||||
}
|
||||
|
||||
return TValue.fromString(value);
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.StringEater;
|
||||
@ -45,7 +46,6 @@ import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Eval extends SimpleReturnFunction {
|
||||
|
||||
@ -59,7 +59,7 @@ public class Eval extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String exp = values.get(0).toString();
|
||||
final StringEater eater = new StringEater(exp);
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Feature extends SimpleReturnFunction {
|
||||
|
||||
@ -58,15 +58,15 @@ public class Feature extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String arg = values.get(0).toString();
|
||||
if ("style".equalsIgnoreCase(arg)) {
|
||||
if ("style".equalsIgnoreCase(arg))
|
||||
return TValue.fromInt(1);
|
||||
}
|
||||
if ("theme".equalsIgnoreCase(arg)) {
|
||||
|
||||
if ("theme".equalsIgnoreCase(arg))
|
||||
return TValue.fromInt(1);
|
||||
}
|
||||
|
||||
return TValue.fromInt(0);
|
||||
}
|
||||
}
|
||||
|
@ -39,13 +39,13 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.security.SFile;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class FileExists extends SimpleReturnFunction {
|
||||
|
||||
@ -59,7 +59,7 @@ public class FileExists extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
// ::comment when __CORE__
|
||||
final String path = values.get(0).toString();
|
||||
|
@ -39,13 +39,13 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.preproc.Defines;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Filename extends SimpleReturnFunction {
|
||||
|
||||
@ -65,7 +65,7 @@ public class Filename extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
if (value == null) {
|
||||
return TValue.fromString("");
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class FunctionExists extends SimpleReturnFunction {
|
||||
// ::remove folder when __HAXE__
|
||||
@ -59,7 +59,7 @@ public class FunctionExists extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String name = values.get(0).toString();
|
||||
return TValue.fromBoolean(context.doesFunctionExist(name));
|
||||
|
@ -39,18 +39,18 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.log.Logme;
|
||||
import net.sourceforge.plantuml.json.Json;
|
||||
import net.sourceforge.plantuml.json.JsonArray;
|
||||
import net.sourceforge.plantuml.json.JsonObject;
|
||||
import net.sourceforge.plantuml.log.Logme;
|
||||
import net.sourceforge.plantuml.preproc.Stdlib;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class GetAllStdlib extends SimpleReturnFunction {
|
||||
|
||||
@ -64,7 +64,7 @@ public class GetAllStdlib extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
|
||||
switch (values.size()) {
|
||||
|
@ -39,8 +39,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.log.Logme;
|
||||
import net.sourceforge.plantuml.json.JsonArray;
|
||||
import net.sourceforge.plantuml.log.Logme;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.theme.ThemeUtils;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
@ -48,7 +49,6 @@ import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class GetAllTheme extends SimpleReturnFunction {
|
||||
|
||||
@ -62,7 +62,7 @@ public class GetAllTheme extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final JsonArray result = new JsonArray();
|
||||
try {
|
||||
|
@ -41,13 +41,13 @@ import java.util.Set;
|
||||
import net.sourceforge.plantuml.json.JsonArray;
|
||||
import net.sourceforge.plantuml.json.JsonObject;
|
||||
import net.sourceforge.plantuml.json.JsonValue;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class GetJsonKey extends SimpleReturnFunction {
|
||||
|
||||
@ -61,7 +61,7 @@ public class GetJsonKey extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final TValue data = values.get(0);
|
||||
if (data.isJson() == false)
|
||||
|
@ -39,13 +39,13 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.json.JsonValue;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class GetJsonType extends SimpleReturnFunction {
|
||||
|
||||
@ -59,7 +59,7 @@ public class GetJsonType extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final TValue data = values.get(0);
|
||||
if (data.isString())
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class GetVariableValue extends SimpleReturnFunction {
|
||||
|
||||
@ -58,13 +58,13 @@ public class GetVariableValue extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String name = values.get(0).toString();
|
||||
final TValue variable = memory.getVariable(name);
|
||||
if (variable == null) {
|
||||
if (variable == null)
|
||||
return TValue.fromString("");
|
||||
}
|
||||
|
||||
return variable;
|
||||
}
|
||||
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
import net.sourceforge.plantuml.version.Version;
|
||||
|
||||
public class GetVersion extends SimpleReturnFunction {
|
||||
@ -59,7 +59,7 @@ public class GetVersion extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
return TValue.fromString(Version.versionString());
|
||||
}
|
||||
|
@ -39,13 +39,13 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.security.SecurityUtils;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Getenv extends SimpleReturnFunction {
|
||||
|
||||
@ -59,7 +59,7 @@ public class Getenv extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
// ::comment when __CORE__
|
||||
final String value = getenv(values.get(0).toString());
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Hex2dec extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class Hex2dec extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
try {
|
||||
return TValue.fromInt(Integer.parseInt(values.get(0).toString(), 16));
|
||||
|
@ -41,13 +41,13 @@ import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.klimt.color.HColors;
|
||||
import net.sourceforge.plantuml.klimt.color.HSLColor;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class HslColor extends SimpleReturnFunction {
|
||||
|
||||
@ -61,7 +61,7 @@ public class HslColor extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final int h = values.get(0).toInt();
|
||||
final int s = values.get(1).toInt();
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
import net.sourceforge.plantuml.utils.Log;
|
||||
|
||||
public class IntVal extends SimpleReturnFunction {
|
||||
@ -59,7 +59,7 @@ public class IntVal extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String s = values.get(0).toString();
|
||||
try {
|
||||
|
@ -38,6 +38,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
@ -46,7 +47,6 @@ import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TFunctionType;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class InvokeProcedure implements TFunction {
|
||||
|
||||
@ -64,20 +64,20 @@ public class InvokeProcedure implements TFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeProcedureInternal(TContext context, TMemory memory, List<TValue> args, Map<String, TValue> named)
|
||||
throws EaterException, EaterExceptionLocated {
|
||||
public void executeProcedureInternal(TContext context, TMemory memory, StringLocated location, List<TValue> args,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String fname = args.get(0).toString();
|
||||
final List<TValue> sublist = args.subList(1, args.size());
|
||||
final TFunctionSignature signature = new TFunctionSignature(fname, sublist.size());
|
||||
final TFunction func = context.getFunctionSmart(signature);
|
||||
if (func == null) {
|
||||
if (func == null)
|
||||
throw EaterException.located("Cannot find void function " + fname);
|
||||
}
|
||||
func.executeProcedureInternal(context, memory, sublist, named);
|
||||
|
||||
func.executeProcedureInternal(context, memory, location, sublist, named);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
@ -41,13 +41,13 @@ import java.util.Set;
|
||||
import net.sourceforge.plantuml.klimt.color.HColor;
|
||||
import net.sourceforge.plantuml.klimt.color.HColorSet;
|
||||
import net.sourceforge.plantuml.klimt.color.NoSuchColorException;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class IsDark extends SimpleReturnFunction {
|
||||
|
||||
@ -62,7 +62,7 @@ public class IsDark extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String colorString = values.get(0).toString();
|
||||
try {
|
||||
|
@ -41,13 +41,13 @@ import java.util.Set;
|
||||
import net.sourceforge.plantuml.klimt.color.HColor;
|
||||
import net.sourceforge.plantuml.klimt.color.HColorSet;
|
||||
import net.sourceforge.plantuml.klimt.color.NoSuchColorException;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class IsLight extends SimpleReturnFunction {
|
||||
|
||||
@ -62,7 +62,7 @@ public class IsLight extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String colorString = values.get(0).toString();
|
||||
try {
|
||||
|
@ -40,13 +40,13 @@ import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.json.JsonObject;
|
||||
import net.sourceforge.plantuml.json.JsonValue;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class JsonKeyExists extends SimpleReturnFunction {
|
||||
|
||||
@ -60,7 +60,7 @@ public class JsonKeyExists extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final TValue arg0 = values.get(0);
|
||||
if (arg0.isJson() == false)
|
||||
|
@ -41,13 +41,13 @@ import java.util.Set;
|
||||
import net.sourceforge.plantuml.klimt.color.HColor;
|
||||
import net.sourceforge.plantuml.klimt.color.HColorSet;
|
||||
import net.sourceforge.plantuml.klimt.color.NoSuchColorException;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Lighten extends SimpleReturnFunction {
|
||||
|
||||
@ -62,7 +62,7 @@ public class Lighten extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String colorString = values.get(0).toString();
|
||||
final int ratio = values.get(1).toInt();
|
||||
|
@ -49,13 +49,13 @@ import net.sourceforge.plantuml.json.ParseException;
|
||||
import net.sourceforge.plantuml.log.Logme;
|
||||
import net.sourceforge.plantuml.security.SFile;
|
||||
import net.sourceforge.plantuml.security.SURL;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
/**
|
||||
* Loads JSON data from file or URL source.
|
||||
@ -108,7 +108,7 @@ public class LoadJson extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String path = values.get(0).toString();
|
||||
try {
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class LogicalAnd extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class LogicalAnd extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
for (TValue v : values)
|
||||
if (v.toBoolean() == false)
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class LogicalNand extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class LogicalNand extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
for (TValue v : values)
|
||||
if (v.toBoolean() == false)
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class LogicalNor extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class LogicalNor extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
for (TValue v : values)
|
||||
if (v.toBoolean() == true)
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class LogicalNot extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class LogicalNot extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final boolean arg = values.get(0).toBoolean();
|
||||
return TValue.fromBoolean(!arg);
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class LogicalNxor extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class LogicalNxor extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
int cpt = 0;
|
||||
for (TValue v : values)
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class LogicalOr extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class LogicalOr extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
for (TValue v : values)
|
||||
if (v.toBoolean() == true)
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class LogicalXor extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class LogicalXor extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
int cpt = 0;
|
||||
for (TValue v : values)
|
||||
|
@ -38,11 +38,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Lower extends SimpleReturnFunction {
|
||||
|
||||
@ -56,7 +56,7 @@ public class Lower extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) {
|
||||
return TValue.fromString(values.get(0).toString().toLowerCase());
|
||||
}
|
||||
|
@ -38,11 +38,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Newline extends SimpleReturnFunction {
|
||||
|
||||
@ -56,7 +56,7 @@ public class Newline extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) {
|
||||
return TValue.fromString("\n");
|
||||
}
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Now extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class Now extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final long now = System.currentTimeMillis() / 1000L;
|
||||
return TValue.fromInt((int) now);
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Ord extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class Ord extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
try {
|
||||
final int codePoint = values.get(0).toString().codePointAt(0);
|
||||
|
@ -39,13 +39,13 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class RandomFunction extends SimpleReturnFunction {
|
||||
|
||||
@ -61,7 +61,7 @@ public class RandomFunction extends SimpleReturnFunction {
|
||||
private final Random random = new Random();
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
switch (values.size()) {
|
||||
case 0:
|
||||
|
@ -39,6 +39,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
@ -46,7 +47,6 @@ import net.sourceforge.plantuml.tim.TFunction;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class RetrieveProcedure extends SimpleReturnFunction {
|
||||
|
||||
@ -60,14 +60,14 @@ public class RetrieveProcedure extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String fname = values.get(0).toString();
|
||||
final List<TValue> args = values.subList(1, values.size());
|
||||
final TFunctionSignature signature = new TFunctionSignature(fname, args.size());
|
||||
final TFunction func = context.getFunctionSmart(signature);
|
||||
final int n1 = context.getResultList().size();
|
||||
func.executeProcedureInternal(context, memory, args, Collections.<String, TValue>emptyMap());
|
||||
func.executeProcedureInternal(context, memory, location, args, Collections.<String, TValue>emptyMap());
|
||||
final String extracted = context.extractFromResultList(n1);
|
||||
return TValue.fromString(extracted);
|
||||
}
|
||||
|
@ -41,13 +41,13 @@ import java.util.Set;
|
||||
import net.sourceforge.plantuml.klimt.color.HColor;
|
||||
import net.sourceforge.plantuml.klimt.color.HColorSet;
|
||||
import net.sourceforge.plantuml.klimt.color.NoSuchColorException;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class ReverseColor extends SimpleReturnFunction {
|
||||
|
||||
@ -61,7 +61,7 @@ public class ReverseColor extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String colorString = values.get(0).toString();
|
||||
try {
|
||||
|
@ -41,13 +41,13 @@ import java.util.Set;
|
||||
import net.sourceforge.plantuml.klimt.color.HColor;
|
||||
import net.sourceforge.plantuml.klimt.color.HColorSet;
|
||||
import net.sourceforge.plantuml.klimt.color.NoSuchColorException;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class ReverseHsluvColor extends SimpleReturnFunction {
|
||||
|
||||
@ -61,7 +61,7 @@ public class ReverseHsluvColor extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String colorString = values.get(0).toString();
|
||||
try {
|
||||
|
@ -38,6 +38,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
@ -45,7 +46,6 @@ import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.TVariableScope;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class SetVariableValue extends SimpleReturnFunction {
|
||||
|
||||
@ -59,7 +59,7 @@ public class SetVariableValue extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
// if (memory instanceof TMemoryLocal) {
|
||||
// memory = ((TMemoryLocal) memory).getGlobalForInternalUseOnly();
|
||||
|
@ -37,13 +37,13 @@ package net.sourceforge.plantuml.tim.stdlib;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunction;
|
||||
import net.sourceforge.plantuml.tim.TFunctionType;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public abstract class SimpleReturnFunction implements TFunction {
|
||||
|
||||
@ -52,8 +52,8 @@ public abstract class SimpleReturnFunction implements TFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
final public void executeProcedureInternal(TContext context, TMemory memory, List<TValue> args,
|
||||
Map<String, TValue> named) throws EaterException {
|
||||
final public void executeProcedureInternal(TContext context, TMemory memory, StringLocated location,
|
||||
List<TValue> args, Map<String, TValue> named) throws EaterException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -41,13 +41,13 @@ import java.util.Set;
|
||||
import net.sourceforge.plantuml.json.JsonArray;
|
||||
import net.sourceforge.plantuml.json.JsonObject;
|
||||
import net.sourceforge.plantuml.json.JsonValue;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Size extends SimpleReturnFunction {
|
||||
|
||||
@ -61,7 +61,7 @@ public class Size extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final TValue value = values.get(0);
|
||||
if (value.isNumber())
|
||||
|
@ -40,13 +40,13 @@ import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.sourceforge.plantuml.json.JsonArray;
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class SplitStr extends SimpleReturnFunction {
|
||||
|
||||
@ -60,7 +60,7 @@ public class SplitStr extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final JsonArray result = new JsonArray();
|
||||
|
||||
|
@ -38,11 +38,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class StringFunction extends SimpleReturnFunction {
|
||||
|
||||
@ -56,7 +56,7 @@ public class StringFunction extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) {
|
||||
return TValue.fromString(values.get(0).toString());
|
||||
}
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Strlen extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class Strlen extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
return TValue.fromInt(values.get(0).toString().length());
|
||||
}
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Strpos extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class Strpos extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String full = values.get(0).toString();
|
||||
final String searched = values.get(1).toString();
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Substr extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class Substr extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String full = values.get(0).toString();
|
||||
final int pos = values.get(1).toInt();
|
||||
|
@ -38,11 +38,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class Upper extends SimpleReturnFunction {
|
||||
|
||||
@ -56,7 +56,7 @@ public class Upper extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) {
|
||||
return TValue.fromString(values.get(0).toString().toUpperCase());
|
||||
}
|
||||
|
@ -38,13 +38,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.text.StringLocated;
|
||||
import net.sourceforge.plantuml.tim.EaterException;
|
||||
import net.sourceforge.plantuml.tim.EaterExceptionLocated;
|
||||
import net.sourceforge.plantuml.tim.TContext;
|
||||
import net.sourceforge.plantuml.tim.TFunctionSignature;
|
||||
import net.sourceforge.plantuml.tim.TMemory;
|
||||
import net.sourceforge.plantuml.tim.expression.TValue;
|
||||
import net.sourceforge.plantuml.utils.LineLocation;
|
||||
|
||||
public class VariableExists extends SimpleReturnFunction {
|
||||
|
||||
@ -58,7 +58,7 @@ public class VariableExists extends SimpleReturnFunction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, StringLocated location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
final String name = values.get(0).toString();
|
||||
return TValue.fromBoolean(memory.getVariable(name) != null);
|
||||
|
@ -46,7 +46,7 @@ public class Version {
|
||||
|
||||
// Warning, "version" should be the same in gradle.properties and Version.java
|
||||
// Any idea anyone how to magically synchronize those :-) ?
|
||||
private static final String version = "1.2024.4beta1";
|
||||
private static final String version = "1.2024.4beta2";
|
||||
|
||||
public static String versionString() {
|
||||
return version;
|
||||
|
Loading…
Reference in New Issue
Block a user