Skip to content

Commit

Permalink
fix: validation - allow THEN <empty> ELSE
Browse files Browse the repository at this point in the history
  • Loading branch information
remy committed Mar 12, 2024
1 parent 220330c commit d7e1e36
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion txt2bas/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ export function validateStatement(tokens, debug = {}) {
if (next && next.text === IF) {
// change the token to ELSEIF and drop the IF
} else if (scope.includes(OUTER_IF)) {
throw new Error('Statement separator (:) expected before ELSE');
if (scope.previousToken.value !== opTable.THEN) {
throw new Error('Statement separator (:) expected before ELSE');
}
}
}

Expand Down

0 comments on commit d7e1e36

Please sign in to comment.