-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrammar
57 lines (29 loc) · 1.28 KB
/
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
S => ∅ | Statement '\n' S
Statement => CategoryDef | Rule
CategoryDef => CategoryName '=' CategoryElements
CategoryName => Ident
Ident => IdentToken | IdentToken Ident
IdentToken => <terminal>
CategoryElements => ∅ | CategoryElement ' ' CategoryElements
CategoryElement => '0' | String
String => ∅ | Token String | Category String
Token => <terminal>
Category => '{' CategoryName CategoryIndex '}'
CategoryIndex => ∅ | ':' Index
Index => Digit | Digit Index
Digit => '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
Rule => Match '>' Replace Environment
Match => '0' | Regex
Regex => RegexConcat | RegexConcat '|' Regex
RegexConcat => RegexRepeat | RegexRepeat RegexConcat
RegexRepeat => RegexToken RegexRepeater
RegexToken => '.' | '#' | Category | '(' Regex ')' | Token
RegexRepeater => ∅ | RegexRepeaterBase RegexRepeaterGreedy
RegexRepeaterBase => '?' | '*' | '+'
RegexRepeaterGreedy => ∅ | '?'
Replace => String
Environment => ∅ | '/' EnvironmentExpr
EnvironmentExpr => EnvironmentFactor | EnvironmentExpr '|' EnvironmentFactor
EnvironmentFactor => EnvironmentTerm | EnvironmentFactor '&' EnvironmentTerm
EnvironmentTerm => EnvironmentComponent '_' EnvironmentComponent | '!' EnvironmentTerm | '(' EnvironmentExpr ')'
EnvironmentComponent => ∅ | Regex