Skip to content

Commit

Permalink
fix braced command parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jul 25, 2019
1 parent ad0da7e commit 3cff9b5
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,16 @@ else if (arg.equals("}")) {
Debug.echoDebug(scriptEntry, "Calculating " + cmd);
}
command.remove(0);
int lineNum = 1;
if (cmd.length() > 2 && cmd.charAt(0) == ScriptBuilder.LINE_PREFIX_CHAR && cmd.charAt(cmd.length() - 1) == ScriptBuilder.LINE_PREFIX_CHAR) {
lineNum = Integer.valueOf(cmd.substring(1, cmd.length() - 1));
cmd = command.get(0);
command.remove(0);
}
String[] args = new String[command.size()];
args = command.toArray(args);
ScriptEntry newEntry = new ScriptEntry(cmd, args, scriptEntry.getScript() != null ? scriptEntry.getScript().getContainer() : null);
newEntry.internal.lineNumber = lineNum;
newEntry.internal.originalLine = newEntry.toString();
bracesSection.add(newEntry);
bracesSection.get(bracesSection.size() - 1).entryData.transferDataFrom(scriptEntry.entryData);
Expand Down

0 comments on commit 3cff9b5

Please sign in to comment.