From 76be0a35f6c37cda7ba65530330f1ac246fb52a8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 6 Apr 2022 11:26:52 +0200 Subject: 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. --- libbuild2/parser.hxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'libbuild2/parser.hxx') 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, 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. // -- cgit v1.1