mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-22 22:41:52 +02:00
b2/: for consistency, make "break/continue $" equivalent to "break/continue"
Plus a bit of code simplification.
This commit is contained in:
parent
694d48b56a
commit
4f142c1250
4
b2/SUBST
4
b2/SUBST
@ -37,7 +37,9 @@ with curly braces:
|
|||||||
${foo}, ...
|
${foo}, ...
|
||||||
input variable (in pattern):
|
input variable (in pattern):
|
||||||
$$
|
$$
|
||||||
the input variable ($) can also be used as LHS for matches and assignments
|
|
||||||
|
the input variable ($) can also be used as LHS for matches, assignments, and
|
||||||
|
as break/continue target.
|
||||||
|
|
||||||
Caveat:
|
Caveat:
|
||||||
|
|
||||||
|
26
b2/lang.y
26
b2/lang.y
@ -67,6 +67,15 @@ static const struct field *top_field(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct subst *parse_jump(const char *keyword, const char *target)
|
||||||
|
{
|
||||||
|
if (!strcmp(keyword, "break"))
|
||||||
|
return subst_break(target);
|
||||||
|
if (!strcmp(keyword, "continue"))
|
||||||
|
return subst_continue(target);
|
||||||
|
yyerrorf("unknown keyword \"%s\"", keyword);
|
||||||
|
}
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
@ -607,12 +616,11 @@ block:
|
|||||||
}
|
}
|
||||||
| WORD WORD
|
| WORD WORD
|
||||||
{
|
{
|
||||||
if (!strcmp($1, "break"))
|
$$ = parse_jump($1, $2);
|
||||||
$$ = subst_break($2);
|
}
|
||||||
else if (!strcmp($1, "continue"))
|
| WORD '$'
|
||||||
$$ = subst_continue($2);
|
{
|
||||||
else
|
$$ = parse_jump($1, NULL);
|
||||||
yyerrorf("unknown keyword \"%s\"", $1);
|
|
||||||
}
|
}
|
||||||
| WORD
|
| WORD
|
||||||
{
|
{
|
||||||
@ -620,12 +628,8 @@ block:
|
|||||||
$$ = subst_end();
|
$$ = subst_end();
|
||||||
else if (!strcmp($1, "ignore"))
|
else if (!strcmp($1, "ignore"))
|
||||||
$$ = subst_ignore();
|
$$ = subst_ignore();
|
||||||
else if (!strcmp($1, "break"))
|
|
||||||
$$ = subst_break(NULL);
|
|
||||||
else if (!strcmp($1, "continue"))
|
|
||||||
$$ = subst_continue(NULL);
|
|
||||||
else
|
else
|
||||||
yyerrorf("unknown keyword \"%s\"", $1);
|
$$ = parse_jump($1, NULL);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user