static int _Alextab(compileContext *ctx, int __na__) { // fucko: JF> 17 -> 19? if (__na__ >= 0 && __na__ <= 17) { ctx->colCount+=nseel_gettokenlen(ctx,256); } switch (__na__) { case 0: { char tmp[NSEEL_MAX_VARIABLE_NAMELEN*2]; nseel_gettoken(ctx,tmp, sizeof(tmp)); if (tmp[0] < '0' || tmp[0] > '9') // not sure where this logic came from { ctx->yylval = nseel_lookup(ctx,&__na__,tmp); return __na__; } } case 1: case 2: case 3: { char tmp[NSEEL_MAX_VARIABLE_NAMELEN*2]; nseel_gettoken(ctx,tmp, sizeof(tmp)); ctx->yylval = nseel_translate(ctx,tmp); return VALUE; } case 4: case 5: { char tmp[NSEEL_MAX_VARIABLE_NAMELEN*2]; nseel_gettoken(ctx,tmp, sizeof(tmp)); ctx->yylval = nseel_lookup(ctx,&__na__,tmp); return __na__; } case 6: return '+'; case 7: return '-'; case 8: return '*'; case 9: return '/'; case 10: return '%'; case 11: return '&'; case 12: return '|'; case 13: return '('; case 14: return ')'; case 15: return '='; case 16: return ','; case 17: return ';'; } return (LEXSKIP); }
int nseellex(opcodeRec **output, YYLTYPE * yylloc_param, compileContext *scctx) { int rv,toklen=0; *output = 0; while ((rv=scctx->rdbuf[0]) && (rv== ' ' || rv=='\t' || rv == '\r' || rv == '\n')) scctx->rdbuf++; if (!rv) { scctx->gotEndOfInput=1; } if (rv) { char buf[NSEEL_MAX_VARIABLE_NAMELEN*2]; int l; char *ss = scctx->rdbuf++; if (isalpha(rv) || rv == '_') { while ((rv=scctx->rdbuf[0]) && (isalnum(rv) || rv == '_' || rv == '.')) scctx->rdbuf++; l = scctx->rdbuf - ss + 1; if (l > sizeof(buf)) l=sizeof(buf); lstrcpyn_safe(buf,ss,l); rv=0; *output = nseel_lookup(scctx,&rv,buf); } else if ((rv >= '0' && rv <= '9') || (rv == '.' && (scctx->rdbuf[0] >= '0' && scctx->rdbuf[0] <= '9'))) { if (rv == '0' && (scctx->rdbuf[0] == 'x' || scctx->rdbuf[0] == 'X')) { scctx->rdbuf++; while ((rv=scctx->rdbuf[0]) && ((rv>='0' && rv<='9') || (rv>='a' && rv<='f') || (rv>='A' && rv<='F'))) scctx->rdbuf++; // this allows 0x, whereas the lex version will not parse that as a token } else { int pcnt=rv == '.'; while ((rv=scctx->rdbuf[0]) && ((rv>='0' && rv<='9') || (rv == '.' && !pcnt++))) scctx->rdbuf++; } l = scctx->rdbuf - ss + 1; if (l > sizeof(buf)) l=sizeof(buf); lstrcpyn_safe(buf,ss,l); *output = nseel_translate(scctx,buf); rv=VALUE; } toklen = scctx->rdbuf - ss; } yylloc_param->first_column = scctx->rdbuf - scctx->rdbuf_start - toklen; return rv; }