Skip to content

Commit bd852df

Browse files
committed
fix not split '\' char correctly
1 parent 1c84f4f commit bd852df

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

analysis.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void getIncludeFiles(Meta_Vector & wordVector, size_t index)
103103
}
104104
}
105105

106-
void getDefine(Meta_Vector & wordVector, size_t index)
106+
void getDefine(Meta_Vector & wordVector, size_t index, bool & needNextLine)
107107
{
108108
int curLine = wordVector[index].line;
109109
int defineType = TYPE_CONSTANT;
@@ -198,6 +198,8 @@ void getDefine(Meta_Vector & wordVector, size_t index)
198198
}
199199
else{
200200
printf("Line %d is a function define: %s\n", curLine, wordVector[index+3].data.str);
201+
restoreLine(wordVector, index, defineStr);
202+
printf("%s\n", defineStr);
201203
}
202204
}
203205

@@ -206,6 +208,7 @@ void analysis(Meta_Vector & wordVector)
206208
int curLine = 0;
207209
bool newLineFlag = true;
208210
size_t vectorSize = wordVector.size();
211+
bool needNextLine = false;
209212

210213
for(size_t i=0; i < vectorSize; i++)
211214
{
@@ -221,7 +224,7 @@ void analysis(Meta_Vector & wordVector)
221224
getIncludeFiles(wordVector, i);
222225
}
223226
else if (strcmp(wordVector[i+1].data.str, "define") == 0) {
224-
getDefine(wordVector, i);
227+
getDefine(wordVector, i, needNextLine);
225228
}
226229
else if (strcmp(wordVector[i+1].data.str, "if") == 0) {
227230
printf("Line %d is a if compile condition.\n", wordVector[i].line);

split.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void split(const char * data, int datalen, int line, Meta_Vector & wordVector)
4141
for (i = 0; i < datalen; i++){
4242
char c = data[i];
4343

44-
if (isEscapeChar){
44+
if (isEscapeChar && !isspace(c)){
4545
isEscapeChar = false;
4646
word[0] = c;
4747
PRINT_LAST_TYPE();

0 commit comments

Comments
 (0)