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
spells = _{ (spell ~ newline?)* }
spell = { invoke_word ~ whitespace ~ spell_type_params ~ type_execution_bridge ~ executable_params_many}
invoke_word = { "cast" | "invoke" }
spell_type_params = { (modifiers ~ whitespace)? ~ spell_type }
spell_type = { "rune" | "projectile" | "touch" | "self" }
type_execution_bridge = { whitespace ~ "to" ~ whitespace }
modifiers = { (modifier ~ modifier_separator)* ~ modifier }
modifier_separator = { whitespace ~ "and" ~ whitespace }
modifier = _{ adjective | condition | repetition | duration }
adjective = { "flaming" | "swift" | "powerful" | "frozen" }
condition = { "if" ~ whitespace ~ condition_name }
condition_name = { "is burning" | "is moving" }
repetition = { number ~ whitespace ~ "of times" }
duration = { "for" ~ whitespace ~ number ~ whitespace? ~ "s" }
executable_params_many = _{ (executable_params ~ executable_separator)* ~ executable_params }
executable_separator = { whitespace ~ "also" ~ whitespace }
executable_params = { (modifiers ~ whitespace)? ~ executable }
executable = { ignite | apply | pull | push | explode }
ignite = { ignite_word }
ignite_word = { "ignite" }
apply = { apply_word ~ whitespace ~ effect }
apply_word = { "apply" }
pull = { pull_word }
pull_word = { "pull" }
push = { push_word }
push_word = { "push" }
explode = { explode_word }
explode_word = { "explode" }
effect = { "damage" | "heal" }
number = @{ ('0'..'9')+ }
whitespace = _{ " " | "\t" }
newline = _{ "\n" | "\r\n" }