-
Notifications
You must be signed in to change notification settings - Fork 34
/
grammar.py
99 lines (83 loc) · 1.9 KB
/
grammar.py
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
grammar = r"""
start: (item ";")+
item: import | coords | playlist | step
import : "import" string
coords : "coords" coords_body
coords_body : "{" coord_def ("," coord_def)* "}"
coord_def: string ":" "{" coord_body ("," coord_body)* "}"
coord_body: string ":" "[" int "," int "]"
playlist : "playlist" string playlist_body
playlist_body : "{" (step ";")* "}"
step : screen
| repeat
| play
| active
| focus
| delay
| sleep
| shell
| coord_off
| coord
| mouse
| drag
| click
| btnclick
| btndown
| btnup
| scroll
| hscroll
| keypress
| keydown
| keyup
| hotkeys
| write
| copy
| paste
| save_clipboard
| load_clipboard
| copy_clipboard
| paste_clipboard
screen: "screen" string
repeat: "play" string+ int | "play" string+ number
play: "play" string+
active: "active" string
focus: "focus" string
delay: "delay" number
sleep: "sleep" number
shell: ("shell"|"sh") string+
coord_off: ("coord"|"mc") string number number number
coord: ("coord"|"mc") string number
mouse: ("mouse"|"mv"|"mm") number number number
drag: ("drag"|"md") string number number number
click: "click"
btnclick: ("btnclick"|"bc") string
btndown: ("btndown"|"bd") string
btnup: ("btnup"|"bu") string
scroll: "scroll" number
hscroll: "hscroll" number
keypress: ("keypress"|"kp") string
keydown: ("keydown"|"kd") string
keyup: ("keyup"|"ku") string
hotkeys: ("hotkeys"|"hk") string+
write: ("write"|"w"|"type"|"t") string number?
copy: "copy"
paste: "paste"
save_clipboard: ("save_clipboard"|"scb") string
load_clipboard: ("load_clipboard"|"lcb") string
copy_clipboard: ("copy_clipboard"|"ccb") string
paste_clipboard: ("paste_clipboard"|"pcb") string
int: INT
number: SIGNED_NUMBER
string: ESCAPED_STRING
COMMENT: /#[^\n]*/
IDENT: (LETTER|"_") (LETTER|INT|"-"|"_")*
NAME: LETTER (LETTER|INT|"-"|"_")*
WORD: LETTER+
%import common.LETTER
%import common.ESCAPED_STRING
%import common.INT
%import common.SIGNED_NUMBER
%import common.WS
%ignore COMMENT
%ignore WS
"""