rename direct to Lift

This commit is contained in:
lyon 2022-01-14 23:22:38 +08:00
parent ca00fd1e96
commit b1808146c7

View File

@ -583,23 +583,23 @@ char* Lexer_getOperator(Args* outBuffs, char* stmt) {
AST* AST_parseStmt(AST* ast, char* stmt) { AST* AST_parseStmt(AST* ast, char* stmt) {
Args* buffs = New_strBuff(); Args* buffs = New_strBuff();
char* assignment = strsGetFirstToken(buffs, stmt, '('); char* assignment = strsGetFirstToken(buffs, stmt, '(');
char* direct = NULL;
char* method = NULL; char* method = NULL;
char* ref = NULL; char* ref = NULL;
char* str = NULL; char* str = NULL;
char* num = NULL; char* num = NULL;
char* left = NULL;
char* right = NULL; char* right = NULL;
/* solve direct */ /* solve left */
uint8_t directExist = 0; uint8_t isLeftExist = 0;
if (Parser_checkIsDirect(assignment)) { if (Parser_checkIsDirect(assignment)) {
directExist = 1; isLeftExist = 1;
} }
if (directExist) { if (isLeftExist) {
direct = strsGetFirstToken(buffs, assignment, '='); left = strsGetFirstToken(buffs, assignment, '=');
obj_setStr(ast, (char*)"direct", direct); obj_setStr(ast, (char*)"left", left);
} }
/* solve right stmt */ /* solve right stmt */
if (directExist) { if (isLeftExist) {
right = strsGetLastToken(buffs, stmt, '='); right = strsGetLastToken(buffs, stmt, '=');
} else { } else {
right = stmt; right = stmt;
@ -761,7 +761,6 @@ AST* AST_parseLine(char* line, Stack* blockStack) {
list_in = strsAppend(list_buffs, list_in, ")"); list_in = strsAppend(list_buffs, list_in, ")");
list_in = strsCopy(buffs, list_in); list_in = strsCopy(buffs, list_in);
args_deinit(list_buffs); args_deinit(list_buffs);
obj_setStr(ast, "block", "for"); obj_setStr(ast, "block", "for");
obj_setStr(ast, "list_in", list_in); obj_setStr(ast, "list_in", list_in);
if (NULL != blockStack) { if (NULL != blockStack) {
@ -944,7 +943,7 @@ char* AST_appandPikaAsm(AST* ast, AST* subAst, Args* buffs, char* pikaAsm) {
char* method = obj_getStr(subAst, "method"); char* method = obj_getStr(subAst, "method");
char* operator= obj_getStr(subAst, "operator"); char* operator= obj_getStr(subAst, "operator");
char* ref = obj_getStr(subAst, "ref"); char* ref = obj_getStr(subAst, "ref");
char* direct = obj_getStr(subAst, "direct"); char* left = obj_getStr(subAst, "left");
char* str = obj_getStr(subAst, "string"); char* str = obj_getStr(subAst, "string");
char* num = obj_getStr(subAst, "num"); char* num = obj_getStr(subAst, "num");
if (NULL != ref) { if (NULL != ref) {
@ -973,9 +972,9 @@ char* AST_appandPikaAsm(AST* ast, AST* subAst, Args* buffs, char* pikaAsm) {
pikaAsm = strsAppend(buffs, pikaAsm, buff); pikaAsm = strsAppend(buffs, pikaAsm, buff);
} }
if (NULL != direct) { if (NULL != left) {
char buff[32] = {0}; char buff[32] = {0};
__platform_sprintf(buff, "%d OUT %s\n", deepth, direct); __platform_sprintf(buff, "%d OUT %s\n", deepth, left);
pikaAsm = strsAppend(buffs, pikaAsm, buff); pikaAsm = strsAppend(buffs, pikaAsm, buff);
} }
obj_setInt(ast, "deepth", deepth - 1); obj_setInt(ast, "deepth", deepth - 1);