-
Notifications
You must be signed in to change notification settings - Fork 0
/
fig.all.min.js
1 lines (1 loc) · 6.2 KB
/
fig.all.min.js
1
caterwaul.tconfiguration('std seq continuation','fig.require.nodejs',function (){this.method('figment_require',fn[files,cc][cc(seq[ ~files.split(/\s+/)*[fs.readFileSync(_,'utf8')]].slice())])},{fs:typeof require==='undefined'||require('fs')}).tconfiguration('std seq continuation','fig.require.ajax',function (){this.method('figment_require',fn[files,cc][l*[file_list=seq[ ~files.split(/\s+/)],contents={},requests_left=file_list.size(),got_everything()=cc(seq[file_list*[contents[_]]]),receive(filename)(data)= --requests_left/se[contents[filename]=data,_||got_everything()]] in seq[file_list* ![get(_,receive(_))]]]),where*[create_xhr()=window.XMLHttpRequest/re[_?new _():new ActiveXObject('Microsoft.XMLHTTP')],get(url,success)=create_xhr()/se[_.open('GET',url,true),_.send(),_.onreadystatechange()=_.readyState===4&&success(_.responseText)]]}).tconfiguration('std seq continuation','fig.require',function (){this.configure(typeof window==='undefined'?'fig.require.nodejs':'fig.require.ajax').method('require',fn[modules,cc][this.figment_require(modules,_)/cpb[seq[ ~_* ![c(_,{'this':c})]],cc&&cc.call(c),where[c=this.clone()]]])});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))]});caterwaul.tconfiguration('std seq continuation parser','fig.parser',function (){this.field('parse',parse).field('lex',lex).field('decompile',parse),where*[parse(s)=expression(lex(s)),lex=l*[literate=peg[c(/[A-Z\|][^\n]*(?:\n[^\n]+)*/,1)>>fn_['']],paragraph=peg[c(/[^\n]*(?:\n[^\n]+)*/,1)>>fn[xs][xs[0]]],paragraphs=peg[(([c(/\n\n+/,2)]>>fn_[''])%(literate/paragraph)>>fn[xs][xs[1]])[0]>>fn[xs][seq[ ~xs%[_]].join('\n')]],line_comment=peg[c(/[-\/]\s*/,1)%c(/[A-Z][^\n]*/,1)%[c('\n')]>>fn_[' ']],code=peg[(line_comment/c(['-','/'])/(c(/[^-\/]+/,1)>>fn[xs][xs[0]]))[1]>>fn[xs][xs.join('')]]] in fn[s][code(paragraphs(s))],expression(x)=expression(x),identifier=peg[c(/[a-z_][A-Za-z0-9_]*['?!]*/,1)>>fn[xs][new caterwaul.syntax(xs[0])]],operator=l*[coerced_identifier=peg[c('=')%identifier>>fn[xs][xs[0]+xs[1].data]],regular_operator=peg[c(/[-+\/*&^%$#@!`~:\\|=?<>\.;]+/,1)>>fn[xs][xs[0]]]] in peg[coerced_identifier/regular_operator],group=l*[grouped_by(open,close)=peg[c(open)%[expression]%c(close)>>fn[xs][xs[1]?new caterwaul.syntax(open,xs[1]):new caterwaul.syntax(open)]]] in peg[grouped_by('(',')')/grouped_by('[',']')/grouped_by('{','}')],atom=l*[quoted_operator=peg[c('_')%operator>>fn[xs][new caterwaul.syntax(xs[0]+xs[1])]],number_options=peg[(c(/\d+/,1)%c('.')%c(/\d+(?:[eE][-+]?\d*)?/,1)>>fn[xs][new caterwaul.syntax(xs[0][0]+xs[1]+xs[2][0])])/(c(/\d+/,1)>>fn[xs][new caterwaul.syntax(xs[0])])],string_options=peg[(c(/'(?:[^'\\]|\\.?)*/,1)%c("'"))/(c(/"(?:[^"\\]|\\.?)*/,1)%c('"'))>>fn[xs][new caterwaul.syntax(xs[0][0]+xs[1])]]] in peg[quoted_operator/number_options/string_options/identifier/group],space=peg[c(/\s+/,1)],spaced(x)=peg[space%x%space>>fn[xs][xs[1]]],binary(op,l,inductive,base)=l*[p(x)=p(x),p=peg[l%[op%p]>>fn[xs][xs[1]?inductive(xs[0],xs[1][0],xs[1][1]):base?base(xs[0]):xs[0]]]] in p,prefix(op,l,inductive,base)=l*[p(x)=p(x),p=peg[(op%p>>fn[xs][inductive(xs[0],xs[1])])/(l>>fn[x][base?base(x):x])]] in p,precedence_table=l[current=0] in {}/se.r[seq[ ~'. */ % +- &|^ :; !@# `~\\ <> ? ='.split(/\s+/)* ![seq[ ~_.split('')* ![r[_]=current]], ++current]],r['$']=1000],precedence_of(op)=op==='join'? -1:/^_/.test(op)?999:seq[ ~op.split('')*[precedence_table[_]]/[_+_0]],right_associates(x)=x!=='join',binary_tree(op,l,r,t)=new caterwaul.syntax(op,l,r)/se[_.is_tight=t],unary_tree(op,r,t)=new caterwaul.syntax(op,r)/se[_.is_tight=t],cons_binary(op,l,r,t)=r.is_tight===t&&r.length===2&&precedence_of(r.data)>precedence_of(op)+ +right_associates(r.data)?binary_tree(r.data,binary_tree(op,l,r[0],t),r[1],t):binary_tree(op,l,r,t),tight_join=peg[atom[1]>>fn[xs][seq[ ~xs/ ![cons_binary('join',_,_0,true)]]]],tight_prefix=peg[prefix(operator,tight_join,fn[op,r][unary_tree(op,r,true)])],tight_binary=peg[binary(seq(operator,opt(space)),tight_prefix,fn[l,op,r][cons_binary(op[0],l,r,true)])],loose_join=peg[binary(space,tight_binary,fn[l,op,r][cons_binary('join',l,r,false)])],loose_prefix=peg[prefix(seq(operator,space),loose_join,fn[op,r][unary_tree(op[0],r,false)])],loose_binary=peg[binary(spaced(operator),loose_prefix,fn[l,op,r][cons_binary(op,l,r,false)])],commas=peg[binary(seq(opt(space),c(/,\s*/,1)),loose_binary,fn[l,op,r][binary_tree(',',l,r,false)])],expression=commas]});caterwaul.configuration('fig',function (){this.configure('fig.require fig.semantics fig.parser')});