Skip to content

Commit

Permalink
Fixes to IF using a stripped argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed Jun 26, 2013
1 parent 3c8fc19 commit e6e1953
Showing 1 changed file with 8 additions and 8 deletions.
Expand Up @@ -128,29 +128,29 @@ else if (arg.matches("{")) {
bracketsEntered++;

if (bracketsEntered > 1) {
thenOutcome.get(thenOutcome.lastKey()).add(arg.getValue());
thenOutcome.get(thenOutcome.lastKey()).add(arg.raw_value);
}
}

else if (arg.matches("}")) {
bracketsEntered--;

if (bracketsEntered > 0) {
thenOutcome.get(thenOutcome.lastKey()).add(arg.getValue());
thenOutcome.get(thenOutcome.lastKey()).add(arg.raw_value);
}
}

// Add new outcome command if the last argument was a non-nested "-"
// or if there are no outcome commands yet
else if (newCommand == true || thenOutcome.size() == 0) {
thenOutcome.put(thenOutcome.size(), new ArrayList<String>());
thenOutcome.get(thenOutcome.lastKey()).add(arg.getValue());
thenOutcome.get(thenOutcome.lastKey()).add(arg.raw_value);
newCommand = false;
}

// Add new outcome argument
else {
thenOutcome.get(thenOutcome.lastKey()).add(arg.getValue());
thenOutcome.get(thenOutcome.lastKey()).add(arg.raw_value);
}
}

Expand All @@ -163,15 +163,15 @@ else if (insideElse) {
bracketsEntered++;

if (bracketsEntered > 1) {
elseOutcome.get(elseOutcome.lastKey()).add(arg.getValue());
elseOutcome.get(elseOutcome.lastKey()).add(arg.raw_value);
}
}

else if (arg.matches("}")) {
bracketsEntered--;

if (bracketsEntered > 0) {
elseOutcome.get(elseOutcome.lastKey()).add(arg.getValue());
elseOutcome.get(elseOutcome.lastKey()).add(arg.raw_value);
}
}

Expand All @@ -180,7 +180,7 @@ else if (arg.matches("}")) {
else if (newCommand == true || elseOutcome.size() == 0) {
newCommand = false;
elseOutcome.put(elseOutcome.size(), new ArrayList<String>());
elseOutcome.get(elseOutcome.lastKey()).add(arg.getValue());
elseOutcome.get(elseOutcome.lastKey()).add(arg.raw_value);

// Important!
//
Expand All @@ -194,7 +194,7 @@ else if (newCommand == true || elseOutcome.size() == 0) {

// Add new else argument
else {
elseOutcome.get(elseOutcome.lastKey()).add(arg.getValue());
elseOutcome.get(elseOutcome.lastKey()).add(arg.raw_value);
}
}
}
Expand Down

0 comments on commit e6e1953

Please sign in to comment.