Skip to content

Commit

Permalink
Create Token.h
Browse files Browse the repository at this point in the history
all tokens used in Tokenizer. Sorry for Polish comments, if somebody want translation should tell me :)
  • Loading branch information
tomekl007 committed Jan 12, 2013
1 parent 2544cc6 commit 4e196b1
Showing 1 changed file with 137 additions and 0 deletions.
137 changes: 137 additions & 0 deletions Token.h
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,137 @@
#ifndef Token_h
#define Token_h

#include <string>

using std::wstring;

enum Token_Type ///there is 6 types of tokens
{
GENERIC = 0, CHARACTER, START_TAG, END_TAG, COMMENT, DOCTYPE, DOCTYPE_PUBLIC, DOCTYPE_SYSTEM


};



class Token //this is base class for all tokens
{
public:
virtual Token_Type getType()
{
return GENERIC;

}



};



class CharacterToken : public Token //
{
public:
wchar_t character; //skladowa moze byc publiczna, bo niez zalezy zeby Token byl
//chermetycznym typem danych. bedzie przenosil dane z Tokenizer do Parser
CharacterToken() : character(0)
{}


virtual Token_Type getType()
{

return CHARACTER;
}
};

class StartTagToken : public Token
{
public:
wstring tagName; //wstring poniewaz te znaki beda stopniowo dodawane

virtual Token_Type getType()
{
return START_TAG;
}


};

class EndTagToken : public Token
{
public:
wstring tagName; //wstring poniewaz te znaki beda stopniowo dodawane

virtual Token_Type getType()
{
return END_TAG;
}


};

class CommentToken : public Token
{
public:
wstring comment;



virtual Token_Type getType()
{
return COMMENT;
}


};

class DoctypeToken : public Token
{
public:
wstring doctype;

virtual Token_Type getType()
{
return DOCTYPE;
}


};

class DoctypePublicToken : public Token
{
public:
wstring doctypePublic;

virtual Token_Type getType()
{
return DOCTYPE_PUBLIC;
}


};

class DoctypeSystemToken : public Token
{
public:
wstring doctypeSystem;

virtual Token_Type getType()
{
return DOCTYPE_SYSTEM;
}

};











#endif // TOKEN_H_INCLUDED

0 comments on commit 4e196b1

Please sign in to comment.