+ return setuint(v);
+ }
+}
+
+static inline int handlehex()
+{
+ char l = (yytext[0]=='-')+2;
+
+ if(yyleng-l>8) {
+ char*s = nrbuf();
+ syntaxerror("integer overflow %s", s);
+ }
+
+ int t;
+ unsigned int v = 0;
+ for(t=l;t<yyleng;t++) {
+ v<<=4;
+ char c = yytext[t];
+ if(c>='0' && c<='9')
+ v|=(c&15);
+ else if(c>='a' && c<='f' ||
+ c>='A' && c<='F')
+ v|=(c&0x0f)+9;
+ }
+ if(l && v>1073741824) {
+ char*s = nrbuf();
+ warning("signed integer overflow: %s", s);
+ return setfloat(v);
+ }
+ if(!l && v>2147483647) {
+ char*s = nrbuf();
+ warning("unsigned integer overflow: %s", s);
+ return setfloat(v);
+ }
+
+ if(l==3) {
+ return setint(-(int)v);
+ } else {
+ return setuint(v);
+ }
+}
+
+void handleLabel(char*text, int len)
+{
+ int t;
+ for(t=len-1;t>=0;--t) {
+ if(text[t]!=' ' &&
+ text[t]!=':')
+ break;
+ }
+ char*s = malloc(t+1);
+ memcpy(s, yytext, t);
+ s[t]=0;
+ avm2_lval.id = s;
+}
+
+static int handleregexp()
+{
+ char*s = malloc(yyleng);
+ int len=yyleng-1;
+ memcpy(s, yytext+1, len);
+ s[len] = 0;
+ int t;
+ for(t=len;t>=0;--t) {
+ if(s[t]=='/') {
+ s[t] = 0;
+ break;
+ }
+ }
+ avm2_lval.regexp.pattern = s;
+ if(t==len) {
+ avm2_lval.regexp.options = 0;
+ } else {
+ avm2_lval.regexp.options = s+t+1;