From b0b048c03930b826ab3dbf88b56fd664fca26886 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 22 May 2020 15:32:31 +0300 Subject: Add script command redirect aliases --- libbuild2/script/script.hxx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'libbuild2/script/script.hxx') diff --git a/libbuild2/script/script.hxx b/libbuild2/script/script.hxx index abb2fd7..22747a8 100644 --- a/libbuild2/script/script.hxx +++ b/libbuild2/script/script.hxx @@ -8,7 +8,7 @@ #include #include -#include // replay_tokens +#include #include namespace build2 @@ -54,7 +54,7 @@ namespace build2 // Note that the exact spacing and partial quoting may not be restored due // to the information loss. // - LIBBUILD2_SYMEXPORT void + void dump (ostream&, const string& ind, const lines&); // Parse object model. @@ -167,7 +167,10 @@ namespace build2 reference_wrapper ref; // Note: no chains. }; - string modifiers; // Redirect modifiers. + // Modifiers and the original representation (potentially an alias). + // + build2::token token; + string end; // Here-document end marker (no regex intro/flags). uint64_t end_line; // Here-document end marker location. uint64_t end_column; @@ -179,8 +182,10 @@ namespace build2 // Create redirect of the reference type. // - redirect (redirect_type t, const redirect& r) - : type (redirect_type::here_doc_ref), ref (r) + redirect (redirect_type t, const redirect& r, build2::token tk) + : type (redirect_type::here_doc_ref), + ref (r), + token (move (tk)) { // There is no support (and need) for reference chains. // @@ -217,6 +222,12 @@ namespace build2 { return type == redirect_type::here_doc_ref ? ref.get () : *this; } + + const string& + modifiers () const noexcept + { + return token.value; + } }; // cleanup -- cgit v1.1