📄 wsgram.c
字号:
case 111:#line 604 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_binary(pctx, yylsp[-1].first_line, WS_ASM_ADD, yyvsp[-2].expr, yyvsp[0].expr); ; break;}case 112:#line 606 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_binary(pctx, yylsp[-1].first_line, WS_ASM_SUB, yyvsp[-2].expr, yyvsp[0].expr); ; break;}case 114:#line 612 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_binary(pctx, yylsp[-1].first_line, WS_ASM_MUL, yyvsp[-2].expr, yyvsp[0].expr); ; break;}case 115:#line 614 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_binary(pctx, yylsp[-1].first_line, WS_ASM_DIV, yyvsp[-2].expr, yyvsp[0].expr); ; break;}case 116:#line 616 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_binary(pctx, yylsp[-1].first_line, WS_ASM_IDIV, yyvsp[-2].expr, yyvsp[0].expr); ; break;}case 117:#line 618 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_binary(pctx, yylsp[-1].first_line, WS_ASM_REM, yyvsp[-2].expr, yyvsp[0].expr); ; break;}case 119:#line 624 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_unary(pctx, yylsp[-1].first_line, WS_ASM_TYPEOF, yyvsp[0].expr); ; break;}case 120:#line 626 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_unary(pctx, yylsp[-1].first_line, WS_ASM_ISVALID, yyvsp[0].expr); ; break;}case 121:#line 628 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_unary_var(pctx, yylsp[-1].first_line, WS_TRUE, yyvsp[0].identifier); ; break;}case 122:#line 630 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_unary_var(pctx, yylsp[-1].first_line, WS_FALSE, yyvsp[0].identifier); ; break;}case 123:#line 632 "wmlscript/wsgram.y"{ /* There is no direct way to compile unary `+'. * It doesn't do anything except require type conversion * (section 7.2, 7.3.2), and we do that by converting * it to a binary expression: `UnaryExpression - 0'. * Using `--UnaryExpression' would not be correct because * it might overflow if UnaryExpression is the smallest * possible integer value (see 6.2.7.1). * Using `UnaryExpression + 0' would not be correct * because binary `+' accepts strings, which makes the * type conversion different. */ yyval.expr = ws_expr_binary(pctx, yylsp[-1].first_line, WS_ASM_SUB, yyvsp[0].expr, ws_expr_const_integer(pctx, yylsp[-1].first_line, 0)); ; break;}case 124:#line 648 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_unary(pctx, yylsp[-1].first_line, WS_ASM_UMINUS, yyvsp[0].expr); ; break;}case 125:#line 650 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_unary(pctx, yylsp[-1].first_line, WS_ASM_B_NOT, yyvsp[0].expr); ; break;}case 126:#line 652 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_unary(pctx, yylsp[-1].first_line, WS_ASM_NOT, yyvsp[0].expr); ; break;}case 128:#line 658 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_postfix_var(pctx, yylsp[-1].first_line, WS_TRUE, yyvsp[-1].identifier); ; break;}case 129:#line 660 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_postfix_var(pctx, yylsp[-1].first_line, WS_FALSE, yyvsp[-1].identifier); ; break;}case 131:#line 666 "wmlscript/wsgram.y"{ WsFunctionHash *f = ws_function_hash(pctx, yyvsp[-1].identifier); /* Add an usage count for the local script function. */ if (f) f->usage_count++; yyval.expr = ws_expr_call(pctx, yylsp[-1].first_line, ' ', NULL, yyvsp[-1].identifier, yyvsp[0].list); ; break;}case 132:#line 676 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_call(pctx, yylsp[-1].first_line, '#', yyvsp[-3].identifier, yyvsp[-1].identifier, yyvsp[0].list); ; break;}case 133:#line 678 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_call(pctx, yylsp[-1].first_line, '.', yyvsp[-3].identifier, yyvsp[-1].identifier, yyvsp[0].list); ; break;}case 134:#line 683 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_symbol(pctx, yylsp[0].first_line, yyvsp[0].identifier); ; break;}case 135:#line 685 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_const_invalid(pctx, yylsp[0].first_line); ; break;}case 136:#line 687 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_const_true(pctx, yylsp[0].first_line); ; break;}case 137:#line 689 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_const_false(pctx, yylsp[0].first_line); ; break;}case 138:#line 691 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_const_integer(pctx, yylsp[0].first_line, yyvsp[0].integer); ; break;}case 139:#line 693 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_const_float(pctx, yylsp[0].first_line, yyvsp[0].vfloat); ; break;}case 140:#line 695 "wmlscript/wsgram.y"{ yyval.expr = ws_expr_const_string(pctx, yylsp[0].first_line, yyvsp[0].string); ; break;}case 141:#line 697 "wmlscript/wsgram.y"{ yyval.expr = yyvsp[-1].expr; ; break;}case 142:#line 702 "wmlscript/wsgram.y"{ yyval.list = ws_list_new(pctx); ; break;}case 143:#line 704 "wmlscript/wsgram.y"{ yyval.list = yyvsp[-1].list; ; break;}case 144:#line 709 "wmlscript/wsgram.y"{ yyval.list = ws_list_new(pctx); ws_list_append(pctx, yyval.list, yyvsp[0].expr); ; break;}case 145:#line 714 "wmlscript/wsgram.y"{ ws_list_append(pctx, yyvsp[-2].list, yyvsp[0].expr); ; break;}} /* the action file gets copied in in place of this dollarsign */#line 543 "/usr/share/misc/bison.simple" yyvsp -= yylen; yyssp -= yylen;#ifdef YYLSP_NEEDED yylsp -= yylen;#endif#if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); }#endif *++yyvsp = yyval;#ifdef YYLSP_NEEDED yylsp++; if (yylen == 0) { yylsp->first_line = yylloc.first_line; yylsp->first_column = yylloc.first_column; yylsp->last_line = (yylsp-1)->last_line; yylsp->last_column = (yylsp-1)->last_column; yylsp->text = 0; } else { yylsp->last_line = (yylsp+yylen-1)->last_line; yylsp->last_column = (yylsp+yylen-1)->last_column; }#endif /* Now "shift" the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTBASE] + *yyssp; if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate;yyerrlab: /* here on detecting error */ if (! yyerrstatus) /* If not already recovering from an error, report this error. */ { ++yynerrs;#ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { int size = 0; char *msg; int x, count; count = 0; /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) size += strlen(yytname[x]) + 15, count++; msg = (char *) malloc(size + 15); if (msg != 0) { strcpy(msg, "parse error"); if (count < 5) { count = 0; for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) { strcat(msg, count == 0 ? ", expecting `" : " or `"); strcat(msg, yytname[x]); strcat(msg, "'"); count++; } } yyerror(msg); free(msg); } else yyerror ("parse error; also virtual memory exceeded"); } else#endif /* YYERROR_VERBOSE */ yyerror("parse error"); } goto yyerrlab1;yyerrlab1: /* here on error raised explicitly by an action */ if (yyerrstatus == 3) { /* if just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) YYABORT;#if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);#endif yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle;yyerrdefault: /* current state does not do anything special for the error token. */#if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ if (yyn) goto yydefault;#endifyyerrpop: /* pop the current state because it cannot handle the error token */ if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp;#ifdef YYLSP_NEEDED yylsp--;#endif#if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); }#endifyyerrhandle: yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; yyn += YYTERROR; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) goto yyerrdefault; yyn = yytable[yyn]; if (yyn < 0) { if (yyn == YYFLAG) goto yyerrpop; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrpop; if (yyn == YYFINAL) YYACCEPT;#if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting error token, ");#endif *++yyvsp = yylval;#ifdef YYLSP_NEEDED *++yylsp = yylloc;#endif yystate = yyn; goto yynewstate; yyacceptlab: /* YYACCEPT comes here. */ if (yyfree_stacks) { free (yyss); free (yyvs);#ifdef YYLSP_NEEDED free (yyls);#endif } return 0; yyabortlab: /* YYABORT comes here. */ if (yyfree_stacks) { free (yyss); free (yyvs);#ifdef YYLSP_NEEDED free (yyls);#endif } return 1;}#line 717 "wmlscript/wsgram.y"voidyyerror(char *msg){#if WS_DEBUG fprintf(stderr, "*** %s:%d: wsc: %s - this msg will be removed ***\n", global_compiler->input_name, global_compiler->linenum, msg);#endif /* WS_DEBUG */}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -