Skip to content

Commit

Permalink
Proper fix to If, hopefully.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcernat committed Oct 10, 2013
1 parent 020d11f commit 9ce6629
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -180,17 +180,19 @@ else if (arg.matches("}")) {
// or if it was "else" and we have no else commands yet
else if (newCommand || elseOutcome.size() == 0) {
newCommand = false;
elseOutcome.put(elseOutcome.size(), new ArrayList<String>());
elseOutcome.get(elseOutcome.lastKey()).add(arg.raw_value);

// Important!
//
// If we find an "if", act like we entered a set of
// If we find an "else if", act like we entered a set of
// brackets, so we treat the if's commands as arguments
// and don't add them to our current else commands
if (arg.matches("if")) {
if (arg.matches("if") && elseOutcome.size() == 0) {
bracketsEntered++;
}

// Add the new else command
elseOutcome.put(elseOutcome.size(), new ArrayList<String>());
elseOutcome.get(elseOutcome.lastKey()).add(arg.raw_value);
}

// Add new else argument
Expand Down

0 comments on commit 9ce6629

Please sign in to comment.