-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgrammar.txt
39 lines (29 loc) · 1.08 KB
/
grammar.txt
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
regexpTopLevel ::= '^' regexp '$'
| '^' regexp
| regexp '$'
| regexp
regexp ::= regexpNoUnion '|' regexp
| regexpNoUnion
regexpNoUnion ::= regexpNoConcat regexpNoUnion
| regexpNoConcat
| { empty }
regexpNoConcat ::= regexpBasic regexpOp
regexpOp ::= '*' regexpOp
| '+' regexpOp
| '?' regexpOp
| { empty }
regexpBasic ::= '[' charClass ']'
| singleChar
| singleEscapedChar
| '(' regexp ')'
charClass ::= '^' charRangesOrSingles
| charRangesOrSingles
charRangesOrSingles ::= singleChar charRangeOrSingles
| singleEscapedChar charRangeOrSingles
| charRange charRangeOrSingles
| singleChar
| singleEscapedChar
| charRange
charRange ::= singleChar '-' singleChar
singleChar ::= a, b, c, ..., A, B, C, ... 0, 1, 2, ..., !, @, #, ..., '.'
singleEscapedChar ::= '\' { s, S, \, (, ), {, }, [, ], ^, ., -, {space}, n, t }