Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N_EXPR_LIST : N_EXPR {printf("b exprs: %d\n", expr_unparsed_count); expr_unparsed_count++;} N_EXPR_LIST
- {
- expr_unparsed_count--;
- printRule("EXPR_LIST", "EXPR EXPR_LIST");
- printf("Type: %d compatible: %d\n", $1.type, list_can_be_call);
- printf("exprs: %d\n", expr_unparsed_count);
- if(isFcnCompatible($1)) {
- if(expr_unparsed_count == 0 && list_can_be_call) {
- if(expr_list_count > $1.numParams) {
- yyerror("Too many parameters in function call");
- return (1);
- }
- if(expr_list_count < $1.numParams) {
- yyerror("Too few parameters in function call");
- return (1);
- }
- setType($$, $1.returnType);
- }
- else {
- yyerror("Arg 1 must be of type integer");
- return(1);
- }
- }
- else {
- expr_list_count++;
- list_can_be_call &= isIntCompatible($1);
- }
- }
- | N_EXPR
- {
- list_can_be_call = true;
- expr_list_count = 1;
- printRule("EXPR_LIST", "EXPR");
- /* Determine whether we're a valid function call */
- list_can_be_call &= isIntCompatible($1);
- printf("exprs: %d\n", expr_unparsed_count);
- printf("Type: %d compatible: %d\n", $1.type, list_can_be_call);
- /* Handle the case of 0 args being passed to a function */
- if(isFcnCompatible($1)) {
- if(expr_unparsed_count == 0) {
- if($1.numParams == 0) {
- setType($$, $1.returnType);
- }
- else {
- yyerror("Too few parameters in function call");
- return (1);
- }
- }
- else {
- yyerror("Arg 1 must be of type integer or string");
- }
- }
- else {
- setType($$, $1);
- }
- }
- ;
Add Comment
Please, Sign In to add comment