-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtoken.go
112 lines (98 loc) · 2.84 KB
/
token.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
* Copyright (c) Cherri
*/
package main
type tokenType string
type token struct {
typeof tokenType
ident string
valueType tokenType
value any
}
var tokens []token
/* Keywords */
const (
Var tokenType = "variable"
Constant tokenType = "const"
If tokenType = "if"
Else tokenType = "else"
EndClosure tokenType = "endif"
Repeat tokenType = "repeat "
RepeatWithEach tokenType = "for "
In tokenType = "in"
Menu tokenType = "menu"
Item tokenType = "item"
Definition tokenType = "#define"
Import tokenType = "#import"
Question tokenType = "#question"
Include tokenType = "#include"
Action tokenType = "action"
Copy tokenType = "copy"
Paste tokenType = "paste"
)
/* Definitions */
const (
Name tokenType = "name"
Color tokenType = "color"
Glyph tokenType = "glyph"
Inputs tokenType = "inputs"
Outputs tokenType = "outputs"
From tokenType = "from"
Version tokenType = "version"
Mac tokenType = "mac"
NoInput tokenType = "noinput"
)
/* No Inputs */
const (
StopWith tokenType = "stopwith"
AskFor tokenType = "askfor"
GetClipboard tokenType = "getclipboard"
)
/* Types */
const (
String tokenType = "text"
RawString tokenType = "rawtext"
Integer tokenType = "number"
Float tokenType = "float"
Dict tokenType = "dictionary"
Arr tokenType = "array"
Bool tokenType = "bool"
Date tokenType = "date"
True tokenType = "true"
False tokenType = "false"
Nil tokenType = "nil"
Comment tokenType = "comment"
Expression tokenType = "expression"
Variable tokenType = "variable"
Conditional tokenType = "conditional"
VariableType tokenType = "var"
)
/* Operators */
const (
Set tokenType = "="
AddTo tokenType = "+="
SubFrom tokenType = "-="
MultiplyBy tokenType = "*="
DivideBy tokenType = "/="
Is tokenType = "==" // is
Not tokenType = "!=" // is not
Any tokenType = "value" // has any value
Empty tokenType = "!value" // does not have any value
Contains tokenType = "contains" // contains
DoesNotContain tokenType = "!contains" // does not contain
BeginsWith tokenType = "beginsWith" // begins with
EndsWith tokenType = "endsWith" // ends with
GreaterThan tokenType = ">"
GreaterOrEqual tokenType = ">="
LessThan tokenType = "<"
LessOrEqual tokenType = "<="
Between tokenType = "<>"
Plus tokenType = "+"
Minus tokenType = "-"
Multiply tokenType = "*"
Divide tokenType = "/"
Modulus tokenType = "%"
LeftBrace tokenType = "{"
RightBrace tokenType = "}"
Colon tokenType = ":"
)