📄 swf5compiler.flex
字号:
shiftright2 { count(); return SHIFTRIGHT2; }varequals { count(); return VAREQUALS; }oldadd { count(); return OLDADD; }subtract { count(); return SUBTRACT; }multiply { count(); return MULTIPLY; }divide { count(); return DIVIDE; }oldequals { count(); return OLDEQUALS; }oldlessthan { count(); return OLDLESSTHAN; }logicaland { count(); return LOGICALAND; }logicalor { count(); return LOGICALOR; }not { count(); return NOT; }stringeq { count(); return STRINGEQ; }stringlength { count(); return STRINGLENGTH; }substring { count(); return SUBSTRING; }getproperty { count(); return GETPROPERTY; }setproperty { count(); return SETPROPERTY; }getvariable { count(); return GETVARIABLE; }setvariable { count(); return SETVARIABLE; }settargetexpr { count(); return SETTARGETEXPRESSION; }startdrag { count(); return STARTDRAG; }stopdrag { count(); return STOPDRAG; }stringlessthan { count(); return STRINGLESSTHAN; }mblength { count(); return MBLENGTH; }mbsubstring { count(); return MBSUBSTRING; }mbord { count(); return MBORD; }mbchr { count(); return MBCHR; }branch { count(); return BRANCHALWAYS; }branchalways { count(); return BRANCHALWAYS; }branchiftrue { count(); return BRANCHIFTRUE; }post { count(); return POST; }get { count(); return GET; }end { count(); return END; }extends { count(); return EXTENDS; }tonumber { count(); return TONUMBER; }tostring { count(); return TOSTRING; }targetpath { count(); return TARGETPATH; }duplicatemovieclip { count(); return DUPLICATEMOVIECLIP; }removemovieclip { count(); return REMOVEMOVIECLIP; }implements { count(); return IMPLEMENTS; }fscommand2 { count(); return FSCOMMAND2; }cast { count(); return CAST; }r\:{DIGIT}+ { count(); swf5lval.str = strdup(yytext+2); return REGISTER; }trace { count(); return TRACE; }} /* rules action in any state */<*>{{ID} { count(); swf5lval.str = strdup(yytext); return IDENTIFIER; }\"(\\.|[^\\"])*\" { count(); swf5lval.str = strdup(yytext+1); swf5lval.str[strlen(swf5lval.str)-1]=0; unescape(swf5lval.str); return STRING; }\'(\\.|[^\\'])*\' { count(); swf5lval.str = strdup(yytext+1); swf5lval.str[strlen(swf5lval.str)-1]=0; unescape(swf5lval.str); return STRING; }\"(\\.|[^\\"])*$ { count(); swf5lval.str = NULL; warning("Unterminated string!"); return BROKENSTRING; }\'(\\.|[^\\'])*$ { count(); swf5lval.str = NULL; warning("Unterminated string!"); return BROKENSTRING; }"/*" { count(); comment(); }"//" { count(); comment1(); }[ \t\v\f] { count(); }"++" { count(); return INCR; }"--" { count(); return DECR; }"<=" { count(); return LE; }">=" { count(); return GE; }"==" { count(); return EQ; }"!=" { count(); return NE; }"&&" { count(); return LAN; }"||" { count(); return LOR; }"*=" { count(); return MEQ; }"/=" { count(); return DEQ; }"+=" { count(); return IEQ; }"-=" { count(); return SEQ; }"&=" { count(); return AEQ; }"|=" { count(); return OEQ; }"<<" { count(); return SHL; }">>" { count(); return SHR; }">>>" { count(); return SHR2; }"<<=" { count(); return SHLEQ; }">>=" { count(); return SHREQ; }">>>=" { count(); return SHR2EQ; }"<" { count(); return '<'; }">" { count(); return '>'; }";" { count(); return ';'; }"=" { count(); return '='; }"+" { count(); return '+'; }"-" { count(); return '-'; }"&" { count(); return '&'; }"|" { count(); return '|'; }"^" { count(); return '^'; }"*" { count(); return '*'; }"/" { count(); return '/'; }"%" { count(); return '%'; }"!" { count(); return '!'; }"(" { count(); return '('; }")" { count(); return ')'; }"[" { count(); return '['; }"]" { count(); return ']'; }"{" { count(); if(yy_new_state) { // if yy_new_state state was already pushed // and will be poped by closing '}' yy_new_state = 0; } else { // push current state on top of stack // preserves state when closing '}' pops stack yy_push_state(YY_START); } return '{'; }"}" { count(); yy_pop_state(); return '}'; }"," { count(); return ','; }"." { count(); return '.'; }"?" { count(); return '?'; }":" { count(); return ':'; }"~" { count(); return '~'; }\r?\n { countline(); yyless(1); }. SWF_error("Unrecognized character: %s\n", yytext);}%%static int getinput() {#ifdef __cplusplus return yyinput();#else return input();#endif}int swf5wrap(){ return 1;}static void countline(){ ++sLineNumber; column = 0; msgline = msgbufs[sLineNumber & 1];}static int LineNumber(void){ return realLine + 1;}static int ColumnNumber(void){ return realColumn;}static char *LineText(void){ return msgbufs[realLine & 1];}static void comment(){ // Handle block comments int c, c1;loop: // We have the start of a comment so look skip everything up to the // end of the comment character while ((c = getinput()) != '*' && c != EOF) { if(column < 1023) msgline[column] = c; ++column; // keep the line number in synch if (c == '\n') { // start the output (matches the algorithim in the lexx above) countline(); } if (swf5debug) putchar(c); } // is this the end of comment character if ((c1 = getinput()) != '/' && c != EOF) { // false start as this was no end of comment do_unput5(c1); goto loop; } // write out the start of the end of comment if (c != EOF) if (swf5debug) putchar(c); // write out the end of the end of comment if (c1 != EOF) if (swf5debug) putchar(c1);}static void comment1(){ // Handle comment of type 1 (ie '//') int c; // this is a line comment while ((c = getinput()) != '\n' && c != EOF) { if (swf5debug) putchar(c); if(column < 1023) msgline[column] = c; ++column; }; // keep the line number in synch if (c == '\n') { if (swf5debug) putchar(c); countline(); }}static void count(void){ int n; if(swf5debug) printf("%s", yytext); if(realLine != sLineNumber) { if(column > 0 || realLine + 1 < sLineNumber) { realColumn = 0; realLine = sLineNumber; } } realColumn += lastToken; lastToken = 0; for(n=0; n<yyleng; ++n, ++column, ++lastToken) { if(column < 1023) msgline[column] = yytext[n]; } msgline[column] = 0;}static void printprog(){ if(sLineNumber) SWF_warn("\n%s", msgbufs[(sLineNumber-1)&1]); if(column < 1023) msgline[column] = 0; SWF_warn("\n%s", msgline);}static void warning(char *msg){ // print a warning message printprog(); SWF_warn("\n%*s", ColumnNumber(), "^"); SWF_warn("\nLine %4.4d: Reason: '%s' \n", LineNumber(), msg);}void swf5error(char *msg){ // report a error if(strlen(yytext)) { SWF_error("\n%s\n%*s\nLine %i: Reason: '%s'\n", LineText(), ColumnNumber(), "^", LineNumber(), msg); } else { SWF_error("\nLine %d: Reason: 'Unexpected EOF found while looking for input.'\n", LineNumber()); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -