mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-26 09:22:28 +02:00
b2/: use glob syntax instead of RE syntax for substitutions
This commit is contained in:
parent
9681d44ca4
commit
adecef8d4a
4
b2/SUBST
4
b2/SUBST
@ -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
|
||||
}
|
||||
|
22
b2/subst.c
22
b2/subst.c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user