Anchor regex meta-rules.

This commit is contained in:
Daniel Jones 2014-02-01 19:13:27 -08:00
parent 75d67f9fdb
commit ccd90668b9
2 changed files with 3 additions and 1 deletions

View file

@ -58,6 +58,8 @@ improvements.
`-p=1` if this is the case.
1. Use Go regular expressions, which are perl-like. The original mk used plan9
regex, which few people know or care to learn.
1. Regex matches are substituted into rule prerequisites with `$stem1`,
`$stem2`, etc, rather than `\1`, `\2`, etc.
1. Allow blank lines in recipes. A recipe is any indented block of text, and
continues until a non-indented character or the end of the file. (Similar
to blocks in Python.)

View file

@ -308,7 +308,7 @@ func parseRecipe(p *parser, t token) parserStateFun {
r.targets = append(r.targets, pattern{spat: targetstr})
if r.attributes.regex {
rpat, err := regexp.Compile(targetstr)
rpat, err := regexp.Compile("^" + targetstr + "$")
if err != nil {
msg := fmt.Sprintf("invalid regular expression: %q", err)
p.basicErrorAtToken(msg, p.tokenbuf[k])