}
};
-/* Basically, a "fragment" that can be incorporated into the AST, created as
- * a result of macro expansion. Really annoying to work with due to the fact
- * that macros can really expand to anything. As such, horrible representation
- * at the moment. */
-class ASTFragment
-{
-private:
- /* basic idea: essentially, a vector of tagged unions of different AST node
- * types. Now, this could actually be stored without a tagged union if the
- * different AST node types had a unified parent, but that would create
- * issues with the diamond problem or significant performance penalties. So
- * a tagged union had to be used instead. A vector is used to represent the
- * ability for a macro to expand to two statements, for instance. */
-
- std::vector<SingleASTNode> nodes;
- bool fragment_is_error;
-
- /**
- * We need to make a special case for Expression and Type fragments as only
- * one Node will be extracted from the `nodes` vector
- */
-
- bool is_single_fragment () const { return nodes.size () == 1; }
-
- bool is_single_fragment_of_kind (SingleASTNode::NodeType expected) const
- {
- return is_single_fragment () && nodes[0].get_kind () == expected;
- }
-
- void assert_single_fragment (SingleASTNode::NodeType expected) const
- {
- static const std::map<SingleASTNode::NodeType, const char *> str_map = {
- {SingleASTNode::NodeType::IMPL, "impl"},
- {SingleASTNode::NodeType::ITEM, "item"},
- {SingleASTNode::NodeType::TYPE, "type"},
- {SingleASTNode::NodeType::EXPRESSION, "expr"},
- {SingleASTNode::NodeType::STMT, "stmt"},
- {SingleASTNode::NodeType::EXTERN, "extern"},
- {SingleASTNode::NodeType::TRAIT, "trait"},
- {SingleASTNode::NodeType::TRAIT_IMPL, "trait impl"},
- };
-
- auto actual = nodes[0].get_kind ();
- auto fail = false;
-
- if (!is_single_fragment ())
- {
- rust_error_at (Location (), "fragment is not single");
- fail = true;
- }
-
- if (actual != expected)
- {
- rust_error_at (
- Location (),
- "invalid fragment operation: expected %qs node, got %qs node",
- str_map.find (expected)->second,
- str_map.find (nodes[0].get_kind ())->second);
- fail = true;
- }
-
- rust_assert (!fail);
- }
-
-public:
- ASTFragment (std::vector<SingleASTNode> nodes, bool fragment_is_error = false)
- : nodes (std::move (nodes)), fragment_is_error (fragment_is_error)
- {
- if (fragment_is_error)
- rust_assert (nodes.empty ());
- }
-
- ASTFragment (ASTFragment const &other)
- : fragment_is_error (other.fragment_is_error)
- {
- nodes.clear ();
- nodes.reserve (other.nodes.size ());
- for (auto &n : other.nodes)
- {
- nodes.push_back (n);
- }
- }
-
- ASTFragment &operator= (ASTFragment const &other)
- {
- fragment_is_error = other.fragment_is_error;
- nodes.clear ();
- nodes.reserve (other.nodes.size ());
- for (auto &n : other.nodes)
- {
- nodes.push_back (n);
- }
-
- return *this;
- }
-
- static ASTFragment create_error () { return ASTFragment ({}, true); }
-
- std::vector<SingleASTNode> &get_nodes () { return nodes; }
- bool is_error () const { return fragment_is_error; }
-
- bool should_expand () const { return !is_error (); }
-
- bool is_expression_fragment () const
- {
- return is_single_fragment_of_kind (SingleASTNode::NodeType::EXPRESSION);
- }
-
- bool is_type_fragment () const
- {
- return is_single_fragment_of_kind (SingleASTNode::NodeType::TYPE);
- }
-
- std::unique_ptr<Expr> take_expression_fragment ()
- {
- assert_single_fragment (SingleASTNode::NodeType::EXPRESSION);
- return nodes[0].take_expr ();
- }
-
- std::unique_ptr<Type> take_type_fragment ()
- {
- assert_single_fragment (SingleASTNode::NodeType::TYPE);
- return nodes[0].take_type ();
- }
-
- void accept_vis (ASTVisitor &vis)
- {
- for (auto &node : nodes)
- node.accept_vis (vis);
- }
-};
-
// A crate AST object - holds all the data for a single compilation unit
struct Crate
{
#include "rust-system.h"
#include "rust-ast.h"
+#include "rust-ast-fragment.h"
#include "rust-location.h"
namespace Rust {
std::vector<MacroRule> rules; // inlined form
Location locus;
- std::function<ASTFragment (Location, MacroInvocData &)>
- associated_transcriber;
+ std::function<Fragment (Location, MacroInvocData &)> associated_transcriber;
// Since we can't compare std::functions, we need to use an extra boolean
bool is_builtin_rule;
* should make use of the actual rules. If the macro is builtin, then another
* associated transcriber should be used
*/
- static ASTFragment dummy_builtin (Location, MacroInvocData &)
+ static Fragment dummy_builtin (Location, MacroInvocData &)
{
gcc_unreachable ();
- return ASTFragment::create_error ();
+ return Fragment::create_error ();
}
/* NOTE: in rustc, macro definitions are considered (and parsed as) a type
associated_transcriber (dummy_builtin), is_builtin_rule (false)
{}
- MacroRulesDefinition (Identifier builtin_name, DelimType delim_type,
- std::function<ASTFragment (Location, MacroInvocData &)>
- associated_transcriber)
+ MacroRulesDefinition (
+ Identifier builtin_name, DelimType delim_type,
+ std::function<Fragment (Location, MacroInvocData &)> associated_transcriber)
: outer_attrs (std::vector<Attribute> ()), rule_name (builtin_name),
delim_type (delim_type), rules (std::vector<MacroRule> ()),
locus (Location ()), associated_transcriber (associated_transcriber),
const std::vector<MacroRule> &get_rules () const { return rules; }
bool is_builtin () const { return is_builtin_rule; }
- const std::function<ASTFragment (Location, MacroInvocData &)> &
+ const std::function<Fragment (Location, MacroInvocData &)> &
get_builtin_transcriber () const
{
rust_assert (is_builtin ());
return associated_transcriber;
}
void set_builtin_transcriber (
- std::function<ASTFragment (Location, MacroInvocData &)> transcriber)
+ std::function<Fragment (Location, MacroInvocData &)> transcriber)
{
associated_transcriber = transcriber;
is_builtin_rule = true;
* @return Either the expanded fragment or an empty errored-out fragment
* indicating an expansion failure.
*/
- AST::ASTFragment expand_macro_fragment_recursive ()
+ AST::Fragment expand_macro_fragment_recursive ()
{
auto fragment = expander.take_expanded_fragment (*this);
unsigned int original_depth = expander.expansion_depth;
- auto final_fragment = AST::ASTFragment ({}, true);
+ auto final_fragment = AST::Fragment ({}, true);
while (fragment.should_expand ())
{
/* Expand and extract an expression from the macro */
-static inline AST::ASTFragment
+static inline AST::Fragment
try_expand_macro_expression (AST::Expr *expr, MacroExpander *expander)
{
rust_assert (expander);
}
} // namespace
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::assert (Location invoc_locus, AST::MacroInvocData &invoc)
{
rust_debug ("assert!() called");
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::file (Location invoc_locus, AST::MacroInvocData &invoc)
{
auto current_file
= Session::get_instance ().linemap->location_file (invoc_locus);
auto file_str = AST::SingleASTNode (make_string (invoc_locus, current_file));
- return AST::ASTFragment ({file_str});
+ return AST::Fragment ({file_str});
}
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::column (Location invoc_locus, AST::MacroInvocData &invoc)
{
auto current_column
new AST::LiteralExpr (std::to_string (current_column), AST::Literal::INT,
PrimitiveCoreType::CORETYPE_U32, {}, invoc_locus)));
- return AST::ASTFragment ({column_no});
+ return AST::Fragment ({column_no});
}
/* Expand builtin macro include_bytes!("filename"), which includes the contents
of the given file as reference to a byte array. Yields an expression of type
&'static [u8; N]. */
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::include_bytes (Location invoc_locus, AST::MacroInvocData &invoc)
{
/* Get target filename from the macro invocation, which is treated as a path
= parse_single_string_literal (invoc.get_delim_tok_tree (), invoc_locus,
invoc.get_expander ());
if (lit_expr == nullptr)
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
std::string target_filename
= source_relative_path (lit_expr->as_string (), invoc_locus);
new AST::BorrowExpr (std::move (array), false, false, {}, invoc_locus));
auto node = AST::SingleASTNode (std::move (borrow));
- return AST::ASTFragment ({node});
+ return AST::Fragment ({node});
}
/* Expand builtin macro include_str!("filename"), which includes the contents
of the given file as a string. The file must be UTF-8 encoded. Yields an
expression of type &'static str. */
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::include_str (Location invoc_locus, AST::MacroInvocData &invoc)
{
/* Get target filename from the macro invocation, which is treated as a path
= parse_single_string_literal (invoc.get_delim_tok_tree (), invoc_locus,
invoc.get_expander ());
if (lit_expr == nullptr)
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
std::string target_filename
= source_relative_path (lit_expr->as_string (), invoc_locus);
std::string str ((const char *) &bytes[0], bytes.size ());
auto node = AST::SingleASTNode (make_string (invoc_locus, str));
- return AST::ASTFragment ({node});
+ return AST::Fragment ({node});
}
/* Expand builtin macro compile_error!("error"), which forces a compile error
during the compile time. */
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::compile_error (Location invoc_locus, AST::MacroInvocData &invoc)
{
auto lit_expr
= parse_single_string_literal (invoc.get_delim_tok_tree (), invoc_locus,
invoc.get_expander ());
if (lit_expr == nullptr)
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
std::string error_string = lit_expr->as_string ();
rust_error_at (invoc_locus, "%s", error_string.c_str ());
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
/* Expand builtin macro concat!(), which joins all the literal parameters
into a string with no delimiter. */
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::concat (Location invoc_locus, AST::MacroInvocData &invoc)
{
auto invoc_token_tree = invoc.get_delim_tok_tree ();
parser.skip_token (last_token_id);
if (has_error)
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
auto node = AST::SingleASTNode (make_string (invoc_locus, str));
- return AST::ASTFragment ({node});
+ return AST::Fragment ({node});
}
/* Expand builtin macro env!(), which inspects an environment variable at
compile time. */
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::env (Location invoc_locus, AST::MacroInvocData &invoc)
{
auto invoc_token_tree = invoc.get_delim_tok_tree ();
auto expanded_expr = try_expand_many_expr (parser, invoc_locus, last_token_id,
invoc.get_expander (), has_error);
if (has_error)
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
if (expanded_expr.size () < 1 || expanded_expr.size () > 2)
{
rust_error_at (invoc_locus, "env! takes 1 or 2 arguments");
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
if (expanded_expr.size () > 0)
{
= try_extract_string_literal_from_fragment (invoc_locus,
expanded_expr[0])))
{
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
}
if (expanded_expr.size () > 1)
= try_extract_string_literal_from_fragment (invoc_locus,
expanded_expr[1])))
{
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
}
lit_expr->as_string ().c_str ());
else
rust_error_at (invoc_locus, "%s", error_expr->as_string ().c_str ());
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
auto node = AST::SingleASTNode (make_string (invoc_locus, env_value));
- return AST::ASTFragment ({node});
+ return AST::Fragment ({node});
}
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::cfg (Location invoc_locus, AST::MacroInvocData &invoc)
{
// only parse if not already parsed
/* TODO: assuming that cfg! macros can only have one meta item inner, like cfg
* attributes */
if (invoc.get_meta_items ().size () != 1)
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
bool result = invoc.get_meta_items ()[0]->check_cfg_predicate (
Session::get_instance ());
new AST::LiteralExpr (result ? "true" : "false", AST::Literal::BOOL,
PrimitiveCoreType::CORETYPE_BOOL, {}, invoc_locus)));
- return AST::ASTFragment ({literal_exp});
+ return AST::Fragment ({literal_exp});
}
/* Expand builtin macro include!(), which includes a source file at the current
scope compile time. */
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::include (Location invoc_locus, AST::MacroInvocData &invoc)
{
/* Get target filename from the macro invocation, which is treated as a path
= parse_single_string_literal (invoc.get_delim_tok_tree (), invoc_locus,
invoc.get_expander ());
if (lit_expr == nullptr)
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
std::string filename
= source_relative_path (lit_expr->as_string (), invoc_locus);
{
rust_error_at (lit_expr->get_locus (),
"cannot open included file %qs: %m", target_filename);
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
rust_debug ("Attempting to parse included file %s", target_filename);
{
// inform the user that the errors above are from a included file
rust_inform (invoc_locus, "included from here");
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
std::vector<AST::SingleASTNode> nodes{};
nodes.push_back (node);
}
- return AST::ASTFragment (nodes);
+ return AST::Fragment (nodes);
}
-AST::ASTFragment
+AST::Fragment
MacroBuiltin::line (Location invoc_locus, AST::MacroInvocData &invoc)
{
auto current_line
new AST::LiteralExpr (std::to_string (current_line), AST::Literal::INT,
PrimitiveCoreType::CORETYPE_U32, {}, invoc_locus)));
- return AST::ASTFragment ({line_no});
+ return AST::Fragment ({line_no});
}
} // namespace Rust
#define RUST_MACRO_BUILTINS_H
#include "rust-ast.h"
+#include "rust-ast-fragment.h"
#include "rust-location.h"
/**
/* If assert is defined as a macro this file will not parse, so undefine this
before continuing. */
+// TODO: Rename all functions here `*_handler`
#ifdef assert
#undef assert
#endif
class MacroBuiltin
{
public:
- static AST::ASTFragment assert (Location invoc_locus,
- AST::MacroInvocData &invoc);
-
- static AST::ASTFragment file (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment assert (Location invoc_locus,
+ AST::MacroInvocData &invoc);
- static AST::ASTFragment column (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment file (Location invoc_locus, AST::MacroInvocData &invoc);
- static AST::ASTFragment include_bytes (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment column (Location invoc_locus,
+ AST::MacroInvocData &invoc);
- static AST::ASTFragment include_str (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment include_bytes (Location invoc_locus,
+ AST::MacroInvocData &invoc);
- static AST::ASTFragment compile_error (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment include_str (Location invoc_locus,
+ AST::MacroInvocData &invoc);
- static AST::ASTFragment concat (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment compile_error (Location invoc_locus,
+ AST::MacroInvocData &invoc);
- static AST::ASTFragment env (Location invoc_locus,
+ static AST::Fragment concat (Location invoc_locus,
AST::MacroInvocData &invoc);
- static AST::ASTFragment cfg (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment env (Location invoc_locus, AST::MacroInvocData &invoc);
- static AST::ASTFragment include (Location invoc_locus,
- AST::MacroInvocData &invoc);
+ static AST::Fragment cfg (Location invoc_locus, AST::MacroInvocData &invoc);
- static AST::ASTFragment line (Location invoc_locus,
+ static AST::Fragment include (Location invoc_locus,
AST::MacroInvocData &invoc);
+
+ static AST::Fragment line (Location invoc_locus, AST::MacroInvocData &invoc);
};
} // namespace Rust
#include "rust-early-name-resolver.h"
namespace Rust {
-AST::ASTFragment
+AST::Fragment
MacroExpander::expand_decl_macro (Location invoc_locus,
AST::MacroInvocData &invoc,
AST::MacroRulesDefinition &rules_def,
RichLocation r (invoc_locus);
r.add_range (rules_def.get_locus ());
rust_error_at (r, "Failed to match any rule within macro");
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
return transcribe_rule (*matched_rule, invoc_token_tree, matched_fragments,
// - else is unreachable
// - derive container macro - unreachable
- auto fragment = AST::ASTFragment::create_error ();
+ auto fragment = AST::Fragment::create_error ();
invoc_data.set_expander (this);
// lookup the rules
/**
* Helper function to refactor calling a parsing function 0 or more times
*/
-static AST::ASTFragment
+static AST::Fragment
parse_many (Parser<MacroInvocLexer> &parser, TokenId &delimiter,
std::function<AST::SingleASTNode ()> parse_fn)
{
for (auto err : parser.get_errors ())
err.emit_error ();
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
nodes.emplace_back (std::move (node));
}
- return AST::ASTFragment (std::move (nodes));
+ return AST::Fragment (std::move (nodes));
}
/**
* @param parser Parser to extract items from
* @param delimiter Id of the token on which parsing should stop
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_many_items (Parser<MacroInvocLexer> &parser, TokenId &delimiter)
{
return parse_many (parser, delimiter, [&parser] () {
* @param parser Parser to extract items from
* @param delimiter Id of the token on which parsing should stop
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_many_ext (Parser<MacroInvocLexer> &parser, TokenId &delimiter)
{
return parse_many (parser, delimiter, [&parser] () {
* @param parser Parser to extract items from
* @param delimiter Id of the token on which parsing should stop
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_many_trait_items (Parser<MacroInvocLexer> &parser,
TokenId &delimiter)
{
* @param parser Parser to extract items from
* @param delimiter Id of the token on which parsing should stop
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_many_impl_items (Parser<MacroInvocLexer> &parser, TokenId &delimiter)
{
return parse_many (parser, delimiter, [&parser] () {
* @param parser Parser to extract items from
* @param delimiter Id of the token on which parsing should stop
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_many_trait_impl_items (Parser<MacroInvocLexer> &parser,
TokenId &delimiter)
{
* @param parser Parser to extract statements from
* @param delimiter Id of the token on which parsing should stop
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_many_stmts (Parser<MacroInvocLexer> &parser, TokenId &delimiter)
{
auto restrictions = ParseRestrictions ();
*
* @param parser Parser to extract statements from
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_expression (Parser<MacroInvocLexer> &parser)
{
auto expr = parser.parse_expr ();
- return AST::ASTFragment ({std::move (expr)});
+ return AST::Fragment ({std::move (expr)});
}
/**
*
* @param parser Parser to extract statements from
*/
-static AST::ASTFragment
+static AST::Fragment
transcribe_type (Parser<MacroInvocLexer> &parser)
{
auto type = parser.parse_type (true);
for (auto err : parser.get_errors ())
err.emit_error ();
- return AST::ASTFragment ({std::move (type)});
+ return AST::Fragment ({std::move (type)});
}
-static AST::ASTFragment
+static AST::Fragment
transcribe_on_delimiter (Parser<MacroInvocLexer> &parser, bool semicolon,
AST::DelimType delimiter, TokenId last_token_id)
{
return transcribe_expression (parser);
} // namespace Rust
-static AST::ASTFragment
+static AST::Fragment
transcribe_context (MacroExpander::ContextType ctx,
Parser<MacroInvocLexer> &parser, bool semicolon,
AST::DelimType delimiter, TokenId last_token_id)
return str;
}
-AST::ASTFragment
+AST::Fragment
MacroExpander::transcribe_rule (
AST::MacroRule &match_rule, AST::DelimTokenTree &invoc_token_tree,
std::map<std::string, MatchedFragmentContainer> &matched_fragments,
rust_debug ("substituted tokens: %s",
tokens_to_str (substituted_tokens).c_str ());
- // parse it to an ASTFragment
+ // parse it to an Fragment
MacroInvocLexer lex (std::move (substituted_tokens));
Parser<MacroInvocLexer> parser (lex);
{
for (auto &err : parser.get_errors ())
rust_error_at (err.locus, "%s", err.message.c_str ());
- return AST::ASTFragment::create_error ();
+ return AST::Fragment::create_error ();
}
// are all the tokens used?
MacroExpander (AST::Crate &crate, ExpansionCfg cfg, Session &session)
: cfg (cfg), crate (crate), session (session),
sub_stack (SubstitutionScope ()),
- expanded_fragment (AST::ASTFragment::create_error ()),
+ expanded_fragment (AST::Fragment::create_error ()),
resolver (Resolver::Resolver::get ()),
mappings (Analysis::Mappings::get ())
{}
void expand_invoc (AST::MacroInvocation &invoc, bool has_semicolon);
// Expands a single declarative macro.
- AST::ASTFragment expand_decl_macro (Location locus,
- AST::MacroInvocData &invoc,
- AST::MacroRulesDefinition &rules_def,
- bool semicolon);
+ AST::Fragment expand_decl_macro (Location locus, AST::MacroInvocData &invoc,
+ AST::MacroRulesDefinition &rules_def,
+ bool semicolon);
void expand_cfg_attrs (AST::AttrVec &attrs);
bool fails_cfg (const AST::AttrVec &attr) const;
bool try_match_rule (AST::MacroRule &match_rule,
AST::DelimTokenTree &invoc_token_tree);
- AST::ASTFragment transcribe_rule (
+ AST::Fragment transcribe_rule (
AST::MacroRule &match_rule, AST::DelimTokenTree &invoc_token_tree,
std::map<std::string, MatchedFragmentContainer> &matched_fragments,
bool semicolon, ContextType ctx);
ContextType peek_context () { return context.back (); }
- void set_expanded_fragment (AST::ASTFragment &&fragment)
+ void set_expanded_fragment (AST::Fragment &&fragment)
{
expanded_fragment = std::move (fragment);
}
- AST::ASTFragment take_expanded_fragment (AST::ASTVisitor &vis)
+ AST::Fragment take_expanded_fragment (AST::ASTVisitor &vis)
{
- AST::ASTFragment old_fragment = std::move (expanded_fragment);
+ AST::Fragment old_fragment = std::move (expanded_fragment);
auto accumulator = std::vector<AST::SingleASTNode> ();
- expanded_fragment = AST::ASTFragment::create_error ();
+ expanded_fragment = AST::Fragment::create_error ();
auto early_name_resolver = Resolver::EarlyNameResolver ();
for (auto &node : old_fragment.get_nodes ())
auto new_nodes = expanded_fragment.get_nodes ();
std::move (new_nodes.begin (), new_nodes.end (),
std::back_inserter (accumulator));
- expanded_fragment = AST::ASTFragment (accumulator);
+ expanded_fragment = AST::Fragment (accumulator);
}
expansion_depth--;
}
Session &session;
SubstitutionScope sub_stack;
std::vector<ContextType> context;
- AST::ASTFragment expanded_fragment;
+ AST::Fragment expanded_fragment;
public:
Resolver::Resolver *resolver;
void
Mappings::insert_macro_def (AST::MacroRulesDefinition *macro)
{
- static std::map<std::string, std::function<AST::ASTFragment (
- Location, AST::MacroInvocData &)>>
+ static std::map<
+ std::string, std::function<AST::Fragment (Location, AST::MacroInvocData &)>>
builtin_macros = {
{"assert", MacroBuiltin::assert},
{"file", MacroBuiltin::file},