mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
support del(x)
This commit is contained in:
parent
d0c62dc249
commit
55508d7e84
2
port/linux/.vscode/launch.json
vendored
2
port/linux/.vscode/launch.json
vendored
@ -11,7 +11,7 @@
|
||||
"program": "${workspaceFolder}/build/test/pikascript_test",
|
||||
// "program": "${workspaceFolder}/build/boot/demo06-pikamain/pikascript_demo06-pikamain",
|
||||
"args": [
|
||||
"--gtest_filter=vm.fn_pos_kw_issue2"
|
||||
// "--gtest_filter=vm.fn_pos_kw_issue2"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
|
@ -2046,9 +2046,15 @@ AST* AST_parseLine_withBlockStack_withBlockDeepth(char* line,
|
||||
AST_setNodeAttr(ast, "global", global_list);
|
||||
goto block_matched;
|
||||
}
|
||||
if (strIsStartWith(line_start, "del ")) {
|
||||
if (strIsStartWith(line_start, "del ") ||
|
||||
strIsStartWith(line_start, "del(")) {
|
||||
stmt = "";
|
||||
char* del_dir = line_start + sizeof("del ") - 1;
|
||||
char* del_dir = NULL;
|
||||
if (line_start[3] == '(') {
|
||||
del_dir = strsCut(&buffs, line_start, '(', ')');
|
||||
} else {
|
||||
del_dir = line_start + sizeof("del ") - 1;
|
||||
}
|
||||
del_dir = strsGetCleanCmd(&buffs, del_dir);
|
||||
AST_setNodeAttr(ast, "del", del_dir);
|
||||
goto block_matched;
|
||||
|
@ -254,12 +254,6 @@ PIKA_WEAK void __platform_thread_delay(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
PIKA_WEAK uint64_t __platform_get_tick_ms(void){
|
||||
__platform_printf("Error: __platform_get_tick_ms need implementation!\r\n");
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
PIKA_WEAK void __platform_sleep_ms(uint32_t ms){
|
||||
__platform_printf("Error: __platform_sleep_ms need implementation!\r\n");
|
||||
while (1) {
|
||||
|
@ -174,7 +174,8 @@ void __platform_panic_handle(void);
|
||||
void __pks_hook_instruct(void);
|
||||
PIKA_BOOL __pks_hook_arg_cache_filter(void* self);
|
||||
void __platform_thread_delay(void);
|
||||
uint64_t __platform_get_tick_ms(void);
|
||||
int64_t __platform_getTick(void);
|
||||
|
||||
void __platform_sleep_ms(uint32_t ms);
|
||||
void __platform_sleep_s(uint32_t s);
|
||||
|
||||
|
@ -3644,6 +3644,21 @@ TEST(parser, _del) {
|
||||
EXPECT_EQ(pikaMemNow(), 0);
|
||||
}
|
||||
|
||||
TEST(parser, _del_issue1) {
|
||||
pikaMemInfo.heapUsedMax = 0;
|
||||
Args* buffs = New_strBuff();
|
||||
char* lines = "del(a)\n";
|
||||
__platform_printf("%s\n", lines);
|
||||
char* pikaAsm = Parser_linesToAsm(buffs, lines);
|
||||
__platform_printf("%s", pikaAsm);
|
||||
EXPECT_STREQ(pikaAsm,
|
||||
"B0\n"
|
||||
"0 DEL a\n"
|
||||
"B0\n");
|
||||
args_deinit(buffs);
|
||||
EXPECT_EQ(pikaMemNow(), 0);
|
||||
}
|
||||
|
||||
#if PIKA_SYNTAX_SLICE_ENABLE
|
||||
TEST(parser, issue_fa13f4) {
|
||||
pikaMemInfo.heapUsedMax = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user