diff --git a/main.cpp b/main.cpp index 8ecdabd..ca274c4 100644 --- a/main.cpp +++ b/main.cpp @@ -19,7 +19,7 @@ void help() <<"nasal \n" <<"file:\n" <<" input file name to execute script file.\n\n" - <<"nasal [options] \n" + <<"nasal [options...] \n" <<"option:\n" <<" -l, --lex | view token info.\n" <<" -a, --ast | view abstract syntax tree.\n" @@ -107,36 +107,38 @@ void execute(const std::string& file,const uint32_t cmd) int main(int argc,const char* argv[]) { - if(argc==2 && (!strcmp(argv[1],"-v") || !strcmp(argv[1],"--version"))) - logo(); - else if(argc==2 && (!strcmp(argv[1],"-h") || !strcmp(argv[1],"--help"))) - help(); - else if(argc==2 && argv[1][0]!='-') - execute(argv[1],VM_EXEC); - else if(argc>=3) + if(argc==2) { - uint32_t cmd=0; - for(int i=1;ielems;// top-imm[pc] stores the vector vec.resize(imm[pc]); - top-=imm[pc]-1; + // use top-=imm[pc]-1 here will cause error if imm[pc] is 0 + top=top-imm[pc]+1; for(uint32_t i=0;i