|
@@ -559,7 +559,8 @@ struct _Nt{enum Ntag_t{N_STRAND,N_LITERAL,N_INDEX1,N_INDEX2,N_FUN,N_MONAD,N_DYAD
|
|
Ar*l;
|
|
Ar*l;
|
|
Nt*a;
|
|
Nt*a;
|
|
Nt*b;
|
|
Nt*b;
|
|
- Nt*c;};
|
|
|
|
|
|
+ Nt*c;
|
|
|
|
+ Z dp;};
|
|
S Nshow(Nt*n){SW(n->tag){CS N_STRAND:{Bt*buf=Bnew();
|
|
S Nshow(Nt*n){SW(n->tag){CS N_STRAND:{Bt*buf=Bnew();
|
|
for(Z i=0;i<n->l->length;i++){if(i!=0)BappendS(buf,",:");
|
|
for(Z i=0;i<n->l->length;i++){if(i!=0)BappendS(buf,",:");
|
|
S s=Nshow(n->l->data[i]);
|
|
S s=Nshow(n->l->data[i]);
|
|
@@ -744,9 +745,13 @@ Vt*Swalk(St*st,Nt*node){if(!node)R st->nil;
|
|
R Vnv(nv);}
|
|
R Vnv(nv);}
|
|
CS N_MONAD:R apM(st,Swalk(st,node->a),Swalk(st,node->b));
|
|
CS N_MONAD:R apM(st,Swalk(st,node->a),Swalk(st,node->b));
|
|
CS N_DYAD:R apD(st,Swalk(st,node->a),Swalk(st,node->b),Swalk(st,node->c));
|
|
CS N_DYAD:R apD(st,Swalk(st,node->a),Swalk(st,node->b),Swalk(st,node->c));
|
|
- CS N_ADV:{Vt*v=Swalk(st,node->a);R Vnv(node->av->adverb(st,v));}
|
|
|
|
|
|
+ CS N_ADV:{Vt*v=Swalk(st,node->a);
|
|
|
|
+ vt*nv=node->av->adverb(st,v);
|
|
|
|
+ if(node->dp<2)nv->mark=T;R Vnv(nv);}
|
|
CS N_CONJ:{Vt*v1=Swalk(st,node->a);
|
|
CS N_CONJ:{Vt*v1=Swalk(st,node->a);
|
|
- Vt*v2=Swalk(st,node->b);R Vnv(node->av->conjunction(st,v1,v2));}
|
|
|
|
|
|
+ Vt*v2=Swalk(st,node->b);
|
|
|
|
+ vt*nv=node->av->conjunction(st,v1,v2);
|
|
|
|
+ if(node->dp<2)nv->mark=T;R Vnv(nv);}
|
|
CS N_PARTIAL_CONJ:{vt*nv=vnew();
|
|
CS N_PARTIAL_CONJ:{vt*nv=vnew();
|
|
Vt*a=Swalk(st,node->a);
|
|
Vt*a=Swalk(st,node->a);
|
|
S r=Vshow(a);
|
|
S r=Vshow(a);
|
|
@@ -761,7 +766,8 @@ Vt*Swalk(St*st,Nt*node){if(!node)R st->nil;
|
|
nv->rank[1]=0;
|
|
nv->rank[1]=0;
|
|
nv->rank[2]=0;
|
|
nv->rank[2]=0;
|
|
nv->monad=_partial_conjunction;
|
|
nv->monad=_partial_conjunction;
|
|
- nv->dyad=N;R Vnv(nv);}
|
|
|
|
|
|
+ nv->dyad=N;
|
|
|
|
+ if(node->dp<2)nv->mark=T;R Vnv(nv);}
|
|
CS N_FORK:{Vt*_f=Swalk(st,node->a);
|
|
CS N_FORK:{Vt*_f=Swalk(st,node->a);
|
|
if(_f->tag!=VERB)R st->udf;
|
|
if(_f->tag!=VERB)R st->udf;
|
|
Vt*_g=Swalk(st,node->b);
|
|
Vt*_g=Swalk(st,node->b);
|
|
@@ -783,7 +789,8 @@ Vt*Swalk(St*st,Nt*node){if(!node)R st->nil;
|
|
nv->rank[1]=0;
|
|
nv->rank[1]=0;
|
|
nv->rank[2]=0;
|
|
nv->rank[2]=0;
|
|
nv->monad=_fork_m;
|
|
nv->monad=_fork_m;
|
|
- nv->dyad=_fork_d;R Vnv(nv);}
|
|
|
|
|
|
+ nv->dyad=_fork_d;
|
|
|
|
+ if(node->dp<2)nv->mark=T;R Vnv(nv);}
|
|
CS N_HOOK:{Vt*_f=Swalk(st,node->a);
|
|
CS N_HOOK:{Vt*_f=Swalk(st,node->a);
|
|
if(_f->tag!=VERB)R st->udf;
|
|
if(_f->tag!=VERB)R st->udf;
|
|
Vt*_g=Swalk(st,node->b);
|
|
Vt*_g=Swalk(st,node->b);
|
|
@@ -801,7 +808,8 @@ Vt*Swalk(St*st,Nt*node){if(!node)R st->nil;
|
|
nv->rank[1]=0;
|
|
nv->rank[1]=0;
|
|
nv->rank[2]=0;
|
|
nv->rank[2]=0;
|
|
nv->monad=_hook_m;
|
|
nv->monad=_hook_m;
|
|
- nv->dyad=_hook_d;R Vnv(nv);}
|
|
|
|
|
|
+ nv->dyad=_hook_d;
|
|
|
|
+ if(node->dp<2)nv->mark=T;R Vnv(nv);}
|
|
CS N_BOND:{Vt*_f=Swalk(st,node->a);
|
|
CS N_BOND:{Vt*_f=Swalk(st,node->a);
|
|
if(_f->tag!=VERB)R st->udf;
|
|
if(_f->tag!=VERB)R st->udf;
|
|
Vt*g=Swalk(st,node->b);
|
|
Vt*g=Swalk(st,node->b);
|
|
@@ -819,7 +827,8 @@ Vt*Swalk(St*st,Nt*node){if(!node)R st->nil;
|
|
nv->rank[1]=0;
|
|
nv->rank[1]=0;
|
|
nv->rank[2]=0;
|
|
nv->rank[2]=0;
|
|
nv->monad=_bond_m;
|
|
nv->monad=_bond_m;
|
|
- nv->dyad=_bond_d;R Vnv(nv);}
|
|
|
|
|
|
+ nv->dyad=_bond_d;
|
|
|
|
+ if(node->dp<2)nv->mark=T;R Vnv(nv);}
|
|
CS N_OVER:{Vt*f=Swalk(st,node->a);
|
|
CS N_OVER:{Vt*f=Swalk(st,node->a);
|
|
Vt*_g=Swalk(st,node->b);
|
|
Vt*_g=Swalk(st,node->b);
|
|
if(_g->tag!=VERB)R st->udf;
|
|
if(_g->tag!=VERB)R st->udf;
|
|
@@ -841,7 +850,8 @@ Vt*Swalk(St*st,Nt*node){if(!node)R st->nil;
|
|
nv->rank[1]=0;
|
|
nv->rank[1]=0;
|
|
nv->rank[2]=0;
|
|
nv->rank[2]=0;
|
|
nv->monad=_over_m;
|
|
nv->monad=_over_m;
|
|
- nv->dyad=_over_d;R Vnv(nv);}
|
|
|
|
|
|
+ nv->dyad=_over_d;
|
|
|
|
+ if(node->dp<2)nv->mark=T;R Vnv(nv);}
|
|
CS N_BIND:{Vt*l=node->a->v;
|
|
CS N_BIND:{Vt*l=node->a->v;
|
|
Nt*b=node->b;
|
|
Nt*b=node->b;
|
|
UI argc=0;
|
|
UI argc=0;
|
|
@@ -2291,7 +2301,8 @@ Nt*Nn3(enum Ntag_t tag,Nt*a,Nt*b,Nt*c){Nt*node=ma(SO(Nt));
|
|
typedef struct{Lt*lexer;
|
|
typedef struct{Lt*lexer;
|
|
St*st;
|
|
St*st;
|
|
Z pos;
|
|
Z pos;
|
|
- Z end;}Pt;
|
|
|
|
|
|
+ Z end;
|
|
|
|
+ Z dp;}Pt;
|
|
Pt*Pnew(St*state){Pt*parser=ma(SO(Pt));
|
|
Pt*Pnew(St*state){Pt*parser=ma(SO(Pt));
|
|
parser->st=state;R parser;}
|
|
parser->st=state;R parser;}
|
|
V Perror(Pt*parser,S s){fatal(s);}
|
|
V Perror(Pt*parser,S s){fatal(s);}
|
|
@@ -2344,7 +2355,10 @@ Nt*PPatom(Pt*parser){Tkt*tok=Plook(parser,0);
|
|
CS T_LPAR:Peat(parser);
|
|
CS T_LPAR:Peat(parser);
|
|
tok=Plook(parser,0);
|
|
tok=Plook(parser,0);
|
|
if(tok&&tok->tag==T_RPAR){node=Nnl(parser->st->unit);BR;}
|
|
if(tok&&tok->tag==T_RPAR){node=Nnl(parser->st->unit);BR;}
|
|
|
|
+ parser->dp++;
|
|
node=PPexpr(parser);
|
|
node=PPexpr(parser);
|
|
|
|
+ node->dp=parser->dp;
|
|
|
|
+ parser->dp--;
|
|
tok=Plook(parser,0);
|
|
tok=Plook(parser,0);
|
|
if(!tok||tok->tag!=T_RPAR)Perror(parser,"unmatched");BR;
|
|
if(!tok||tok->tag!=T_RPAR)Perror(parser,"unmatched");BR;
|
|
CS T_PUNCT:node=PPverb(parser);
|
|
CS T_PUNCT:node=PPverb(parser);
|