123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- function yyrefill(void)
- {
- let yyn;
- while ((yybuflen - yypos) < 512)
- {
- yybuflen *= 2;
- yybuf = realloc(yybuf, yybuflen);
- }
- {
- let yyc = getchar();
- yyn = EOF === yyc ? 0 : ((yybuf + yypos) = yyc, 1);
- ;
- }
- ;
- if (!yyn)
- return 0;
- yylimit += yyn;
- return 1;
- }
- function yymatchDot(void)
- {
- if ((yypos >= yylimit) && (!yyrefill()))
- return 0;
- ++yypos;
- return 1;
- }
- function yymatchChar(c)
- {
- if ((yypos >= yylimit) && (!yyrefill()))
- return 0;
- if (yybuf[yypos] === c)
- {
- ++yypos;
- ;
- return 1;
- }
- ;
- return 0;
- }
- function yymatchString(s)
- {
- let yysav = yypos;
- while (s)
- {
- if ((yypos >= yylimit) && (!yyrefill()))
- return 0;
- if (yybuf[yypos] !== (s))
- {
- yypos = yysav;
- return 0;
- }
- ++s;
- ++yypos;
- }
- return 1;
- }
- function yymatchClass(bits)
- {
- let c;
- if ((yypos >= yylimit) && (!yyrefill()))
- return 0;
- c = yybuf[yypos];
- if (bits[c >> 3] & (1 << (c & 7)))
- {
- ++yypos;
- ;
- return 1;
- }
- ;
- return 0;
- }
- function yyDo(action, begin, end)
- {
- while (yythunkpos >= yythunkslen)
- {
- yythunkslen *= 2;
- yythunks = realloc(yythunks, (sizeof(yythunk)) * yythunkslen);
- }
- yythunks[yythunkpos].begin = begin;
- yythunks[yythunkpos].end = end;
- yythunks[yythunkpos].action = action;
- ++yythunkpos;
- }
- function yyText(begin, end)
- {
- let yyleng = end - begin;
- if (yyleng <= 0)
- yyleng = 0;
- else
- {
- while (yytextlen < (yyleng - 1))
- {
- yytextlen *= 2;
- yytext = realloc(yytext, yytextlen);
- }
- memcpy(yytext, yybuf + begin, yyleng);
- }
- yytext[yyleng] = '\0';
- return yyleng;
- }
- function yyDone(void)
- {
- let pos;
- for (pos = 0; pos < yythunkpos; ++pos)
- {
- let thunk = yythunks[pos];
- let yyleng = thunk.end ? yyText(thunk.begin, thunk.end) : thunk.begin;
- ;
- thunk.action(yytext, yyleng);
- }
- yythunkpos = 0;
- }
- function yyCommit()
- {
- if (yylimit -= yypos)
- {
- memmove(yybuf, yybuf + yypos, yylimit);
- }
- yybegin -= yypos;
- yyend -= yypos;
- yypos = (yythunkpos = 0);
- }
- function yyAccept(tp0)
- {
- if (tp0)
- {
- fprintf(stderr, 'accept denied at %d\n', tp0);
- return 0;
- }
- else
- {
- yyDone();
- yyCommit();
- }
- return 1;
- }
- function yyPush(text, count)
- {
- if (text)
- {
- }
- yyval += count;
- }
- function yyPop(text, count)
- {
- if (text)
- {
- }
- yyval -= count;
- }
- function yySet(text, count)
- {
- if (text)
- {
- }
- yyval[count] = yy;
- }
- function yy_2_start(yytext, yyleng)
- {
- if (yytext)
- {
- }
- if (yyleng)
- {
- }
- ;
- putchar(yytext[0]);
- ;
- }
- function yy_1_start(yytext, yyleng)
- {
- if (yytext)
- {
- }
- if (yyleng)
- {
- }
- ;
- printf('%s', getlogin());
- ;
- }
- function yy_start()
- {
- let yypos0 = yypos;
- let yythunkpos0 = yythunkpos;
- ;
- {
- let yypos2 = yypos;
- let yythunkpos2 = yythunkpos;
- if (!yymatchString('username'))
- // FIXME: goto l3;
- yyDo(yy_1_start, yybegin, yyend);
- // FIXME: goto l2;
- l3:
- ;
- yypos = yypos2;
- yythunkpos = yythunkpos2;
- yyText(yybegin, yyend);
- if (!((yybegin = yypos, 1)))
- // FIXME: goto l1;
- if (!yymatchDot())
- // FIXME: goto l1;
- yyText(yybegin, yyend);
- if (!((yyend = yypos, 1)))
- // FIXME: goto l1;
- yyDo(yy_2_start, yybegin, yyend);
- }
- l2:
- ;
- ;
- return 1;
- l1:
- ;
- yypos = yypos0;
- yythunkpos = yythunkpos0;
- ;
- return 0;
- }
- function yyparsefrom(yystart)
- {
- let yyok;
- if (!yybuflen)
- {
- yybuflen = 1024;
- yybuf = malloc(yybuflen);
- yytextlen = 1024;
- yytext = malloc(yytextlen);
- yythunkslen = 32;
- yythunks = malloc((sizeof(yythunk)) * yythunkslen);
- yyvalslen = 32;
- yyvals = malloc((sizeof(int)) * yyvalslen);
- yybegin = (yyend = (yypos = (yylimit = (yythunkpos = 0))));
- }
- yybegin = (yyend = yypos);
- yythunkpos = 0;
- yyval = yyvals;
- yyok = yystart();
- if (yyok)
- yyDone();
- yyCommit();
- return yyok;
- yyrefill;
- yymatchDot;
- yymatchChar;
- yymatchString;
- yymatchClass;
- yyDo;
- yyText;
- yyDone;
- yyCommit;
- yyAccept;
- yyPush;
- yyPop;
- yySet;
- yytextmax;
- }
- function yyparse(void)
- {
- return yyparsefrom(yy_start);
- }
- function main()
- {
- while (yyparse())
- ;
- return 0;
- }
|