-
Notifications
You must be signed in to change notification settings - Fork 2
/
symbol.go
79 lines (69 loc) · 1.79 KB
/
symbol.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package spiker
// Symbol lexical symbol
type Symbol string
func (sym Symbol) String() string {
return string(sym)
}
// Supported symbol
const (
SymbolIdent Symbol = "(IDENT)"
SymbolNumber Symbol = "(NUMBER)"
SymbolString Symbol = "(STRING)"
SymbolEOF Symbol = "(EOF)"
SymbolTuple Symbol = "()"
SymbolArray Symbol = "[]"
SymbolMap Symbol = "{}"
SymbolPound Symbol = "#"
SymbolTrue Symbol = "true"
SymbolFalse Symbol = "false"
SymbolNone Symbol = "none"
SymbolIf Symbol = "if"
SymbolElse Symbol = "else"
SymbolReturn Symbol = "return"
SymbolContinue Symbol = "continue"
SymbolBreak Symbol = "break"
SymbolWhile Symbol = "while"
SymbolColon Symbol = ":"
SymbolSemicolon Symbol = ";"
SymbolLparen Symbol = "("
SymbolRparen Symbol = ")"
SymbolLbrack Symbol = "["
SymbolRbrack Symbol = "]"
SymbolLbrace Symbol = "{"
SymbolRbrace Symbol = "}"
SymbolComma Symbol = ","
SymbolFuncDeclare Symbol = "->"
// mathematical
SymbolAdd Symbol = "+"
SymbolSub Symbol = "-"
SymbolMul Symbol = "*"
SymbolDiv Symbol = "/"
SymbolMod Symbol = "%"
SymbolPow Symbol = "**"
SymbolIn Symbol = "in"
// bit arithmetic
SymbolAnd Symbol = "&"
SymbolOr Symbol = "|"
SymbolXor Symbol = "^"
SymbolNot Symbol = "~"
SymbolSHL Symbol = "<<"
SymbolSHR Symbol = ">>"
// logic
SymbolLogicNot Symbol = "!"
SymbolLogicAnd Symbol = "&&"
SymbolLogicOr Symbol = "||"
// assignment
SymbolAssign Symbol = "="
SymbolAssignAdd Symbol = "+="
SymbolAssignSub Symbol = "-="
SymbolAssignMul Symbol = "*="
SymbolAssignDiv Symbol = "/="
SymbolAssignMod Symbol = "%="
// comparison
SymbolEQL Symbol = "=="
SymbolNEQ Symbol = "!="
SymbolGTR Symbol = ">"
SymbolGTE Symbol = ">="
SymbolLSS Symbol = "<"
SymbolLTE Symbol = "<="
)