求解C++代码错误:error: expected unqualified-id
程序代码:
#include <string> #include <ostream> #include "Tag.hpp" #include "Token.hpp" namespace Lexer { /* Word.hpp * 用Word类管理保留字、标识符和复合单元词素(如&&, ||) */ class Word : public Lexer::Token { public: Word( std::string str, int tag ) : Token( tag ), lexeme( str ) {} ~Word() {} virtual void initial() final { Lexer::Word *and = new Lexer::Word( "&&", Lexer::AND ), *or = new Lexer::Word( "||", Lexer::OR ), *eq = new Lexer::Word( "==", Lexer::EQ ), *ne = new Lexer::Word( "!=", Lexer::NE ), *le = new Lexer::Word( "<=", Lexer::LE ), *ge = new Lexer::Word( ">=", Lexer::GE ), *minus = new Lexer::Word( "minus", Lexer::MINUS ), // minus 代表单目减号, 如-2 *True = new Lexer::Word( "true", Lexer::TRUE ), *False = new Lexer::Word( "false", Lexer::FALSE ), *temp = new Lexer::Word( "temp", Lexer::TEMP ); } public: friend std::ostream& operator<<( std::ostream& out, const Lexer::Word& w ) { out << w.lexeme; return out; } public: std::string lexeme; }; }找不到自己哪里出错了,求解!!!