using namespace std;
-ILexer::ILexer(istream& in) : line(-1), column(-1), in_stream(in)
+ILexer::ILexer(istream& in) : line(-1), column(-1), in_stream(in), current(in_stream.get())
{
}
#include <string.h>
#include <iostream>
+using namespace std;
+
AST::AST(ASTNodeType type)
{
node_type = type;
return node_type;
}
+void AST::type(ASTNodeType typ)
+{
+ node_type = typ;
+}
+
list<AST*>* AST::children(void)
{
return node_children;
return node_text;
}
+void AST::text(std::string& txt)
+{
+ node_text = txt;
+}
+
void AST::addChild(AST* node)
{
node_children->push_back(node);
#include <list>
#include <string>
-using namespace std;
-
typedef unsigned int ASTNodeType;
class AST
{
protected:
ASTNodeType node_type;
- string node_text;
- list<AST*>* node_children;
+ std::string node_text;
+ std::list<AST*>* node_children;
public:
AST(ASTNodeType type);
AST(ASTNodeType type, const char* text);
- AST(ASTNodeType type, string text);
+ AST(ASTNodeType type, std::string text);
AST(ASTNodeType type, int child_count, ...);
virtual ~AST();
AST& operator = (AST& rhs);
ASTNodeType type(void) const;
- string text(void) const;
- list<AST*>* children(void);
- void addChild(AST* node);
- AST* clone(void) const;
+ void type(ASTNodeType typ);
+ std::string text(void) const;
+ void text(std::string& txt);
+ std::list<AST*>* children(void);
+ void addChild(AST* node);
+ AST* clone(void) const;
};
#endif