diff --git a/version3.0/nasal.ebnf b/version3.0/nasal.ebnf index d7a3d4a..f504974 100644 --- a/version3.0/nasal.ebnf +++ b/version3.0/nasal.ebnf @@ -17,7 +17,7 @@ hash ::= '{' {hashmember ','} '}' ; hashmember::= - id ':' calculation + id|string ':' calculation ; function::= func argument_list expressions diff --git a/version3.0/nasal_parse.h b/version3.0/nasal_parse.h index d31bf32..3fd16f7 100644 --- a/version3.0/nasal_parse.h +++ b/version3.0/nasal_parse.h @@ -205,16 +205,20 @@ bool nasal_parse::check_special_call() // special call means like this: // function_name(a:1,b:2,c:3); int check_ptr=ptr+1; - int curve_cnt=1; + int curve_cnt=1,bracket_cnt=0,brace_cnt=0; bool ret=false; while(check_ptr=tok_list_size) break; + if(tok_list[ptr].type==tok_comma) ++ptr; + else if(tok_list[ptr].type!=tok_comma && tok_list[ptr].type!=tok_right_brace) { error_info(error_line,lack_comma); ++error; @@ -329,14 +334,14 @@ nasal_ast nasal_parse::hash_gen() nasal_ast nasal_parse::hash_member_gen() { nasal_ast node; - if(ptr>=tok_list_size || tok_list[ptr].type!=tok_identifier) + if(ptr>=tok_list_size || (tok_list[ptr].type!=tok_identifier && tok_list[ptr].type!=tok_string)) { error_info(error_line,lack_identifier); return node; } node.set_line(tok_list[ptr].line); node.set_type(ast_hashmember); - node.add_child(id_gen()); + node.add_child(tok_list[ptr].type==tok_identifier?id_gen():string_gen()); ++ptr; if(ptr>=tok_list_size || tok_list[ptr].type!=tok_colon) {