1 using System;
2
3 namespace Calculator
4 {
5 public abstract class Token
6 {
7 }
8
9 public class PrintToken : Token
10 {
11 }
12
13 public class NumberToken : Token
14 {
15 public nothrow NumberToken(double value_) : value(value_)
16 {
17 }
18 public inline nothrow double Value() const
19 {
20 return value;
21 }
22 private double value;
23 }
24
25 public class VariableNameToken : Token
26 {
27 public nothrow VariableNameToken(const ustring& variableName_) : variableName(variableName_)
28 {
29 }
30 public inline nothrow const ustring& VariableName() const
31 {
32 return variableName;
33 }
34 private ustring variableName;
35 }
36
37 public class OperatorToken : Token
38 {
39 public nothrow OperatorToken(uchar operatorChar_) : operatorChar(operatorChar_)
40 {
41 }
42 public inline nothrow uchar Char() const
43 {
44 return operatorChar;
45 }
46 public inline nothrow bool IsAdditiveOperator() const
47 {
48 return operatorChar == '+' || operatorChar == '-';
49 }
50 public inline nothrow bool IsMultiplicativeOperator() const
51 {
52 return operatorChar == '*' || operatorChar == '/';
53 }
54 private uchar operatorChar;
55 }
56
57 public class EndToken : Token
58 {
59 }
60 }