variable = commandLine.substring(0, idx).trim();
commandLine = commandLine.substring(++idx).trim();
}
// If "if" handle "else" if present
Command elseCommand = null;
if (commandLine.startsWith("if")) {
// First convert "if" to the real if handler...
commandLine = "jsft._if" + commandLine.substring(2);
// Check the next few characters to see if they are "else"...
_parser.skipCommentsAndWhiteSpace(CommandParser.SIMPLE_WHITE_SPACE);
int next[] = new int[] {
_parser.nextChar(),
_parser.nextChar(),
_parser.nextChar(),
_parser.nextChar(),
_parser.nextChar()
};
if ((next[0] == 'e')
&& (next[1] == 'l')
&& (next[2] == 's')
&& (next[3] == 'e')
&& (Character.isWhitespace((char) next[4]))) {
// This is an else case, parse it...
elseCommand = readCommand();
} else {
// Not an else, restore the parser state
for (idx=4; idx > -1; idx--) {
if (next[idx] != -1) {
_parser.unread(next[idx]);
}
}
}
}
// Create the Command
Command command = null;
if ((commandLine.length() > 0) || (commandChildren != null)) {
command = new ELCommand(
variable,
convertKeywords(commandLine),
commandChildren,