X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fas3%2Ftokenizer.lex;h=dcae2f2b3e0e4b002518170d996814b1a7bb669d;hb=21ef4c306d38969e8f5fe821a27d155b855735b9;hp=7a1762203a2090d0b58e8db642d4bf53bfca801c;hpb=747a523baa89370e4d2b8cbfe8b2ae2fa0b6edbd;p=swftools.git diff --git a/lib/as3/tokenizer.lex b/lib/as3/tokenizer.lex index 7a17622..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 @@ -121,9 +145,10 @@ static inline int handlenumber() char is_float=0; for(t=0;t10) + char*max = l?"1073741824":"2147483647"; + if(yyleng-l>10) syntaxerror("integer overflow"); - if(yyleng==10) { + if(yyleng-l==10) { int t; for(t=0;tmax[t]) - syntaxerror("integer overflow"); + syntaxerror("integer overflow %s > %s", s+l,max); else if(yytext[l+t]-128) + return T_BYTE; + else if(v>=-32768) + return T_SHORT; + else + return T_INT; } else { - unsigned int v = atoi(s); + unsigned int v = 0; + for(t=0;t