diff options
author | Mike Buland <mike@xagasoft.com> | 2013-04-22 13:05:22 -0600 |
---|---|---|
committer | Mike Buland <mike@xagasoft.com> | 2013-04-22 13:05:22 -0600 |
commit | 2909f50d008920568f0e50da760b266388ccc124 (patch) | |
tree | 6789c162a2b950c2006c944e9d21e6ed9bda7069 /src/token.h | |
parent | d7ccd9c4d8e5a5bb4f12b36b3e4ad3105c5a9317 (diff) | |
download | clic-2909f50d008920568f0e50da760b266388ccc124.tar.gz clic-2909f50d008920568f0e50da760b266388ccc124.tar.bz2 clic-2909f50d008920568f0e50da760b266388ccc124.tar.xz clic-2909f50d008920568f0e50da760b266388ccc124.zip |
There is now a parser & calculator interface.
Diffstat (limited to 'src/token.h')
-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 | ||