Yasm Assembler mainline development tree (ffmpeg 依赖)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

520 lines
10 KiB

/* Generated by re2c 0.9.1-C on Thu Aug 14 20:37:33 2003
*/
#line 1 "scanner.re"
#include <stdlib.h>
#include <string.h>
#include "tools/re2c/scanner.h"
#include "tools/re2c/parse.h"
#include "tools/re2c/globals.h"
#include "re2c-parser.h"
#define BSIZE 8192
#define YYCTYPE unsigned char
#define YYCURSOR cursor
#define YYLIMIT s->lim
#define YYMARKER s->ptr
#define YYFILL(n) {cursor = fill(s, cursor);}
#define RETURN(i) {s->cur = cursor; return i;}
static unsigned char *fill(Scanner*, unsigned char*);
void
Scanner_init(Scanner *s, FILE *i)
{
s->in = i;
s->bot = s->tok = s->ptr = s->cur = s->pos = s->lim = s->top =
s->eof = NULL;
s->tchar = s->tline = 0;
s->cline = 1;
}
static unsigned char *
fill(Scanner *s, unsigned char *cursor)
{
if(!s->eof){
unsigned int cnt = s->tok - s->bot;
if(cnt){
memcpy(s->bot, s->tok, s->lim - s->tok);
s->tok = s->bot;
s->ptr -= cnt;
cursor -= cnt;
s->pos -= cnt;
s->lim -= cnt;
}
if((s->top - s->lim) < BSIZE){
unsigned char *buf = malloc(((s->lim - s->bot) + BSIZE));
memcpy(buf, s->tok, s->lim - s->tok);
s->tok = buf;
s->ptr = &buf[s->ptr - s->bot];
cursor = &buf[cursor - s->bot];
s->pos = &buf[s->pos - s->bot];
s->lim = &buf[s->lim - s->bot];
s->top = &s->lim[BSIZE];
if (s->bot)
free(s->bot);
s->bot = buf;
}
if((cnt = fread(s->lim, 1, BSIZE, s->in)) != BSIZE){
s->eof = &s->lim[cnt]; *s->eof++ = '\n';
}
s->lim += cnt;
}
return cursor;
}
#line 75 "scanner.re"
int
Scanner_echo(Scanner *s, FILE *out)
{
unsigned char *cursor = s->cur;
/* Catch EOF */
if (s->eof && cursor == s->eof)
return 0;
s->tok = cursor;
echo:
#line 85 "scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy0;
++YYCURSOR;
yy0:
if((YYLIMIT - YYCURSOR) < 7) YYFILL(7);
yych = *YYCURSOR;
if(yych == '\n') goto yy4;
if(yych != '/') goto yy6;
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if(yych == '*') goto yy7;
yy3:
#line 96 "scanner.re"
{ goto echo; }
#line 102 "scanner.c"
yy4: yych = *++YYCURSOR;
#line 92 "scanner.re"
{ if(cursor == s->eof) RETURN(0);
fwrite(s->tok, 1, cursor - s->tok, out);
s->tok = s->pos = cursor; s->cline++; oline++;
goto echo; }
#line 110 "scanner.c"
yy6: yych = *++YYCURSOR;
goto yy3;
yy7: yych = *++YYCURSOR;
if(yych == '!') goto yy9;
yy8: YYCURSOR = YYMARKER;
switch(yyaccept){
case 0: goto yy3;
}
yy9: yych = *++YYCURSOR;
if(yych != 'r') goto yy8;
yych = *++YYCURSOR;
if(yych != 'e') goto yy8;
yych = *++YYCURSOR;
if(yych != '2') goto yy8;
yych = *++YYCURSOR;
if(yych != 'c') goto yy8;
yych = *++YYCURSOR;
#line 89 "scanner.re"
{ fwrite(s->tok, 1, &cursor[-7] - s->tok, out);
s->tok = cursor;
RETURN(1); }
#line 133 "scanner.c"
}
#line 97 "scanner.re"
}
int
Scanner_scan(Scanner *s)
{
unsigned char *cursor = s->cur;
unsigned int depth;
scan:
s->tchar = cursor - s->pos;
s->tline = s->cline;
s->tok = cursor;
#line 151 "scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy15;
++YYCURSOR;
yy15:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if(yych <= ':'){
if(yych <= '"'){
if(yych <= '\n'){
if(yych <= '\b') goto yy35;
if(yych <= '\t') goto yy31;
goto yy33;
} else {
if(yych == ' ') goto yy31;
if(yych <= '!') goto yy35;
goto yy23;
}
} else {
if(yych <= '*'){
if(yych <= '\'') goto yy35;
if(yych <= ')') goto yy27;
goto yy21;
} else {
if(yych <= '+') goto yy28;
if(yych == '/') goto yy19;
goto yy35;
}
}
} else {
if(yych <= 'Z'){
if(yych <= '='){
if(yych == '<') goto yy35;
goto yy27;
} else {
if(yych == '?') goto yy28;
if(yych <= '@') goto yy35;
goto yy29;
}
} else {
if(yych <= '`'){
if(yych <= '[') goto yy25;
if(yych <= '\\') goto yy27;
goto yy35;
} else {
if(yych <= 'z') goto yy29;
if(yych <= '{') goto yy17;
if(yych <= '|') goto yy27;
goto yy35;
}
}
}
yy17: yych = *++YYCURSOR;
#line 112 "scanner.re"
{ depth = 1;
goto code;
}
#line 211 "scanner.c"
yy19: yych = *++YYCURSOR;
if(yych == '*') goto yy54;
yy20:
#line 131 "scanner.re"
{ RETURN(*s->tok); }
#line 217 "scanner.c"
yy21: yych = *++YYCURSOR;
if(yych == '/') goto yy52;
yy22:
#line 133 "scanner.re"
{ yylval.op = *s->tok;
RETURN(CLOSE); }
#line 224 "scanner.c"
yy23: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if(yych != '\n') goto yy48;
yy24:
#line 124 "scanner.re"
{ Scanner_fatal(s, "bad string"); }
#line 231 "scanner.c"
yy25: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
if(yych != '\n') goto yy42;
yy26:
#line 129 "scanner.re"
{ Scanner_fatal(s, "bad character constant"); }
#line 238 "scanner.c"
yy27: yych = *++YYCURSOR;
goto yy20;
yy28: yych = *++YYCURSOR;
goto yy22;
yy29: yych = *++YYCURSOR;
goto yy40;
yy30:
#line 136 "scanner.re"
{ SubStr substr;
s->cur = cursor;
substr = Scanner_token(s);
yylval.symbol = Symbol_find(&substr);
return ID; }
#line 252 "scanner.c"
yy31: yych = *++YYCURSOR;
goto yy38;
yy32:
#line 142 "scanner.re"
{ goto scan; }
#line 258 "scanner.c"
yy33: yych = *++YYCURSOR;
#line 144 "scanner.re"
{ if(cursor == s->eof) RETURN(0);
s->pos = cursor; s->cline++;
goto scan;
}
#line 266 "scanner.c"
yy35: yych = *++YYCURSOR;
#line 149 "scanner.re"
{ fprintf(stderr, "unexpected character: '%c'\n", *s->tok);
goto scan;
}
#line 273 "scanner.c"
yy37: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy38: if(yych == '\t') goto yy37;
if(yych == ' ') goto yy37;
goto yy32;
yy39: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy40: if(yych <= '@'){
if(yych <= '/') goto yy30;
if(yych <= '9') goto yy39;
goto yy30;
} else {
if(yych <= 'Z') goto yy39;
if(yych <= '`') goto yy30;
if(yych <= 'z') goto yy39;
goto yy30;
}
yy41: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy42: if(yych <= '['){
if(yych != '\n') goto yy41;
} else {
if(yych <= '\\') goto yy44;
if(yych <= ']') goto yy45;
goto yy41;
}
yy43: YYCURSOR = YYMARKER;
switch(yyaccept){
case 0: goto yy24;
case 1: goto yy26;
}
yy44: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if(yych == '\n') goto yy43;
goto yy41;
yy45: yych = *++YYCURSOR;
#line 126 "scanner.re"
{ s->cur = cursor;
yylval.regexp = ranToRE(Scanner_token(s));
return RANGE; }
#line 319 "scanner.c"
yy47: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy48: if(yych <= '!'){
if(yych == '\n') goto yy43;
goto yy47;
} else {
if(yych <= '"') goto yy50;
if(yych != '\\') goto yy47;
}
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if(yych == '\n') goto yy43;
goto yy47;
yy50: yych = *++YYCURSOR;
#line 121 "scanner.re"
{ s->cur = cursor;
yylval.regexp = strToRE(Scanner_token(s));
return STRING; }
#line 341 "scanner.c"
yy52: yych = *++YYCURSOR;
#line 118 "scanner.re"
{ s->tok = cursor;
RETURN(0); }
#line 347 "scanner.c"
yy54: yych = *++YYCURSOR;
#line 115 "scanner.re"
{ depth = 1;
goto comment; }
#line 353 "scanner.c"
}
#line 152 "scanner.re"
code:
#line 360 "scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy56;
++YYCURSOR;
yy56:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if(yych <= '&'){
if(yych <= '\n'){
if(yych <= '\t') goto yy64;
goto yy62;
} else {
if(yych == '"') goto yy66;
goto yy64;
}
} else {
if(yych <= '{'){
if(yych <= '\'') goto yy67;
if(yych <= 'z') goto yy64;
goto yy60;
} else {
if(yych != '}') goto yy64;
}
}
yych = *++YYCURSOR;
#line 156 "scanner.re"
{ if(--depth == 0){
s->cur = cursor;
yylval.token = Token_new(Scanner_token(s), s->tline);
return CODE;
}
goto code; }
#line 395 "scanner.c"
yy60: yych = *++YYCURSOR;
#line 162 "scanner.re"
{ ++depth;
goto code; }
#line 401 "scanner.c"
yy62: yych = *++YYCURSOR;
#line 164 "scanner.re"
{ if(cursor == s->eof) Scanner_fatal(s, "missing '}'");
s->pos = cursor; s->cline++;
goto code;
}
#line 409 "scanner.c"
yy64: yych = *++YYCURSOR;
yy65:
#line 168 "scanner.re"
{ goto code; }
#line 414 "scanner.c"
yy66: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if(yych == '\n') goto yy65;
goto yy73;
yy67: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
if(yych == '\n') goto yy65;
goto yy69;
yy68: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy69: if(yych <= '&'){
if(yych != '\n') goto yy68;
} else {
if(yych <= '\'') goto yy64;
if(yych == '\\') goto yy71;
goto yy68;
}
yy70: YYCURSOR = YYMARKER;
switch(yyaccept){
case 0: goto yy65;
}
yy71: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if(yych == '\n') goto yy70;
goto yy68;
yy72: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy73: if(yych <= '!'){
if(yych == '\n') goto yy70;
goto yy72;
} else {
if(yych <= '"') goto yy64;
if(yych != '\\') goto yy72;
}
++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
if(yych == '\n') goto yy70;
goto yy72;
}
#line 169 "scanner.re"
comment:
#line 463 "scanner.c"
{
YYCTYPE yych;
unsigned int yyaccept;
goto yy75;
++YYCURSOR;
yy75:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
if(yych <= ')'){
if(yych == '\n') goto yy80;
goto yy82;
} else {
if(yych <= '*') goto yy77;
if(yych == '/') goto yy79;
goto yy82;
}
yy77: yych = *++YYCURSOR;
if(yych == '/') goto yy85;
yy78:
#line 183 "scanner.re"
{ goto comment; }
#line 485 "scanner.c"
yy79: yych = *++YYCURSOR;
if(yych == '*') goto yy83;
goto yy78;
yy80: yych = *++YYCURSOR;
#line 179 "scanner.re"
{ if(cursor == s->eof) RETURN(0);
s->tok = s->pos = cursor; s->cline++;
goto comment;
}
#line 496 "scanner.c"
yy82: yych = *++YYCURSOR;
goto yy78;
yy83: yych = *++YYCURSOR;
#line 177 "scanner.re"
{ ++depth;
goto comment; }
#line 504 "scanner.c"
yy85: yych = *++YYCURSOR;
#line 173 "scanner.re"
{ if(--depth == 0)
goto scan;
else
goto comment; }
#line 512 "scanner.c"
}
#line 184 "scanner.re"
}
void
Scanner_fatal(Scanner *s, const char *msg)
{
fprintf(stderr, "line %d, column %d: %s\n", s->tline, s->tchar + 1, msg);
exit(1);
}