forked from xxq250/Nasal-Interpreter
Update
This commit is contained in:
@@ -325,6 +325,24 @@ void nasal_parser::list_search_expr()
|
||||
std::cout<<"\" in list call."<<std::endl;
|
||||
break;
|
||||
}
|
||||
get_token();
|
||||
if(this_token.type!=__right_bracket)
|
||||
{
|
||||
if(this_token.type==__semi)
|
||||
parse.push(this_token);
|
||||
++error;
|
||||
std::cout<<">>[Error] line "<<this_token.line<<": expect a \']\' when calling a list."<<std::endl;
|
||||
return;
|
||||
}
|
||||
get_token();
|
||||
switch(this_token.type)
|
||||
{
|
||||
case __left_bracket:list_search_expr();break;
|
||||
case __dot:hash_search_expr();break;
|
||||
default:
|
||||
parse.push(this_token);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
void nasal_parser::hash_search_expr()
|
||||
@@ -339,8 +357,8 @@ void nasal_parser::hash_search_expr()
|
||||
get_token();
|
||||
switch(this_token.type)
|
||||
{
|
||||
case __left_curve:break;
|
||||
case __left_bracket:break;
|
||||
case __left_curve:call_function_expr();break;
|
||||
case __left_bracket:list_search_expr();break;
|
||||
case __dot:hash_search_expr();break;
|
||||
case __semi:parse.push(this_token);break;
|
||||
default:
|
||||
@@ -387,6 +405,15 @@ void nasal_parser::call_function_expr()
|
||||
std::cout<<">>[Error] line "<<this_token.line<<": expect a \')\'."<<std::endl;
|
||||
return;
|
||||
}
|
||||
get_token();
|
||||
switch(this_token.type)
|
||||
{
|
||||
case __left_bracket:list_search_expr();break;
|
||||
case __dot:hash_search_expr();break;
|
||||
default:
|
||||
parse.push(this_token);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
void nasal_parser::identifier_begin_expr()
|
||||
|
||||
@@ -9,4 +9,7 @@ var id;
|
||||
var id=[1,2,3,4];
|
||||
var id={id:"str"};
|
||||
id();
|
||||
id.id();
|
||||
id.id();
|
||||
id.id.id();
|
||||
id[0].id.id(id,"str",1,2,3,4).id[10];
|
||||
id(0)[1];
|
||||
Reference in New Issue
Block a user