1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-26 07:13:08 +02:00

b2/: use glob syntax instead of RE syntax for substitutions

This commit is contained in:
Werner Almesberger 2012-05-20 21:05:17 -03:00
parent 9681d44ca4
commit adecef8d4a
2 changed files with 24 additions and 2 deletions

View File

@ -1,8 +1,8 @@
REF=R[0-9]* {
T=R
VAL=.* { R=$$#R }
VAL=* { R=$$#R }
TOL = 5%
FN=.*% { TOL=${$#%} }
FN=*% { TOL=${$#%} }
break REF
// end break again
}

View File

@ -44,6 +44,28 @@ static char *prepare_re(const char *re)
int res_len = 0;
append_char(&res, &res_len, '^');
while (*re) {
switch (*re) {
case '.':
append_n(&res, &res_len, "\\.", 2);
break;
case '*':
append_n(&res, &res_len, ".*", 2);
break;
case '?':
append_char(&res, &res_len, '.');
break;
case '\\':
if (!re[1])
yyerrorf("regexp ends with backslash");
append_n(&res, &res_len, re, 2);
re++;
break;
default:
append_char(&res, &res_len, *re);
}
re++;
}
append(&res, &res_len, re);
append_char(&res, &res_len, '$');
return res;