diff options
Diffstat (limited to '')
| -rw-r--r-- | src/token.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/token.h b/src/token.h new file mode 100644 index 0000000..3b5caff --- /dev/null +++ b/src/token.h | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | #ifndef TOKEN_H | ||
| 2 | #define TOKEN_H | ||
| 3 | |||
| 4 | class Number; | ||
| 5 | namespace Bu | ||
| 6 | { | ||
| 7 | class String; | ||
| 8 | class Formatter; | ||
| 9 | }; | ||
| 10 | |||
| 11 | class Token | ||
| 12 | { | ||
| 13 | public: | ||
| 14 | enum Type | ||
| 15 | { | ||
| 16 | tNumber, | ||
| 17 | tString, | ||
| 18 | tCommand, | ||
| 19 | tPlus, | ||
| 20 | tMinus, | ||
| 21 | tDivide, | ||
| 22 | tMultiply, | ||
| 23 | tOpenParen, | ||
| 24 | tCloseParen, | ||
| 25 | |||
| 26 | tEndOfLine, | ||
| 27 | |||
| 28 | tEndOfInput | ||
| 29 | }; | ||
| 30 | |||
| 31 | Token( Type eType ); | ||
| 32 | Token( Type eType, Bu::String *s ); | ||
| 33 | Token( Type eType, Number *n ); | ||
| 34 | Token( const Token &rSrc ); | ||
| 35 | ~Token(); | ||
| 36 | |||
| 37 | Type eType; | ||
| 38 | union | ||
| 39 | { | ||
| 40 | Bu::String *sVal; | ||
| 41 | class Number *nVal; | ||
| 42 | }; | ||
| 43 | }; | ||
| 44 | |||
| 45 | Bu::Formatter &operator<<( Bu::Formatter &f, Token::Type eType ); | ||
| 46 | |||
| 47 | #endif | ||
