@ -49,7 +49,7 @@
#define YY_EXTRA_TYPE urj_svf_scanner_extra_t *
static int map_keyw_ident(YYSTYPE *, char *);
static void align_string(char *);
static int align_string(char *);
static void fix_yylloc(YYLTYPE *, char *);
static void fix_yylloc_nl(YYLTYPE *, char *, YY_EXTRA_TYPE);
@ -143,11 +143,12 @@ COMMENT (!.*)|("//".*)[^\n]
This is enabled with <expect_vector>. */
/* token is a vector string */
char *cstring;
int len;
fix_yylloc_nl(yylloc, yytext, yyget_extra(yyscanner));
align_string(yytext);
len = align_string(yytext);
cstring = malloc(str len(yytext) + 1);
cstring = malloc(len + 1);
strcpy(cstring, yytext);
yylval->cvalue = cstring;
return(VECTOR_STRING);
@ -161,13 +162,16 @@ COMMENT (!.*)|("//".*)[^\n]
1024 is chosen arbitrarily, increasing to e.g. 4096 enhances scanner
performance, trading off against huge table sizes.
This whole strategy needs to be revisited with support of flex experts.
Actually svf files generated by Quartus II SVF converter 10.0 have
fragments of 255 bytes as that is the data on a line
*/
char *cstring;
int len;
fix_yylloc_nl(yylloc, yytext, yyget_extra(yyscanner));
align_string(yytext);
len = align_string(yytext);
cstring = (char *)malloc(str len(yytext) + 1);
cstring = (char *)malloc(len + 1);
strcpy(cstring, yytext);
yylval->cvalue = cstring;
return(HEXA_NUM_FRAGMENT);
@ -333,20 +337,19 @@ map_keyw_ident (YYSTYPE *mylval, char *str)
}
static void
static int
align_string (char *str)
{
int src, dst, len;
dst = 0;
len = strlen (str);
char *src = str;
char *dst;
for (src = 0; src < len ; src++)
for (dst = src; *src; src++)
{
if (isxdigit (str[src] ))
str[dst++] = str[src] ;
if (isxdigit (*src ))
*dst++ = *src ;
}
str[dst] = '\0';
*dst = '\0';
return (dst - str);
}