mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
parse a = b[c] is ok
This commit is contained in:
parent
52cd909fdd
commit
827c70bb08
0
port/linux/api-make-linux.sh
Normal file → Executable file
0
port/linux/api-make-linux.sh
Normal file → Executable file
0
port/linux/api-make-win10.sh
Normal file → Executable file
0
port/linux/api-make-win10.sh
Normal file → Executable file
0
port/linux/api-make.sh
Normal file → Executable file
0
port/linux/api-make.sh
Normal file → Executable file
0
port/linux/ci_benchmark.sh
Normal file → Executable file
0
port/linux/ci_benchmark.sh
Normal file → Executable file
0
port/linux/gtest.sh
Normal file → Executable file
0
port/linux/gtest.sh
Normal file → Executable file
0
port/linux/init.sh
Normal file → Executable file
0
port/linux/init.sh
Normal file → Executable file
0
port/linux/install_dependency.sh
Normal file → Executable file
0
port/linux/install_dependency.sh
Normal file → Executable file
0
port/linux/make.sh
Normal file → Executable file
0
port/linux/make.sh
Normal file → Executable file
0
port/linux/pkg-push.sh
Normal file → Executable file
0
port/linux/pkg-push.sh
Normal file → Executable file
0
port/linux/pull-core.sh
Normal file → Executable file
0
port/linux/pull-core.sh
Normal file → Executable file
0
port/linux/push-core.sh
Normal file → Executable file
0
port/linux/push-core.sh
Normal file → Executable file
0
port/linux/run.sh
Normal file → Executable file
0
port/linux/run.sh
Normal file → Executable file
0
port/linux/test-banchmark.sh
Normal file → Executable file
0
port/linux/test-banchmark.sh
Normal file → Executable file
@ -1807,11 +1807,13 @@ TEST(parser, __get__) {
|
||||
printf("%s", lines);
|
||||
char* pikaAsm = Parser_multiLineToAsm(buffs, (char*)lines);
|
||||
printf("%s", pikaAsm);
|
||||
// EXPECT_STREQ(pikaAsm,
|
||||
// "B0\n"
|
||||
// "1 STR [Info]: in Python config...\n"
|
||||
// "0 RUN print\n"
|
||||
// );
|
||||
EXPECT_STREQ(pikaAsm,
|
||||
"B0\n"
|
||||
"1 REF b\n"
|
||||
"1 REF c\n"
|
||||
"0 RUN __get__\n"
|
||||
"0 OUT a\n"
|
||||
);
|
||||
args_deinit(buffs);
|
||||
EXPECT_EQ(pikaMemNow(), 0);
|
||||
}
|
||||
|
0
port/linux/update-compiler.sh
Normal file → Executable file
0
port/linux/update-compiler.sh
Normal file → Executable file
@ -623,11 +623,18 @@ char* Parser_solveRightBranckets(Args* outBuffs, char* right) {
|
||||
pyload2 = Lexer_getTokenPyload(token2);
|
||||
|
||||
/* matched [] */
|
||||
if ((TOKEN_devider == token_type1) && (strEqu(pyload1, "["))) {
|
||||
} else if ((TOKEN_devider == token_type1) &&
|
||||
(strEqu(pyload1, "]"))) {
|
||||
if ((TOKEN_devider == token_type2) && (strEqu(pyload2, "["))) {
|
||||
args_setStr(buffs, "obj", pyload1);
|
||||
} else if ((TOKEN_devider == token_type2) &&
|
||||
(strEqu(pyload2, "]"))) {
|
||||
args_setStr(buffs, "index", pyload1);
|
||||
right_arg = arg_strAppend(right_arg, "__get__(");
|
||||
right_arg = arg_strAppend(right_arg, args_getStr(buffs, "obj"));
|
||||
right_arg = arg_strAppend(right_arg, ",");
|
||||
right_arg =
|
||||
arg_strAppend(right_arg, args_getStr(buffs, "index"));
|
||||
right_arg = arg_strAppend(right_arg, ")");
|
||||
} else {
|
||||
right_arg = arg_strAppend(right_arg, pyload1);
|
||||
}
|
||||
args_deinit(token_buffs);
|
||||
}
|
||||
@ -689,7 +696,7 @@ AST* AST_parseStmt(AST* ast, char* stmt) {
|
||||
if (STMT_method == stmtType) {
|
||||
method = strsGetFirstToken(buffs, right, '(');
|
||||
obj_setStr(ast, (char*)"method", method);
|
||||
char* subStmts = strsCut(buffs, stmt, '(', ')');
|
||||
char* subStmts = strsCut(buffs, right, '(', ')');
|
||||
while (1) {
|
||||
char* subStmt =
|
||||
strsPopTokenWithSkip(buffs, subStmts, ',', '(', ')');
|
||||
|
Loading…
x
Reference in New Issue
Block a user