Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

Commit

Permalink
device VAL= more lenient
Browse files Browse the repository at this point in the history
  • Loading branch information
koendv committed Jul 26, 2017
1 parent a05ed24 commit 1154e7b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Process this file with autoconf to produce a configure script.
AC_INIT([hyp2mat], [0.0.16])
AC_INIT([hyp2mat], [0.0.17])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/hyp2mat.cc])
Expand Down
48 changes: 28 additions & 20 deletions lib/scan.ll
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ STRING [^ \t\v\f\r\n\{\}\(\)=\"]+|"("[[:alnum:]]+")"
QUOTED_STRING \"([^\"\n]|\"\")*\"
/* an unquoted string with spaces */
CHARS_AND_SPACES [^\t\v\f\r\n\{\}\(\)=\"\,]+
CHARS_AND_SPACES [^\t\v\f\r\n\{\}\(\)=\"]+
/* all variables used in assignments */
VARIABLE ("A"|"A1"|"A2"|"BR"|"C"|"C\?"|"CO\?"|"D"|"ER"|"F"|"ID"|"L"|"L1"|"L2"|"LPS"|"LT"|"M"|"N"|"NAME"|"P"|"PKG"|"PR\?"|"PS"|"R"|"REF"|"S"|"SX"|"SY"|"S1"|"S1X"|"S1Y"|"S2"|"S2X"|"S2Y"|"T"|"TC"|"USE_DIE_FOR_METAL"|"V"|"V\?"|"VAL"|"W"|"X"|"X1"|"X2"|"XC"|"Y"|"Y1"|"Y2"|"YC"|"Z"|"ZL"|"ZLEN"|"ZW")
Expand Down Expand Up @@ -251,7 +251,7 @@ EMPTY_STRING ({WS}{VARIABLE}"="|")"|"}")
"USE_DIE_FOR_METAL"/{LHS} {return USE_DIE_FOR_METAL;}
"V"/{LHS} {BEGIN STATE_STRING; return V;}
"V?"/{LHS} {return V_QM;}
"VAL"/{LHS} {return VAL;}
"VAL"/{LHS} {BEGIN STATE_STRING; return VAL;}
"W"/{LHS} {return W;}
"X"/{LHS} {return X;}
"X1"/{LHS} {return X1;}
Expand Down Expand Up @@ -319,22 +319,31 @@ EMPTY_STRING ({WS}{VARIABLE}"="|")"|"}")
{EMPTY_STRING} { yyless(0); BEGIN INITIAL; yylval.strval = strdup(""); return STRING; } /* emit empty string and reprocess */
{STRING_W_SPACES} {
char *s = strdup(yytext);
BEGIN INITIAL;
/* strip final ' VAR=' */
if ((strlen(s) != 0) && (s[strlen(s)-1] == '=')) {
char* space = strrchr(s, ' ');
/* strip trailing spaces */
if (space != NULL)
while ((space >= s) && (*space == ' ')) *space-- = '\0';
yyless(strlen(s));
}
yylval.strval = s;
return STRING;
/*
* Commas are not allowed in strings in the padstack section unless the string is enclosed in double quotes (").
*/

if ((section == PADSTACK) && strchr(yytext, ','))
REJECT
else
{
char *s = strdup(yytext);

BEGIN INITIAL;

/* strip final ' VAR=' */
if ((strlen(s) != 0) && (s[strlen(s)-1] == '=')) {
char* space = strrchr(s, ' ');
/* strip trailing spaces */
if (space != NULL)
while ((space >= s) && (*space == ' ')) *space-- = '\0';
yyless(strlen(s));
}

yylval.strval = s;

return STRING;
}
}
}

Expand All @@ -356,8 +365,7 @@ EMPTY_STRING ({WS}{VARIABLE}"="|")"|"}")
/* string */
{STRING} {
/*
* Commas are not allowed in strings in the padstack section
* unless the string is enclosed in double quotes (").
* Commas are not allowed in strings in the padstack section unless the string is enclosed in double quotes (").
*/
if ((section == PADSTACK) && strchr(yytext, ','))
Expand Down

0 comments on commit 1154e7b

Please sign in to comment.