mirror of
https://github.com/ValKmjolnir/Nasal-Interpreter.git
synced 2026-07-26 21:08:45 +08:00
Update
This commit is contained in:
@@ -325,6 +325,24 @@ void nasal_parser::list_search_expr()
|
|||||||
std::cout<<"\" in list call."<<std::endl;
|
std::cout<<"\" in list call."<<std::endl;
|
||||||
break;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
void nasal_parser::hash_search_expr()
|
void nasal_parser::hash_search_expr()
|
||||||
@@ -339,8 +357,8 @@ void nasal_parser::hash_search_expr()
|
|||||||
get_token();
|
get_token();
|
||||||
switch(this_token.type)
|
switch(this_token.type)
|
||||||
{
|
{
|
||||||
case __left_curve:break;
|
case __left_curve:call_function_expr();break;
|
||||||
case __left_bracket:break;
|
case __left_bracket:list_search_expr();break;
|
||||||
case __dot:hash_search_expr();break;
|
case __dot:hash_search_expr();break;
|
||||||
case __semi:parse.push(this_token);break;
|
case __semi:parse.push(this_token);break;
|
||||||
default:
|
default:
|
||||||
@@ -387,6 +405,15 @@ void nasal_parser::call_function_expr()
|
|||||||
std::cout<<">>[Error] line "<<this_token.line<<": expect a \')\'."<<std::endl;
|
std::cout<<">>[Error] line "<<this_token.line<<": expect a \')\'."<<std::endl;
|
||||||
return;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
void nasal_parser::identifier_begin_expr()
|
void nasal_parser::identifier_begin_expr()
|
||||||
|
|||||||
@@ -10,3 +10,6 @@ var id=[1,2,3,4];
|
|||||||
var id={id:"str"};
|
var id={id:"str"};
|
||||||
id();
|
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