// ------------------------------------------------------------------------
void
-token::make_junk (const string new_msg)
+token::make_junk (const string& new_msg)
{
type = tok_junk;
msg = new_msg;
struct token
{
source_loc location;
- token_type type;
interned_string content;
- std::string msg; // for tok_junk
- void make_junk (const std::string msg);
+ std::string msg; // for tok_junk, more efficient than interned_string if empty
const token* chain; // macro invocation that produced this token
+ token_type type;
+
+ void make_junk (const std::string& msg);
friend class parser;
friend class lexer;
private:
- token(): type(tok_junk), chain(0) {}
+ token(): chain(0), type(tok_junk) {}
token(const token& other):
- location(other.location), type(other.type), content(other.content),
- msg(other.msg), chain(other.chain) {}
+ location(other.location), content(other.content),
+ msg(other.msg), chain(other.chain), type(other.type) {}
};