-
Notifications
You must be signed in to change notification settings - Fork 7
/
diceroll.grammar
68 lines (60 loc) · 2.76 KB
/
diceroll.grammar
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
command: flaggeddice;
/* Special commands that don't combine with regular dice rolls */
command: "cheat" {rollmode};
command: "eyes" {rollmode};
command: "test" {testroll};
command: "test" " " "digits" {testroll};
command: "test" " " "digits" " " "digits" {testroll};
command: "eval" " " words {rollmode};
command: stats;
command: "alias" {rollalias};
command: "alias" " " "word" {rollalias};
command: "alias" " " "word" " " multidice {rollalias};
command: "unalias" " " "word" {rollalias};
/* "roll stats" variants */
stats: "stats" {defaultstats};
stats: "stats" " " statsroll " " statsroll "d" "digits" {stats};
statsroll: "digits" {firstlast};
statsroll: "digits" "/" "digits" {firstlast};
/* Stackable flags */
flaggeddice: rollable;
flaggeddice: "quiet" " " flaggeddice {addflag};
flaggeddice: "shield" " " flaggeddice {addflag};
flaggeddice: "as" " " "word" " " flaggeddice {addflagval};
flaggeddice: "cheat" " " flaggeddice {addflag};
flaggeddice: "uncheat" " " flaggeddice {addflag};
flaggeddice: "b" "digits" " " flaggeddice {addflagval_compact};
rollable: multidice;
rollable: "table" {rollmode}; /* List available tables */
rollable: "table" " " words {rollmode}; /* eg "roll table medium magic" */
rollable: "note" {rollmode}; /* roll off the first note in your inventory */
rollable: "note" " " "digits" {rollmode}; /* eg "roll note 2" */
rollable: "note" " " words {rollmode}; /* eg "roll note wondrousitem" */
/* Note that there's one form that isn't acceptable: "roll init d20". This */
/* form would make no sense, or would be ambiguous, depending on point of view. */
multidice: shorttag {tagonly}; /* "roll init" or "roll (init)"; also "roll (search) + 2" */
multidice: tag dice {taggeddice}; /* "roll (Goblin init) d20" */
multidice: tag dice " " shorttag {taggeddice_with_tag}; /* "roll (Goblin init) d20" */
multidice: tag " " "word" {taggedcharsheet}; /* "roll (where aaaaaare you) search" */
multidice: dice {no_tag}; /* "roll d20" */
multidice: dice " " shorttag {no_tag_with_tag}; /* "roll d20 Foo" */
multidice: multidice sign dice {plusroll}; /* After any of the above forms, further dice can be added */
multidice: multidice sign dice " " shorttag {plusroll}; /* With or without a tag */
multidice: multidice sign "word" {pluscharsheet}; /* Charsheet entries can have implicit dice */
multidice: multidice sign " " "word" {pluscharsheet};
dice1: "digits" "d" "digits" "/" "digits" {NdTM};
dice1: "digits" "d" "digits" {NdM};
dice1: "digits" "d" {NdM};
dice1: "d" "digits" {dM};
dice1: "digits" {N};
dice1: "take" "digits" {takeN};
dice: dice1;
dice: " " dice1 {take2};
sign: "+";
sign: "-";
words: "word";
words: words " " "word" {joinwords};
tag: "(" words ")" {take2};
/* In some contexts, you can omit the parens on a tag if it's a single word. */
shorttag: "word";
shorttag: tag;