update src/PikaParser.c.

This commit is contained in:
李昂 2021-12-11 10:19:19 +00:00 committed by Gitee
parent faa03e4362
commit 285daec8f2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -702,12 +702,16 @@ AST* AST_parseLine(char* line, Stack* blockStack) {
Args* buffs = New_strBuff();
line = strsDeleteChar(buffs, line, '\r');
line = Parser_removeAnnotation(line);
uint8_t blockDeepth;
uint8_t blockDeepthLast;
char* lineStart;
char* stmt;
if (strEqu("#", line)) {
obj_setStr(ast, "annotation", "annotation");
goto exit;
}
uint8_t blockDeepth = Parser_getPyLineBlockDeepth(line);
uint8_t blockDeepthLast = blockDeepth;
blockDeepth = Parser_getPyLineBlockDeepth(line);
blockDeepthLast = blockDeepth;
/* in block */
if (NULL != blockStack) {
blockDeepthLast = args_getInt(blockStack, "top");
@ -724,8 +728,8 @@ AST* AST_parseLine(char* line, Stack* blockStack) {
}
}
obj_setInt(ast, "blockDeepth", blockDeepth);
char* lineStart = line + blockDeepth * 4;
char* stmt = lineStart;
lineStart = line + blockDeepth * 4;
stmt = lineStart;
if (0 == strncmp(lineStart, (char*)"while ", 6)) {
stmt = strsCut(buffs, lineStart, ' ', ':');
obj_setStr(ast, "block", "while");