mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 00:06:35 +00:00
1387 lines
168 KiB
HTML
Executable file
1387 lines
168 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V1.07">
|
|
<style type="text/css">
|
|
body {background-color:#1f1f1f;}
|
|
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
|
|
.cF1{color:#4f84a6;background-color:#1f1f1f;}
|
|
.cF2{color:#73a255;background-color:#1f1f1f;}
|
|
.cF3{color:#297582;background-color:#1f1f1f;}
|
|
.cF4{color:#b34f4b;background-color:#1f1f1f;}
|
|
.cF5{color:#8a52c3;background-color:#1f1f1f;}
|
|
.cF6{color:#b7822f;background-color:#1f1f1f;}
|
|
.cF7{color:#444444;background-color:#1f1f1f;}
|
|
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
|
|
.cF9{color:#94bfde;background-color:#1f1f1f;}
|
|
.cFA{color:#a1ce97;background-color:#1f1f1f;}
|
|
.cFB{color:#6db4be;background-color:#1f1f1f;}
|
|
.cFC{color:#e88e88;background-color:#1f1f1f;}
|
|
.cFD{color:#ca94e8;background-color:#1f1f1f;}
|
|
.cFE{color:#d4b475;background-color:#1f1f1f;}
|
|
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>define</span><span class=cF0> PE_UNARY_TERM1 </span><span class=cFE>0</span><span class=cF0>
|
|
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> PE_UNARY_TERM2 </span><span class=cFE>1</span><span class=cF0>
|
|
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> PE_MAYBE_MODIFIERS </span><span class=cFE>2</span><span class=cF0>
|
|
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> PE_UNARY_MODIFIERS </span><span class=cFE>3</span><span class=cF0>
|
|
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> PE_DEREFERENCE </span><span class=cFE>4</span><span class=cF0>
|
|
<a name="l6"></a>#</span><span class=cF1>define</span><span class=cF0> PE_CHECK_BINARY_OPS1 </span><span class=cFE>5</span><span class=cF0>
|
|
<a name="l7"></a>#</span><span class=cF1>define</span><span class=cF0> PE_CHECK_BINARY_OPS2 </span><span class=cFE>6</span><span class=cF0>
|
|
<a name="l8"></a>#</span><span class=cF1>define</span><span class=cF0> PE_DO_UNARY_OP </span><span class=cFE>7</span><span class=cF0>
|
|
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> PE_DO_BINARY_OP </span><span class=cFE>8</span><span class=cF0>
|
|
<a name="l10"></a>#</span><span class=cF1>define</span><span class=cF0> PE_POP_HIGHER </span><span class=cFE>9</span><span class=cF0>
|
|
<a name="l11"></a>#</span><span class=cF1>define</span><span class=cF0> PE_PUSH_LOWER </span><span class=cFE>10</span><span class=cF0>
|
|
<a name="l12"></a>#</span><span class=cF1>define</span><span class=cF0> PE_POP_ALL1 </span><span class=cFE>11</span><span class=cF0>
|
|
<a name="l13"></a>#</span><span class=cF1>define</span><span class=cF0> PE_POP_ALL2 </span><span class=cFE>12</span><span class=cF0>
|
|
<a name="l14"></a>
|
|
<a name="l15"></a></span><span class=cF9>CIntermediateCode</span><span class=cF0> *</span><span class=cFD>ParseAddOp</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> stack_op, </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc)
|
|
<a name="l16"></a>{
|
|
<a name="l17"></a> </span><span class=cF9>CIntermediateCode</span><span class=cF0> *tmpi = cc->coc.coc_head.last;
|
|
<a name="l18"></a> </span><span class=cF1>Bool</span><span class=cF0> div_sizeof = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l19"></a>
|
|
<a name="l20"></a> </span><span class=cF1>switch</span><span class=cF0> (stack_op.u16[</span><span class=cFE>0</span><span class=cF0>])
|
|
<a name="l21"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l22"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IC_ADD</span><span class=cF0>:
|
|
<a name="l23"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc->ptr_stars_count && !tmpi->ic_class->ptr_stars_count && tmpi->ic_class->raw_type != </span><span class=cF3>RT_F64</span><span class=cF0>)
|
|
<a name="l24"></a> {
|
|
<a name="l25"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_SIZEOF</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l26"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_MUL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l27"></a> }
|
|
<a name="l28"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l29"></a>
|
|
<a name="l30"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IC_SUB</span><span class=cF0>:
|
|
<a name="l31"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc->ptr_stars_count && tmpi->ic_class->raw_type != </span><span class=cF3>RT_F64</span><span class=cF0>)
|
|
<a name="l32"></a> {
|
|
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpi->ic_class->ptr_stars_count)
|
|
<a name="l34"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l35"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_SIZEOF</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l36"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_MUL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l37"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l38"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l39"></a> div_sizeof = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l40"></a> }
|
|
<a name="l41"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l42"></a>
|
|
<a name="l43"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IC_AND_AND</span><span class=cF0>:
|
|
<a name="l44"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IC_OR_OR</span><span class=cF0>:
|
|
<a name="l45"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_NOP1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l46"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l47"></a>
|
|
<a name="l48"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IC_ADD_EQU</span><span class=cF0>:
|
|
<a name="l49"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IC_SUB_EQU</span><span class=cF0>:
|
|
<a name="l50"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc->ptr_stars_count)
|
|
<a name="l51"></a> {
|
|
<a name="l52"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_SIZEOF</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l53"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_MUL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l54"></a> }
|
|
<a name="l55"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l56"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l57"></a> tmpi = </span><span class=cFD>ICAdd</span><span class=cF0>(cc, stack_op, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (stack_op.u8[</span><span class=cFE>3</span><span class=cF0>] & </span><span class=cF3>ECF_HAS_PUSH_CMP</span><span class=cF0>)
|
|
<a name="l59"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l60"></a> tmpi->ic_flags |= </span><span class=cF3>ICF_POP_CMP</span><span class=cF0>;
|
|
<a name="l61"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_NOP1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l62"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_AND_AND</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>], </span><span class=cF3>ICF_POP_CMP</span><span class=cF0>);
|
|
<a name="l63"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l64"></a> </span><span class=cF1>if</span><span class=cF0> (div_sizeof)
|
|
<a name="l65"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l66"></a> tmpc--;
|
|
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc->size != </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l68"></a> {
|
|
<a name="l69"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, tmpc->size, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l70"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_DIV</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l71"></a> tmpc = </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>];
|
|
<a name="l72"></a> }
|
|
<a name="l73"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l74"></a>
|
|
<a name="l75"></a> </span><span class=cF1>return</span><span class=cF0> tmpi;
|
|
<a name="l76"></a>}
|
|
<a name="l77"></a>
|
|
<a name="l78"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParseExpression2</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> *_max_prec, </span><span class=cF9>CParseStack</span><span class=cF0> *ps)
|
|
<a name="l79"></a>{
|
|
<a name="l80"></a> </span><span class=cF9>I64</span><span class=cF0> i, cur_op, stack_op, state,
|
|
<a name="l81"></a> max_prec = </span><span class=cF3>PREC_NULL</span><span class=cF0>, unary_pre_prec, paren_prec, unary_post_prec, left_prec = </span><span class=cF3>PREC_MAX</span><span class=cF0>;
|
|
<a name="l82"></a> </span><span class=cF9>CIntermediateCode</span><span class=cF0> *tmpi;
|
|
<a name="l83"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc;
|
|
<a name="l84"></a> </span><span class=cF9>CMemberList</span><span class=cF0> *local_var;
|
|
<a name="l85"></a> </span><span class=cF9>CArrayDim</span><span class=cF0> *tmpad = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l86"></a>
|
|
<a name="l87"></a> </span><span class=cF1>goto</span><span class=cF0> pe_unary_term1;
|
|
<a name="l88"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l89"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l90"></a> </span><span class=cF1>switch</span><span class=cF0> [state]
|
|
<a name="l91"></a> {
|
|
<a name="l92"></a> </span><span class=cF1>case</span><span class=cF0> PE_UNARY_TERM1:
|
|
<a name="l93"></a>pe_unary_term1:
|
|
<a name="l94"></a> unary_pre_prec = </span><span class=cF3>PREC_NULL</span><span class=cF0>;
|
|
<a name="l95"></a> unary_post_prec = </span><span class=cF3>PREC_NULL</span><span class=cF0>;
|
|
<a name="l96"></a> cc->flags &= ~(</span><span class=cF3>CCF_PAREN</span><span class=cF0> + </span><span class=cF3>CCF_PREINC</span><span class=cF0> + </span><span class=cF3>CCF_PREDEC</span><span class=cF0> + </span><span class=cF3>CCF_POSTINC</span><span class=cF0> + </span><span class=cF3>CCF_POSTDEC</span><span class=cF0> + </span><span class=cF3>CCF_FUN_EXP</span><span class=cF0>);
|
|
<a name="l97"></a>
|
|
<a name="l98"></a> </span><span class=cF1>case</span><span class=cF0> PE_UNARY_TERM2:
|
|
<a name="l99"></a> state = </span><span class=cFD>ParseUnaryTerm</span><span class=cF0>(cc, ps, &local_var, &tmpad, &max_prec, &unary_pre_prec, &paren_prec);
|
|
<a name="l100"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l101"></a>
|
|
<a name="l102"></a> </span><span class=cF1>case</span><span class=cF0> PE_UNARY_MODIFIERS:
|
|
<a name="l103"></a> state = </span><span class=cFD>ParseUnaryModifier</span><span class=cF0>(cc, ps, &local_var, &tmpad, &unary_post_prec);
|
|
<a name="l104"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l105"></a>
|
|
<a name="l106"></a> </span><span class=cF1>case</span><span class=cF0> PE_MAYBE_MODIFIERS:
|
|
<a name="l107"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l108"></a> </span><span class=cF7>{</span><span class=cF0> </span><span class=cF2>//Typecast or fun_ptr</span><span class=cF0>
|
|
<a name="l109"></a> cc->flags |= </span><span class=cF3>CCF_RAX</span><span class=cF0>;
|
|
<a name="l110"></a> state = </span><span class=cFD>ParseUnaryModifier</span><span class=cF0>(cc, ps, &local_var, &tmpad, &unary_post_prec);
|
|
<a name="l111"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l112"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l113"></a> </span><span class=cF1>goto</span><span class=cF0> pe_check_binary_ops1;
|
|
<a name="l114"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l115"></a>
|
|
<a name="l116"></a> </span><span class=cF1>case</span><span class=cF0> PE_DEREFERENCE:
|
|
<a name="l117"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc->flags & (</span><span class=cF3>CCF_PREINC</span><span class=cF0> | </span><span class=cF3>CCF_PREDEC</span><span class=cF0> | </span><span class=cF3>CCF_POSTINC</span><span class=cF0> | </span><span class=cF3>CCF_POSTDEC</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l118"></a> i = </span><span class=cF3>IC_DEREF</span><span class=cF0> + </span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0>;
|
|
<a name="l119"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l120"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l121"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_POSTINC</span><span class=cF0>)
|
|
<a name="l122"></a> i = </span><span class=cF3>IC__PP</span><span class=cF0> + </span><span class=cF3>PREC_UNARY_POST</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0>;
|
|
<a name="l123"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_POSTDEC</span><span class=cF0>)
|
|
<a name="l124"></a> i = </span><span class=cF3>IC__MM</span><span class=cF0> + </span><span class=cF3>PREC_UNARY_POST</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0>;
|
|
<a name="l125"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_PREDEC</span><span class=cF0>)
|
|
<a name="l126"></a> i = </span><span class=cF3>IC_MM_</span><span class=cF0> + </span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0>;
|
|
<a name="l127"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l128"></a> i = </span><span class=cF3>IC_PP_</span><span class=cF0>+</span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0>;
|
|
<a name="l129"></a> cc->flags &= ~(</span><span class=cF3>CCF_PREINC</span><span class=cF0> | </span><span class=cF3>CCF_PREDEC</span><span class=cF0> | </span><span class=cF3>CCF_POSTINC</span><span class=cF0> | </span><span class=cF3>CCF_POSTDEC</span><span class=cF0>);
|
|
<a name="l130"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l131"></a> tmpi = cc->coc.coc_head.last;
|
|
<a name="l132"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF7>(</span><span class=cF3>CCF_RAX</span><span class=cF0> | </span><span class=cF3>CCF_ARRAY</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l133"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l134"></a> </span><span class=cF1>if</span><span class=cF0> (tmpi->ic_code == </span><span class=cF3>IC_DEREF</span><span class=cF0>)
|
|
<a name="l135"></a> tmpi->ic_code = i;
|
|
<a name="l136"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l137"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l138"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l139"></a> tmpc = </span><span class=cF5>OptClassFwd</span><span class=cF0>(tmpi->ic_class - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l140"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, i, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l141"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l142"></a>
|
|
<a name="l143"></a> </span><span class=cF1>case</span><span class=cF0> PE_CHECK_BINARY_OPS1:
|
|
<a name="l144"></a>pe_check_binary_ops1:
|
|
<a name="l145"></a> </span><span class=cF1>if</span><span class=cF0> (paren_prec)
|
|
<a name="l146"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l147"></a> </span><span class=cF1>if</span><span class=cF0> (unary_pre_prec || unary_post_prec)
|
|
<a name="l148"></a> {
|
|
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (paren_prec <= unary_pre_prec && !unary_post_prec)
|
|
<a name="l150"></a> </span><span class=cFD>ParenWarning</span><span class=cF0>(cc);
|
|
<a name="l151"></a> paren_prec = </span><span class=cF3>PREC_NULL</span><span class=cF0>;
|
|
<a name="l152"></a> }
|
|
<a name="l153"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (paren_prec <= </span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0> + </span><span class=cF3>ASSOC_MASK</span><span class=cF0>)
|
|
<a name="l154"></a> </span><span class=cFD>ParenWarning</span><span class=cF0>(cc);
|
|
<a name="l155"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l156"></a> cur_op = </span><span class=cFB>cmp</span><span class=cF0>.binary_ops[cc->token];
|
|
<a name="l157"></a>
|
|
<a name="l158"></a>
|
|
<a name="l159"></a> </span><span class=cF1>case</span><span class=cF0> PE_CHECK_BINARY_OPS2:
|
|
<a name="l160"></a>pe_check_binary_ops2:
|
|
<a name="l161"></a> stack_op = </span><span class=cFD>ParsePop</span><span class=cF0>(ps);
|
|
<a name="l162"></a> tmpc = </span><span class=cFD>ParsePop</span><span class=cF0>(ps);
|
|
<a name="l163"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cFE>0</span><span class=cF0> < stack_op.u8[</span><span class=cFE>2</span><span class=cF0>] <= </span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0> + </span><span class=cF3>ASSOC_MASK</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l164"></a> </span><span class=cF1>goto</span><span class=cF0> pe_do_binary_op;
|
|
<a name="l165"></a>
|
|
<a name="l166"></a> </span><span class=cF1>case</span><span class=cF0> PE_DO_UNARY_OP:
|
|
<a name="l167"></a> </span><span class=cF1>if</span><span class=cF0> (cur_op.u16[</span><span class=cFE>0</span><span class=cF0>] == </span><span class=cF3>IC_POWER</span><span class=cF0> && stack_op.u16[</span><span class=cFE>0</span><span class=cF0>] == </span><span class=cF3>IC_UNARY_MINUS</span><span class=cF0>)
|
|
<a name="l168"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l169"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip ` op</span><span class=cF0>
|
|
<a name="l170"></a> left_prec = cur_op.i8[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l171"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, tmpc);
|
|
<a name="l172"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, stack_op);
|
|
<a name="l173"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, cc->coc.coc_head.last->ic_class);
|
|
<a name="l174"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, cur_op);
|
|
<a name="l175"></a> </span><span class=cF1>goto</span><span class=cF0> pe_unary_term1;
|
|
<a name="l176"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l177"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l178"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l179"></a> tmpi = cc->coc.coc_head.last;
|
|
<a name="l180"></a> tmpc = tmpi->ic_class;
|
|
<a name="l181"></a> </span><span class=cF1>if</span><span class=cF0> (stack_op.u16[</span><span class=cFE>0</span><span class=cF0>] == </span><span class=cF3>IC_DEREF</span><span class=cF0> && tmpc->ptr_stars_count)
|
|
<a name="l182"></a> tmpc--;
|
|
<a name="l183"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (stack_op.u16[</span><span class=cFE>0</span><span class=cF0>] == </span><span class=cF3>IC_ADDR</span><span class=cF0>)
|
|
<a name="l184"></a> {
|
|
<a name="l185"></a> cc->abs_counts.c_address++;
|
|
<a name="l186"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>intermediate_code_table</span><span class=cF0>[tmpi->ic_code].type == </span><span class=cF3>IST_DEREF</span><span class=cF0>)
|
|
<a name="l187"></a> </span><span class=cFD>OptFree</span><span class=cF0>(tmpi);
|
|
<a name="l188"></a> tmpc++;
|
|
<a name="l189"></a> }
|
|
<a name="l190"></a> tmpc = </span><span class=cF5>OptClassFwd</span><span class=cF0>(tmpc);
|
|
<a name="l191"></a> </span><span class=cF1>if</span><span class=cF0> (stack_op)
|
|
<a name="l192"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, stack_op, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l193"></a> </span><span class=cF1>goto</span><span class=cF0> pe_check_binary_ops2;
|
|
<a name="l194"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l195"></a>
|
|
<a name="l196"></a> </span><span class=cF1>case</span><span class=cF0> PE_DO_BINARY_OP:
|
|
<a name="l197"></a>pe_do_binary_op:
|
|
<a name="l198"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, tmpc);
|
|
<a name="l199"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, stack_op);
|
|
<a name="l200"></a> </span><span class=cF1>if</span><span class=cF0> (!cur_op)
|
|
<a name="l201"></a> </span><span class=cF1>goto</span><span class=cF0> pe_pop_all1;
|
|
<a name="l202"></a>
|
|
<a name="l203"></a> </span><span class=cF1>switch</span><span class=cF0> (cur_op.u16[</span><span class=cFE>0</span><span class=cF0>])
|
|
<a name="l204"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l205"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IC_ADD</span><span class=cF0>:
|
|
<a name="l206"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IC_SUB</span><span class=cF0>:
|
|
<a name="l207"></a> tmpi = cc->coc.coc_head.last;
|
|
<a name="l208"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpi->ic_class->ptr_stars_count && tmpi->ic_class->raw_type != </span><span class=cF3>RT_F64</span><span class=cF0>)
|
|
<a name="l209"></a> {
|
|
<a name="l210"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_SIZEOF</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l211"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_MUL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l212"></a> }
|
|
<a name="l213"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l214"></a>
|
|
<a name="l215"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IC_AND_AND</span><span class=cF0>:
|
|
<a name="l216"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IC_OR_OR</span><span class=cF0>:
|
|
<a name="l217"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_NOP1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l218"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l219"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l220"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_FUN_EXP</span><span class=cF0>)
|
|
<a name="l221"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l222"></a> ps->ptr2--;
|
|
<a name="l223"></a> cc->flags &= ~</span><span class=cF3>CCF_FUN_EXP</span><span class=cF0>;
|
|
<a name="l224"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l225"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip op</span><span class=cF0>
|
|
<a name="l226"></a> </span><span class=cF1>if</span><span class=cF0> (paren_prec > </span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0> + </span><span class=cF3>ASSOC_MASK</span><span class=cF0> &&
|
|
<a name="l227"></a> paren_prec & ~</span><span class=cF3>ASSOC_MASK</span><span class=cF0> < left_prec & ~</span><span class=cF3>ASSOC_MASK</span><span class=cF0> + paren_prec & </span><span class=cF3>ASSOCF_RIGHT</span><span class=cF0> &&
|
|
<a name="l228"></a> paren_prec & ~</span><span class=cF3>ASSOC_MASK</span><span class=cF0> < cur_op.u8[</span><span class=cFE>2</span><span class=cF0>] & ~</span><span class=cF3>ASSOC_MASK</span><span class=cF0> + !</span><span class=cF7>(</span><span class=cF0>paren_prec & </span><span class=cF3>ASSOCF_RIGHT</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l229"></a> </span><span class=cFD>ParenWarning</span><span class=cF0>(cc);
|
|
<a name="l230"></a> </span><span class=cF1>if</span><span class=cF0> (cur_op.u8[</span><span class=cFE>2</span><span class=cF0>] > max_prec)
|
|
<a name="l231"></a> max_prec = cur_op.u8[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l232"></a> left_prec = cur_op.u8[</span><span class=cFE>2</span><span class=cF0>];
|
|
<a name="l233"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>intermediate_code_table</span><span class=cF0>[cur_op.u16[</span><span class=cFE>0</span><span class=cF0>]].type == </span><span class=cF3>IST_ASSIGN</span><span class=cF0>)
|
|
<a name="l234"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l235"></a> tmpi = cc->coc.coc_head.last;
|
|
<a name="l236"></a> tmpc = </span><span class=cF5>OptClassFwd</span><span class=cF0>(tmpi->ic_class);
|
|
<a name="l237"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>intermediate_code_table</span><span class=cF0>[tmpi->ic_code].type != </span><span class=cF3>IST_DEREF</span><span class=cF0> || !tmpc->ptr_stars_count &&
|
|
<a name="l238"></a> !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmpc->flags, </span><span class=cF3>Cf_INTERNAL_TYPE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l239"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Invalid lval at "</span><span class=cF0>);
|
|
<a name="l240"></a> tmpi->ic_code = </span><span class=cF3>IC_NOP1</span><span class=cF0>; </span><span class=cF2>//Important for setting class (pretty sure)</span><span class=cF0>
|
|
<a name="l241"></a> cur_op.u8[</span><span class=cFE>2</span><span class=cF0>] = </span><span class=cF3>PREC_ASSIGN</span><span class=cF0> | </span><span class=cF3>ASSOCF_RIGHT</span><span class=cF0>;
|
|
<a name="l242"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l243"></a>
|
|
<a name="l244"></a> </span><span class=cF1>case</span><span class=cF0> PE_POP_HIGHER:
|
|
<a name="l245"></a>pe_pop_higher:
|
|
<a name="l246"></a> stack_op = </span><span class=cFD>ParsePop</span><span class=cF0>(ps); </span><span class=cF2>//pop ops of higher prec</span><span class=cF0>
|
|
<a name="l247"></a> tmpc = </span><span class=cFD>ParsePop</span><span class=cF0>(ps);
|
|
<a name="l248"></a> </span><span class=cF1>if</span><span class=cF0> (!stack_op)
|
|
<a name="l249"></a> </span><span class=cF1>goto</span><span class=cF0> pe_push_lower;
|
|
<a name="l250"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cur_op.u8[</span><span class=cFE>2</span><span class=cF0>] & ~</span><span class=cF3>ASSOC_MASK</span><span class=cF0> == stack_op.u8[</span><span class=cFE>2</span><span class=cF0>] & ~</span><span class=cF3>ASSOC_MASK</span><span class=cF0>)
|
|
<a name="l251"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l252"></a> </span><span class=cF1>if</span><span class=cF0> (cur_op.u8[</span><span class=cFE>2</span><span class=cF0>] & </span><span class=cF3>ASSOCF_RIGHT</span><span class=cF0>)
|
|
<a name="l253"></a> </span><span class=cF1>goto</span><span class=cF0> pe_push_lower;
|
|
<a name="l254"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l255"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cur_op.u8[</span><span class=cFE>2</span><span class=cF0>] & ~</span><span class=cF3>ASSOC_MASK</span><span class=cF0> <= stack_op.u8[</span><span class=cFE>2</span><span class=cF0>] & ~</span><span class=cF3>ASSOC_MASK</span><span class=cF0>)
|
|
<a name="l256"></a> </span><span class=cF1>goto</span><span class=cF0> pe_push_lower;
|
|
<a name="l257"></a>
|
|
<a name="l258"></a> tmpi = </span><span class=cFD>ParseAddOp</span><span class=cF0>(cc, stack_op, tmpc);
|
|
<a name="l259"></a>
|
|
<a name="l260"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>intermediate_code_table</span><span class=cF0>[cur_op.u16[</span><span class=cFE>0</span><span class=cF0>]].type == </span><span class=cF3>IST_CMP</span><span class=cF0> &&
|
|
<a name="l261"></a> </span><span class=cFD>intermediate_code_table</span><span class=cF0>[stack_op.u16[</span><span class=cFE>0</span><span class=cF0>]].type == </span><span class=cF3>IST_CMP</span><span class=cF0>)
|
|
<a name="l262"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l263"></a> tmpi->ic_flags |= </span><span class=cF3>ICF_PUSH_CMP</span><span class=cF0>;
|
|
<a name="l264"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_NOP1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l265"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_PUSH_CMP</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l266"></a> cur_op.u8[</span><span class=cFE>3</span><span class=cF0>] |= </span><span class=cF3>ECF_HAS_PUSH_CMP</span><span class=cF0>;
|
|
<a name="l267"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l268"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cur_op.u16[</span><span class=cFE>0</span><span class=cF0>] == </span><span class=cF3>IC_AND_AND</span><span class=cF0> || cur_op.u16[</span><span class=cFE>0</span><span class=cF0>] == </span><span class=cF3>IC_OR_OR</span><span class=cF0>)
|
|
<a name="l269"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_NOP1</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l270"></a> </span><span class=cF1>goto</span><span class=cF0> pe_pop_higher;
|
|
<a name="l271"></a>
|
|
<a name="l272"></a> </span><span class=cF1>case</span><span class=cF0> PE_PUSH_LOWER:
|
|
<a name="l273"></a>pe_push_lower:
|
|
<a name="l274"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, tmpc);
|
|
<a name="l275"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, stack_op);
|
|
<a name="l276"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, cc->coc.coc_head.last->ic_class);
|
|
<a name="l277"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, cur_op);
|
|
<a name="l278"></a> </span><span class=cF1>goto</span><span class=cF0> pe_unary_term1;
|
|
<a name="l279"></a>
|
|
<a name="l280"></a> </span><span class=cF1>case</span><span class=cF0> PE_POP_ALL1:
|
|
<a name="l281"></a>pe_pop_all1:
|
|
<a name="l282"></a> </span><span class=cF1>if</span><span class=cF0> (paren_prec > </span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0> + </span><span class=cF3>ASSOC_MASK</span><span class=cF0> &&
|
|
<a name="l283"></a> paren_prec & ~</span><span class=cF3>ASSOC_MASK</span><span class=cF0> <= left_prec & ~</span><span class=cF3>ASSOC_MASK</span><span class=cF0> -
|
|
<a name="l284"></a> paren_prec & </span><span class=cF3>ASSOCF_LEFT</span><span class=cF0> - left_prec & </span><span class=cF3>ASSOCF_LEFT</span><span class=cF0>)
|
|
<a name="l285"></a> </span><span class=cFD>ParenWarning</span><span class=cF0>(cc);
|
|
<a name="l286"></a>
|
|
<a name="l287"></a> </span><span class=cF1>case</span><span class=cF0> PE_POP_ALL2:
|
|
<a name="l288"></a>pe_pop_all2:
|
|
<a name="l289"></a> stack_op = </span><span class=cFD>ParsePop</span><span class=cF0>(ps);
|
|
<a name="l290"></a> tmpc = </span><span class=cFD>ParsePop</span><span class=cF0>(ps);
|
|
<a name="l291"></a> </span><span class=cF1>if</span><span class=cF0> (!stack_op.u16[</span><span class=cFE>0</span><span class=cF0>])
|
|
<a name="l292"></a> </span><span class=cF1>goto</span><span class=cF0> pe_done;
|
|
<a name="l293"></a> </span><span class=cFD>ParseAddOp</span><span class=cF0>(cc, stack_op, tmpc);
|
|
<a name="l294"></a> </span><span class=cF1>goto</span><span class=cF0> pe_pop_all2;
|
|
<a name="l295"></a> }
|
|
<a name="l296"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l297"></a>pe_done:
|
|
<a name="l298"></a> </span><span class=cF1>if</span><span class=cF0> (_max_prec)
|
|
<a name="l299"></a> *_max_prec = max_prec;
|
|
<a name="l300"></a>}
|
|
<a name="l301"></a>
|
|
<a name="l302"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cFD>ParseExpression</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> *_max_prec, </span><span class=cF1>Bool</span><span class=cF0> end_exp, </span><span class=cF9>CParseStack</span><span class=cF0> *_ps=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l303"></a>{
|
|
<a name="l304"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l305"></a> </span><span class=cF9>I64</span><span class=cF0> old_flags = cc->flags;
|
|
<a name="l306"></a> </span><span class=cF9>CParseStack</span><span class=cF0> *ps;
|
|
<a name="l307"></a>
|
|
<a name="l308"></a> </span><span class=cF1>if</span><span class=cF0> (_ps)
|
|
<a name="l309"></a> ps = _ps;
|
|
<a name="l310"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l311"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l312"></a> ps = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CParseStack</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l313"></a> ps->ptr = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l314"></a> ps->ptr2 = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l315"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l316"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, </span><span class=cFE>0</span><span class=cF0>); </span><span class=cF2>//terminate</span><span class=cF0>
|
|
<a name="l317"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, </span><span class=cFE>0</span><span class=cF0>); </span><span class=cF2>//terminate</span><span class=cF0>
|
|
<a name="l318"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l319"></a></span><span class=cF2>//try catch causes noreg variables in function</span><span class=cF0>
|
|
<a name="l320"></a> </span><span class=cFD>ParseExpression2</span><span class=cF0>(cc, _max_prec, ps);
|
|
<a name="l321"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l322"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l323"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>->except_ch == </span><span class=cF6>'Compiler'</span><span class=cF0>)
|
|
<a name="l324"></a> {
|
|
<a name="l325"></a> res = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l326"></a> </span><span class=cF5>Fs</span><span class=cF0>->catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l327"></a> }
|
|
<a name="l328"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l329"></a> </span><span class=cF1>if</span><span class=cF0> (!_ps)
|
|
<a name="l330"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l331"></a> </span><span class=cF1>if</span><span class=cF0> (ps->ptr)
|
|
<a name="l332"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Compiler Parse Error at "</span><span class=cF0>);
|
|
<a name="l333"></a> </span><span class=cF5>Free</span><span class=cF0>(ps);
|
|
<a name="l334"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l335"></a> </span><span class=cF1>if</span><span class=cF0> (res)
|
|
<a name="l336"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l337"></a> </span><span class=cF1>if</span><span class=cF0> (end_exp)
|
|
<a name="l338"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_END_EXP</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>ICF_RES_NOT_USED</span><span class=cF0>);
|
|
<a name="l339"></a> </span><span class=cF1>if</span><span class=cF0> (cc->coc.coc_head.last->ic_class == </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_U0</span><span class=cF0>])
|
|
<a name="l340"></a> </span><span class=cF5>LexWarn</span><span class=cF0>(cc, </span><span class=cF6>"U0 Expression "</span><span class=cF0>);
|
|
<a name="l341"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l342"></a> cc->flags |= old_flags & (</span><span class=cF3>CCF_PREINC</span><span class=cF0> | </span><span class=cF3>CCF_PREDEC</span><span class=cF0>);
|
|
<a name="l343"></a>
|
|
<a name="l344"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l345"></a>}
|
|
<a name="l346"></a>
|
|
<a name="l347"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParseSizeOf</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc)
|
|
<a name="l348"></a>{
|
|
<a name="l349"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc;
|
|
<a name="l350"></a> </span><span class=cF9>CMemberList</span><span class=cF0> *tmpm;
|
|
<a name="l351"></a> </span><span class=cF9>CDebugInfo</span><span class=cF0> *debug_info;
|
|
<a name="l352"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l353"></a>
|
|
<a name="l354"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l355"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Invalid class at "</span><span class=cF0>);
|
|
<a name="l356"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm = cc->local_var_entry)
|
|
<a name="l357"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l358"></a> tmpc = tmpm->member_class;
|
|
<a name="l359"></a> i = tmpc->size * tmpm->dim.total_count;
|
|
<a name="l360"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>'.'</span><span class=cF0>)
|
|
<a name="l361"></a> </span><span class=cF1>goto</span><span class=cF0> pu_sizeof_member;
|
|
<a name="l362"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l363"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l364"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l365"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpc = cc->hash_entry</span><span class=cF7>)</span><span class=cF0> ||
|
|
<a name="l366"></a> !</span><span class=cF7>(</span><span class=cF0>tmpc->type & (</span><span class=cF3>HTT_CLASS</span><span class=cF0> | </span><span class=cF3>HTT_INTERNAL_TYPE</span><span class=cF0> | </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0> | </span><span class=cF3>HTT_FUN</span><span class=cF0> | </span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l367"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Invalid class at "</span><span class=cF0>);
|
|
<a name="l368"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc->type & </span><span class=cF7>(</span><span class=cF3>HTT_FUN</span><span class=cF0> | </span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l369"></a> {
|
|
<a name="l370"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>debug_info = tmpc(</span><span class=cF9>CHashFun</span><span class=cF0> *)->debug_info</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l371"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Size not defined at "</span><span class=cF0>);
|
|
<a name="l372"></a> i = debug_info->body[debug_info->max_line + </span><span class=cFE>1</span><span class=cF0> - debug_info->min_line] - debug_info->body[</span><span class=cFE>0</span><span class=cF0>];
|
|
<a name="l373"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l374"></a> }
|
|
<a name="l375"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l376"></a> {
|
|
<a name="l377"></a> i = tmpc->size;
|
|
<a name="l378"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>'.'</span><span class=cF0>)
|
|
<a name="l379"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l380"></a>pu_sizeof_member:
|
|
<a name="l381"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpc->type & (</span><span class=cF3>HTT_CLASS</span><span class=cF0> | </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l382"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Invalid class at "</span><span class=cF0>);
|
|
<a name="l383"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpc->type & </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0>)
|
|
<a name="l384"></a> tmpc = tmpc(</span><span class=cF9>CHashGlobalVar</span><span class=cF0> *)->var_class;
|
|
<a name="l385"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF3>TK_IDENT</span><span class=cF0> || !</span><span class=cF7>(</span><span class=cF0>tmpm = </span><span class=cF5>MemberFind</span><span class=cF0>(cc->cur_str, tmpc)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l386"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Invalid member at "</span><span class=cF0>);
|
|
<a name="l387"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->local_var_entry)
|
|
<a name="l388"></a> cc->local_var_entry->use_count--;
|
|
<a name="l389"></a> tmpc = tmpm->member_class;
|
|
<a name="l390"></a></span><span class=cF2>//Probably others like this:</span><span class=cF0>
|
|
<a name="l391"></a> #</span><span class=cF1>assert</span><span class=cF0> </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CHashClass</span><span class=cF0>.size) == </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CHashGlobalVar</span><span class=cF0>.size)
|
|
<a name="l392"></a> i = tmpc->size * tmpm->dim.total_count;
|
|
<a name="l393"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l394"></a> }
|
|
<a name="l395"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l396"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>'*'</span><span class=cF0>)
|
|
<a name="l397"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l398"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>'*'</span><span class=cF0>);
|
|
<a name="l399"></a> i = </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *);
|
|
<a name="l400"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l401"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, i, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l402"></a>}
|
|
<a name="l403"></a>
|
|
<a name="l404"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>ParseOffsetOf</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc)
|
|
<a name="l405"></a>{
|
|
<a name="l406"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc;
|
|
<a name="l407"></a> </span><span class=cF9>CMemberList</span><span class=cF0> *tmpm;
|
|
<a name="l408"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l409"></a>
|
|
<a name="l410"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l411"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Invalid class at "</span><span class=cF0>);
|
|
<a name="l412"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm = cc->local_var_entry)
|
|
<a name="l413"></a> tmpc = tmpm->member_class;
|
|
<a name="l414"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l415"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l416"></a> tmpc = cc->hash_entry;
|
|
<a name="l417"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpc || !</span><span class=cF7>(</span><span class=cF0>tmpc->type & (</span><span class=cF3>HTT_CLASS</span><span class=cF0> | </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l418"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Invalid class at "</span><span class=cF0>);
|
|
<a name="l419"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpc->type & </span><span class=cF3>HTT_GLOBAL_VAR</span><span class=cF0>)
|
|
<a name="l420"></a> tmpc = tmpc(</span><span class=cF9>CHashGlobalVar</span><span class=cF0> *)->var_class;
|
|
<a name="l421"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l422"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF6>'.'</span><span class=cF0>)
|
|
<a name="l423"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting '.' at "</span><span class=cF0>);
|
|
<a name="l424"></a> i = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l425"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l426"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l427"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF3>TK_IDENT</span><span class=cF0> || !</span><span class=cF7>(</span><span class=cF0>tmpm = </span><span class=cF5>MemberFind</span><span class=cF0>(cc->cur_str, tmpc)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l428"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Invalid member at "</span><span class=cF0>);
|
|
<a name="l429"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->local_var_entry)
|
|
<a name="l430"></a> cc->local_var_entry->use_count--;
|
|
<a name="l431"></a> i += tmpm-></span><span class=cF1>offset</span><span class=cF0>;
|
|
<a name="l432"></a> tmpc = tmpm->member_class;
|
|
<a name="l433"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l434"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>'.'</span><span class=cF0>);
|
|
<a name="l435"></a>
|
|
<a name="l436"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, i, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l437"></a>}
|
|
<a name="l438"></a>
|
|
<a name="l439"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>ParseFunCall</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>CParseStack</span><span class=cF0> *ps, </span><span class=cF1>Bool</span><span class=cF0> indirect, </span><span class=cF9>CHashFun</span><span class=cF0> *tmpf)
|
|
<a name="l440"></a>{
|
|
<a name="l441"></a> </span><span class=cF9>I64</span><span class=cF0> i, argc_count, default_val;
|
|
<a name="l442"></a> </span><span class=cF1>Bool</span><span class=cF0> is_first_arg = </span><span class=cF3>TRUE</span><span class=cF0>, needs_right_paren, is_print, is_putchars, is_template_fun;
|
|
<a name="l443"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc2, *last_class = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l444"></a> </span><span class=cF9>CMemberList</span><span class=cF0> *tmpm;
|
|
<a name="l445"></a> </span><span class=cF9>CCodeCtrl</span><span class=cF0> *tmpcbh, *tmpcbh1;
|
|
<a name="l446"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *cm;
|
|
<a name="l447"></a> </span><span class=cF9>CIntermediateCode</span><span class=cF0> *tmpi;
|
|
<a name="l448"></a>
|
|
<a name="l449"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpf)
|
|
<a name="l450"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l451"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF3>TK_CHAR_CONST</span><span class=cF0>)
|
|
<a name="l452"></a> {
|
|
<a name="l453"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpf = </span><span class=cF5>HashFind</span><span class=cF0>(</span><span class=cF6>"PutChars"</span><span class=cF0>, cc->htc.hash_table_list, </span><span class=cF3>HTT_FUN</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l454"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing header for Print() and PutChars() at "</span><span class=cF0>);
|
|
<a name="l455"></a> </span><span class=cF1>if</span><span class=cF0> (!cc->cur_i64) </span><span class=cF2>//empty char signals PutChars with variable</span><span class=cF0>
|
|
<a name="l456"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l457"></a> is_print = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l458"></a> is_putchars = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l459"></a> }
|
|
<a name="l460"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l461"></a> {
|
|
<a name="l462"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpf = </span><span class=cF5>HashFind</span><span class=cF0>(</span><span class=cF6>"Print"</span><span class=cF0>, cc->htc.hash_table_list, </span><span class=cF3>HTT_FUN</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l463"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing header for Print() and PutChars() at "</span><span class=cF0>);
|
|
<a name="l464"></a> </span><span class=cF1>if</span><span class=cF0> (!*cc->cur_str) </span><span class=cF2>//empty string signals Print with variable format_str</span><span class=cF0>
|
|
<a name="l465"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l466"></a> is_putchars = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l467"></a> is_print = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l468"></a> }
|
|
<a name="l469"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l470"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l471"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l472"></a> is_print = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l473"></a> is_putchars = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l474"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l475"></a>
|
|
<a name="l476"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmpf->flags, </span><span class=cF3>Ff_INTERNAL</span><span class=cF7>)</span><span class=cF0> && </span><span class=cF3>IC_SQR</span><span class=cF0> <= tmpf->exe_addr <= </span><span class=cF3>IC_ATAN</span><span class=cF0>)
|
|
<a name="l477"></a> is_template_fun = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l478"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l479"></a> is_template_fun = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l480"></a>
|
|
<a name="l481"></a> </span><span class=cF1>if</span><span class=cF0> (indirect)
|
|
<a name="l482"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l483"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc->flags & (</span><span class=cF3>CCF_RAX</span><span class=cF0> | </span><span class=cF3>CCF_ARRAY</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l484"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_DEREF</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l485"></a> cc->coc.coc_head.last->ic_class = </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>];
|
|
<a name="l486"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_RAX_SET</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l487"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_NOP2</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]); </span><span class=cF2>//balance the books</span><span class=cF0>
|
|
<a name="l488"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l489"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l490"></a> tmpcbh = cc->coc.coc_next;
|
|
<a name="l491"></a> cc->coc.coc_next = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l492"></a> i = tmpf->arg_count;
|
|
<a name="l493"></a> tmpm = tmpf->member_list_and_root;
|
|
<a name="l494"></a> argc_count = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l495"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l496"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l497"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l498"></a> needs_right_paren = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l499"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l500"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l501"></a> needs_right_paren = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l502"></a> </span><span class=cF1>while</span><span class=cF0> (i--)
|
|
<a name="l503"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l504"></a> </span><span class=cFD>COCInit</span><span class=cF0>(cc);
|
|
<a name="l505"></a> </span><span class=cF1>if</span><span class=cF0> (!is_first_arg)
|
|
<a name="l506"></a> {
|
|
<a name="l507"></a> </span><span class=cF1>if</span><span class=cF0> (is_print)
|
|
<a name="l508"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l509"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l510"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l511"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l512"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting ',' at "</span><span class=cF0>);
|
|
<a name="l513"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l514"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l515"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l516"></a> </span><span class=cF1>if</span><span class=cF0> (needs_right_paren)
|
|
<a name="l517"></a> {
|
|
<a name="l518"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l519"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l520"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l521"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting ',' at "</span><span class=cF0>);
|
|
<a name="l522"></a> }
|
|
<a name="l523"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l524"></a> }
|
|
<a name="l525"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->flags & </span><span class=cF3>MLF_DEFAULT_AVAILABLE</span><span class=cF0> && </span><span class=cF7>(</span><span class=cF0>cc->token == </span><span class=cF6>')'</span><span class=cF0> || cc->token == </span><span class=cF6>','</span><span class=cF0> || !needs_right_paren</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l526"></a> {
|
|
<a name="l527"></a> default_val = tmpm->default_val;
|
|
<a name="l528"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->flags & </span><span class=cF3>MLF_LASTCLASS</span><span class=cF0> && last_class)
|
|
<a name="l529"></a> default_val = (last_class - last_class->ptr_stars_count)->str;
|
|
<a name="l530"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->flags & </span><span class=cF7>(</span><span class=cF3>MLF_STR_DEFAULT_AVAILABLE</span><span class=cF0> | </span><span class=cF3>MLF_LASTCLASS</span><span class=cF7>)</span><span class=cF0> && cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l531"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l532"></a> cm = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_STR_CONST</span><span class=cF0>);
|
|
<a name="l533"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_STR_CONST</span><span class=cF0>, cm, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_U8</span><span class=cF0>] + </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l534"></a> cm->st_len = </span><span class=cF5>StrLen</span><span class=cF0>(default_val) + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l535"></a> cm->str = </span><span class=cF5>StrNew</span><span class=cF0>(default_val);
|
|
<a name="l536"></a> cc->flags |= </span><span class=cF3>CCF_HAS_MISC_DATA</span><span class=cF0>;
|
|
<a name="l537"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l538"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l539"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, default_val, tmpm->member_class);
|
|
<a name="l540"></a> }
|
|
<a name="l541"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l542"></a> {
|
|
<a name="l543"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>ParseExpression</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>, ps</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l544"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l545"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l546"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l547"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l548"></a> cc->pass = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l549"></a> </span><span class=cFD>OptPass012</span><span class=cF0>(cc);
|
|
<a name="l550"></a> cc->pass = </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l551"></a> tmpi = </span><span class=cFD>OptPass012</span><span class=cF0>(cc);
|
|
<a name="l552"></a> </span><span class=cFD>COCPop</span><span class=cF0>(cc);
|
|
<a name="l553"></a> last_class = </span><span class=cF5>OptClassFwd</span><span class=cF0>(tmpi->ic_class);
|
|
<a name="l554"></a> tmpc2 = </span><span class=cF5>OptClassFwd</span><span class=cF0>(tmpm->member_class);
|
|
<a name="l555"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc2->raw_type == </span><span class=cF3>RT_F64</span><span class=cF0> && !tmpm->dim.next && last_class->raw_type != </span><span class=cF3>RT_F64</span><span class=cF0>)
|
|
<a name="l556"></a> tmpi->ic_flags |= </span><span class=cF3>ICF_RES_TO_F64</span><span class=cF0>;
|
|
<a name="l557"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l558"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc2->raw_type != </span><span class=cF3>RT_F64</span><span class=cF0> && last_class->raw_type == </span><span class=cF3>RT_F64</span><span class=cF0>)
|
|
<a name="l559"></a> tmpi->ic_flags |= </span><span class=cF3>ICF_RES_TO_INT</span><span class=cF0>;
|
|
<a name="l560"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l561"></a> }
|
|
<a name="l562"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l563"></a> is_first_arg = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l564"></a> tmpm = tmpm->next;
|
|
<a name="l565"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l566"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm && tmpm->flags & </span><span class=cF3>MLF_DOT_DOT_DOT</span><span class=cF0>)
|
|
<a name="l567"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l568"></a> </span><span class=cFD>COCInit</span><span class=cF0>(cc);
|
|
<a name="l569"></a> tmpi = </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpm->member_class);
|
|
<a name="l570"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l571"></a> </span><span class=cF1>if</span><span class=cF0> (is_print)
|
|
<a name="l572"></a> {
|
|
<a name="l573"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>';'</span><span class=cF0>)
|
|
<a name="l574"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l575"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l576"></a> {
|
|
<a name="l577"></a> </span><span class=cF1>if</span><span class=cF0> (!is_first_arg)
|
|
<a name="l578"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l579"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l580"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l581"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l582"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting ',' at "</span><span class=cF0>);
|
|
<a name="l583"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l584"></a> </span><span class=cFD>COCInit</span><span class=cF0>(cc);
|
|
<a name="l585"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>ParseExpression</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>, ps</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l586"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l587"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l588"></a> is_first_arg = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l589"></a> argc_count++;
|
|
<a name="l590"></a> }
|
|
<a name="l591"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token == </span><span class=cF6>','</span><span class=cF0>);
|
|
<a name="l592"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l593"></a> }
|
|
<a name="l594"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (needs_right_paren)
|
|
<a name="l595"></a> {
|
|
<a name="l596"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l597"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l598"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l599"></a> {
|
|
<a name="l600"></a> </span><span class=cF1>if</span><span class=cF0> (!is_first_arg)
|
|
<a name="l601"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l602"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>','</span><span class=cF0>)
|
|
<a name="l603"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l604"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l605"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting ',' at "</span><span class=cF0>);
|
|
<a name="l606"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l607"></a> </span><span class=cFD>COCInit</span><span class=cF0>(cc);
|
|
<a name="l608"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>ParseExpression</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>, ps</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l609"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l610"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l611"></a> is_first_arg = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l612"></a> argc_count++;
|
|
<a name="l613"></a> }
|
|
<a name="l614"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token == </span><span class=cF6>','</span><span class=cF0>);
|
|
<a name="l615"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l616"></a> }
|
|
<a name="l617"></a> tmpi->ic_data = argc_count++; </span><span class=cF2>//++ so add_esp latter works</span><span class=cF0>
|
|
<a name="l618"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l619"></a> </span><span class=cF1>if</span><span class=cF0> (needs_right_paren)
|
|
<a name="l620"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l621"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l622"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l623"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l624"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l625"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l626"></a> tmpcbh1 = tmpcbh->coc_next;
|
|
<a name="l627"></a> tmpcbh->coc_next = cc->coc.coc_next;
|
|
<a name="l628"></a> cc->coc.coc_next = tmpcbh;
|
|
<a name="l629"></a> </span><span class=cFD>COCPop</span><span class=cF0>(cc);
|
|
<a name="l630"></a> tmpcbh = cc->coc.coc_next;
|
|
<a name="l631"></a> cc->coc.coc_next = tmpcbh1;
|
|
<a name="l632"></a> </span><span class=cF1>if</span><span class=cF0> (!is_template_fun)
|
|
<a name="l633"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_START</span><span class=cF0>, tmpf, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l634"></a> </span><span class=cF1>if</span><span class=cF0> (indirect)
|
|
<a name="l635"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_PUSH_REGS</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0> << </span><span class=cF3>REG_RAX</span><span class=cF0>, tmpf->return_class);
|
|
<a name="l636"></a> </span><span class=cF1>while</span><span class=cF0> (tmpcbh)
|
|
<a name="l637"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l638"></a> tmpcbh1 = tmpcbh->coc_next;
|
|
<a name="l639"></a> </span><span class=cFD>COCAppend</span><span class=cF0>(cc, tmpcbh);
|
|
<a name="l640"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmpf->flags, </span><span class=cF3>Ff_INTERNAL</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l641"></a> cc->coc.coc_head.last->ic_flags |= </span><span class=cF3>ICF_PUSH_RES</span><span class=cF0>;
|
|
<a name="l642"></a> tmpcbh = tmpcbh1;
|
|
<a name="l643"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l644"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmpf->flags, </span><span class=cF3>Ff_INTERNAL</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l645"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, tmpf->exe_addr, </span><span class=cFE>0</span><span class=cF0>, tmpf->return_class);
|
|
<a name="l646"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l647"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l648"></a> </span><span class=cF1>if</span><span class=cF0> (indirect)
|
|
<a name="l649"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_INDIRECT</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF0>argc_count + tmpf->arg_count</span><span class=cF7>)</span><span class=cF0> << </span><span class=cFE>3</span><span class=cF0>, tmpf->return_class);
|
|
<a name="l650"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmpf->flags, </span><span class=cF3>Cf_EXTERN</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l651"></a> {
|
|
<a name="l652"></a> cc->abs_counts.externs++;
|
|
<a name="l653"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l654"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l655"></a> </span><span class=cF1>if</span><span class=cF0> (tmpf->type & </span><span class=cF3>HTF_IMPORT</span><span class=cF0>)
|
|
<a name="l656"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_IMPORT</span><span class=cF0>, tmpf, tmpf->return_class);
|
|
<a name="l657"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l658"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_EXTERN</span><span class=cF0>, tmpf, tmpf->return_class);
|
|
<a name="l659"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l660"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l661"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_INDIRECT2</span><span class=cF0>, &tmpf->exe_addr, tmpf->return_class);
|
|
<a name="l662"></a> }
|
|
<a name="l663"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l664"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL</span><span class=cF0>, tmpf->exe_addr, tmpf->return_class);
|
|
<a name="l665"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF5>Bt</span><span class=cF0>(&tmpf->flags, </span><span class=cF3>Ff_RET1</span><span class=cF0>) || </span><span class=cF5>Bt</span><span class=cF0>(&tmpf->flags, </span><span class=cF3>Ff_ARGPOP</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> && !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmpf->flags, </span><span class=cF3>Ff_NOARGPOP</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l666"></a> {
|
|
<a name="l667"></a> </span><span class=cF1>if</span><span class=cF0> (indirect)
|
|
<a name="l668"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l669"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ADD_RSP1</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF0>argc_count + tmpf->arg_count</span><span class=cF7>)</span><span class=cF0> << </span><span class=cFE>3</span><span class=cF0>, tmpf->return_class);
|
|
<a name="l670"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ADD_RSP</span><span class=cF0>, </span><span class=cFE>8</span><span class=cF0>, tmpf->return_class);
|
|
<a name="l671"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l672"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l673"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ADD_RSP1</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF0>argc_count + tmpf->arg_count</span><span class=cF7>)</span><span class=cF0> << </span><span class=cFE>3</span><span class=cF0>, tmpf->return_class);
|
|
<a name="l674"></a> }
|
|
<a name="l675"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l676"></a> {
|
|
<a name="l677"></a> </span><span class=cF1>if</span><span class=cF0> (indirect)
|
|
<a name="l678"></a> argc_count++;
|
|
<a name="l679"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ADD_RSP</span><span class=cF0>, </span><span class=cF7>(</span><span class=cF0>argc_count + tmpf->arg_count</span><span class=cF7>)</span><span class=cF0> << </span><span class=cFE>3</span><span class=cF0>, tmpf->return_class);
|
|
<a name="l680"></a> }
|
|
<a name="l681"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l682"></a> </span><span class=cF1>if</span><span class=cF0> (!is_template_fun)
|
|
<a name="l683"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_CALL_END</span><span class=cF0>, tmpf, tmpf->return_class);
|
|
<a name="l684"></a> </span><span class=cF1>if</span><span class=cF0> (is_print || is_putchars)
|
|
<a name="l685"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_END_EXP</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>ICF_RES_NOT_USED</span><span class=cF0>);
|
|
<a name="l686"></a> cc->flags = (cc->flags | </span><span class=cF3>CCF_RAX</span><span class=cF0>) & ~(</span><span class=cF3>CCF_ARRAY</span><span class=cF0> | </span><span class=cF3>CCF_FUN_EXP</span><span class=cF0>);
|
|
<a name="l687"></a>
|
|
<a name="l688"></a> </span><span class=cF1>return</span><span class=cF0> PE_UNARY_MODIFIERS;
|
|
<a name="l689"></a>}
|
|
<a name="l690"></a>
|
|
<a name="l691"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>ParseUnaryTerm</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>CParseStack</span><span class=cF0> *ps, </span><span class=cF9>CMemberList</span><span class=cF0> **_local_var, </span><span class=cF9>CArrayDim</span><span class=cF0> **_tmpad,
|
|
<a name="l692"></a> </span><span class=cF9>I64</span><span class=cF0> *max_prec, </span><span class=cF9>I64</span><span class=cF0> *unary_pre_prec, </span><span class=cF9>I64</span><span class=cF0> *paren_prec)
|
|
<a name="l693"></a>{
|
|
<a name="l694"></a> </span><span class=cF9>I64</span><span class=cF0> i, j;
|
|
<a name="l695"></a> </span><span class=cF9>CHashExport</span><span class=cF0> *tmpex;
|
|
<a name="l696"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc;
|
|
<a name="l697"></a> </span><span class=cF9>CHashFun</span><span class=cF0> *tmpf;
|
|
<a name="l698"></a> </span><span class=cF9>CHashGlobalVar</span><span class=cF0> *tmpg;
|
|
<a name="l699"></a> </span><span class=cF9>CMemberList</span><span class=cF0> *tmpm;
|
|
<a name="l700"></a> </span><span class=cF9>CAsmUndefHash</span><span class=cF0> *tmpauh;
|
|
<a name="l701"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *cm;
|
|
<a name="l702"></a> </span><span class=cF1>Bool</span><span class=cF0> paren_warn;
|
|
<a name="l703"></a>
|
|
<a name="l704"></a> *_local_var = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l705"></a> *paren_prec = </span><span class=cF3>PREC_NULL</span><span class=cF0>;
|
|
<a name="l706"></a> </span><span class=cF1>switch</span><span class=cF0> (cc->token)
|
|
<a name="l707"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l708"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l709"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0> > *max_prec)
|
|
<a name="l710"></a> *max_prec = </span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0>;
|
|
<a name="l711"></a> *unary_pre_prec = </span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0>;
|
|
<a name="l712"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l713"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'~'</span><span class=cF0>: i = </span><span class=cF3>IC_COM</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l714"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'!'</span><span class=cF0>: i = </span><span class=cF3>IC_NOT</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l715"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'-'</span><span class=cF0>: i = </span><span class=cF3>IC_UNARY_MINUS</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l716"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'*'</span><span class=cF0>: i = </span><span class=cF3>IC_DEREF</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l717"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l718"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//Skip op</span><span class=cF0>
|
|
<a name="l719"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l720"></a>
|
|
<a name="l721"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'&'</span><span class=cF0>:
|
|
<a name="l722"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l723"></a> {
|
|
<a name="l724"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc = cc->hash_entry)
|
|
<a name="l725"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l726"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc->type & </span><span class=cF3>HTT_FUN</span><span class=cF0>)
|
|
<a name="l727"></a> {
|
|
<a name="l728"></a> tmpf = tmpc;
|
|
<a name="l729"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmpf->flags, </span><span class=cF3>Ff_INTERNAL</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l730"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l731"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&tmpf->flags, </span><span class=cF3>Cf_EXTERN</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l732"></a> {
|
|
<a name="l733"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l734"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l735"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0>)
|
|
<a name="l736"></a> {
|
|
<a name="l737"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex = </span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF0>tmpf->str, cc->htc.hash_table_list, </span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l738"></a> </span><span class=cF1>goto</span><span class=cF0> pu_export_sys_sym;
|
|
<a name="l739"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l740"></a> </span><span class=cF1>goto</span><span class=cF0> pu_new_sys_sym;
|
|
<a name="l741"></a> }
|
|
<a name="l742"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Can't take address of extern function"</span><span class=cF0>);
|
|
<a name="l743"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l744"></a> cc->abs_counts.externs++;
|
|
<a name="l745"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, &tmpf->exe_addr, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l746"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_DEREF</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l747"></a> }
|
|
<a name="l748"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l749"></a> {
|
|
<a name="l750"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l751"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l752"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ABS_ADDR</span><span class=cF0>, tmpf->exe_addr, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l753"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0>)
|
|
<a name="l754"></a> cc->abs_counts.abs_address++;
|
|
<a name="l755"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l756"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l757"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, tmpf->exe_addr, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l758"></a> }
|
|
<a name="l759"></a> cc->abs_counts.c_address++;
|
|
<a name="l760"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l761"></a> </span><span class=cF1>return</span><span class=cF0> PE_MAYBE_MODIFIERS;
|
|
<a name="l762"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l763"></a> }
|
|
<a name="l764"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmpc->type & </span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF0>)
|
|
<a name="l765"></a> {
|
|
<a name="l766"></a> tmpex = tmpc;
|
|
<a name="l767"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF7>)</span><span class=cF0> && tmpex->type & </span><span class=cF3>HTF_IMM</span><span class=cF0>)
|
|
<a name="l768"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l769"></a> cc->abs_counts.c_address++;
|
|
<a name="l770"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, tmpex->val, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l771"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l772"></a> </span><span class=cF1>return</span><span class=cF0> PE_MAYBE_MODIFIERS;
|
|
<a name="l773"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l774"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l775"></a> </span><span class=cF1>goto</span><span class=cF0> pu_export_sys_sym;
|
|
<a name="l776"></a> }
|
|
<a name="l777"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l778"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0> && !cc->local_var_entry)
|
|
<a name="l779"></a> </span><span class=cF1>goto</span><span class=cF0> pu_ident_but_not_local_var;
|
|
<a name="l780"></a> }
|
|
<a name="l781"></a> i = </span><span class=cF3>IC_ADDR</span><span class=cF0>;
|
|
<a name="l782"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l783"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l784"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, tmpc);
|
|
<a name="l785"></a> </span><span class=cFD>ParsePush</span><span class=cF0>(ps, </span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0> + i);
|
|
<a name="l786"></a> </span><span class=cF1>return</span><span class=cF0> PE_UNARY_TERM2;
|
|
<a name="l787"></a>
|
|
<a name="l788"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l789"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>TK_I64</span><span class=cF0>:
|
|
<a name="l790"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>TK_CHAR_CONST</span><span class=cF0>:
|
|
<a name="l791"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>TK_INS_BIN_SIZE</span><span class=cF0>:
|
|
<a name="l792"></a> </span><span class=cF1>if</span><span class=cF0> (cc->cur_i64 < </span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l793"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, cc->cur_i64, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_U64</span><span class=cF0>]);
|
|
<a name="l794"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l795"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, cc->cur_i64, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l796"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l797"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l798"></a>
|
|
<a name="l799"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>TK_F64</span><span class=cF0>:
|
|
<a name="l800"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_F64</span><span class=cF0>, cc->cur_f64</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_F64</span><span class=cF0>]);
|
|
<a name="l801"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l802"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l803"></a>
|
|
<a name="l804"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>TK_STR</span><span class=cF0>:
|
|
<a name="l805"></a> cm = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_STR_CONST</span><span class=cF0>);
|
|
<a name="l806"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_STR_CONST</span><span class=cF0>, cm, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_U8</span><span class=cF0>] + </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l807"></a> cm->str = </span><span class=cF5>LexExtStr</span><span class=cF0>(cc, &cm->st_len);
|
|
<a name="l808"></a> cc->flags |= </span><span class=cF3>CCF_HAS_MISC_DATA</span><span class=cF0>;
|
|
<a name="l809"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l810"></a>
|
|
<a name="l811"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>TK_INS_BIN</span><span class=cF0>:
|
|
<a name="l812"></a> cm = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_STR_CONST</span><span class=cF0>);
|
|
<a name="l813"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_STR_CONST</span><span class=cF0>, cm, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_U8</span><span class=cF0>] + </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l814"></a> cm->str = cc->cur_str;
|
|
<a name="l815"></a> cm->st_len = cc->cur_str_len;
|
|
<a name="l816"></a> cc->cur_str = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l817"></a> cc->flags |= </span><span class=cF3>CCF_HAS_MISC_DATA</span><span class=cF0>;
|
|
<a name="l818"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l819"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l820"></a>
|
|
<a name="l821"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'$'</span><span class=cF0>:
|
|
<a name="l822"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0>)
|
|
<a name="l823"></a> {
|
|
<a name="l824"></a> cc->abs_counts.abs_address++;
|
|
<a name="l825"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags &</span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l826"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ABS_ADDR</span><span class=cF0>, cc->aotc->rip, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l827"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l828"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, cc->aotc->rip, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l829"></a> }
|
|
<a name="l830"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l831"></a> {
|
|
<a name="l832"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_CLASS_DOL_OFFSET</span><span class=cF0>)
|
|
<a name="l833"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, cc->class_dol_offset, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l834"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l835"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_RIP</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l836"></a> }
|
|
<a name="l837"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l838"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l839"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l840"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>PREC_TERM</span><span class=cF0> > *max_prec)
|
|
<a name="l841"></a> *max_prec = </span><span class=cF3>PREC_TERM</span><span class=cF0>;
|
|
<a name="l842"></a> </span><span class=cF1>return</span><span class=cF0> PE_MAYBE_MODIFIERS;
|
|
<a name="l843"></a>
|
|
<a name="l844"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'('</span><span class=cF0>:
|
|
<a name="l845"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF3>TK_IDENT</span><span class=cF0> && cc->hash_entry && cc->hash_entry->type & </span><span class=cF7>(</span><span class=cF3>HTT_CLASS</span><span class=cF0> | </span><span class=cF3>HTT_INTERNAL_TYPE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l846"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Use ZealOS postfix typecasting at "</span><span class=cF0>);
|
|
<a name="l847"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l848"></a> {
|
|
<a name="l849"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>PREC_TERM</span><span class=cF0> > *max_prec)
|
|
<a name="l850"></a> *max_prec = </span><span class=cF3>PREC_TERM</span><span class=cF0>;
|
|
<a name="l851"></a> </span><span class=cF1>if</span><span class=cF0> (cc->lex_include_stack->flags & </span><span class=cF3>LFSF_DEFINE</span><span class=cF0>)
|
|
<a name="l852"></a> paren_warn = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l853"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l854"></a> paren_warn = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l855"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>ParseExpression</span><span class=cF7>(</span><span class=cF0>cc, paren_prec, </span><span class=cF3>FALSE</span><span class=cF0>, ps</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l856"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l857"></a> </span><span class=cF1>if</span><span class=cF0> (!paren_warn)
|
|
<a name="l858"></a> *paren_prec = </span><span class=cF3>PREC_NULL</span><span class=cF0>;
|
|
<a name="l859"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l860"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l861"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip )</span><span class=cF0>
|
|
<a name="l862"></a> cc->flags = cc->flags & ~</span><span class=cF3>CCF_ARRAY</span><span class=cF0> | </span><span class=cF3>CCF_RAX</span><span class=cF0> | </span><span class=cF3>CCF_PAREN</span><span class=cF0>;
|
|
<a name="l863"></a> </span><span class=cF1>return</span><span class=cF0> PE_UNARY_MODIFIERS;
|
|
<a name="l864"></a> }
|
|
<a name="l865"></a>
|
|
<a name="l866"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l867"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'+'</span><span class=cF0>: </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l868"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>TK_PLUS_PLUS</span><span class=cF0>: cc->flags |= </span><span class=cF3>CCF_PREINC</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l869"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>TK_MINUS_MINUS</span><span class=cF0>: cc->flags |= </span><span class=cF3>CCF_PREDEC</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l870"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l871"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0> > *max_prec)
|
|
<a name="l872"></a> *max_prec = </span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0>;
|
|
<a name="l873"></a> *unary_pre_prec = </span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0>;
|
|
<a name="l874"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l875"></a> </span><span class=cF1>return</span><span class=cF0> PE_UNARY_TERM2;
|
|
<a name="l876"></a>
|
|
<a name="l877"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>TK_IDENT</span><span class=cF0>:
|
|
<a name="l878"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm = cc->local_var_entry)
|
|
<a name="l879"></a> {
|
|
<a name="l880"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>PREC_TERM</span><span class=cF0> > *max_prec)
|
|
<a name="l881"></a> *max_prec = </span><span class=cF3>PREC_TERM</span><span class=cF0>;
|
|
<a name="l882"></a> cc->flags &= ~(</span><span class=cF3>CCF_RAX</span><span class=cF0> | </span><span class=cF3>CCF_ARRAY</span><span class=cF0> | </span><span class=cF3>CCF_FUN_EXP</span><span class=cF0>);
|
|
<a name="l883"></a> tmpc = tmpm->member_class + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l884"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->flags & </span><span class=cF3>MLF_FUN</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>cc->flags & </span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l885"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l886"></a> </span><span class=cFD>ParsePopDeref</span><span class=cF0>(ps);
|
|
<a name="l887"></a> cc->flags |= </span><span class=cF3>CCF_FUN_EXP</span><span class=cF0>;
|
|
<a name="l888"></a> </span><span class=cFD>ParsePush2</span><span class=cF0>(ps, tmpm->fun_ptr - tmpm->fun_ptr->ptr_stars_count);
|
|
<a name="l889"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l890"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->dim.next)
|
|
<a name="l891"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l892"></a> *_tmpad = tmpm->dim.next;
|
|
<a name="l893"></a> cc->flags |= </span><span class=cF3>CCF_ARRAY</span><span class=cF0>;
|
|
<a name="l894"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l895"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->flags & </span><span class=cF3>MLF_STATIC</span><span class=cF0>)
|
|
<a name="l896"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l897"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l898"></a> {
|
|
<a name="l899"></a> </span><span class=cF2>//</span><span class=cF0> </span><span class=cF2>if (tmpg->flags&GVF_DATA_HEAP) //TODO</span><span class=cF0>
|
|
<a name="l900"></a> </span><span class=cF2>//</span><span class=cF0> </span><span class=cF2>ICAdd(cc,IC_HEAP_GLOBAL,tmpm->static_data,tmpc);</span><span class=cF0>
|
|
<a name="l901"></a> </span><span class=cF2>//</span><span class=cF0> </span><span class=cF2>else</span><span class=cF0>
|
|
<a name="l902"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ABS_ADDR</span><span class=cF0>, tmpm->static_data_rip, tmpc);
|
|
<a name="l903"></a> }
|
|
<a name="l904"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l905"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, tmpm->static_data, tmpc);
|
|
<a name="l906"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l907"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l908"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l909"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF0>)
|
|
<a name="l910"></a> {
|
|
<a name="l911"></a> i = </span><span class=cFD>ParsePop</span><span class=cF0>(ps);
|
|
<a name="l912"></a> ps->ptr--;
|
|
<a name="l913"></a> </span><span class=cF1>if</span><span class=cF0> (i.u16[</span><span class=cFE>0</span><span class=cF0>] != </span><span class=cF3>IC_ADDR</span><span class=cF0>)
|
|
<a name="l914"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Expecting '&' at "</span><span class=cF0>);
|
|
<a name="l915"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, tmpm-></span><span class=cF1>offset</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l916"></a> *_local_var = tmpm;
|
|
<a name="l917"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l918"></a> </span><span class=cF1>return</span><span class=cF0> PE_MAYBE_MODIFIERS;
|
|
<a name="l919"></a> }
|
|
<a name="l920"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l921"></a> {
|
|
<a name="l922"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->dim.next && tmpm-></span><span class=cF1>offset</span><span class=cF0> > </span><span class=cFE>0</span><span class=cF0> && </span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>tmpm->str, </span><span class=cF6>"argv"</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l923"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l924"></a> tmpc++;
|
|
<a name="l925"></a> cc->flags &= ~</span><span class=cF3>CCF_ARRAY</span><span class=cF0>;
|
|
<a name="l926"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l927"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_RBP</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l928"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, tmpm-></span><span class=cF1>offset</span><span class=cF0>, tmpc);
|
|
<a name="l929"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ADD</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l930"></a> }
|
|
<a name="l931"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l932"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip variable name</span><span class=cF0>
|
|
<a name="l933"></a> *_local_var = tmpm;
|
|
<a name="l934"></a> </span><span class=cF1>return</span><span class=cF0> PE_UNARY_MODIFIERS;
|
|
<a name="l935"></a> }
|
|
<a name="l936"></a>pu_ident_but_not_local_var:
|
|
<a name="l937"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpex = cc->hash_entry</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l938"></a> {
|
|
<a name="l939"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc->flags & </span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l940"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Invalid lval at "</span><span class=cF0>);
|
|
<a name="l941"></a> tmpc = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l942"></a>pu_new_sys_sym:
|
|
<a name="l943"></a> tmpex = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CHashExport</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF5>Fs</span><span class=cF0>->code_heap);
|
|
<a name="l944"></a> tmpex->str = cc->cur_str;
|
|
<a name="l945"></a> cc->cur_str = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l946"></a> </span><span class=cF1>if</span><span class=cF0> (!cc->htc.local_var_list && *tmpex->str == </span><span class=cF6>'@'</span><span class=cF0> && tmpex->str[</span><span class=cFE>1</span><span class=cF0>] == </span><span class=cF6>'@'</span><span class=cF0>)
|
|
<a name="l947"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l948"></a> tmpex->type = </span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF0> | </span><span class=cF3>HTF_UNRESOLVED</span><span class=cF0> | </span><span class=cF3>HTF_LOCAL</span><span class=cF0>;
|
|
<a name="l949"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpex, cc->htc.local_hash_table);
|
|
<a name="l950"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l951"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l952"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l953"></a> tmpex->type = </span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF0> | </span><span class=cF3>HTF_UNRESOLVED</span><span class=cF0>;
|
|
<a name="l954"></a> </span><span class=cF1>if</span><span class=cF0> (tmpc)
|
|
<a name="l955"></a> </span><span class=cF5>HashAddAfter</span><span class=cF0>(tmpex, tmpc, cc->htc.global_hash_table);
|
|
<a name="l956"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l957"></a> </span><span class=cF5>HashAdd</span><span class=cF0>(tmpex, cc->htc.global_hash_table);
|
|
<a name="l958"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l959"></a> }
|
|
<a name="l960"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>Bsf</span><span class=cF7>(</span><span class=cF0>tmpex->type</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l961"></a> {
|
|
<a name="l962"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_EXPORT_SYS_SYM</span><span class=cF0>:
|
|
<a name="l963"></a>pu_export_sys_sym:
|
|
<a name="l964"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>PREC_TERM</span><span class=cF0> > *max_prec)
|
|
<a name="l965"></a> *max_prec = </span><span class=cF3>PREC_TERM</span><span class=cF0>;
|
|
<a name="l966"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpex->type & (</span><span class=cF3>HTF_IMM</span><span class=cF0> | </span><span class=cF3>HTF_IMPORT</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l967"></a> cc->abs_counts.abs_address++;
|
|
<a name="l968"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex->type & </span><span class=cF3>HTF_UNRESOLVED</span><span class=cF0>)
|
|
<a name="l969"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l970"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc->flags & </span><span class=cF3>CCF_ASM_EXPRESSIONS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l971"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Illegal forward ref at "</span><span class=cF0>);
|
|
<a name="l972"></a> tmpauh = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CAsmUndefHash</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l973"></a> tmpauh->hash = tmpex;
|
|
<a name="l974"></a> tmpauh->next = cc->asm_undef_hash;
|
|
<a name="l975"></a> cc->asm_undef_hash = tmpauh;
|
|
<a name="l976"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex->type & </span><span class=cF3>HTF_LOCAL</span><span class=cF0>)
|
|
<a name="l977"></a> cc->flags |= </span><span class=cF3>CCF_UNRESOLVED</span><span class=cF0> | </span><span class=cF3>CCF_LOCAL</span><span class=cF0>;
|
|
<a name="l978"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l979"></a> cc->flags |= </span><span class=cF3>CCF_UNRESOLVED</span><span class=cF0>;
|
|
<a name="l980"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, &tmpex->val, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>], </span><span class=cF3>ICF_NO_RIP</span><span class=cF0>);
|
|
<a name="l981"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_DEREF</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l982"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l983"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l984"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l985"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>tmpex->type & </span><span class=cF3>HTF_IMM</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l986"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ABS_ADDR</span><span class=cF0>, tmpex->val, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l987"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l988"></a> {
|
|
<a name="l989"></a> </span><span class=cF1>if</span><span class=cF0> (tmpex->type & </span><span class=cF3>HTF_IMM</span><span class=cF0>)
|
|
<a name="l990"></a> cc->abs_counts.c_address++;
|
|
<a name="l991"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, tmpex->val, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_PTR</span><span class=cF0>]);
|
|
<a name="l992"></a> }
|
|
<a name="l993"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l994"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l995"></a> </span><span class=cF1>return</span><span class=cF0> PE_MAYBE_MODIFIERS;
|
|
<a name="l996"></a>
|
|
<a name="l997"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_FUN</span><span class=cF0>:
|
|
<a name="l998"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>PREC_TERM</span><span class=cF0> > *max_prec)
|
|
<a name="l999"></a> *max_prec = </span><span class=cF3>PREC_TERM</span><span class=cF0>;
|
|
<a name="l1000"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip fun name</span><span class=cF0>
|
|
<a name="l1001"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFD>ParseFunCall</span><span class=cF0>(cc, ps, </span><span class=cF3>FALSE</span><span class=cF0>, tmpex);
|
|
<a name="l1002"></a>
|
|
<a name="l1003"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_GLOBAL_VAR</span><span class=cF0>:
|
|
<a name="l1004"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>PREC_TERM</span><span class=cF0> > *max_prec)
|
|
<a name="l1005"></a> *max_prec = </span><span class=cF3>PREC_TERM</span><span class=cF0>;
|
|
<a name="l1006"></a> tmpg = tmpex;
|
|
<a name="l1007"></a> tmpc = tmpg->var_class + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l1008"></a> cc->flags &= ~(</span><span class=cF3>CCF_RAX</span><span class=cF0> | </span><span class=cF3>CCF_ARRAY</span><span class=cF0> | </span><span class=cF3>CCF_FUN_EXP</span><span class=cF0>);
|
|
<a name="l1009"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg->flags & </span><span class=cF3>GVF_ARRAY</span><span class=cF0>)
|
|
<a name="l1010"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1011"></a> *_tmpad = tmpg->dim.next;
|
|
<a name="l1012"></a> cc->flags |= </span><span class=cF3>CCF_ARRAY</span><span class=cF0>;
|
|
<a name="l1013"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1014"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_AOT_COMPILE</span><span class=cF0>)
|
|
<a name="l1015"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1016"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg->flags & </span><span class=cF3>GVF_EXTERN</span><span class=cF0>) </span><span class=cF2>//TODO</span><span class=cF0>
|
|
<a name="l1017"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Feature not implemented "</span><span class=cF0>);
|
|
<a name="l1018"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1019"></a> {
|
|
<a name="l1020"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg->flags & </span><span class=cF3>GVF_IMPORT</span><span class=cF0>)
|
|
<a name="l1021"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ADDR_IMPORT</span><span class=cF0>, tmpg, tmpc);
|
|
<a name="l1022"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1023"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1024"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg->flags & </span><span class=cF3>GVF_DATA_HEAP</span><span class=cF0>)
|
|
<a name="l1025"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_HEAP_GLOBAL</span><span class=cF0>, tmpg->heap_global, tmpc);
|
|
<a name="l1026"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1027"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ABS_ADDR</span><span class=cF0>, tmpg->data_addr_rip, tmpc);
|
|
<a name="l1028"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1029"></a> }
|
|
<a name="l1030"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1031"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1032"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1033"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg->flags & </span><span class=cF3>GVF_EXTERN</span><span class=cF0>)
|
|
<a name="l1034"></a> {
|
|
<a name="l1035"></a> cc->abs_counts.externs++;
|
|
<a name="l1036"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, &tmpg->data_addr, tmpc);
|
|
<a name="l1037"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_DEREF</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l1038"></a> }
|
|
<a name="l1039"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1040"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, tmpg->data_addr, tmpc);
|
|
<a name="l1041"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1042"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1043"></a> </span><span class=cF1>if</span><span class=cF0> (tmpg->flags & </span><span class=cF3>GVF_FUN</span><span class=cF0>)
|
|
<a name="l1044"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1045"></a> </span><span class=cFD>ParsePopDeref</span><span class=cF0>(ps);
|
|
<a name="l1046"></a> cc->flags |= </span><span class=cF3>CCF_FUN_EXP</span><span class=cF0>;
|
|
<a name="l1047"></a> </span><span class=cFD>ParsePush2</span><span class=cF0>(ps, tmpg->fun_ptr - tmpg->fun_ptr->ptr_stars_count);
|
|
<a name="l1048"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1049"></a> </span><span class=cF1>return</span><span class=cF0> PE_UNARY_MODIFIERS;
|
|
<a name="l1050"></a>
|
|
<a name="l1051"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_CLASS</span><span class=cF0>:
|
|
<a name="l1052"></a> </span><span class=cFD>ParseOffsetOf</span><span class=cF0>(cc);
|
|
<a name="l1053"></a> </span><span class=cF1>return</span><span class=cF0> PE_MAYBE_MODIFIERS;
|
|
<a name="l1054"></a>
|
|
<a name="l1055"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_KEYWORD</span><span class=cF0>:
|
|
<a name="l1056"></a> </span><span class=cF1>switch</span><span class=cF0> (tmpex</span><span class=cF7>(</span><span class=cF9>CHashGeneric</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->user_data0)
|
|
<a name="l1057"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1058"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_SIZEOF</span><span class=cF0>:
|
|
<a name="l1059"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>PREC_TERM</span><span class=cF0> > *max_prec)
|
|
<a name="l1060"></a> *max_prec = </span><span class=cF3>PREC_TERM</span><span class=cF0>;
|
|
<a name="l1061"></a> j = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1062"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l1063"></a> j++;
|
|
<a name="l1064"></a> </span><span class=cFD>ParseSizeOf</span><span class=cF0>(cc);
|
|
<a name="l1065"></a> </span><span class=cF1>while</span><span class=cF0> (j--)
|
|
<a name="l1066"></a> {
|
|
<a name="l1067"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l1068"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l1069"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1070"></a> }
|
|
<a name="l1071"></a> </span><span class=cF1>return</span><span class=cF0> PE_MAYBE_MODIFIERS;
|
|
<a name="l1072"></a>
|
|
<a name="l1073"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_OFFSET</span><span class=cF0>:
|
|
<a name="l1074"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>PREC_TERM</span><span class=cF0> > *max_prec)
|
|
<a name="l1075"></a> *max_prec = </span><span class=cF3>PREC_TERM</span><span class=cF0>;
|
|
<a name="l1076"></a> j = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1077"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l1078"></a> j++;
|
|
<a name="l1079"></a> </span><span class=cFD>ParseOffsetOf</span><span class=cF0>(cc);
|
|
<a name="l1080"></a> </span><span class=cF1>while</span><span class=cF0> (j--)
|
|
<a name="l1081"></a> {
|
|
<a name="l1082"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l1083"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l1084"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1085"></a> }
|
|
<a name="l1086"></a> </span><span class=cF1>return</span><span class=cF0> PE_MAYBE_MODIFIERS;
|
|
<a name="l1087"></a>
|
|
<a name="l1088"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>KW_DEFINED</span><span class=cF0>:
|
|
<a name="l1089"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>PREC_TERM</span><span class=cF0> > *max_prec)
|
|
<a name="l1090"></a> *max_prec = </span><span class=cF3>PREC_TERM</span><span class=cF0>;
|
|
<a name="l1091"></a> j = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1092"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> == </span><span class=cF6>'('</span><span class=cF0>)
|
|
<a name="l1093"></a> j++;
|
|
<a name="l1094"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token == </span><span class=cF3>TK_IDENT</span><span class=cF0> && </span><span class=cF7>(</span><span class=cF0>cc->hash_entry || cc->local_var_entry</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1095"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l1096"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1097"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cFB>cmp</span><span class=cF0>.internal_types[</span><span class=cF3>RT_I64</span><span class=cF0>]);
|
|
<a name="l1098"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1099"></a> </span><span class=cF1>while</span><span class=cF0> (j--)
|
|
<a name="l1100"></a> {
|
|
<a name="l1101"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l1102"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l1103"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1104"></a> }
|
|
<a name="l1105"></a> </span><span class=cF1>return</span><span class=cF0> PE_MAYBE_MODIFIERS;
|
|
<a name="l1106"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1107"></a> }
|
|
<a name="l1108"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1109"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing expression at "</span><span class=cF0>);
|
|
<a name="l1110"></a>}
|
|
<a name="l1111"></a>
|
|
<a name="l1112"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>ParseUnaryModifier</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>CParseStack</span><span class=cF0> *ps, </span><span class=cF9>CMemberList</span><span class=cF0> **_local_var, </span><span class=cF9>CArrayDim</span><span class=cF0> **_tmpad, </span><span class=cF9>I64</span><span class=cF0> *unary_post_prec)
|
|
<a name="l1113"></a>{
|
|
<a name="l1114"></a> </span><span class=cF9>CHashClass</span><span class=cF0> *tmpc, *tmpc1;
|
|
<a name="l1115"></a> </span><span class=cF9>CHashFun</span><span class=cF0> *fun_ptr;
|
|
<a name="l1116"></a> </span><span class=cF9>CMemberList</span><span class=cF0> *tmpm = *_local_var;
|
|
<a name="l1117"></a> </span><span class=cF9>CIntermediateCode</span><span class=cF0> *tmpi, *tmpi1;
|
|
<a name="l1118"></a> </span><span class=cF9>CArrayDim</span><span class=cF0> *tmpad1, tmpad2;
|
|
<a name="l1119"></a> </span><span class=cF9>CCodeMisc</span><span class=cF0> *cm;
|
|
<a name="l1120"></a> </span><span class=cF9>I64</span><span class=cF0> mode, old_flags;
|
|
<a name="l1121"></a> </span><span class=cF1>Bool</span><span class=cF0> was_paren = </span><span class=cF5>Btr</span><span class=cF0>(&cc->flags, </span><span class=cF3>CCf_PAREN</span><span class=cF0>);
|
|
<a name="l1122"></a>
|
|
<a name="l1123"></a> *_local_var = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l1124"></a> </span><span class=cF1>switch</span><span class=cF0> (cc->token)
|
|
<a name="l1125"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1126"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'.'</span><span class=cF0>:
|
|
<a name="l1127"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm)
|
|
<a name="l1128"></a> tmpm-></span><span class=cF1>reg</span><span class=cF0> = </span><span class=cF3>REG_NONE</span><span class=cF0>;
|
|
<a name="l1129"></a> </span><span class=cF1>goto</span><span class=cF0> um_join;
|
|
<a name="l1130"></a>
|
|
<a name="l1131"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>TK_DEREFERENCE</span><span class=cF0>:
|
|
<a name="l1132"></a> tmpi = cc->coc.coc_head.last;
|
|
<a name="l1133"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc->flags & (</span><span class=cF3>CCF_RAX</span><span class=cF0> | </span><span class=cF3>CCF_ARRAY</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1134"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_DEREF</span><span class=cF0> + </span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpi->ic_class - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l1135"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1136"></a> tmpi->ic_class--;
|
|
<a name="l1137"></a>
|
|
<a name="l1138"></a> um_join:
|
|
<a name="l1139"></a> </span><span class=cF1>if</span><span class=cF0> (!*unary_post_prec)
|
|
<a name="l1140"></a> *unary_post_prec = </span><span class=cF3>PREC_TERM</span><span class=cF0>;
|
|
<a name="l1141"></a> tmpc = cc->coc.coc_head.last->ic_class;
|
|
<a name="l1142"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>!tmpc->ptr_stars_count || cc->flags & </span><span class=cF3>CCF_ARRAY</span><span class=cF7>)</span><span class=cF0> && cc->token == </span><span class=cF6>'.'</span><span class=cF0>)
|
|
<a name="l1143"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Must be address, not value "</span><span class=cF0>);
|
|
<a name="l1144"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc->flags & </span><span class=cF3>CCF_RAX</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1145"></a> tmpc--;
|
|
<a name="l1146"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmpc->type & </span><span class=cF3>HTT_CLASS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1147"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Invalid class at "</span><span class=cF0>);
|
|
<a name="l1148"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF3>TK_IDENT</span><span class=cF0> || !</span><span class=cF7>(</span><span class=cF0>tmpm = </span><span class=cF5>MemberFind</span><span class=cF0>(cc->cur_str, tmpc)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1149"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Invalid member at "</span><span class=cF0>);
|
|
<a name="l1150"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc->local_var_entry)
|
|
<a name="l1151"></a> cc->local_var_entry->use_count--;
|
|
<a name="l1152"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip member name</span><span class=cF0>
|
|
<a name="l1153"></a> tmpc1 = tmpm->member_class + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l1154"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, tmpm-></span><span class=cF1>offset</span><span class=cF0>, tmpc1);
|
|
<a name="l1155"></a> cc->flags &= ~(</span><span class=cF3>CCF_RAX</span><span class=cF0> | </span><span class=cF3>CCF_ARRAY</span><span class=cF0> | </span><span class=cF3>CCF_FUN_EXP</span><span class=cF0>);
|
|
<a name="l1156"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->dim.next)
|
|
<a name="l1157"></a> {
|
|
<a name="l1158"></a> *_tmpad = tmpm->dim.next;
|
|
<a name="l1159"></a> cc->flags |= </span><span class=cF3>CCF_ARRAY</span><span class=cF0>;
|
|
<a name="l1160"></a> }
|
|
<a name="l1161"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm->flags & </span><span class=cF3>MLF_FUN</span><span class=cF0>)
|
|
<a name="l1162"></a> {
|
|
<a name="l1163"></a> </span><span class=cFD>ParsePopDeref</span><span class=cF0>(ps);
|
|
<a name="l1164"></a> </span><span class=cFD>ParsePush2</span><span class=cF0>(ps, tmpm->fun_ptr - tmpm->fun_ptr->ptr_stars_count);
|
|
<a name="l1165"></a> cc->flags |= </span><span class=cF3>CCF_FUN_EXP</span><span class=cF0>;
|
|
<a name="l1166"></a> }
|
|
<a name="l1167"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ADD</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpc1);
|
|
<a name="l1168"></a> </span><span class=cF1>return</span><span class=cF0> PE_UNARY_MODIFIERS;
|
|
<a name="l1169"></a>
|
|
<a name="l1170"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'('</span><span class=cF0>:
|
|
<a name="l1171"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags & </span><span class=cF3>CCF_FUN_EXP</span><span class=cF0>)
|
|
<a name="l1172"></a> {
|
|
<a name="l1173"></a> </span><span class=cF1>if</span><span class=cF0> (!*unary_post_prec)
|
|
<a name="l1174"></a> *unary_post_prec = </span><span class=cF3>PREC_TERM</span><span class=cF0>;
|
|
<a name="l1175"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFD>ParseFunCall</span><span class=cF0>(cc, ps, </span><span class=cF3>TRUE</span><span class=cF0>, </span><span class=cFD>ParsePop2</span><span class=cF7>(</span><span class=cF0>ps</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l1176"></a> }
|
|
<a name="l1177"></a> </span><span class=cF1>if</span><span class=cF0> (!*unary_post_prec)
|
|
<a name="l1178"></a> *unary_post_prec = </span><span class=cF3>PREC_TERM</span><span class=cF0>;
|
|
<a name="l1179"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Lex</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0> != </span><span class=cF3>TK_IDENT</span><span class=cF0>)
|
|
<a name="l1180"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Invalid class at "</span><span class=cF0>);
|
|
<a name="l1181"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Btr</span><span class=cF7>(</span><span class=cF0>&cc->flags, </span><span class=cF3>CCf_FUN_EXP</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1182"></a> ps->ptr2--;
|
|
<a name="l1183"></a> cc->flags &= ~</span><span class=cF3>CCF_ARRAY</span><span class=cF0>;
|
|
<a name="l1184"></a> tmpc = cc->hash_entry;
|
|
<a name="l1185"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1186"></a> mode = </span><span class=cF3>PRS0_TYPECAST</span><span class=cF0> | </span><span class=cF3>PRS1_NULL</span><span class=cF0>;
|
|
<a name="l1187"></a> tmpc = </span><span class=cFD>ParseType</span><span class=cF0>(cc, &tmpc, &mode, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>NULL</span><span class=cF0>, &fun_ptr, </span><span class=cF3>NULL</span><span class=cF0>, &tmpad2, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1188"></a> </span><span class=cF1>if</span><span class=cF0> (fun_ptr)
|
|
<a name="l1189"></a> {
|
|
<a name="l1190"></a> </span><span class=cFD>ParsePopDeref</span><span class=cF0>(ps);
|
|
<a name="l1191"></a> </span><span class=cF5>Bts</span><span class=cF0>(&cc->flags, </span><span class=cF3>CCf_FUN_EXP</span><span class=cF0>);
|
|
<a name="l1192"></a> </span><span class=cFD>ParsePush2</span><span class=cF0>(ps, fun_ptr);
|
|
<a name="l1193"></a> cm=</span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_HASH_ENTRY</span><span class=cF0>);
|
|
<a name="l1194"></a> cm->h = fun_ptr;
|
|
<a name="l1195"></a> }
|
|
<a name="l1196"></a> </span><span class=cF1>if</span><span class=cF0> (*_tmpad = tmpad2.next)
|
|
<a name="l1197"></a> {
|
|
<a name="l1198"></a> cc->flags |= </span><span class=cF3>CCF_ARRAY</span><span class=cF0>;
|
|
<a name="l1199"></a> tmpc++;
|
|
<a name="l1200"></a> cm = </span><span class=cFD>COCMiscNew</span><span class=cF0>(cc, </span><span class=cF3>CMT_ARRAY_DIM</span><span class=cF0>);
|
|
<a name="l1201"></a> cm->dim = *_tmpad;
|
|
<a name="l1202"></a> }
|
|
<a name="l1203"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc->flags & (</span><span class=cF3>CCF_RAX</span><span class=cF0> | </span><span class=cF3>CCF_ARRAY</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1204"></a> tmpc++;
|
|
<a name="l1205"></a> tmpi = cc->coc.coc_head.last;
|
|
<a name="l1206"></a> tmpi->ic_class = tmpc;
|
|
<a name="l1207"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_POSTFIX_TYPECAST</span><span class=cF0>, was_paren, tmpc);
|
|
<a name="l1208"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>')'</span><span class=cF0>)
|
|
<a name="l1209"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ')' at "</span><span class=cF0>);
|
|
<a name="l1210"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1211"></a> </span><span class=cF1>return</span><span class=cF0> PE_UNARY_MODIFIERS;
|
|
<a name="l1212"></a>
|
|
<a name="l1213"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'['</span><span class=cF0>:
|
|
<a name="l1214"></a> </span><span class=cF1>if</span><span class=cF0> (!*unary_post_prec)
|
|
<a name="l1215"></a> *unary_post_prec = </span><span class=cF3>PREC_TERM</span><span class=cF0>;
|
|
<a name="l1216"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1217"></a> tmpc = </span><span class=cF5>OptClassFwd</span><span class=cF0>(cc->coc.coc_head.last->ic_class);
|
|
<a name="l1218"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpc->ptr_stars_count)
|
|
<a name="l1219"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Not array or pointer "</span><span class=cF0>);
|
|
<a name="l1220"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc->flags & (</span><span class=cF3>CCF_ARRAY</span><span class=cF0> | </span><span class=cF3>CCF_RAX</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1221"></a> {
|
|
<a name="l1222"></a> tmpc = </span><span class=cF5>OptClassFwd</span><span class=cF0>(tmpc - </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l1223"></a> </span><span class=cF1>if</span><span class=cF0> (!tmpc->ptr_stars_count)
|
|
<a name="l1224"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Not array or pointer "</span><span class=cF0>);
|
|
<a name="l1225"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_DEREF</span><span class=cF0> + </span><span class=cF3>PREC_UNARY_PRE</span><span class=cF0> << </span><span class=cFE>16</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l1226"></a> }
|
|
<a name="l1227"></a> tmpc1 = tmpc - </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l1228"></a> </span><span class=cF1>if</span><span class=cF0> (tmpad1 = *_tmpad)
|
|
<a name="l1229"></a> {
|
|
<a name="l1230"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, tmpad1->total_count * tmpc1->size, tmpc);
|
|
<a name="l1231"></a> </span><span class=cF1>if</span><span class=cF0> (*_tmpad = tmpad1->next)
|
|
<a name="l1232"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1233"></a> old_flags = cc->flags;
|
|
<a name="l1234"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>ParseExpression</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>, ps</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1235"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l1236"></a> cc->flags = cc->flags & ~</span><span class=cF3>CCF_FUN_EXP</span><span class=cF0> | old_flags & </span><span class=cF3>CCF_FUN_EXP</span><span class=cF0>;
|
|
<a name="l1237"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>']'</span><span class=cF0>)
|
|
<a name="l1238"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc, </span><span class=cF6>"Missing ']' at "</span><span class=cF0>);
|
|
<a name="l1239"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip ]</span><span class=cF0>
|
|
<a name="l1240"></a> tmpi1 = cc->coc.coc_head.last;
|
|
<a name="l1241"></a> tmpi1->ic_flags |= </span><span class=cF3>ICF_RES_TO_INT</span><span class=cF0>;
|
|
<a name="l1242"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_MUL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l1243"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ADD</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l1244"></a> cc->flags |= </span><span class=cF3>CCF_RAX</span><span class=cF0>;
|
|
<a name="l1245"></a> </span><span class=cF1>return</span><span class=cF0> PE_UNARY_MODIFIERS;
|
|
<a name="l1246"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1247"></a> }
|
|
<a name="l1248"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1249"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_IMM_I64</span><span class=cF0>, tmpc1->size, tmpc);
|
|
<a name="l1250"></a> old_flags = cc->flags;
|
|
<a name="l1251"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cFD>ParseExpression</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF0>, ps</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1252"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Compiler'</span><span class=cF0>);
|
|
<a name="l1253"></a> cc->flags = cc->flags & ~</span><span class=cF3>CCF_FUN_EXP</span><span class=cF0> | old_flags & </span><span class=cF3>CCF_FUN_EXP</span><span class=cF0>;
|
|
<a name="l1254"></a> </span><span class=cF1>if</span><span class=cF0> (cc->token != </span><span class=cF6>']'</span><span class=cF0>)
|
|
<a name="l1255"></a> </span><span class=cF5>LexExcept</span><span class=cF0>(cc,</span><span class=cF6>"Missing ']' at "</span><span class=cF0>);
|
|
<a name="l1256"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc); </span><span class=cF2>//skip ]</span><span class=cF0>
|
|
<a name="l1257"></a> tmpi1 = cc->coc.coc_head.last;
|
|
<a name="l1258"></a> tmpi1->ic_flags |= </span><span class=cF3>ICF_RES_TO_INT</span><span class=cF0>;
|
|
<a name="l1259"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_MUL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l1260"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_ADD</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, tmpc);
|
|
<a name="l1261"></a> cc->flags &= ~(</span><span class=cF3>CCF_RAX</span><span class=cF0> | </span><span class=cF3>CCF_ARRAY</span><span class=cF0>);
|
|
<a name="l1262"></a> </span><span class=cF1>return</span><span class=cF0> PE_UNARY_MODIFIERS;
|
|
<a name="l1263"></a> </span><span class=cF1>start</span><span class=cF0>:
|
|
<a name="l1264"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>TK_PLUS_PLUS</span><span class=cF0>:
|
|
<a name="l1265"></a> cc->flags |= </span><span class=cF3>CCF_POSTINC</span><span class=cF0>;
|
|
<a name="l1266"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1267"></a>
|
|
<a name="l1268"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>TK_MINUS_MINUS</span><span class=cF0>:
|
|
<a name="l1269"></a> cc->flags |= </span><span class=cF3>CCF_POSTDEC</span><span class=cF0>;
|
|
<a name="l1270"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l1271"></a> </span><span class=cF1>end</span><span class=cF0>:
|
|
<a name="l1272"></a> </span><span class=cF1>if</span><span class=cF0> (!*unary_post_prec)
|
|
<a name="l1273"></a> *unary_post_prec = </span><span class=cF3>PREC_UNARY_POST</span><span class=cF0>;
|
|
<a name="l1274"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
|
<a name="l1275"></a> </span><span class=cF1>return</span><span class=cF0> PE_DEREFERENCE;
|
|
<a name="l1276"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1277"></a>
|
|
<a name="l1278"></a> </span><span class=cF1>return</span><span class=cF0> PE_DEREFERENCE;
|
|
<a name="l1279"></a>}
|
|
<a name="l1280"></a>
|
|
<a name="l1281"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>LexExpression2Bin</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF9>I64</span><span class=cF0> *_type=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
<a name="l1282"></a>{</span><span class=cF2>//Compile cc expression. You call the code.</span><span class=cF0>
|
|
<a name="l1283"></a> </span><span class=cF1>U8</span><span class=cF0> *res;
|
|
<a name="l1284"></a> </span><span class=cF9>I64</span><span class=cF0> size;
|
|
<a name="l1285"></a> </span><span class=cF1>Bool</span><span class=cF0> old_trace = </span><span class=cF5>Btr</span><span class=cF0>(&cc->flags, </span><span class=cF3>CCf_PASS_TRACE_PRESENT</span><span class=cF0>);
|
|
<a name="l1286"></a>
|
|
<a name="l1287"></a> </span><span class=cFD>COCPush</span><span class=cF0>(cc);
|
|
<a name="l1288"></a> </span><span class=cFD>COCInit</span><span class=cF0>(cc);
|
|
<a name="l1289"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFD>ParseExpression</span><span class=cF7>(</span><span class=cF0>cc, </span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1290"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1291"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_RETURN_VAL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1292"></a> </span><span class=cFD>ICAdd</span><span class=cF0>(cc, </span><span class=cF3>IC_RET</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l1293"></a> res = </span><span class=cFD>COCCompile</span><span class=cF0>(cc, &size, </span><span class=cF3>NULL</span><span class=cF0>, _type);
|
|
<a name="l1294"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1295"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1296"></a> res = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l1297"></a> </span><span class=cFD>COCPop</span><span class=cF0>(cc);
|
|
<a name="l1298"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&cc->flags, </span><span class=cF3>CCf_PASS_TRACE_PRESENT</span><span class=cF0>, old_trace);
|
|
<a name="l1299"></a>
|
|
<a name="l1300"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l1301"></a>}
|
|
<a name="l1302"></a>
|
|
<a name="l1303"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>IsLexExpression2Bin</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc, </span><span class=cF1>U8</span><span class=cF0> **_machine_code)
|
|
<a name="l1304"></a>{</span><span class=cF2>//Compile cc expression to bin. Return error status.</span><span class=cF0>
|
|
<a name="l1305"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>ToBool</span><span class=cF0>(*_machine_code = </span><span class=cF5>LexExpression2Bin</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l1306"></a>}
|
|
<a name="l1307"></a>
|
|
<a name="l1308"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>LexExpressionI64</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc)
|
|
<a name="l1309"></a>{</span><span class=cF2>//Compile cc expression, forcing to I64 and eval.</span><span class=cF0>
|
|
<a name="l1310"></a> </span><span class=cF1>U8</span><span class=cF0> *machine_code;
|
|
<a name="l1311"></a> </span><span class=cF9>I64</span><span class=cF0> res, type;
|
|
<a name="l1312"></a>
|
|
<a name="l1313"></a> </span><span class=cF1>if</span><span class=cF0> (machine_code = </span><span class=cF5>LexExpression2Bin</span><span class=cF7>(</span><span class=cF0>cc, &type</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1314"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1315"></a> res = </span><span class=cF5>Call</span><span class=cF0>(machine_code);
|
|
<a name="l1316"></a> </span><span class=cF5>Free</span><span class=cF0>(machine_code);
|
|
<a name="l1317"></a> </span><span class=cF1>if</span><span class=cF0> (type == </span><span class=cF3>RT_F64</span><span class=cF0>)
|
|
<a name="l1318"></a> res = </span><span class=cF5>ToI64</span><span class=cF0>(res</span><span class=cF7>(</span><span class=cF1>F64</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l1319"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1320"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1321"></a> res = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1322"></a>
|
|
<a name="l1323"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l1324"></a>}
|
|
<a name="l1325"></a>
|
|
<a name="l1326"></a></span><span class=cF1>F64</span><span class=cF0> </span><span class=cF5>LexExpressionF64</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc)
|
|
<a name="l1327"></a>{</span><span class=cF2>//Compile cc expression, forcing to F64 and eval.</span><span class=cF0>
|
|
<a name="l1328"></a> </span><span class=cF1>U8</span><span class=cF0> *machine_code;
|
|
<a name="l1329"></a> </span><span class=cF9>I64</span><span class=cF0> res, type;
|
|
<a name="l1330"></a>
|
|
<a name="l1331"></a> </span><span class=cF1>if</span><span class=cF0> (machine_code = </span><span class=cF5>LexExpression2Bin</span><span class=cF7>(</span><span class=cF0>cc, &type</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1332"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1333"></a> res = </span><span class=cF5>Call</span><span class=cF0>(machine_code);
|
|
<a name="l1334"></a> </span><span class=cF5>Free</span><span class=cF0>(machine_code);
|
|
<a name="l1335"></a> </span><span class=cF1>if</span><span class=cF0> (type != </span><span class=cF3>RT_F64</span><span class=cF0>)
|
|
<a name="l1336"></a> res(</span><span class=cF1>F64</span><span class=cF0>) = </span><span class=cF5>ToF64</span><span class=cF0>(res);
|
|
<a name="l1337"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1338"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1339"></a> res = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1340"></a>
|
|
<a name="l1341"></a> </span><span class=cF1>return</span><span class=cF0> res(</span><span class=cF1>F64</span><span class=cF0>);
|
|
<a name="l1342"></a>}
|
|
<a name="l1343"></a>
|
|
<a name="l1344"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>LexExpression</span><span class=cF0>(</span><span class=cF9>CCompCtrl</span><span class=cF0> *cc)
|
|
<a name="l1345"></a>{</span><span class=cF2>//Compile cc expression and eval.</span><span class=cF0> </span><span class=cF2>Might be I64 or F64.</span><span class=cF0>
|
|
<a name="l1346"></a> </span><span class=cF1>U8</span><span class=cF0> *machine_code;
|
|
<a name="l1347"></a> </span><span class=cF9>I64</span><span class=cF0> res;
|
|
<a name="l1348"></a>
|
|
<a name="l1349"></a> </span><span class=cF1>if</span><span class=cF0> (machine_code = </span><span class=cF5>LexExpression2Bin</span><span class=cF7>(</span><span class=cF0>cc</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l1350"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l1351"></a> res = </span><span class=cF5>Call</span><span class=cF0>(machine_code);
|
|
<a name="l1352"></a> </span><span class=cF5>Free</span><span class=cF0>(machine_code);
|
|
<a name="l1353"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l1354"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l1355"></a> res = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l1356"></a>
|
|
<a name="l1357"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l1358"></a>}
|
|
</span></pre></body>
|
|
</html>
|