Lines Matching refs:lp

116 #define	pushlevel(lp,c,s)	((lp->lexd.level>=lp->lexd.lex_max?stack_grow(lp):1) &&\
117 ((lp->lexd.lex_match[lp->lexd.level++]=lp->lexd.lastc),\
118 lp->lexd.lastc=(((s)<<CHAR_BIT)|(c))))
119 #define oldmode(lp) (lp->lexd.lastc>>CHAR_BIT)
120 #define endchar(lp) (lp->lexd.lastc&0xff)
121 #define setchar(lp,c) (lp->lexd.lastc = ((lp->lexd.lastc&~0xff)|(c)))
122 #define poplevel(lp) (lp->lexd.lastc=lp->lexd.lex_match[--lp->lexd.level])
139 static void refvar(Lex_t *lp, int type)
141 register Shell_t *shp = lp->sh;
143 off_t off = (fcseek(0)-(type+1))-(lp->lexd.first?lp->lexd.first:fcfirst());
145 if(lp->lexd.first)
147 off = (fcseek(0)-(type+1)) - lp->lexd.first;
148 r=kiaentity(lp,lp->lexd.first+lp->lexd.kiaoff+type,off-lp->lexd.kiaoff,'v',-1,-1,lp->current,'v',0,"");
155 if(lp->lexd.kiaoff < offset)
160 n = stktell(stkp)-lp->lexd.kiaoff;
161 begin = stkptr(stkp,lp->lexd.kiaoff);
166 begin = fcfirst()+(type+lp->lexd.kiaoff-offset);
167 n = off-lp->lexd.kiaoff;
170 r=kiaentity(lp,begin,n,'v',-1,-1,lp->current,'v',0,"");
173 sfprintf(lp->kiatmp,"p;%..64d;v;%..64d;%d;%d;r;\n",lp->current,r,shp->inlineno,shp->inlineno);
183 register Lex_t *lp = (Lex_t*)context;
184 register Shell_t *shp = lp->sh;
198 if(lp->lexd.nocopy)
200 if(lp->lexd.dolparen && lp->lexd.docword)
202 int n = size - (lp->lexd.docend-(char*)buff);
203 sfwrite(shp->strbuf,lp->lexd.docend,n);
204 lp->lexd.docextra += n;
206 if(lp->lexd.first)
208 size -= (lp->lexd.first-(char*)buff);
209 buff = lp->lexd.first;
210 if(!lp->lexd.noarg)
211 lp->arg = (struct argnod*)stkseek(stkp,ARGVAL);
213 lp->lexd.kiaoff += ARGVAL;
216 if(size>0 && (lp->arg||lp->lexd.noarg))
219 lp->lexd.first = 0;
227 static int lexfill(Lex_t *lp)
233 savelex = *lp;
234 ap = lp->arg;
237 lp->arg = ap;
238 docextra = lp->lexd.docextra;
239 lp->lex = savelex.lex;
240 lp->lexd = savelex.lexd;
242 lp->lexd.first = 0;
243 aok= lp->aliasok;
244 ap = lp->arg;
245 memcpy(lp, &savelex, offsetof(Lex_t,lexd));
246 lp->arg = ap;
247 lp->aliasok = aok;
248 if(lp->lexd.docword && docextra)
250 lp->lexd.docextra = docextra;
251 lp->lexd.docend = fcseek(0)-1;
259 Lex_t *sh_lexopen(Lex_t *lp, Shell_t *sp, int mode)
261 if(!lp)
263 lp = (Lex_t*)newof(0,Lex_t,1,0);
264 lp->sh = sp;
266 fcnotify(lex_advance,lp);
267 lp->lex.intest = lp->lex.incase = lp->lex.skipword = lp->lexd.warn = 0;
268 lp->comp_assign = 0;
269 lp->lex.reservok = 1;
271 lp->lexd.warn=1;
274 lp->lexd.noarg = lp->lexd.level= lp->lexd.dolparen = lp->lexd.balance = 0;
275 lp->lexd.nocopy = lp->lexd.docword = lp->lexd.nest = lp->lexd.paren = 0;
276 lp->lexd.lex_state = lp->lexd.lastc=0;
278 lp->comsub = 0;
279 return(lp);
284 int sh_lex(Lex_t *lp)
286 Shell_t *shp = lp->sh;
292 if(tok==0 && (flag=lp->arg->argflag))
302 macro, split, expand, fmttoken(lp,tok,tokstr));
310 * A pointer to the current word is stored in lp->arg
313 int sh_lex(Lex_t* lp)
315 register Shell_t *shp = lp->sh;
319 int inlevel=lp->lexd.level, assignment=0, ingrave=0;
324 if(lp->lexd.paren)
326 lp->lexd.paren = 0;
327 return(lp->token=LPAREN);
329 if(lp->lex.incase)
330 lp->assignok = 0;
332 lp->assignok |= lp->lex.reservok;
333 if(lp->comp_assign==2)
334 lp->comp_assign = lp->lex.reservok = 0;
335 lp->lexd.arith = (lp->lexd.nest==1);
336 if(lp->lexd.nest)
338 pushlevel(lp,lp->lexd.nest,ST_NONE);
339 lp->lexd.nest = 0;
340 mode = lp->lexd.lex_state;
342 else if(lp->lexd.docword)
346 lp->lexd.docword++;
347 lp->digits=(c=='#'?3:1);
351 lp->digits=2;
352 lp->lexd.docword=0;
357 if(!lp->lexd.dolparen)
359 lp->arg = 0;
361 lp->lexd.first = fcseek(0);
363 lp->lexd.first = 0;
365 lp->lastline = lp->sh->inlineno;
378 if((n=lexfill(lp)) > 0)
395 lp->token = -1;
396 sh_syntax(lp);
401 return(lp->token=EOFSYM);
402 if(mode >ST_NORM && lp->lexd.level>0)
404 switch(c=endchar(lp))
412 mode = oldmode(lp);
413 poplevel(lp);
426 lp->lexd.balance = c;
431 lp->lasttok = c;
432 lp->token = EOFSYM;
433 sh_syntax(lp);
435 lp->lexd.balance = c;
440 lp->lex.reservok = !lp->lex.intest;
441 if((n=lp->lexd.nocopy) && lp->lexd.dolparen)
442 lp->lexd.nocopy--;
446 if(c<=0 || lp->heredoc)
454 lp->lexd.nocopy = n;
456 return(lp->token=EOFSYM);
462 if(lp->heredoc)
464 if(!lp->lexd.dolparen)
465 lp->lexd.nocopy++;
467 if(here_copy(lp,lp->heredoc)<=0 && lp->lasttok)
469 lp->lasttok = IODOCSYM;
470 lp->token = EOFSYM;
471 lp->lastline = c;
472 sh_syntax(lp);
474 if(!lp->lexd.dolparen)
475 lp->lexd.nocopy--;
476 lp->heredoc = 0;
478 lp->lex.reservok = !lp->lex.intest;
479 lp->lex.skipword = 0;
483 lp->lex.last_quote = 0;
488 lp->comp_assign = 0;
489 return(lp->token='\n');
492 if(lp->lex.incase<=TEST_RE)
495 if(inlevel+1==lp->lexd.level)
497 if(lp->lex.intest)
507 if(lp->lex.testop2)
508 lp->lex.testop2 = 0;
511 lp->digits = (c=='>');
512 lp->lex.skipword = 1;
513 lp->aliasok = lp->lex.reservok;
514 lp->lex.reservok = 0;
519 lp->lex.reservok = !lp->lex.intest;
522 if(!lp->lexd.dolparen)
523 lp->lex.incase = 0;
524 return(lp->token=c);
526 lp->lex.testop1 = lp->lex.intest;
535 lp->lexd.docword=1;
538 lp->lexd.nest=1;
539 lp->lastline = shp->inlineno;
540 lp->lexd.lex_state = ST_NESTED;
542 return(sh_lex(lp));
547 return(lp->token=c);
552 if(!sh_isoption(SH_BASH) && !lp->nonstandard)
554 lp->nonstandard = 1;
557 lp->digits = -1;
570 lp->lex.reservok = 1;
571 lp->lex.skipword = 0;
577 lp->digits = 1;
582 lp->token = c = IORDWRSYMT;
583 if(lp->inexec)
584 sh_syntax(lp);
595 if(lp->inexec)
597 lp->token = c;
598 sh_syntax(lp);
606 lp->lex.incase = (c==BREAKCASESYM || c==FALLTHRUSYM);
610 if(lp->lexd.warn && (n=fcpeek(0))!=RPAREN && n!=' ' && n!='\t')
614 if(c==LPAREN && lp->comp_assign && !lp->lex.intest && !lp->lex.incase)
615 lp->comp_assign = 2;
617 lp->comp_assign = 0;
618 return(lp->token=c);
644 ap = lp->arg;
652 lp->arg = ap;
656 lp->lexd.first = 0;
664 else if(mode==ST_NESTED && lp->lexd.warn &&
665 endchar(lp)==RBRACE &&
672 if(!lp->lex.skipword)
673 lp->lex.reservok *= 2;
677 if(!lp->lexd.dolparen)
678 lp->lexd.first = fcseek(0)-LEN;
679 else if(lp->lexd.docword)
680 lp->lexd.docend = fcseek(0)-LEN;
689 if(c=='~' && n==LPAREN && lp->lex.incase)
690 lp->lex.incase = TEST_RE;
710 if(!lp->lexd.dolparen)
711 lp->lexd.first = fcseek(0);
712 else if(lp->lexd.docword)
713 lp->lexd.docend = fcseek(0);
714 if(c=='[' && lp->assignok>=SH_ASSIGN)
723 if(oldmode(lp)==ST_NONE && !lp->lexd.noarg) /* in ((...)) */
735 if(endchar(lp)!='$')
737 if(oldmode(lp)==ST_QUOTE) /* $' within "" or `` */
739 if(lp->lexd.warn)
746 if(lp->lexd.warn && lp->lex.last_quote && shp->inlineno > lp->lastline)
747 errormsg(SH_DICT,ERROR_warn(0),e_lexlongquote,lp->lastline,lp->lex.last_quote);
748 lp->lex.last_quote = 0;
749 lp->lastline = shp->inlineno;
751 pushlevel(lp,'\'',mode);
756 else if(shp->inlineno > lp->lastline)
757 lp->lex.last_quote = '\'';
758 mode = oldmode(lp);
759 poplevel(lp);
763 if(endchar(lp)=='$')
771 if(lp->lexd.warn && (mode!=ST_QUOTE || endchar(lp)!='`'))
778 if(oldmode(lp)==ST_NONE && lp->lexd.arith) /* in ((...)) */
789 if(lp->lexd.warn && lp->lex.last_quote && shp->inlineno > lp->lastline)
790 errormsg(SH_DICT,ERROR_warn(0),e_lexlongquote,lp->lastline,lp->lex.last_quote);
791 lp->lex.last_quote=0;
792 lp->lastline = shp->inlineno;
793 pushlevel(lp,c,mode);
799 else if((n=endchar(lp))==c)
801 if(shp->inlineno > lp->lastline)
802 lp->lex.last_quote = c;
803 mode = oldmode(lp);
804 poplevel(lp);
814 if(lp->lexd.first)
815 lp->lexd.kiaoff = fcseek(0)-lp->lexd.first;
817 lp->lexd.kiaoff = stktell(stkp)+fcseek(0)-fcfirst();
819 pushlevel(lp,'$',mode);
825 mode = oldmode(lp);
826 poplevel(lp);
828 wordflags |= comsub(lp,c);
831 if((n=endchar(lp)) == '$')
835 mode = oldmode(lp);
836 poplevel(lp);
842 if(lp->kiafile)
843 refvar(lp,0);
845 if(lp->lexd.warn && c==LBRACT && !lp->lex.intest && !lp->lexd.arith && oldmode(lp)!= ST_NESTED)
848 mode = oldmode(lp);
849 poplevel(lp);
875 if(endchar(lp)==RBRACE)
877 setchar(lp,c);
882 if(c=='.' && endchar(lp)=='$')
887 switch(endchar(lp))
894 mode = oldmode(lp);
895 poplevel(lp);
908 setchar(lp,RBRACE);
920 setchar(lp,'0');
922 setchar(lp,'!');
934 if((n=endchar(lp)) == '$')
939 mode = oldmode(lp);
940 poplevel(lp);
941 if((n = endchar(lp)) != '`')
943 pushlevel(lp,RBRACE,mode);
946 setchar(lp,RBRACE);
950 if(oldmode(lp)==ST_QUOTE || oldmode(lp)==ST_NONE)
967 if(lp->kiafile)
968 refvar(lp,1);
981 lp->token = n;
982 sh_syntax(lp);
984 else if(lp->lexd.warn)
992 if((c=endchar(lp)) == '$')
996 setchar(lp,RBRACE);
1006 n = endchar(lp);
1007 mode = oldmode(lp);
1008 poplevel(lp);
1011 lp->token = c;
1012 sh_syntax(lp);
1016 if(lp->lexd.warn && c!='/' && sh_lexstates[ST_NORM][c]!=S_BREAK && (c!='"' || mode==ST_QUOTE))
1024 if(lp->lexd.warn && endchar(lp)==RBRACE)
1028 pushlevel(lp,RPAREN,mode);
1033 if(lp->lexd.level <= inlevel)
1035 if(lp->lexd.level==inlevel+1 && lp->lex.incase>=TEST_RE && !lp->lex.intest)
1040 n = endchar(lp);
1057 if(lp->lexd.warn && n==RBRACE)
1063 if(lp->lexd.warn)
1067 mode = oldmode(lp);
1068 poplevel(lp);
1077 if(mode==ST_NONE && !lp->lexd.dolparen)
1079 lp->lex.reservok = 1;
1080 lp->lex.skipword = 0;
1081 return(lp->token=EXPRSYM);
1085 if(lp->lexd.warn)
1087 if(!(state=lp->lexd.first))
1090 if(lp->arg)
1092 lp->arg = (struct argnod*)stkfreeze(stkp,1);
1093 setupalias(lp,lp->arg->argval,NIL(Namval_t*));
1095 lp->lexd.paren = 1;
1097 return(lp->token=LPAREN);
1103 lp->token = c;
1104 sh_syntax(lp);
1110 assignment = lp->assignok;
1123 if(lp->lex.reservok && !lp->lex.incase)
1136 if((n=endchar(lp))==RBRACT || n==RPAREN ||
1138 (oldmode(lp)==ST_NONE) ||
1139 (mode==ST_NAME && (lp->assignok||lp->lexd.level)))
1151 pushlevel(lp,RBRACT,mode);
1161 if(lp->lexd.dolparen)
1163 if(mode==ST_BEGIN && (lp->lex.reservok||lp->comsub))
1171 return(lp->token=c);
1177 if(lp->comsub && c==RBRACE)
1178 return(lp->token=c);
1181 isfirst = (lp->lexd.first&&fcseek(0)==lp->lexd.first+1);
1188 else if(lp->lex.reservok)
1191 if(lp->lex.reservok && state[n]==S_BREAK && isfirst)
1194 && !lp->lex.incase && !lp->lex.intest
1195 && !lp->lex.skipword)
1210 if(lp->lex.incase==TEST_RE)
1212 lp->lex.incase++;
1213 pushlevel(lp,RPAREN,ST_NORM);
1217 pushlevel(lp,RPAREN,mode);
1227 lp->comp_assign = 0;
1234 if(lp->lexd.nocopy)
1236 lp->lexd.balance = 0;
1239 if(lp->lexd.dolparen)
1241 lp->lexd.balance = 0;
1242 if(lp->lexd.docword)
1243 nested_here(lp);
1244 lp->lexd.message = (wordflags&ARG_MESSAGE);
1245 return(lp->token=0);
1247 if(!(state=lp->lexd.first))
1250 if(!lp->arg)
1251 lp->arg = (struct argnod*)stkseek(stkp,ARGVAL);
1255 if(lp->lexd.balance)
1257 sfputc(stkp,lp->lexd.balance);
1258 lp->lexd.balance = 0;
1264 lp->lexd.first=0;
1271 c = sh_lex(lp);
1272 lp->digits = (n-'0');
1277 else if(n==RBRACE && lp->comsub)
1278 return(lp->token=n);
1285 else if(n>2 && state[0]=='{' && state[n-1]=='}' && !lp->lex.intest && !lp->lex.incase && (c=='<' || c== '>') && sh_isoption(SH_BRACEEXPAND))
1290 lp->arg = (struct argnod*)stkfreeze(stkp,1);
1291 return(lp->token=IOVNAME);
1300 lp->arg = (struct argnod*)stkfreeze(stkp,1);
1301 lp->lex.reservok = 1;
1302 return(lp->token=LABLSYM);
1304 if(assignment || (lp->lex.intest&&!lp->lex.incase) || mode==ST_NONE)
1316 lp->arg = sh_endword(shp,2);
1319 lp->arg = sh_endword(shp,1);
1323 if(c==0 || (c&(ARG_MAC|ARG_EXP)) || (lp->lexd.warn && !lp->lexd.docword))
1325 lp->arg = (struct argnod*)stkfreeze(stkp,1);
1326 lp->arg->argflag = (c?c:ARG_RAW);
1329 lp->arg = sh_endword(shp,-1);
1331 lp->arg = sh_endword(shp,0);
1332 state = lp->arg->argval;
1333 lp->comp_assign = assignment;
1335 lp->arg->argflag |= ARG_ASSIGN;
1336 else if(!lp->lex.skipword)
1337 lp->assignok = 0;
1338 lp->arg->argchn.cp = 0;
1339 lp->arg->argnxt.ap = 0;
1341 return(lp->token=EXPRSYM);
1342 if(lp->lex.intest)
1344 if(lp->lex.testop1)
1346 lp->lex.testop1 = 0;
1350 if(lp->lexd.warn && state[1]=='a')
1352 lp->digits = state[1];
1353 lp->token = TESTUNOP;
1357 lp->lex.testop1 = 1;
1358 lp->token = '!';
1362 lp->lex.testop2 = 1;
1363 lp->token = 0;
1365 return(lp->token);
1367 lp->lex.incase = 0;
1372 lp->lex.testop2 = lp->lex.intest = 0;
1373 lp->lex.reservok = 1;
1374 lp->token = ETESTSYM;
1375 return(lp->token);
1378 if(lp->lexd.warn && state[1]==0)
1382 if(lp->lex.testop2)
1384 if(lp->lexd.warn && (c&TEST_ARITH))
1387 lp->lex.incase = 1;
1389 lp->lex.incase = TEST_RE;
1390 lp->lex.testop2 = 0;
1391 lp->digits = c;
1392 lp->token = TESTBINOP;
1393 return(lp->token);
1398 return(lp->token=0);
1401 if(lp->lex.reservok /* && !lp->lex.incase*/ && n<=2)
1407 if(lp->lexd.warn && c=='{' && lp->lex.incase==2)
1409 if(lp->lex.incase==1 && c==RBRACE)
1410 lp->lex.incase = 0;
1411 return(lp->token=c);
1413 else if(!lp->lex.incase && c==LBRACT && state[1]==LBRACT)
1415 lp->lex.intest = lp->lex.testop1 = 1;
1416 lp->lex.testop2 = lp->lex.reservok = 0;
1417 return(lp->token=BTESTSYM);
1421 if(!lp->lex.skipword)
1423 if(n>1 && lp->lex.reservok==1 && mode==ST_NAME &&
1426 if(lp->lex.incase)
1428 if(lp->lex.incase >1)
1429 lp->lex.incase = 1;
1431 lp->lex.incase = 0;
1437 lp->lex.skipword = 1;
1438 lp->lex.incase = 2*(c==CASESYM);
1441 lp->lex.skipword = 0;
1443 lp->lex.reservok = 0;
1453 return(lp->token=c);
1455 if(!(wordflags&ARG_QUOTED) && (lp->lex.reservok||lp->aliasok))
1459 if(!lp->lex.incase && !assignment && fcpeek(0)!=LPAREN &&
1467 setupalias(lp,state,np);
1469 lp->lex.reservok = 1;
1470 lp->assignok |= lp->lex.reservok;
1471 return(sh_lex(lp));
1474 lp->lex.reservok = 0;
1476 lp->lex.skipword = lp->lexd.docword = 0;
1477 return(lp->token=c);
1483 static int comsub(register Lex_t *lp, int endtok)
1486 register int line=lp->sh->inlineno;
1488 int off, messages=0, assignok=lp->assignok, csub;
1490 save = lp->lex;
1491 csub = lp->comsub;
1492 sh_lexopen(lp,lp->sh,1);
1493 lp->lexd.dolparen++;
1494 lp->lex.incase=0;
1495 pushlevel(lp,0,0);
1496 lp->comsub = (endtok==LBRACE);
1497 off = fcseek(0) - lp->lexd.first;
1498 if(sh_lex(lp)==endtok)
1500 if(endtok==LPAREN && fcseek(0)==lp->lexd.first)
1503 lp->lexd.paren = 0;
1525 lp->lex.incase=1;
1527 lp->lex.incase=0;
1532 if(c==RBRACE && lp->lex.incase)
1533 lp->lex.incase=0;
1534 switch(c=sh_lex(lp))
1537 if(endtok==LBRACE && !lp->lex.incase)
1539 lp->comsub = 0;
1547 lp->comsub = (count==1);
1551 if(endtok==LPAREN && !lp->lex.incase)
1555 if(lp->lex.incase)
1556 lp->lex.incase=0;
1561 lp->lastline = line;
1562 lp->lasttok = endtok;
1563 sh_syntax(lp);
1569 lp->lexd.docextra = 0;
1570 sh_lex(lp);
1573 lp->lex.reservok = 0;
1574 messages |= lp->lexd.message;
1584 lp->lex.reservok = 1;
1589 poplevel(lp);
1590 lp->comsub = csub;
1591 lp->lastline = line;
1592 lp->lexd.dolparen--;
1593 lp->lex = save;
1594 lp->assignok = (endchar(lp)==RBRACT?assignok:0);
1602 static void nested_here(register Lex_t *lp)
1606 struct argnod *arg = lp->arg;
1607 Stk_t *stkp = lp->sh->stk;
1611 n = fcseek(0)-lp->lexd.docend;
1612 iop = newof(0,struct ionod,1,lp->lexd.docextra+n+ARGVAL);
1613 iop->iolst = lp->heredoc;
1615 if(lp->lexd.docextra)
1617 sfseek(lp->sh->strbuf,(Sfoff_t)0, SEEK_SET);
1618 sfmove(lp->sh->strbuf,stkp,lp->lexd.docextra,-1);
1620 sfwrite(stkp,lp->lexd.docend,n);
1621 lp->arg = sh_endword(lp->sh,0);
1623 strcpy(iop->ioname,lp->arg->argval);
1625 if(lp->lexd.docword>1)
1627 lp->heredoc = iop;
1628 lp->arg = arg;
1629 lp->lexd.docword = 0;
1641 void sh_lexskip(Lex_t *lp,int close, register int copy, int state)
1644 lp->lexd.nest = close;
1645 lp->lexd.lex_state = state;
1646 lp->lexd.noarg = 1;
1648 fcnotify(lex_advance,lp);
1650 lp->lexd.nocopy++;
1651 sh_lex(lp);
1652 lp->lexd.noarg = 0;
1655 fcnotify(0,lp);
1656 if(!(cp=lp->lexd.first))
1659 sfwrite(lp->sh->stk,cp,copy);
1662 lp->lexd.nocopy--;
1695 static int here_copy(Lex_t *lp,register struct ionod *iop)
1700 register Sfio_t *sp=lp->sh->heredocs, *funlog;
1702 if(funlog=lp->sh->funlog)
1706 lp->sh->funlog = 0;
1709 here_copy(lp,iop->iolst);
1750 if(!lp->lexd.dolparen && (c=(fcseek(0)-1)-bufp))
1757 if((c=lexfill(lp))<=0)
1777 lp->sh->inlineno++;
1780 if(!lp->lexd.dolparen)
1817 if(!lp->lexd.dolparen && (c=cp-bufp))
1823 if((c=lexfill(lp))<=0)
1838 lp->sh->inlineno++;
1841 if(!lp->lexd.dolparen && (n=cp-bufp))
1846 lp->sh->inlineno--;
1859 if(!lp->lexd.dolparen && nsave>0)
1891 lp->sh->inlineno++;
1892 if(!lp->lexd.dolparen && (n=(fcseek(0)-bufp)-n)>=0)
1912 lp->sh->funlog = funlog;
1913 if(lp->lexd.dolparen)
1923 static char *fmttoken(Lex_t *lp, register int sym, char *tok)
1929 return(lp->arg?lp->arg->argval:"?");
1930 if(lp->lex.intest && lp->arg && *lp->arg->argval)
1931 return(lp->arg->argval);
1983 void sh_syntax(Lex_t *lp)
1985 register Shell_t *shp = lp->sh;
1988 register int tok = lp->token;
1991 if((tok==EOFSYM) && lp->lasttok)
1993 tok = lp->lasttok;
1997 lp->lastline = shp->inlineno;
1998 tokstr = fmttoken(lp,tok,tokbuf);
2010 shp->inlineno = lp->inlineno;
2011 shp->st.firstline = lp->firstline;
2017 errormsg(SH_DICT,ERROR_exit(SYNBAD),e_lexsyntax1,lp->lastline,tokstr,cp);
2307 Lex_t *lp;
2328 register Lex_t *lp;
2331 lp = ap->lp;
2350 lp->aliasok = 1;
2363 static void setupalias(Lex_t *lp, const char *string,Namval_t *np)
2368 ap->lp = lp;
2373 if(lp->kiafile)
2376 r=kiaentity(lp,nv_name(np),-1,'p',0,0,lp->current,'a',0,"");
2377 sfprintf(lp->kiatmp,"p;%..64d;p;%..64d;%d;%d;e;\n",lp->current,r,lp->sh->inlineno,lp->sh->inlineno);
2387 lp->lexd.nocopy++;
2393 lp->lexd.nocopy--;
2399 static int stack_grow(Lex_t *lp)
2401 lp->lexd.lex_max += STACK_ARRAY;
2402 if(lp->lexd.lex_match)
2403 lp->lexd.lex_match = (int*)realloc((char*)lp->lexd.lex_match,sizeof(int)*lp->lexd.lex_max);
2405 lp->lexd.lex_match = (int*)malloc(sizeof(int)*STACK_ARRAY);
2406 return(lp->lexd.lex_match!=0);