auto size = collection.size () - end_offset;
for (size_t i = start_offset + 1; i < size; i++)
{
- push (Rust::Token::make (separator, Location ()));
+ push (Rust::Token::make (separator, UNDEF_LOCATION));
visit (collection.at (i));
}
}
std::vector<TokenPtr> trailing,
TokenId left_brace, TokenId right_brace)
{
- push (Rust::Token::make (left_brace, Location ()));
+ push (Rust::Token::make (left_brace, UNDEF_LOCATION));
if (collection.empty ())
{
- push (Rust::Token::make (right_brace, Location ()));
+ push (Rust::Token::make (right_brace, UNDEF_LOCATION));
newline ();
}
else
visit_items_as_lines (collection, trailing);
decrement_indentation ();
indentation ();
- push (Rust::Token::make (right_brace, Location ()));
+ push (Rust::Token::make (right_brace, UNDEF_LOCATION));
newline ();
}
}
{
if (output_trailing_commas)
{
- push (Rust::Token::make (COMMA, Location ()));
+ push (Rust::Token::make (COMMA, UNDEF_LOCATION));
}
}
TokenCollector::visit (FunctionParam ¶m)
{
visit (param.get_pattern ());
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit (param.get_type ());
}
{
push (Rust::Token::make (HASH, attrib.get_locus ()));
if (attrib.is_inner_attribute ())
- push (Rust::Token::make (EXCLAM, Location ()));
- push (Rust::Token::make (LEFT_SQUARE, Location ()));
+ push (Rust::Token::make (EXCLAM, UNDEF_LOCATION));
+ push (Rust::Token::make (LEFT_SQUARE, UNDEF_LOCATION));
visit (attrib.get_path ());
if (attrib.has_attr_input ())
gcc_unreachable ();
}
}
- push (Rust::Token::make (RIGHT_SQUARE, Location ()));
+ push (Rust::Token::make (RIGHT_SQUARE, UNDEF_LOCATION));
}
void
break;
case Visibility::PUB_CRATE:
push (Rust::Token::make (PUB, vis.get_locus ()));
- push (Rust::Token::make (LEFT_PAREN, Location ()));
- push (Rust::Token::make (CRATE, Location ()));
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
+ push (Rust::Token::make (CRATE, UNDEF_LOCATION));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
break;
case Visibility::PUB_SELF:
push (Rust::Token::make (PUB, vis.get_locus ()));
- push (Rust::Token::make (LEFT_PAREN, Location ()));
- push (Rust::Token::make (SELF, Location ()));
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
+ push (Rust::Token::make (SELF, UNDEF_LOCATION));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
break;
case Visibility::PUB_SUPER:
push (Rust::Token::make (PUB, vis.get_locus ()));
- push (Rust::Token::make (LEFT_PAREN, Location ()));
- push (Rust::Token::make (SUPER, Location ()));
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
+ push (Rust::Token::make (SUPER, UNDEF_LOCATION));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
break;
case Visibility::PUB_IN_PATH:
push (Rust::Token::make (PUB, vis.get_locus ()));
- push (Rust::Token::make (LEFT_PAREN, Location ()));
- push (Rust::Token::make (IN, Location ()));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
+ push (Rust::Token::make (IN, UNDEF_LOCATION));
visit (vis.get_path ());
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
break;
case Visibility::PRIV:
break;
{
auto name = param.get_name ();
push (Rust::Token::make_identifier (param.get_locus (), std::move (name)));
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit (param.get_type ());
}
void
TokenCollector::visit (std::vector<std::unique_ptr<GenericParam>> ¶ms)
{
- push (Rust::Token::make (LEFT_ANGLE, Location ()));
+ push (Rust::Token::make (LEFT_ANGLE, UNDEF_LOCATION));
visit_items_joined_by_separator (params, COMMA);
- push (Rust::Token::make (RIGHT_ANGLE, Location ()));
+ push (Rust::Token::make (RIGHT_ANGLE, UNDEF_LOCATION));
}
void
visit (field.get_visibility ());
auto name = field.get_field_name ().as_string ();
push (Rust::Token::make_identifier (field.get_locus (), std::move (name)));
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit (field.get_field_type ());
}
void
TokenCollector::visit (std::vector<LifetimeParam> &for_lifetimes)
{
- push (Rust::Token::make (FOR, Location ()));
- push (Rust::Token::make (LEFT_ANGLE, Location ()));
+ push (Rust::Token::make (FOR, UNDEF_LOCATION));
+ push (Rust::Token::make (LEFT_ANGLE, UNDEF_LOCATION));
visit_items_joined_by_separator (for_lifetimes, COMMA);
- push (Rust::Token::make (RIGHT_ANGLE, Location ()));
+ push (Rust::Token::make (RIGHT_ANGLE, UNDEF_LOCATION));
}
void
push (Rust::Token::make (EXTERN_TOK, qualifiers.get_locus ()));
if (qualifiers.has_abi ())
{
- push (Rust::Token::make_string (Location (),
+ push (Rust::Token::make_string (UNDEF_LOCATION,
qualifiers.get_extern_abi ()));
}
}
case MaybeNamedParam::UNNAMED:
break;
case MaybeNamedParam::IDENTIFIER:
- push (Rust::Token::make_identifier (Location (), std::move (param_name)));
- push (Rust::Token::make (COLON, Location ()));
+ push (
+ Rust::Token::make_identifier (UNDEF_LOCATION, std::move (param_name)));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
break;
case MaybeNamedParam::WILDCARD:
- push (Rust::Token::make (UNDERSCORE, Location ()));
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make (UNDERSCORE, UNDEF_LOCATION));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
break;
}
visit (param.get_type ());
if (lifetime_param.has_lifetime_bounds ())
{
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
for (auto &bound : lifetime_param.get_lifetime_bounds ())
{
visit (bound);
push (Rust::Token::make (CONST, param.get_locus ()));
auto id = param.get_name ().as_string ();
- push (Rust::Token::make_identifier (Location (), std::move (id)));
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit (param.get_type ());
if (param.has_default_value ())
{
- push (Rust::Token::make (EQUAL, Location ()));
+ push (Rust::Token::make (EQUAL, UNDEF_LOCATION));
visit (param.get_type ());
}
}
if (!lifetime_args.empty ()
&& (!generic_args.empty () || !binding_args.empty ()))
{
- push (Rust::Token::make (COMMA, Location ()));
+ push (Rust::Token::make (COMMA, UNDEF_LOCATION));
}
visit_items_joined_by_separator (binding_args, COMMA);
if (!generic_args.empty () && !binding_args.empty ())
{
- push (Rust::Token::make (COMMA, Location ()));
+ push (Rust::Token::make (COMMA, UNDEF_LOCATION));
}
visit_items_joined_by_separator (lifetime_args, COMMA);
- push (Rust::Token::make (RIGHT_ANGLE, Location ()));
+ push (Rust::Token::make (RIGHT_ANGLE, UNDEF_LOCATION));
}
}
Rust::Token::make_identifier (ident_segment.get_locus (), std::move (id)));
if (segment.get_separating_scope_resolution ())
- push (Rust::Token::make (SCOPE_RESOLUTION, Location ()));
+ push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
- push (Rust::Token::make (LEFT_ANGLE, Location ()));
+ push (Rust::Token::make (LEFT_ANGLE, UNDEF_LOCATION));
{
auto &lifetime_args = segment.get_generic_args ().get_lifetime_args ();
visit_items_joined_by_separator (lifetime_args, COMMA);
if (!lifetime_args.empty ()
&& (!generic_args.empty () || !binding_args.empty ()))
- push (Rust::Token::make (COMMA, Location ()));
+ push (Rust::Token::make (COMMA, UNDEF_LOCATION));
visit_items_joined_by_separator (generic_args, COMMA);
if (!generic_args.empty () && !binding_args.empty ())
- push (Rust::Token::make (COMMA, Location ()));
+ push (Rust::Token::make (COMMA, UNDEF_LOCATION));
visit_items_joined_by_separator (binding_args, COMMA);
}
- push (Rust::Token::make (RIGHT_ANGLE, Location ()));
+ push (Rust::Token::make (RIGHT_ANGLE, UNDEF_LOCATION));
}
void
push (Rust::Token::make_identifier (binding.get_locus (),
std::move (identifier)));
- push (Rust::Token::make (EQUAL, Location ()));
+ push (Rust::Token::make (EQUAL, UNDEF_LOCATION));
visit (binding.get_type ());
}
break;
case GenericArg::Kind::Either: {
auto path = arg.get_path ();
- push (Rust::Token::make_identifier (Location (), std::move (path)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (path)));
}
break;
case GenericArg::Kind::Error:
Rust::Token::make_identifier (ident_segment.get_locus (), std::move (id)));
if (segment.get_separating_scope_resolution ())
- push (Rust::Token::make (SCOPE_RESOLUTION, Location ()));
+ push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
if (!segment.is_ident_only ())
visit (segment.get_type_path_function ());
push (Rust::Token::make (LEFT_PAREN, type_path_fn.get_locus ()));
if (type_path_fn.has_inputs ())
visit_items_joined_by_separator (type_path_fn.get_params (), COMMA);
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
if (type_path_fn.has_return_type ())
{
- push (Rust::Token::make (RETURN_TYPE, Location ()));
+ push (Rust::Token::make (RETURN_TYPE, UNDEF_LOCATION));
visit (type_path_fn.get_return_type ());
}
}
visit (path.get_qualified_path_type ());
for (auto &segment : path.get_segments ())
{
- push (Rust::Token::make (SCOPE_RESOLUTION, Location ()));
+ push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
visit (segment);
}
}
visit (path.get_type ());
if (path.has_as_clause ())
{
- push (Rust::Token::make (AS, Location ()));
+ push (Rust::Token::make (AS, UNDEF_LOCATION));
visit (path.get_as_type_path ());
}
- push (Rust::Token::make (RIGHT_ANGLE, Location ()));
+ push (Rust::Token::make (RIGHT_ANGLE, UNDEF_LOCATION));
}
void
{
visit (path.get_qualified_path_type ());
- push (Rust::Token::make (SCOPE_RESOLUTION, Location ()));
+ push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
visit (path.get_associated_segment ());
for (auto &segment : path.get_segments ())
{
- push (Rust::Token::make (SCOPE_RESOLUTION, Location ()));
+ push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
visit (segment);
}
}
void
TokenCollector::visit (AttrInputLiteral &literal)
{
- push (Rust::Token::make (EQUAL, Location ()));
+ push (Rust::Token::make (EQUAL, UNDEF_LOCATION));
visit (literal.get_literal ());
}
void
TokenCollector::visit (AttrInputMacro ¯o)
{
- push (Rust::Token::make (EQUAL, Location ()));
+ push (Rust::Token::make (EQUAL, UNDEF_LOCATION));
visit (macro.get_macro ());
}
{
push (Rust::Token::make (AMP, expr.get_locus ()));
if (expr.get_is_double_borrow ())
- push (Rust::Token::make (AMP, Location ()));
+ push (Rust::Token::make (AMP, UNDEF_LOCATION));
if (expr.get_is_mut ())
- push (Rust::Token::make (MUT, Location ()));
+ push (Rust::Token::make (MUT, UNDEF_LOCATION));
visit (expr.get_borrowed_expr ());
}
TokenCollector::visit (ArrayElemsCopied &elems)
{
visit (elems.get_elem_to_copy ());
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
visit (elems.get_num_copies ());
}
{
push (Rust::Token::make (LEFT_SQUARE, expr.get_locus ()));
visit (expr.get_array_elems ());
- push (Rust::Token::make (RIGHT_SQUARE, Location ()));
+ push (Rust::Token::make (RIGHT_SQUARE, UNDEF_LOCATION));
}
void
visit (expr.get_array_expr ());
push (Rust::Token::make (LEFT_SQUARE, expr.get_locus ()));
visit (expr.get_index_expr ());
- push (Rust::Token::make (RIGHT_SQUARE, Location ()));
+ push (Rust::Token::make (RIGHT_SQUARE, UNDEF_LOCATION));
}
void
visit_items_as_lines (expr.get_outer_attrs ());
push (Rust::Token::make (LEFT_PAREN, expr.get_locus ()));
visit_items_joined_by_separator (expr.get_tuple_elems (), COMMA);
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
}
void
{
visit (expr.get_tuple_expr ());
push (Rust::Token::make (DOT, expr.get_locus ()));
- push (Rust::Token::make_int (Location (),
+ push (Rust::Token::make_int (UNDEF_LOCATION,
std::to_string (expr.get_tuple_index ())));
}
// visit_items_as_lines (expr.get_attrs ());
auto id = expr.get_field_name ();
push (Rust::Token::make_identifier (expr.get_locus (), std::move (id)));
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit (expr.get_value ());
}
// visit_items_as_lines (expr.get_attrs ());
push (Rust::Token::make_int (expr.get_locus (),
std::to_string (expr.get_index ())));
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit (expr.get_value ());
}
void
TokenCollector::visit (StructBase &base)
{
- push (Rust::Token::make (DOT_DOT, Location ()));
+ push (Rust::Token::make (DOT_DOT, UNDEF_LOCATION));
visit (base.get_base_struct ());
}
visit_items_joined_by_separator (expr.get_fields (), COMMA);
if (expr.has_struct_base ())
{
- push (Rust::Token::make (COMMA, Location ()));
+ push (Rust::Token::make (COMMA, UNDEF_LOCATION));
visit (expr.get_struct_base ());
}
else
{
visit (expr.get_function_expr ());
- push (Rust::Token::make (LEFT_PAREN, Location ()));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
visit_items_joined_by_separator (expr.get_params (), COMMA);
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
}
void
visit (expr.get_receiver_expr ());
push (Rust::Token::make (DOT, expr.get_locus ()));
visit (expr.get_method_name ());
- push (Rust::Token::make (LEFT_PAREN, Location ()));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
visit_items_joined_by_separator (expr.get_params (), COMMA);
trailing_comma ();
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
}
void
visit (expr.get_receiver_expr ());
push (Rust::Token::make (DOT, expr.get_locus ()));
auto field_name = expr.get_field_name ().as_string ();
- push (Rust::Token::make_identifier (Location (), std::move (field_name)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (field_name)));
}
void
{
push (Rust::Token::make (MOVE, expr.get_locus ()));
}
- push (Rust::Token::make (PIPE, Location ()));
+ push (Rust::Token::make (PIPE, UNDEF_LOCATION));
visit_items_joined_by_separator (expr.get_params (), COMMA);
- push (Rust::Token::make (PIPE, Location ()));
+ push (Rust::Token::make (PIPE, UNDEF_LOCATION));
}
void
{
visit_loop_common (expr);
push (Rust::Token::make (WHILE, expr.get_locus ()));
- push (Rust::Token::make (LET, Location ()));
+ push (Rust::Token::make (LET, UNDEF_LOCATION));
// TODO: The reference mention only one Pattern
for (auto &item : expr.get_patterns ())
{
visit (item);
}
- push (Rust::Token::make (EQUAL, Location ()));
+ push (Rust::Token::make (EQUAL, UNDEF_LOCATION));
visit (expr.get_scrutinee_expr ());
visit (expr.get_loop_block ());
}
visit_loop_common (expr);
push (Rust::Token::make (FOR, expr.get_locus ()));
visit (expr.get_pattern ());
- push (Rust::Token::make (IN, Location ()));
+ push (Rust::Token::make (IN, UNDEF_LOCATION));
visit (expr.get_iterator_expr ());
visit (expr.get_loop_block ());
}
TokenCollector::visit (IfLetExpr &expr)
{
push (Rust::Token::make (IF, expr.get_locus ()));
- push (Rust::Token::make (LET, Location ()));
+ push (Rust::Token::make (LET, UNDEF_LOCATION));
for (auto &pattern : expr.get_patterns ())
{
visit (pattern);
}
- push (Rust::Token::make (EQUAL, Location ()));
+ push (Rust::Token::make (EQUAL, UNDEF_LOCATION));
visit (expr.get_value_expr ());
visit (expr.get_if_block ());
}
}
if (arm.has_match_arm_guard ())
{
- push (Rust::Token::make (IF, Location ()));
+ push (Rust::Token::make (IF, UNDEF_LOCATION));
visit (arm.get_guard_expr ());
}
}
{
indentation ();
visit (match_case.get_arm ());
- push (Rust::Token::make (MATCH_ARROW, Location ()));
+ push (Rust::Token::make (MATCH_ARROW, UNDEF_LOCATION));
visit (match_case.get_expr ());
indentation ();
- push (Rust::Token::make (COMMA, Location ()));
+ push (Rust::Token::make (COMMA, UNDEF_LOCATION));
newline ();
}
{
push (Rust::Token::make (MATCH_TOK, expr.get_locus ()));
visit (expr.get_scrutinee_expr ());
- push (Rust::Token::make (LEFT_CURLY, Location ()));
+ push (Rust::Token::make (LEFT_CURLY, UNDEF_LOCATION));
newline ();
increment_indentation ();
visit_items_as_lines (expr.get_inner_attrs ());
}
decrement_indentation ();
indentation ();
- push (Rust::Token::make (RIGHT_CURLY, Location ()));
+ push (Rust::Token::make (RIGHT_CURLY, UNDEF_LOCATION));
}
void
visit (expr.get_awaited_expr ());
push (Rust::Token::make (DOT, expr.get_locus ()));
// TODO: Check status of await keyword (Context dependant ?)
- push (Rust::Token::make_identifier (Location (), "await"));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, "await"));
}
void
{
push (Rust::Token::make (ASYNC, expr.get_locus ()));
if (expr.get_has_move ())
- push (Rust::Token::make (MOVE, Location ()));
+ push (Rust::Token::make (MOVE, UNDEF_LOCATION));
visit (expr.get_block_expr ());
}
push (Rust::Token::make_identifier (param.get_locus (), std::move (id)));
if (param.has_type_param_bounds ())
{
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit_items_joined_by_separator (param.get_type_param_bounds (), PLUS);
}
if (param.has_type ())
{
- push (Rust::Token::make (EQUAL, Location ()));
+ push (Rust::Token::make (EQUAL, UNDEF_LOCATION));
visit (param.get_type ());
}
}
// LifetimeWhereClauseItem
// | TypeBoundWhereClauseItem
- push (Rust::Token::make (WHERE, Location ()));
+ push (Rust::Token::make (WHERE, UNDEF_LOCATION));
newline ();
increment_indentation ();
visit_items_joined_by_separator (rule.get_items (), COMMA);
// ( Lifetime + )* Lifetime?
visit (item.get_lifetime ());
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit_items_joined_by_separator (item.get_lifetime_bounds (), PLUS);
}
visit (item.get_type ());
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit_items_joined_by_separator (item.get_type_param_bounds (), PLUS);
}
visit (qualifiers);
push (Rust::Token::make (FN_TOK, method.get_locus ()));
- push (Rust::Token::make_identifier (Location (), std::move (method_name)));
- push (Rust::Token::make (LEFT_PAREN, Location ()));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (method_name)));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
visit (method.get_self_param ());
if (!method.get_function_params ().empty ())
{
- push (Rust::Token::make (COMMA, Location ()));
+ push (Rust::Token::make (COMMA, UNDEF_LOCATION));
visit_items_joined_by_separator (method.get_function_params (), COMMA);
}
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
if (method.has_return_type ())
{
- push (Rust::Token::make (RETURN_TYPE, Location ()));
+ push (Rust::Token::make (RETURN_TYPE, UNDEF_LOCATION));
visit (method.get_return_type ());
}
auto &block = method.get_definition ();
if (!block)
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
else
visit (block);
newline ();
visit (module.get_visibility ());
auto name = module.get_name ().as_string ();
push (Rust::Token::make (MOD, module.get_locus ()));
- push (Rust::Token::make_identifier (Location (), std::move (name)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (name)));
if (module.get_kind () == Module::UNLOADED)
{
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
newline ();
}
else /* Module::LOADED */
{
- push (Rust::Token::make (LEFT_CURLY, Location ()));
+ push (Rust::Token::make (LEFT_CURLY, UNDEF_LOCATION));
newline ();
increment_indentation ();
decrement_indentation ();
- push (Rust::Token::make (RIGHT_CURLY, Location ()));
+ push (Rust::Token::make (RIGHT_CURLY, UNDEF_LOCATION));
newline ();
}
}
{
visit_items_as_lines (crate.get_outer_attrs ());
push (Rust::Token::make (EXTERN_TOK, crate.get_locus ()));
- push (Rust::Token::make (CRATE, Location ()));
+ push (Rust::Token::make (CRATE, UNDEF_LOCATION));
auto ref = crate.get_referenced_crate ();
- push (Rust::Token::make_identifier (Location (), std::move (ref)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (ref)));
if (crate.has_as_clause ())
{
auto as_clause = crate.get_as_clause ();
- push (Rust::Token::make (AS, Location ()));
- push (Rust::Token::make_identifier (Location (), std::move (as_clause)));
+ push (Rust::Token::make (AS, UNDEF_LOCATION));
+ push (
+ Rust::Token::make_identifier (UNDEF_LOCATION, std::move (as_clause)));
}
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
newline ();
}
case UseTreeGlob::PathType::PATH_PREFIXED: {
auto path = use_tree.get_path ();
visit (path);
- push (Rust::Token::make (SCOPE_RESOLUTION, Location ()));
+ push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
}
break;
case UseTreeGlob::PathType::NO_PATH:
- push (Rust::Token::make (SCOPE_RESOLUTION, Location ()));
+ push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
break;
case UseTreeGlob::PathType::GLOBAL:
break;
}
- push (Rust::Token::make (ASTERISK, Location ()));
+ push (Rust::Token::make (ASTERISK, UNDEF_LOCATION));
}
void
case UseTreeList::PathType::PATH_PREFIXED: {
auto path = use_tree.get_path ();
visit (path);
- push (Rust::Token::make (SCOPE_RESOLUTION, Location ()));
+ push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
}
break;
case UseTreeList::PathType::NO_PATH:
- push (Rust::Token::make (SCOPE_RESOLUTION, Location ()));
+ push (Rust::Token::make (SCOPE_RESOLUTION, UNDEF_LOCATION));
break;
case UseTreeList::PathType::GLOBAL:
break;
}
- push (Rust::Token::make (LEFT_CURLY, Location ()));
+ push (Rust::Token::make (LEFT_CURLY, UNDEF_LOCATION));
if (use_tree.has_trees ())
{
visit_items_joined_by_separator (use_tree.get_trees (), COMMA);
}
- push (Rust::Token::make (RIGHT_CURLY, Location ()));
+ push (Rust::Token::make (RIGHT_CURLY, UNDEF_LOCATION));
}
void
switch (use_tree.get_new_bind_type ())
{
case UseTreeRebind::NewBindType::IDENTIFIER: {
- push (Rust::Token::make (AS, Location ()));
+ push (Rust::Token::make (AS, UNDEF_LOCATION));
auto id = use_tree.get_identifier ().as_string ();
push (
Rust::Token::make_identifier (use_tree.get_locus (), std::move (id)));
}
break;
case UseTreeRebind::NewBindType::WILDCARD:
- push (Rust::Token::make (AS, Location ()));
+ push (Rust::Token::make (AS, UNDEF_LOCATION));
push (Rust::Token::make (UNDERSCORE, use_tree.get_locus ()));
break;
case UseTreeRebind::NewBindType::NONE:
visit_items_as_lines (decl.get_outer_attrs ());
push (Rust::Token::make (USE, decl.get_locus ()));
visit (*decl.get_tree ());
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
newline ();
}
push (Rust::Token::make (FN_TOK, function.get_locus ()));
auto name = function.get_function_name ().as_string ();
- push (Rust::Token::make_identifier (Location (), std::move (name)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (name)));
if (function.has_generics ())
visit (function.get_generic_params ());
- push (Rust::Token::make (LEFT_PAREN, Location ()));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
visit_items_joined_by_separator (function.get_function_params ());
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
if (function.has_return_type ())
{
- push (Rust::Token::make (RETURN_TYPE, Location ()));
+ push (Rust::Token::make (RETURN_TYPE, UNDEF_LOCATION));
visit (function.get_return_type ());
}
auto &block = function.get_definition ();
if (!block)
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
else
visit (block);
newline ();
visit (type_alias.get_visibility ());
auto alias_name = type_alias.get_new_type_name ().as_string ();
push (Rust::Token::make (TYPE, type_alias.get_locus ()));
- push (Rust::Token::make_identifier (Location (), std::move (alias_name)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (alias_name)));
if (type_alias.has_generics ())
visit (type_alias.get_generic_params ());
if (type_alias.has_where_clause ())
visit (type_alias.get_where_clause ());
- push (Rust::Token::make (EQUAL, Location ()));
+ push (Rust::Token::make (EQUAL, UNDEF_LOCATION));
visit (type_alias.get_type_aliased ());
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
}
void
visit (struct_item.get_visibility ());
auto struct_name = struct_item.get_identifier ().as_string ();
push (Rust::Token::make (STRUCT_TOK, struct_item.get_locus ()));
- push (Rust::Token::make_identifier (Location (), std::move (struct_name)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (struct_name)));
if (struct_item.has_generics ())
visit (struct_item.get_generic_params ());
visit (struct_item.get_where_clause ());
if (struct_item.is_unit_struct ())
{
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
newline ();
}
else
visit_items_as_block (struct_item.get_fields (),
- {Rust::Token::make (COMMA, Location ())});
+ {Rust::Token::make (COMMA, UNDEF_LOCATION)});
}
void
visit_items_as_lines (tuple_struct.get_outer_attrs ());
auto struct_name = tuple_struct.get_identifier ().as_string ();
push (Rust::Token::make (STRUCT_TOK, tuple_struct.get_locus ()));
- push (Rust::Token::make_identifier (Location (), std::move (struct_name)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (struct_name)));
if (tuple_struct.has_generics ())
visit (tuple_struct.get_generic_params ());
if (tuple_struct.has_where_clause ())
visit (tuple_struct.get_where_clause ());
- push (Rust::Token::make (LEFT_PAREN, Location ()));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
visit_items_joined_by_separator (tuple_struct.get_fields (), COMMA);
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
newline ();
}
{
auto id = item.get_identifier ().as_string ();
push (Rust::Token::make_identifier (item.get_locus (), std::move (id)));
- push (Rust::Token::make (LEFT_PAREN, Location ()));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
visit_items_joined_by_separator (item.get_tuple_fields (), COMMA);
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
}
void
auto id = item.get_identifier ().as_string ();
push (Rust::Token::make_identifier (item.get_locus (), std::move (id)));
visit_items_as_block (item.get_struct_fields (),
- {Rust::Token::make (COMMA, Location ())});
+ {Rust::Token::make (COMMA, UNDEF_LOCATION)});
}
void
{
auto id = item.get_identifier ().as_string ();
push (Rust::Token::make_identifier (item.get_locus (), std::move (id)));
- push (Rust::Token::make (EQUAL, Location ()));
+ push (Rust::Token::make (EQUAL, UNDEF_LOCATION));
visit (item.get_expr ());
}
visit (enumeration.get_where_clause ());
visit_items_as_block (enumeration.get_variants (),
- {Rust::Token::make (COMMA, Location ())});
+ {Rust::Token::make (COMMA, UNDEF_LOCATION)});
}
void
visit_items_as_lines (union_item.get_outer_attrs ());
auto id = union_item.get_identifier ().as_string ();
push (Rust::Token::make_identifier (union_item.get_locus (), "union"));
- push (Rust::Token::make_identifier (Location (), std::move (id)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
if (union_item.has_generics ())
visit (union_item.get_generic_params ());
visit (union_item.get_where_clause ());
visit_items_as_block (union_item.get_variants (),
- {Rust::Token::make (COMMA, Location ())});
+ {Rust::Token::make (COMMA, UNDEF_LOCATION)});
}
void
push (Rust::Token::make (CONST, item.get_locus ()));
if (item.is_unnamed ())
{
- push (Rust::Token::make (UNDERSCORE, Location ()));
+ push (Rust::Token::make (UNDERSCORE, UNDEF_LOCATION));
}
else
{
auto id = item.get_identifier ();
- push (Rust::Token::make_identifier (Location (), std::move (id)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
}
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit (item.get_type ());
if (item.has_expr ())
{
- push (Rust::Token::make (EQUAL, Location ()));
+ push (Rust::Token::make (EQUAL, UNDEF_LOCATION));
visit (item.get_expr ());
}
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
}
void
visit_items_as_lines (item.get_outer_attrs ());
push (Rust::Token::make (STATIC_TOK, item.get_locus ()));
if (item.is_mutable ())
- push (Rust::Token::make (MUT, Location ()));
+ push (Rust::Token::make (MUT, UNDEF_LOCATION));
auto id = item.get_identifier ().as_string ();
- push (Rust::Token::make_identifier (Location (), std::move (id)));
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit (item.get_type ());
if (item.has_expr ())
{
- push (Rust::Token::make (EQUAL, Location ()));
+ push (Rust::Token::make (EQUAL, UNDEF_LOCATION));
visit (item.get_expr ());
}
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
}
void
// FIXME: This should format the `<vis> fn <name> ( [args] )` as well
if (return_type)
{
- push (Rust::Token::make (RETURN_TYPE, Location ()));
+ push (Rust::Token::make (RETURN_TYPE, UNDEF_LOCATION));
visit (return_type);
}
}
else
{
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
newline ();
}
}
auto id = func.get_identifier ().as_string ();
push (Rust::Token::make (FN_TOK, item.get_locus ()));
- push (Rust::Token::make_identifier (Location (), std::move (id)));
- push (Rust::Token::make (LEFT_PAREN, Location ()));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
visit_items_joined_by_separator (func.get_function_params ());
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
visit_function_common (func.get_return_type (), item.get_definition ());
}
{
if (param.get_has_ref ())
{
- push (Rust::Token::make (AMP, Location ()));
+ push (Rust::Token::make (AMP, UNDEF_LOCATION));
if (param.has_lifetime ())
{
auto lifetime = param.get_lifetime ();
visit (lifetime);
}
if (param.get_is_mut ())
- push (Rust::Token::make (MUT, Location ()));
+ push (Rust::Token::make (MUT, UNDEF_LOCATION));
}
- push (Rust::Token::make (SELF, Location ()));
+ push (Rust::Token::make (SELF, UNDEF_LOCATION));
if (param.has_type ())
{
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit (param.get_type ());
}
}
auto id = method.get_identifier ().as_string ();
push (Rust::Token::make (FN_TOK, item.get_locus ()));
- push (Rust::Token::make_identifier (Location (), std::move (id)));
- push (Rust::Token::make (LEFT_PAREN, Location ()));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
visit (method.get_self_param ());
if (!method.get_function_params ().empty ())
{
- push (Rust::Token::make (COMMA, Location ()));
+ push (Rust::Token::make (COMMA, UNDEF_LOCATION));
visit_items_joined_by_separator (method.get_function_params (), COMMA);
}
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
visit_function_common (method.get_return_type (), item.get_definition ());
}
auto id = item.get_identifier ().as_string ();
indentation ();
push (Rust::Token::make (CONST, item.get_locus ()));
- push (Rust::Token::make_identifier (Location (), std::move (id)));
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit (item.get_type ());
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
newline ();
}
indentation ();
push (Rust::Token::make (TYPE, item.get_locus ()));
- push (Rust::Token::make_identifier (Location (), std::move (id)));
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
newline ();
}
auto id = trait.get_identifier ().as_string ();
push (Rust::Token::make (TRAIT, trait.get_locus ()));
- push (Rust::Token::make_identifier (Location (), std::move (id)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
visit (trait.get_generic_params ());
push (Rust::Token::make (IMPL, impl.get_locus ()));
visit (impl.get_generic_params ());
if (impl.is_exclam ())
- push (Rust::Token::make (EXCLAM, Location ()));
+ push (Rust::Token::make (EXCLAM, UNDEF_LOCATION));
visit (impl.get_trait_path ());
- push (Rust::Token::make (FOR, Location ()));
+ push (Rust::Token::make (FOR, UNDEF_LOCATION));
visit (impl.get_type ());
if (impl.has_where_clause ())
auto id = type.get_identifier ().as_string ();
- push (Rust::Token::make (TYPE, Location ()));
- push (Rust::Token::make_identifier (Location (), std::move (id)));
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (TYPE, UNDEF_LOCATION));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
}
void
visit (item.get_visibility ());
push (Rust::Token::make (STATIC_TOK, item.get_locus ()));
if (item.is_mut ())
- push (Rust::Token::make (MUT, Location ()));
- push (Rust::Token::make_identifier (Location (), std::move (id)));
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make (MUT, UNDEF_LOCATION));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit (item.get_type ());
// TODO: No expr ? The "(= Expression)?" part from the reference seems missing
// in the ast.
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
}
void
auto id = function.get_identifier ().as_string ();
push (Rust::Token::make (FN_TOK, function.get_locus ()));
- push (Rust::Token::make_identifier (Location (), std::move (id)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
if (function.has_generics ())
visit (function.get_generic_params ());
- push (Rust::Token::make (LEFT_PAREN, Location ()));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
visit_items_joined_by_separator (function.get_function_params ());
if (function.is_variadic ())
{
- push (Rust::Token::make (COMMA, Location ()));
+ push (Rust::Token::make (COMMA, UNDEF_LOCATION));
// TODO: Add variadic outer attributes?
// TODO: Add variadic name once implemented.
- push (Rust::Token::make (ELLIPSIS, Location ()));
+ push (Rust::Token::make (ELLIPSIS, UNDEF_LOCATION));
}
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
if (function.has_return_type ())
{
- push (Rust::Token::make (RETURN_TYPE, Location ()));
+ push (Rust::Token::make (RETURN_TYPE, UNDEF_LOCATION));
visit (function.get_return_type ());
}
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
}
void
if (block.has_abi ())
{
auto abi = block.get_abi ();
- push (Rust::Token::make_string (Location (), std::move (abi)));
+ push (Rust::Token::make_string (UNDEF_LOCATION, std::move (abi)));
}
visit_items_as_block (block.get_extern_items (), {});
{
auto id = match.get_ident ().as_string ();
auto frag_spec = match.get_frag_spec ().as_string ();
- push (Rust::Token::make (DOLLAR_SIGN, Location ()));
- push (Rust::Token::make_identifier (Location (), std::move (id)));
- push (Rust::Token::make (COLON, Location ()));
- push (Rust::Token::make_identifier (Location (), std::move (frag_spec)));
+ push (Rust::Token::make (DOLLAR_SIGN, UNDEF_LOCATION));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (frag_spec)));
}
void
TokenCollector::visit (MacroMatchRepetition &repetition)
{
- push (Rust::Token::make (DOLLAR_SIGN, Location ()));
- push (Rust::Token::make (LEFT_PAREN, Location ()));
+ push (Rust::Token::make (DOLLAR_SIGN, UNDEF_LOCATION));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
for (auto &match : repetition.get_matches ())
{
visit (match);
}
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
if (repetition.has_sep ())
{
switch (repetition.get_op ())
{
case MacroMatchRepetition::ANY:
- push (Rust::Token::make (ASTERISK, Location ()));
+ push (Rust::Token::make (ASTERISK, UNDEF_LOCATION));
break;
case MacroMatchRepetition::ONE_OR_MORE:
- push (Rust::Token::make (PLUS, Location ()));
+ push (Rust::Token::make (PLUS, UNDEF_LOCATION));
break;
case MacroMatchRepetition::ZERO_OR_ONE:
- push (Rust::Token::make (QUESTION_MARK, Location ()));
+ push (Rust::Token::make (QUESTION_MARK, UNDEF_LOCATION));
break;
case MacroMatchRepetition::NONE:
break;
{
auto delimiters = get_delimiters (matcher.get_delim_type ());
- push (Rust::Token::make (delimiters.first, Location ()));
+ push (Rust::Token::make (delimiters.first, UNDEF_LOCATION));
for (auto &item : matcher.get_matches ())
{
visit (item);
}
- push (Rust::Token::make (delimiters.second, Location ()));
+ push (Rust::Token::make (delimiters.second, UNDEF_LOCATION));
}
void
auto rule_name = rules_def.get_rule_name ().as_string ();
push (Rust::Token::make_identifier (rules_def.get_locus (), "macro_rules"));
- push (Rust::Token::make (EXCLAM, Location ()));
+ push (Rust::Token::make (EXCLAM, UNDEF_LOCATION));
- push (Rust::Token::make_identifier (Location (), std::move (rule_name)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (rule_name)));
visit_items_as_block (rules_def.get_rules (),
- {Rust::Token::make (SEMICOLON, Location ())});
+ {Rust::Token::make (SEMICOLON, UNDEF_LOCATION)});
}
void
{
auto data = invocation.get_invoc_data ();
visit (data.get_path ());
- push (Rust::Token::make (EXCLAM, Location ()));
+ push (Rust::Token::make (EXCLAM, UNDEF_LOCATION));
visit (data.get_delim_tok_tree ());
if (invocation.has_semicolon ())
{
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
}
}
{
visit (item.get_path ());
// TODO: Double check this, there is probably a mistake.
- push (Rust::Token::make (LEFT_PAREN, Location ()));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
visit_items_joined_by_separator (item.get_seq (), COMMA);
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
}
void
push (Rust::Token::make_identifier (name.get_locus (), std::move (id)));
push (Rust::Token::make (EQUAL, name.get_locus ()));
- push (Rust::Token::make (DOUBLE_QUOTE, Location ()));
+ push (Rust::Token::make (DOUBLE_QUOTE, UNDEF_LOCATION));
push (Rust::Token::make_identifier (name.get_locus (), std::move (value)));
- push (Rust::Token::make (DOUBLE_QUOTE, Location ()));
+ push (Rust::Token::make (DOUBLE_QUOTE, UNDEF_LOCATION));
}
void
auto id = list.get_ident ().as_string ();
push (Rust::Token::make_identifier (list.get_locus (), std::move (id)));
- push (Rust::Token::make (LEFT_PAREN, Location ()));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
visit_items_joined_by_separator (list.get_paths (), COMMA);
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
}
void
auto id = list.get_ident ().as_string ();
push (Rust::Token::make_identifier (list.get_locus (), std::move (id)));
- push (Rust::Token::make (LEFT_PAREN, Location ()));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
visit_items_joined_by_separator (list.get_values (), COMMA);
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
}
// rust-pattern.h
}
if (pattern.get_is_mut ())
{
- push (Rust::Token::make (MUT, Location ()));
+ push (Rust::Token::make (MUT, UNDEF_LOCATION));
}
auto id = pattern.get_ident ().as_string ();
- push (Rust::Token::make_identifier (Location (), std::move (id)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
if (pattern.has_pattern_to_bind ())
{
- push (Rust::Token::make (PATTERN_BIND, Location ()));
+ push (Rust::Token::make (PATTERN_BIND, UNDEF_LOCATION));
visit (pattern.get_pattern_to_bind ());
}
}
if (pattern.get_is_mut ())
{
- push (Rust::Token::make (MUT, Location ()));
+ push (Rust::Token::make (MUT, UNDEF_LOCATION));
}
visit (pattern.get_referenced_pattern ());
visit_items_as_lines (pattern.get_outer_attrs ());
auto id = pattern.get_identifier ().as_string ();
- push (Rust::Token::make_identifier (Location (), std::move (id)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
push (Rust::Token::make (COLON, pattern.get_locus ()));
{
visit_items_as_lines (pattern.get_outer_attrs ());
if (pattern.is_ref ())
- push (Rust::Token::make (REF, Location ()));
+ push (Rust::Token::make (REF, UNDEF_LOCATION));
if (pattern.is_mut ())
- push (Rust::Token::make (MUT, Location ()));
+ push (Rust::Token::make (MUT, UNDEF_LOCATION));
auto id = pattern.get_identifier ().as_string ();
- push (Rust::Token::make_identifier (Location (), std::move (id)));
+ push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
}
void
visit_items_joined_by_separator (elems.get_struct_pattern_fields ());
if (elems.has_etc ())
{
- push (Rust::Token::make (COMMA, Location ()));
+ push (Rust::Token::make (COMMA, UNDEF_LOCATION));
visit_items_as_lines (elems.get_etc_outer_attrs ());
}
}
visit_items_as_lines (elems.get_etc_outer_attrs ());
}
- push (Rust::Token::make (RIGHT_CURLY, Location ()));
+ push (Rust::Token::make (RIGHT_CURLY, UNDEF_LOCATION));
}
// void TokenCollector::visit(TupleStructItems& ){}
{
visit (lower);
}
- push (Rust::Token::make (DOT_DOT, Location ()));
+ push (Rust::Token::make (DOT_DOT, UNDEF_LOCATION));
for (auto &upper : pattern.get_lower_patterns ())
{
visit (upper);
push (Rust::Token::make (LEFT_PAREN, pattern.get_locus ()));
if (pattern.has_items ())
visit (pattern.get_items ());
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
}
// void
{
visit (lower);
}
- push (Rust::Token::make (DOT_DOT, Location ()));
+ push (Rust::Token::make (DOT_DOT, UNDEF_LOCATION));
for (auto &upper : pattern.get_lower_patterns ())
{
visit (upper);
{
push (Rust::Token::make (LEFT_PAREN, pattern.get_locus ()));
visit (pattern.get_items ());
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
}
void
{
push (Rust::Token::make (LEFT_PAREN, pattern.get_locus ()));
visit (pattern.get_pattern_in_parens ());
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
}
void
{
push (Rust::Token::make (LEFT_SQUARE, pattern.get_locus ()));
visit_items_joined_by_separator (pattern.get_items (), COMMA);
- push (Rust::Token::make (RIGHT_SQUARE, Location ()));
+ push (Rust::Token::make (RIGHT_SQUARE, UNDEF_LOCATION));
}
void
if (stmt.has_type ())
{
- push (Rust::Token::make (COLON, Location ()));
+ push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit (stmt.get_type ());
}
if (stmt.has_init_expr ())
{
- push (Rust::Token::make (EQUAL, Location ()));
+ push (Rust::Token::make (EQUAL, UNDEF_LOCATION));
visit (stmt.get_init_expr ());
}
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
}
void
{
visit (stmt.get_expr ());
if (stmt.is_semicolon_followed ())
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
}
// rust-type.h
push (Rust::Token::make (LEFT_PAREN, type.get_locus ()));
visit (type.get_type_in_parens ());
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
}
void
push (Rust::Token::make (LEFT_PAREN, type.get_locus ()));
visit_items_joined_by_separator (type.get_elems (), COMMA);
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
}
void
push (Rust::Token::make (ASTERISK, type.get_locus ()));
if (type.get_pointer_type () == RawPointerType::MUT)
- push (Rust::Token::make (MUT, Location ()));
+ push (Rust::Token::make (MUT, UNDEF_LOCATION));
else /* RawPointerType::CONST */
- push (Rust::Token::make (CONST, Location ()));
+ push (Rust::Token::make (CONST, UNDEF_LOCATION));
visit (type.get_type_pointed_to ());
}
}
if (type.get_has_mut ())
- push (Rust::Token::make (MUT, Location ()));
+ push (Rust::Token::make (MUT, UNDEF_LOCATION));
visit (type.get_type_referenced ());
}
push (Rust::Token::make (LEFT_SQUARE, type.get_locus ()));
visit (type.get_elem_type ());
- push (Rust::Token::make (SEMICOLON, Location ()));
+ push (Rust::Token::make (SEMICOLON, UNDEF_LOCATION));
visit (type.get_size_expr ());
- push (Rust::Token::make (RIGHT_SQUARE, Location ()));
+ push (Rust::Token::make (RIGHT_SQUARE, UNDEF_LOCATION));
}
void
push (Rust::Token::make (LEFT_SQUARE, type.get_locus ()));
visit (type.get_elem_type ());
- push (Rust::Token::make (RIGHT_SQUARE, Location ()));
+ push (Rust::Token::make (RIGHT_SQUARE, UNDEF_LOCATION));
}
void
visit (type.get_function_qualifiers ());
push (Rust::Token::make (FN_TOK, type.get_locus ()));
- push (Rust::Token::make (LEFT_PAREN, Location ()));
+ push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
visit_items_joined_by_separator (type.get_function_params (), COMMA);
if (type.is_variadic ())
{
- push (Rust::Token::make (COMMA, Location ()));
+ push (Rust::Token::make (COMMA, UNDEF_LOCATION));
for (auto &item : type.get_variadic_attr ())
{
visit (item);
}
- push (Rust::Token::make (ELLIPSIS, Location ()));
+ push (Rust::Token::make (ELLIPSIS, UNDEF_LOCATION));
}
- push (Rust::Token::make (RIGHT_PAREN, Location ()));
+ push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
if (type.has_return_type ())
{
- push (Rust::Token::make (RETURN_TYPE, Location ()));
+ push (Rust::Token::make (RETURN_TYPE, UNDEF_LOCATION));
visit (type.get_return_type ());
}
}