diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-04-06 11:26:52 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-04-06 13:51:56 +0200 |
commit | 76be0a35f6c37cda7ba65530330f1ac246fb52a8 (patch) | |
tree | f613ceafcf6c7208984d4536653061c4e0c23be7 /libbuild2/parser.hxx | |
parent | 0a9dd0c7d31cbba2170fdfda4b747a1fe5ce665a (diff) |
Add support for rule hints
A rule hint is a target attribute, for example:
[rule_hint=cxx] exe{hello}: c{hello}
Rule hints can be used to resolve ambiguity when multiple rules match the same
target as well as to override an unambiguous match.
Diffstat (limited to 'libbuild2/parser.hxx')
-rw-r--r-- | libbuild2/parser.hxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libbuild2/parser.hxx b/libbuild2/parser.hxx index 1474c5e..4f105e5 100644 --- a/libbuild2/parser.hxx +++ b/libbuild2/parser.hxx @@ -162,13 +162,20 @@ namespace build2 enter_adhoc_members (adhoc_names_loc&&, bool); small_vector<reference_wrapper<target>, 1> - enter_targets (names&&, const location&, adhoc_names&&, size_t); + enter_targets (names&&, const location&, + adhoc_names&&, + size_t, + const attributes&); + + void + apply_target_attributes (target&, const attributes&); void parse_dependency (token&, token_type&, names&&, const location&, adhoc_names&&, - names&&, const location&); + names&&, const location&, + const attributes&); void parse_assert (token&, token_type&); @@ -305,8 +312,8 @@ namespace build2 // then parse the attribute sequence until ']' storing the result in the // new stack entry. Then get the next token and, if standalone is false, // verify it is not newline/eos (i.e., there is something after it). - // Return the indication of whether we have seen `[` (even if it's the - // `[]` empty list) and its location. + // Return the indication of whether we have seen any attributes (note + // that the `[]` empty list does not count) and the location of `[`. // // Note that during pre-parsing nothing is pushed into the stack. // |