diff --git a/Source/lineparse.cpp b/Source/lineparse.cpp index 5bdd7956..ba760105 100644 --- a/Source/lineparse.cpp +++ b/Source/lineparse.cpp @@ -23,6 +23,7 @@ LineParser::LineParser(bool bCommentBlock) { m_bCommentBlock=bCommentBlock; + m_incomment=false; m_nt=m_eat=0; m_tokens=0; } @@ -32,6 +33,11 @@ LineParser::~LineParser() freetokens(); } +bool LineParser::inComment() +{ + return m_incomment; +} + bool LineParser::InCommentBlock() { return m_bCommentBlock; @@ -140,6 +146,7 @@ void LineParser::freetokens() int LineParser::doline(char *line, int ignore_escaping/*=0*/) { m_nt=0; + m_incomment = false; while (*line == ' ' || *line == '\t') line++; while (*line) { @@ -159,7 +166,11 @@ int LineParser::doline(char *line, int ignore_escaping/*=0*/) } else { int lstate=0; // 1=", 2=`, 4=' - if (*line == ';' || *line == '#') break; + if (*line == ';' || *line == '#') + { + m_incomment = true; + break; + } if (*line == '/' && *(line+1) == '*') { m_bCommentBlock = true; diff --git a/Source/lineparse.h b/Source/lineparse.h index 6fc3bbca..953e778c 100644 --- a/Source/lineparse.h +++ b/Source/lineparse.h @@ -23,6 +23,7 @@ class LineParser { LineParser(bool bCommentBlock); virtual ~LineParser(); + bool inComment(); bool InCommentBlock(); int parse(char *line, int ignore_escaping=0); // returns -1 on error int getnumtokens(); @@ -40,6 +41,7 @@ class LineParser { int m_eat; int m_nt; bool m_bCommentBlock; + bool m_incomment; char **m_tokens; }; #endif//_LINEPARSE_H_ diff --git a/Source/script.cpp b/Source/script.cpp index 000a64cc..fe8997ed 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -287,7 +287,14 @@ int CEXEBuild::doParse(const char *str) // keep waiting for more lines, if this line ends with a backslash if (str[0] && CharPrev(str,str+strlen(str))[0] == '\\') + { + line.parse((char*)m_linebuild.get()); + if (line.inComment()) + { + warning_fl("comment contains line-continuation character, following line will be ignored"); + } return PS_OK; + } // parse before checking if the line should be ignored, so block comments won't be missed res=line.parse((char*)m_linebuild.get(),!strnicmp((char*)m_linebuild.get(),"!define",7));