"else if" can now also be written as "elif"

git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@444 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
marcobaye
2025-07-10 21:49:27 +00:00
parent 196c2522b2
commit 1051dc6248
2 changed files with 10 additions and 5 deletions

View File

@@ -1033,14 +1033,19 @@ static enum eos ifelse(enum ifmode mode)
if (GotByte == CHAR_EOS)
return AT_EOS_ANYWAY; // normal exit if there is no ELSE {...} block
// read keyword (expected to be "else")
// read keyword (expected to be "elif" or "else")
if (parser_read_and_lower_keyword() == 0)
return SKIP_REMAINDER; // "missing string error" -> ignore rest of line
// if it's "elif", we can just do another iteration:
if (strcmp(GlobalDynaBuf->buffer, "elif") == 0) {
mode = IFMODE_IF;
continue;
}
// make sure it's "else"
// FIXME - also accept ELSEIF and ELIF?
if (strcmp(GlobalDynaBuf->buffer, "else")) {
throw_error("Expected end-of-statement or ELSE keyword after '}'.");
throw_error("Expected end-of-statement or ELIF/ELSE keyword after '}'.");
return SKIP_REMAINDER; // an error has been reported, so ignore rest of line
}
// anything more?
@@ -1051,7 +1056,7 @@ static enum eos ifelse(enum ifmode mode)
continue;
}
// read keyword (expected to be if/ifdef/ifndef)
// read keyword after else (expected to be if/ifdef/ifndef)
if (parser_read_and_lower_keyword() == 0)
return SKIP_REMAINDER; // "missing string error" -> ignore rest of line

View File

@@ -9,7 +9,7 @@
#define RELEASE "0.97" // update before release FIXME
#define CODENAME "Zem" // update before release
#define CHANGE_DATE "17 Jun" // update before release FIXME
#define CHANGE_DATE "10 Jul" // update before release FIXME
#define CHANGE_YEAR "2025" // update before release
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME