3 Routines for compiling Flash2 AVM2 ABC Actionscript
5 Extension module for the rfxswf library.
6 Part of the swftools package.
8 Copyright (c) 2008 Matthias Kramm <kramm@quiss.org>
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
32 #include "tokenizer.h"
35 unsigned int as3_tokencount = 0;
37 static void dbg(const char*format, ...)
44 va_start(arglist, format);
45 vsnprintf(buf, sizeof(buf)-1, format, arglist);
48 while(l && buf[l-1]=='\n') {
52 printf("(tokenizer) ");
57 #ifndef YY_CURRENT_BUFFER
58 #define YY_CURRENT_BUFFER yy_current_buffer
61 static void*as3_buffer=0;
62 static int as3_buffer_pos=0;
63 static int as3_buffer_len=0;
64 void as3_file_input(FILE*fi)
69 void as3_buffer_input(void*buffer, int len)
72 syntaxerror("trying to parse zero bytearray");
80 //#define BEGIN(x) {(yy_start) = 1 + 2 *x;dbg("entering state %d", x);}
82 #define YY_INPUT(buf,result,max_size) { \
85 while((result = fread(buf, 1, max_size, as3_in))==0 && ferror(as3_in)) \
86 { if(errno != EINTR) {YY_FATAL_ERROR("input in flex scanner failed"); break;} \
87 errno=0; clearerr(as3_in); \
90 int to_read = max_size; \
91 if(to_read + as3_buffer_pos > as3_buffer_len) \
92 to_read = as3_buffer_len - as3_buffer_pos; \
93 memcpy(buf, as3_buffer+as3_buffer_pos, to_read); \
94 as3_buffer_pos += to_read; \
99 void handleInclude(char*text, int len, char quotes)
103 char*p1 = strchr(text, '"');
104 char*p2 = strrchr(text, '"');
105 if(!p1 || !p2 || p1==p2) {
106 syntaxerror("Invalid include in line %d\n", current_line);
109 filename = strdup(p1+1);
113 while(!strchr(" \n\r\t\xa0", text[i1])) i1++;
115 while(strchr(" \n\r\t\xa0", text[i1])) i1++;
116 while(strchr(" \n\r\t\xa0", text[i2-1])) i2--;
117 if(i2!=len) text[i2]=0;
118 filename = strdup(&text[i1]);
121 char*fullfilename = find_file(filename, 1);
122 enter_file2(filename, fullfilename, YY_CURRENT_BUFFER);
123 yyin = fopen(fullfilename, "rb");
125 syntaxerror("Couldn't open include file \"%s\"\n", fullfilename);
128 yy_switch_to_buffer(yy_create_buffer( yyin, YY_BUF_SIZE ) );
129 //BEGIN(DEFAULT); keep context
132 static int do_unescape(const char*s, const char*end, char*n)
138 if(o) o[len] = *s;len++;
143 if(s==end) syntaxerror("invalid \\ at end of string");
145 /* handle the various line endings (mac, dos, unix) */
158 case '\\': if(o) o[len] = '\\';s++;len++; break;
159 case '"': if(o) o[len] = '"';s++;len++; break;
160 case '\'': if(o) o[len] = '\'';s++;len++; break;
161 case 'b': if(o) o[len] = '\b';s++;len++; break;
162 case 'f': if(o) o[len] = '\f';s++;len++; break;
163 case 'n': if(o) o[len] = '\n';s++;len++; break;
164 case 'r': if(o) o[len] = '\r';s++;len++; break;
165 case 't': if(o) o[len] = '\t';s++;len++; break;
166 case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': {
169 while(strchr("01234567", *s) && nr<3 && s<end) {
176 syntaxerror("octal number out of range (0-255): %d", num);
177 if(o) o[len] = num;len++;
180 case 'x': case 'u': {
189 if(s==end) syntaxerror("invalid \\u or \\x at end of string");
192 if(s==end) syntaxerror("invalid \\u{ at end of string");
197 while(strchr("0123456789abcdefABCDEF", *s) && (bracket || nr < max) && s<end) {
199 if(*s>='0' && *s<='9') num |= *s - '0';
200 if(*s>='a' && *s<='f') num |= *s - 'a' + 10;
201 if(*s>='A' && *s<='F') num |= *s - 'A' + 10;
206 if(*s=='}' && s<end) {
209 syntaxerror("missing terminating '}'");
213 char*utf8 = getUTF8(num);
215 if(o) o[len] = *utf8;utf8++;len++;
219 syntaxerror("byte out of range (0-255): %d", num);
220 if(o) o[len] = num;len++;
239 static string_t string_unescape(const char*in, int l)
242 const char*end = &in[l];
244 int len = do_unescape(s, end, 0);
245 char*n = (char*)malloc(len+1);
246 do_unescape(s, end, n);
247 string_t out = string_new(n, len);
251 static void handleCData(char*s, int len)
253 a3_lval.str.str = s+9; // <![CDATA[
254 a3_lval.str.len = len-9-3;// ]]>
255 a3_lval.str.str = strdup_n(a3_lval.str.str, a3_lval.str.len);
258 static void handleRaw(char*s, int len)
260 a3_lval.str.len = len;
261 a3_lval.str.str = strdup_n(s, a3_lval.str.len);
264 static void handleString(char*s, int len)
267 if(s[len-1]!='"') syntaxerror("String doesn't end with '\"'");
270 else if(s[0]=='\'') {
271 if(s[len-1]!='\'') syntaxerror("String doesn't end with '\"'");
274 else syntaxerror("String incorrectly terminated");
276 a3_lval.str = string_unescape(s, len);
280 char start_of_expression;
282 static inline int m(int type)
284 a3_lval.token = type;
288 static char numberbuf[64];
291 if(yyleng>sizeof(numberbuf)-1)
292 syntaxerror("decimal number overflow");
294 memcpy(s, yytext, yyleng);
299 static inline int setint(int v)
301 a3_lval.number_int = v;
304 static inline int setfloat(double v)
306 a3_lval.number_float = v;
310 static inline int handlefloat()
313 a3_lval.number_float = atof(s);
317 static inline int handleint()
320 char l = (yytext[0]=='-');
322 //char*max = l?"1073741824":"2147483647";
323 char*max = l?"2147483648":"2147483647";
326 as3_softwarning("integer overflow: %s (converted to Number)", s);
327 return handlefloat();
331 for(t=0;t<yyleng-l;t++) {
332 if(yytext[l+t]>max[t]) {
333 as3_softwarning("integer overflow: %s (converted to Number)", s);
334 return handlefloat();
336 else if(yytext[l+t]<max[t])
346 for(t=0;t<yyleng;t++) {
354 static inline int handlehexfloat()
356 char l = (yytext[0]=='-')+2;
361 for(t=l;t<yyleng;t++) {
374 else if((c>='a' && c<='f') || (c>='A' && c<='F'))
375 d+=((c&0x0f)+9)*base;
379 static inline int handlehex()
381 char l = (yytext[0]=='-')+2;
386 syntaxerror("integer overflow %s", s);
396 else if((c>='a' && c<='f') || (c>='A' && c<='F'))
399 if(l && v>=0x80000000) {
401 as3_softwarning("integer overflow: %s (converted to Number)", s);
404 if(!l && v>0x7fffffff) {
406 as3_softwarning("integer overflow: %s (converted to Number)", s);
411 return setint(-(int)v);
417 void handleLabel(char*text, int len)
420 for(t=len-1;t>=0;--t) {
425 char*s = malloc(t+1);
426 memcpy(s, yytext, t);
431 static int handleregexp()
433 char*s = malloc(yyleng);
435 memcpy(s, yytext+1, len);
438 for(t=len;t>=0;--t) {
444 a3_lval.regexp.pattern = s;
446 a3_lval.regexp.options = 0;
448 a3_lval.regexp.options = s+t+1;
453 void initialize_scanner();
454 #define YY_USER_INIT initialize_scanner();
456 /* count the number of lines+columns consumed by this token */
457 static inline void l() {
459 for(t=0;t<yyleng;t++) {
460 if(yytext[t]=='\n') {
468 /* count the number of columns consumed by this token */
469 static inline void c() {
470 current_column+=yyleng;
473 trie_t*active_namespaces = 0;
474 /*void tokenizer_register_namespace(const char*id)
476 trie_put(namespaces, id, 0);
478 void tokenizer_unregister_namespace(const char*id)
480 trie_remove(namespaces, id);
482 static inline char tokenizer_is_namespace(const char*id)
484 if(!active_namespaces) return 0;
485 return trie_contains(active_namespaces, (const unsigned char*)id);
488 static inline int handleIdentifier()
490 char*s = malloc(yyleng+1);
491 memcpy(s, yytext, yyleng);
494 if(tokenizer_is_namespace(s))
499 static int tokenerror();
502 //Boolean {c();return m(KW_BOOLEAN);}
503 //int {c();return m(KW_INT);}
504 //uint {c();return m(KW_UINT);}
505 //Number {c();return m(KW_NUMBER);}
506 //XMLCOMMENT <!--([^->]|(-/[^-])|(--/[^>]))*-->
518 X1 parsing identifiers with a non unicode lexer is a knightmare we have to skip all possible
519 X2 combinations of byte order markers or utf8 space chars and i dont quite like the fact that
520 X3 lex doesnt support proper comments in this section either...
521 X4 {NAME_HEAD}{NAME_TAIL}
523 NAME_NOC2EF [a-zA-Z_\x80-\xc1\xc3-\xee\xf0-\xff]
524 NAME_EF [\xef][a-zA-Z0-9_\\\x80-\xba\xbc-\xff]
525 NAME_C2 [\xc2][a-zA-Z0-9_\\\x80-\x9f\xa1-\xff]
526 NAME_EFBB [\xef][\xbb][a-zA-Z0-9_\\\x80-\xbe\xc0-\xff]
527 NAME_TAIL [a-zA-Z_0-9\\\x80-\xff]*
528 NAME_HEAD (({NAME_NOC2EF})|({NAME_EF})|({NAME_C2})|({NAME_EFBB}))
529 NAME {NAME_HEAD}{NAME_TAIL}
531 _ [^a-zA-Z0-9_\\\x80-\xff]
533 HEXINT 0x[a-zA-Z0-9]+
534 HEXFLOAT 0x[a-zA-Z0-9]*\.[a-zA-Z0-9]*
536 FLOAT ([0-9]+(\.[0-9]*)?|\.[0-9]+)(e[0-9]+)?
538 HEXWITHSIGN [+-]?({HEXINT})
539 HEXFLOATWITHSIGN [+-]?({HEXFLOAT})
540 INTWITHSIGN [+-]?({INT})
541 FLOATWITHSIGN [+-]?({FLOAT})
543 CDATA <!\[CDATA\[([^]]|\][^]]|\]\][^>])*\]*\]\]\>
544 XMLCOMMENT <!--([^->]|[-]+[^>-]|>)*-*-->
546 XMLID [A-Za-z0-9_\x80-\xff]+([:][A-Za-z0-9_\x80-\xff]+)?
547 XMLSTRING ["][^"]*["]
549 STRING ["](\\[\x00-\xff]|[^\\"\n])*["]|['](\\[\x00-\xff]|[^\\'\n])*[']
550 S ([ \n\r\t\xa0]|[\xc2][\xa0])
551 MULTILINE_COMMENT [/][*]+([*][^/]|[^/*]|[^*][/]|[\x00-\x1f])*[*]+[/]
552 SINGLELINE_COMMENT \/\/[^\n\r]*[\n\r]
553 REGEXP [/]([^/\n]|\\[/])*[/][a-zA-Z]*
557 {SINGLELINE_COMMENT} {l(); /* single line comment */}
558 {MULTILINE_COMMENT} {l(); /* multi line comment */}
559 [/][*] {syntaxerror("syntax error: unterminated comment", yytext);}
561 ^include{S}+{STRING}{S}*/\n {l();handleInclude(yytext, yyleng, 1);}
562 ^include{S}+[^" \t\xa0\r\n][\x20-\xff]*{S}*/\n {l();handleInclude(yytext, yyleng, 0);}
563 {STRING} {l(); BEGIN(DEFAULT);handleString(yytext, yyleng);return T_STRING;}
564 {CDATA} {l(); BEGIN(DEFAULT);handleCData(yytext, yyleng);return T_STRING;}
566 <DEFAULT,BEGINNING,REGEXPOK>{
567 {XMLCOMMENT} {l(); BEGIN(DEFAULT);handleRaw(yytext, yyleng);return T_STRING;}
571 {XMLSTRING} {l(); handleRaw(yytext, yyleng);return T_STRING;}
572 [{] {c(); BEGIN(REGEXPOK);return m('{');}
573 [<] {c(); return m('<');}
574 [/] {c(); return m('/');}
575 [>] {c(); return m('>');}
576 [=] {c(); return m('=');}
577 {XMLID} {c(); handleRaw(yytext, yyleng);return T_IDENTIFIER;}
579 <<EOF>> {syntaxerror("unexpected end of file");}
583 [^<>{]+ {l(); handleRaw(yytext, yyleng);return T_STRING;}
584 [{] {c(); BEGIN(REGEXPOK);return m('{');}
585 [<] {c(); BEGIN(XML);return m('<');}
586 [>] {c(); return m('>');}
587 {XMLCOMMENT} {l(); handleRaw(yytext, yyleng);return T_STRING;}
588 {CDATA} {l(); handleRaw(yytext, yyleng);return T_STRING;}
589 <<EOF>> {syntaxerror("unexpected end of file");}
592 <BEGINNING,REGEXPOK>{
593 {REGEXP} {c(); BEGIN(DEFAULT);return handleregexp();}
594 {HEXWITHSIGN}/{_} {c(); BEGIN(DEFAULT);return handlehex();}
595 {HEXFLOATWITHSIGN}/{_} {c(); BEGIN(DEFAULT);return handlehexfloat();}
596 {INTWITHSIGN}/{_} {c(); BEGIN(DEFAULT);return handleint();}
597 {FLOATWITHSIGN}/{_} {c(); BEGIN(DEFAULT);return handlefloat();}
600 <REGEXPOK>[\{] {c(); BEGIN(REGEXPOK);return m(T_DICTSTART);}
601 [\{] {c(); BEGIN(DEFAULT); return m('{');}
603 \xef\xbb\xbf {/* utf 8 bom (0xfeff) */}
606 {HEXINT}/{_} {c(); BEGIN(DEFAULT);return handlehex();}
607 {HEXFLOAT}/{_} {c(); BEGIN(DEFAULT);return handlehexfloat();}
608 {INT}/{_} {c(); BEGIN(DEFAULT);return handleint();}
609 {FLOAT}/{_} {c(); BEGIN(DEFAULT);return handlefloat();}
610 NaN {c(); BEGIN(DEFAULT);return m(KW_NAN);}
612 3rr0r {/* for debugging: generates a tokenizer-level error */
613 syntaxerror("3rr0r");}
615 {NAME}{S}*:{S}*for/{_} {l();BEGIN(DEFAULT);handleLabel(yytext, yyleng-3);return T_FOR;}
616 {NAME}{S}*:{S}*do/{_} {l();BEGIN(DEFAULT);handleLabel(yytext, yyleng-2);return T_DO;}
617 {NAME}{S}*:{S}*while/{_} {l();BEGIN(DEFAULT);handleLabel(yytext, yyleng-5);return T_WHILE;}
618 {NAME}{S}*:{S}*switch/{_} {l();BEGIN(DEFAULT);handleLabel(yytext, yyleng-6);return T_SWITCH;}
619 default{S}xml {l();BEGIN(DEFAULT);return m(KW_DEFAULT_XML);}
620 for {c();BEGIN(DEFAULT);a3_lval.id="";return T_FOR;}
621 do {c();BEGIN(DEFAULT);a3_lval.id="";return T_DO;}
622 while {c();BEGIN(DEFAULT);a3_lval.id="";return T_WHILE;}
623 switch {c();BEGIN(DEFAULT);a3_lval.id="";return T_SWITCH;}
625 [&][&] {c();BEGIN(REGEXPOK);return m(T_ANDAND);}
626 [|][|] {c();BEGIN(REGEXPOK);return m(T_OROR);}
627 [!][=] {c();BEGIN(REGEXPOK);return m(T_NE);}
628 [!][=][=] {c();BEGIN(REGEXPOK);return m(T_NEE);}
629 [=][=][=] {c();BEGIN(REGEXPOK);return m(T_EQEQEQ);}
630 [=][=] {c();BEGIN(REGEXPOK);return m(T_EQEQ);}
631 [>][=] {c();BEGIN(REGEXPOK);return m(T_GE);}
632 [<][=] {c();BEGIN(REGEXPOK);return m(T_LE);}
633 [-][-] {c();BEGIN(DEFAULT);return m(T_MINUSMINUS);}
634 [+][+] {c();BEGIN(DEFAULT);return m(T_PLUSPLUS);}
635 [+][=] {c();BEGIN(REGEXPOK);return m(T_PLUSBY);}
636 [\^][=] {c();BEGIN(REGEXPOK);return m(T_XORBY);}
637 [-][=] {c();BEGIN(REGEXPOK);return m(T_MINUSBY);}
638 [/][=] {c();BEGIN(REGEXPOK);return m(T_DIVBY);}
639 [%][=] {c();BEGIN(REGEXPOK);return m(T_MODBY);}
640 [*][=] {c();BEGIN(REGEXPOK);return m(T_MULBY);}
641 [|][=] {c();BEGIN(REGEXPOK);return m(T_ORBY);}
642 [&][=] {c();BEGIN(REGEXPOK);return m(T_ANDBY);}
643 [>][>][=] {c();BEGIN(REGEXPOK);return m(T_SHRBY);}
644 [<][<][=] {c();BEGIN(REGEXPOK);return m(T_SHLBY);}
645 [>][>][>][=] {c();BEGIN(REGEXPOK);return m(T_USHRBY);}
646 [<][<] {c();BEGIN(REGEXPOK);return m(T_SHL);}
647 [>][>][>] {c();BEGIN(REGEXPOK);return m(T_USHR);}
648 [>][>] {c();BEGIN(REGEXPOK);return m(T_SHR);}
649 \.\.\. {c();BEGIN(REGEXPOK);return m(T_DOTDOTDOT);}
650 \.\. {c();BEGIN(REGEXPOK);return m(T_DOTDOT);}
651 \. {c();BEGIN(REGEXPOK);return m('.');}
652 :: {c();BEGIN(REGEXPOK);return m(T_COLONCOLON);}
653 : {c();BEGIN(REGEXPOK);return m(':');}
654 instanceof {c();BEGIN(REGEXPOK);return m(KW_INSTANCEOF);}
655 implements {c();BEGIN(REGEXPOK);return m(KW_IMPLEMENTS);}
656 interface {c();BEGIN(DEFAULT);return m(KW_INTERFACE);}
657 protected {c();BEGIN(DEFAULT);return m(KW_PROTECTED);}
658 namespace {c();BEGIN(DEFAULT);return m(KW_NAMESPACE);}
659 undefined {c();BEGIN(DEFAULT);return m(KW_UNDEFINED);}
660 arguments {c();BEGIN(DEFAULT);return m(KW_ARGUMENTS);}
661 continue {c();BEGIN(DEFAULT);return m(KW_CONTINUE);}
662 override {c();BEGIN(DEFAULT);return m(KW_OVERRIDE);}
663 internal {c();BEGIN(DEFAULT);return m(KW_INTERNAL);}
664 function {c();BEGIN(DEFAULT);return m(KW_FUNCTION);}
665 finally {c();BEGIN(DEFAULT);return m(KW_FINALLY);}
666 default {c();BEGIN(DEFAULT);return m(KW_DEFAULT);}
667 package {c();BEGIN(DEFAULT);return m(KW_PACKAGE);}
668 private {c();BEGIN(DEFAULT);return m(KW_PRIVATE);}
669 dynamic {c();BEGIN(DEFAULT);return m(KW_DYNAMIC);}
670 extends {c();BEGIN(DEFAULT);return m(KW_EXTENDS);}
671 delete {c();BEGIN(REGEXPOK);return m(KW_DELETE);}
672 return {c();BEGIN(REGEXPOK);return m(KW_RETURN);}
673 public {c();BEGIN(DEFAULT);return m(KW_PUBLIC);}
674 native {c();BEGIN(DEFAULT);return m(KW_NATIVE);}
675 static {c();BEGIN(DEFAULT);return m(KW_STATIC);}
676 import {c();BEGIN(REGEXPOK);return m(KW_IMPORT);}
677 typeof {c();BEGIN(REGEXPOK);return m(KW_TYPEOF);}
678 throw {c();BEGIN(REGEXPOK);return m(KW_THROW);}
679 class {c();BEGIN(DEFAULT);return m(KW_CLASS);}
680 const {c();BEGIN(DEFAULT);return m(KW_CONST);}
681 catch {c();BEGIN(DEFAULT);return m(KW_CATCH);}
682 final {c();BEGIN(DEFAULT);return m(KW_FINAL);}
683 false {c();BEGIN(DEFAULT);return m(KW_FALSE);}
684 break {c();BEGIN(DEFAULT);return m(KW_BREAK);}
685 super {c();BEGIN(DEFAULT);return m(KW_SUPER);}
686 each {c();BEGIN(DEFAULT);return m(KW_EACH);}
687 void {c();BEGIN(DEFAULT);return m(KW_VOID);}
688 true {c();BEGIN(DEFAULT);return m(KW_TRUE);}
689 null {c();BEGIN(DEFAULT);return m(KW_NULL);}
690 else {c();BEGIN(DEFAULT);return m(KW_ELSE);}
691 case {c();BEGIN(REGEXPOK);return m(KW_CASE);}
692 with {c();BEGIN(REGEXPOK);return m(KW_WITH);}
693 use {c();BEGIN(REGEXPOK);return m(KW_USE);}
694 new {c();BEGIN(REGEXPOK);return m(KW_NEW);}
695 get {c();BEGIN(DEFAULT);return m(KW_GET);}
696 set {c();BEGIN(DEFAULT);return m(KW_SET);}
697 var {c();BEGIN(DEFAULT);return m(KW_VAR);}
698 try {c();BEGIN(DEFAULT);return m(KW_TRY);}
699 is {c();BEGIN(REGEXPOK);return m(KW_IS) ;}
700 in {c();BEGIN(REGEXPOK);return m(KW_IN) ;}
701 if {c();BEGIN(DEFAULT);return m(KW_IF) ;}
702 as {c();BEGIN(REGEXPOK);return m(KW_AS);}
703 $?{NAME} {c();BEGIN(DEFAULT);return handleIdentifier();}
705 [\]\}*] {c();BEGIN(DEFAULT);return m(yytext[0]);}
706 [+-\/^~@$!%&\(=\[|?:;,<>] {c();BEGIN(REGEXPOK);return m(yytext[0]);}
707 [\)\]] {c();BEGIN(DEFAULT);return m(yytext[0]);}
709 <DEFAULT,BEGINNING,REGEXPOK,XML,XMLTEXT>{
713 void*b = leave_file();
716 yy_delete_buffer(YY_CURRENT_BUFFER);
719 yy_delete_buffer(YY_CURRENT_BUFFER);
720 yy_switch_to_buffer(b);
731 static int tokenerror()
738 char c = buf[t]=input();
739 if(c=='\n' || c==EOF) {
744 if(c1>='0' && c1<='9')
745 syntaxerror("syntax error: %s (identifiers must not start with a digit)");
747 syntaxerror("syntax error [state=%d]: %s", (yy_start-1)/2, buf);
754 static char mbuf[256];
755 char*token2string(enum yytokentype nr, YYSTYPE v)
758 char*s = malloc(v.str.len+10);
759 strcpy(s, "<string>");
760 memcpy(s+8, v.str.str, v.str.len);
761 sprintf(s+8+v.str.len, " (%d bytes)", v.str.len);
764 else if(nr==T_REGEXP) {
765 char*s = malloc(strlen(v.regexp.pattern)+10);
766 sprintf(s, "<regexp>%s", v.regexp.pattern);
769 else if(nr==T_IDENTIFIER) {
770 char*s = malloc(strlen(v.id)+10);
771 sprintf(s, "<ID>%s", v.id);
774 else if(nr==T_INT) return "<int>";
775 else if(nr==T_UINT) return "<uint>";
776 else if(nr==T_FLOAT) return "<float>";
777 else if(nr==T_EOF) return "***END***";
778 else if(nr==T_GE) return ">=";
779 else if(nr==T_LE) return "<=";
780 else if(nr==T_MINUSMINUS) return "--";
781 else if(nr==T_PLUSPLUS) return "++";
782 else if(nr==KW_IMPLEMENTS) return "implements";
783 else if(nr==KW_INTERFACE) return "interface";
784 else if(nr==KW_NAMESPACE) return "namespace";
785 else if(nr==KW_PROTECTED) return "protected";
786 else if(nr==KW_OVERRIDE) return "override";
787 else if(nr==KW_INTERNAL) return "internal";
788 else if(nr==KW_FUNCTION) return "function";
789 else if(nr==KW_PACKAGE) return "package";
790 else if(nr==KW_PRIVATE) return "private";
791 else if(nr==KW_BOOLEAN) return "Boolean";
792 else if(nr==KW_DYNAMIC) return "dynamic";
793 else if(nr==KW_EXTENDS) return "extends";
794 else if(nr==KW_PUBLIC) return "public";
795 else if(nr==KW_NATIVE) return "native";
796 else if(nr==KW_STATIC) return "static";
797 else if(nr==KW_IMPORT) return "import";
798 else if(nr==KW_NUMBER) return "number";
799 else if(nr==KW_CLASS) return "class";
800 else if(nr==KW_CONST) return "const";
801 else if(nr==KW_FINAL) return "final";
802 else if(nr==KW_FALSE) return "False";
803 else if(nr==KW_TRUE) return "True";
804 else if(nr==KW_UINT) return "uint";
805 else if(nr==KW_NULL) return "null";
806 else if(nr==KW_ELSE) return "else";
807 else if(nr==KW_USE) return "use";
808 else if(nr==KW_INT) return "int";
809 else if(nr==KW_NEW) return "new";
810 else if(nr==KW_GET) return "get";
811 else if(nr==KW_SET) return "set";
812 else if(nr==KW_VAR) return "var";
813 else if(nr==KW_IS) return "is";
814 else if(nr==KW_AS) return "as";
816 sprintf(mbuf, "%d", nr);
821 void tokenizer_begin_xml()
823 dbg("begin reading xml");
826 void tokenizer_begin_xmltext()
828 dbg("begin reading xml text");
831 void tokenizer_end_xmltext()
833 dbg("end reading xml text");
836 void tokenizer_end_xml()
838 dbg("end reading xml");
842 void initialize_scanner()