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