-
Notifications
You must be signed in to change notification settings - Fork 0
/
fig.semantics.min.js
1 lines (1 loc) · 1.87 KB
/
fig.semantics.min.js
1
caterwaul.tconfiguration('std seq continuation','fig.semantics',function (){this.macro(qs[_],transform),where*[qualifies_for_regexp_promotion(t)=t.data==='join'&&t[0].match(qs[r])&&t[1].is_string(),operator_bucket(ops)=l[bucket=seq[ ~ops.split(/\s+/)*[[_,true]]].object()] in fn[t][bucket.hasOwnProperty(t.data)],is_valid_binary_operator=operator_bucket('* / % + - << >> >>> & | ^ && || < > <= >= == != === !=='),is_valid_unary_operator=operator_bucket('u+ u- u~ u!'),is_valid_groupless_operator=operator_bucket('= : , .'),regexp_promotion(t)=qualifies_for_regexp_promotion(t)&&new caterwaul.syntax(t[1].data.replace(/\//g,'\\$1')/re['/#{_.substring(1, _.length - 1)}/']),constant_literal(t)=t.is_constant()&&t.as('('),regular_group(t)=(t.data==='('||t.data==='['||t.data==='{')&&t,direct_join_as_invocation(t)=t.data==='join'&&(t[1].data==='('&&qs[_x(_y)].replace({_x:t[0],_y:t[1][0]})||t[1].data==='['&&qs[_x[_y]].replace({_x:t[0],_y:t[1][0]})),join_to_invocation_promotion(t)=t.data==='join'&&qs[_x(_y)].replace({_x:t[0],_y:t[1]}),groupless_operator(t)=t.length===2&&is_valid_groupless_operator(t)&&t,binary_operator(t)=t.length===2&&(is_valid_binary_operator(t)?t.as('('):qs[_l[_op](_r)].replace({_l:t[0],_op:'"#{t.data}"',_r:t[1]})),unary_operator(t)=t.length===1&&(is_valid_unary_operator(t)?t.as('('):qs[_l[_op]()].replace({_l:t[0],_op:'"#{t.data}"'})),identifier_mapping={'\'':'$prime','?':'$q','!':'$bang'},identifier(t)=t.length===0&&/[A-Za-z0-9_]/.test(t.data.charAt(0))&&t/se[_.data=_.data/re[_&&_.replace(/[^A-Za-z0-9_$]/g,fn[c][identifier_mapping[c]||'$#{c.charCodeAt(0).toString(16)}'])/re[/\d/.test(_.charAt(0))?'$#{_}':_]]],transform_single(t)=regexp_promotion(t)||constant_literal(t)||groupless_operator(t)||regular_group(t)||direct_join_as_invocation(t)||join_to_invocation_promotion(t)||binary_operator(t)||unary_operator(t)||identifier(t)||t,transform(t)=t&&transform_single(t.map(transform))]});