|
@@ -2138,16 +2138,23 @@ Nt*PPatom(Pt*parser){Tkt*tok=Plook(parser,0);
|
|
|
node=Nnl(Vna(r));}BR;}
|
|
|
if(!node)Perror(parser,"parse");
|
|
|
Peat(parser);R node;}
|
|
|
+B isunb(St*st,S s){if(st->args->data){Ar*args=Ai(st->args,-1);
|
|
|
+ Z argc=args->length-1;
|
|
|
+ if(argc==2&&strcmp(s,"y")==0)R F;
|
|
|
+ elif(strcmp(s,"x")==0)R F;}
|
|
|
+ elif(Thas(st->env,s))R F;R T;}
|
|
|
Nt*PPa(Pt*parser,Nt*a,enum Tkt tag){Tkt*tok;
|
|
|
- if((tok=Plook(parser,0))&&(tok->tag==tag||(tag==T_NUM&&tok->tag==T_BNUM))){Ar*as=An();
|
|
|
+ if((tok=Plook(parser,0))&&(tok->tag==tag||(tag==T_NUM&&tok->tag==T_BNUM))){if(tag==T_NAME&&!isunb(parser->st,tok->text))R N;
|
|
|
+ Ar*as=An();
|
|
|
Ap(as,a->v);
|
|
|
- do{a=PPatom(parser);
|
|
|
+ do{if(tag==T_NAME&&tok->tag==T_NAME&&!isunb(parser->st,tok->text))BR;
|
|
|
+ a=PPatom(parser);
|
|
|
Ap(as,a->v);}WH((tok=Plook(parser,0))&&(tok->tag==tag||(tag==T_NUM&&tok->tag==T_BNUM)));R Nnl(Vna(as));}
|
|
|
R N;}
|
|
|
Nt*_PPnoun(Pt*parser){Nt*n;
|
|
|
Nt*a=PPatom(parser);
|
|
|
if(a->tag==N_LITERAL&&a->v->tag==NUM&&(n=PPa(parser,a,T_NUM)))R n;
|
|
|
- elif(a->tag==N_LITERAL&&a->v->tag==SYM&&(n=PPa(parser,a,T_NAME)))R n;
|
|
|
+ elif(a->tag==N_LITERAL&&a->v->tag==SYM&&isunb(parser->st,a->v->val.symbol)&&(n=PPa(parser,a,T_NAME)))R n;
|
|
|
elif(a->tag==N_LITERAL&&a->v->tag==ARRAY&&Cap(a->v->val.array)&&(n=PPa(parser,a,T_QUOTE)))R n;R a;}
|
|
|
Nt*PPnoun(Pt*parser,B flat){Nt*a=flat?PPatom(parser):_PPnoun(parser);
|
|
|
Tkt*tok;
|