X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fas3%2Ftokenizer.lex;h=dcae2f2b3e0e4b002518170d996814b1a7bb669d;hb=21ef4c306d38969e8f5fe821a27d155b855735b9;hp=5a8ec323fb14c1d01180ef8adb6755b6f63e95ca;hpb=2f5439b70a9b86a51b629efe0c9ae7f4bda00107;p=swftools.git diff --git a/lib/as3/tokenizer.lex b/lib/as3/tokenizer.lex index 5a8ec32..dcae2f2 100644 --- a/lib/as3/tokenizer.lex +++ b/lib/as3/tokenizer.lex @@ -1,4 +1,28 @@ +/* tokenizer.lex + + Routines for compiling Flash2 AVM2 ABC Actionscript + + Extension module for the rfxswf library. + Part of the swftools package. + + Copyright (c) 2008 Matthias Kramm + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ %{ + + #include #include #include @@ -147,8 +171,14 @@ static inline int handlenumber() } } if(yytext[0]=='-') { - avm2_lval.number_int = atoi(s); - return T_INT; + int v = atoi(s); + avm2_lval.number_int = v; + if(v>-128) + return T_BYTE; + else if(v>=-32768) + return T_SHORT; + else + return T_INT; } else { unsigned int v = 0; for(t=0;t