-"_asm" { count(); asmp = asmbuff ;BEGIN(asm) ;}
-<asm>"_endasm" { count() ;
- *asmp = '\0' ;
- strcpy(yylval.yyinline,asmbuff) ;
- BEGIN(INITIAL) ;
- return (INLINEASM) ; }
-<asm>. { *asmp++ = yytext[0] ; }
-<asm>\n { count(); *asmp++ = '\n' ;}
-"/*" { comment(); }
+"_asm" {
+ count();
+ asmp = asmbuff = realloc (asmbuff, INITIAL_INLINEASM);
+ asmbuffSize=INITIAL_INLINEASM;
+ BEGIN(asm) ;
+}
+<asm>"_endasm" {
+ count();
+ *asmp = '\0';
+ yylval.yyinline = malloc (strlen(asmbuff)+1);
+ strcpy(yylval.yyinline,asmbuff);
+ BEGIN(INITIAL);
+ return (INLINEASM);
+}
+<asm>. {
+ if (asmp-asmbuff >= asmbuffSize-2) {
+ // increase the buffersize with 50%
+ int size=asmp-asmbuff;
+ asmbuffSize=asmbuffSize*3/2;
+ asmbuff = realloc (asmbuff, asmbuffSize);
+ asmp=asmbuff+size;
+ }
+ *asmp++ = yytext[0];
+}
+<asm>\n {
+ count();
+ if (asmp-asmbuff >= asmbuffSize-3) {
+ // increase the buffersize with 50%
+ int size=asmp-asmbuff;
+ asmbuffSize=asmbuffSize*3/2;
+ asmbuff = realloc (asmbuff, asmbuffSize);
+ asmp=asmbuff+size;
+ }
+ *asmp++ = '\n' ;
+}