diff --git a/Source/Tests/preprocessor.nsi b/Source/Tests/preprocessor.nsi index 7e00a8ec..b025b6c4 100644 --- a/Source/Tests/preprocessor.nsi +++ b/Source/Tests/preprocessor.nsi @@ -10,6 +10,8 @@ this should not be executed, so no error should be raised code inside comments should not be executed !ifdef */ +# invalid preprocessor should be ignored +!hello !endif !ifdef d1 diff --git a/Source/build.h b/Source/build.h index 042966c6..13b97d7e 100644 --- a/Source/build.h +++ b/Source/build.h @@ -140,6 +140,7 @@ class CEXEBuild { void update_exehead(const unsigned char *new_exehead, size_t new_size); // tokens.cpp + bool is_valid_token(char *s); int get_commandtoken(char *s, int *np, int *op, int *pos); int GetCurrentTokenPlace(); int IsTokenPlacedRight(int pos, char *tok); diff --git a/Source/script.cpp b/Source/script.cpp index 9b9b6314..daef81e7 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -305,7 +305,7 @@ int CEXEBuild::doParse(const char *str) { bool ignore_line = cur_ifblock && (cur_ifblock->ignore || cur_ifblock->inherited_ignore); char first_char = *(char *) m_linebuild.get(); - if (ignore_line && first_char!='!') + if (ignore_line && (first_char!='!' || !is_valid_token(line.gettoken_str(0)))) { m_linebuild.resize(0); return PS_OK; diff --git a/Source/tokens.cpp b/Source/tokens.cpp index 512d80e7..09951c08 100644 --- a/Source/tokens.cpp +++ b/Source/tokens.cpp @@ -297,6 +297,14 @@ void CEXEBuild::print_help(char *commandname) } +bool CEXEBuild::is_valid_token(char *s) +{ + for (int x = 0; x < TOK__LAST; x ++) + if (!stricmp(tokenlist[x].name,s)) + return true; + return false; +} + int CEXEBuild::get_commandtoken(char *s, int *np, int *op, int *pos) { int x;