-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsyntax.bnf
78 lines (40 loc) · 2.59 KB
/
syntax.bnf
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
Document ::= FirstSection Section*
FirstSection ::= SectionContent
Section ::= Heading SectionContent
SectionContent ::= ( BlankLine | !StarterLine FeedbackLine )* ( ChoiceBlock | InstructionBlock | TextBlock )+
BlankLine ::= QuoteMarker? LineWhitespace? Newline
ChoiceBlock ::= FirstChoice ( BlankLine | Choice | !StarterLine FeedbackLine )*
InstructionBlock ::= FirstInstructionLine ( BlankLine | InstructionLine | !StarterLine FeedbackLine )*
TextBlock ::= FirstTextLine ( BlankLine | TextLine | !StarterLine FeedbackLine )*
StarterLine ::= FirstTextLine | FirstInstructionLine | Heading | FirstChoice
QuoteMarker ::= ( ( ' ' | '\t' )* '>' )+ ( ' ' | '\t' )*
LineWhitespace ::= ( ' ' | '\t' )+
Newline ::= '\r' '\n'? | '\n'
Choice ::= QuoteMarker? TextLineMarker LineWhitespace? ChoiceMarker ChoiceContent
FirstChoice ::= QuoteMarker? FirstTextLineMarker LineWhitespace? ChoiceMarker ChoiceContent
ChoiceContent ::= LineWhitespace? ChoiceDescription ChoiceResponse? LineWhitespace? Newline
ChoiceMarker ::= '[' LineWhitespace? ChoiceMarkerMark? ']'
ChoiceMarkerMark ::= ( '\x20-\x5C' | '\x5E-\x7E' | '\t' )+
ChoiceDescription ::= ChoiceDescPart ( ChoiceDescNewline ChoiceDescPart )*
ChoiceDescNewline ::= Newline ( BlankLine | !( StarterLine | TextLine ) FeedbackLine )*
QuoteMarker? TextLineMarker LineWhitespace? !ChoiceMarker
ChoiceDescPart ::= ( '\x20-\x2C' | '\x2E-\x7E' | '\t' | '-' !'-' )+
ChoiceResponse ::= ChoiceDescNewline? '-' '-' ( ChoiceDescNewline? ChoiceResponseDesc ChoiceGoto? | ChoiceGoto )
ChoiceResponseDesc ::= ChoiceResponseDescPart ( ChoiceDescNewLine ChoiceResponseDescPart )*
ChoiceResponseDescPart ::= ( '\x20-\x46' | '\x48-\x7E' | 'G' !( 'O' ' ' 'T' 'O') )
ChoiceGoto ::= ChoiceDescNewLin? 'G' 'O' ' ' 'T' 'O' LineWhitespace? Name EndPunctuation?
EndPunctuation ::= ( '.' | ',' | ':' | ';' | '!' | '?' )+
Heading ::= QuoteMarker? HeadingMarker LineWhitespace? Name HeadingMarker Newline
HeadingMarker ::= '=' '='+
Name ::= ( 'a-z' | 'A-Z' | '0-9' | '_' | '-' ) ( 'a-z' | 'A-Z' | '0-9' | '_' | '-' | ' ' )*
InstructionLine ::= QuoteMarker? InstructionLineMarker TextLineContent
InstructionLineMarker ::= '%' !'%'
FirstInstructionLine ::= QuoteMarker? FirstInstructionLineMarker TextLineContent
FirstInstructionLineMarker ::= '%' '%'
LineText ::= ( '\x20-\x7E' | '\t' )+
TextLine ::= QuoteMarker? TextLineMarker TextLineContent
TextLineMarker ::= ':' !':'
FirstTextLine ::= QuoteMarker? FirstTextLineMarker TextLineContent
FirstTextLineMarker ::= ':' ':'
TextLineContent ::= LineWhitespace? LineText Newline
FeedbackLine ::= QuoteMarker? LineText Newline