token.go
322 bytes
1package rpn
2
3type TokenType int
4
5const (
6 number TokenType = iota
7 binaryOp
8 unaryOp
9 dec
10 bin
11 hex
12 pop
13 swap
14 clr
15 help
16 exit
17)
18
19type Operator int
20
21const (
22 plus Operator = iota
23 minus
24 multiply
25 divide
26 mod
27 power
28 sqrt
29)
30
31type Token struct {
32 Type TokenType
33 Operator Operator
34 Value float64
35 Original string
36}