From 2909f50d008920568f0e50da760b266388ccc124 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 22 Apr 2013 13:05:22 -0600 Subject: There is now a parser & calculator interface. --- src/token.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/token.h (limited to 'src/token.h') 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 @@ +#ifndef TOKEN_H +#define TOKEN_H + +class Number; +namespace Bu +{ + class String; + class Formatter; +}; + +class Token +{ +public: + enum Type + { + tNumber, + tString, + tCommand, + tPlus, + tMinus, + tDivide, + tMultiply, + tOpenParen, + tCloseParen, + + tEndOfLine, + + tEndOfInput + }; + + Token( Type eType ); + Token( Type eType, Bu::String *s ); + Token( Type eType, Number *n ); + Token( const Token &rSrc ); + ~Token(); + + Type eType; + union + { + Bu::String *sVal; + class Number *nVal; + }; +}; + +Bu::Formatter &operator<<( Bu::Formatter &f, Token::Type eType ); + +#endif -- cgit v1.2.3