diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-05-25 12:12:13 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-05-27 15:44:40 +0200 |
commit | ba628f6f90e7412245dcebdecd9cfa7e4bbf989c (patch) | |
tree | 8f7f109c70d615bc93daa2a8f4b25ceb3842e062 /libbuild2/variable.cxx | |
parent | 2a9204cab666d47770bf3809d95a689088019121 (diff) |
Add support for value subscript after expansionsadhoc-recipe-history
Value subscript is only recognized in evaluation contexts (due to ambiguity
with wildcard patterns; consider: $x[123].txt) and should be unseparated from
the previous token. For example:
x = ($y[1])
x = (($f ? $y : $z)[1])
x = ($identity($x)[$z])
Diffstat (limited to 'libbuild2/variable.cxx')
-rw-r--r-- | libbuild2/variable.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libbuild2/variable.cxx b/libbuild2/variable.cxx index d16fcb4..206eb54 100644 --- a/libbuild2/variable.cxx +++ b/libbuild2/variable.cxx @@ -491,7 +491,13 @@ namespace build2 { // May throw invalid_argument or out_of_range. // - return stoull (n.value); + size_t i; + uint64_t r (stoull (n.value, &i)); + + if (i == n.value.size ()) + return r; + + // Fall through. } catch (const std::exception&) { |