1 /* Copyright (C) 2024 Free Software Foundation, Inc.
2 Contributed by David Malcolm <dmalcolm@redhat.com>
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_PRETTY_PRINT_MARKUP_H
21 #define GCC_PRETTY_PRINT_MARKUP_H
23 #include "diagnostic-color.h"
32 context (pretty_printer
&pp
,
34 pp_token_list
*formatted_token_list
)
36 m_buf (*pp_buffer (&pp
)),
38 m_formatted_token_list (formatted_token_list
)
45 void begin_highlight_color (const char *color_name
);
46 void end_highlight_color ();
48 void push_back_any_text ();
53 pp_token_list
*m_formatted_token_list
;
56 /* Abstract base class for use in pp_format for handling "%e".
57 This can add arbitrary content to the buffer being constructed, and
58 isolates the non-typesafe part of the formatting call in one place. */
63 virtual ~element () {}
64 virtual void add_to_phase_2 (context
&ctxt
) = 0;
70 DISABLE_COPY_AND_ASSIGN (element
);
73 /* Concrete subclass: handle "%e" by printing a comma-separated list
76 class comma_separated_quoted_strings
: public element
79 comma_separated_quoted_strings (const auto_vec
<const char *> &strings
)
84 void add_to_phase_2 (context
&ctxt
) final override
;
87 const auto_vec
<const char *> &m_strings
;
90 } // namespace pp_markup
92 #endif /* GCC_PRETTY_PRINT_MARKUP_H */