-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlouis.bnf
184 lines (162 loc) · 8.48 KB
/
louis.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
table ::= ((comment | rule_with_comment | empty_line) <newline>)*;
comment ::= sp_maybe <"#"> not_newline;
end_comment ::= sp not_newline;
<not_newline> ::= #'[^\n]*';
<empty_line> ::= sp_maybe;
<rule_with_comment> ::= sp_maybe rule (end_comment | sp_maybe);
<rule> ::= (* Miscellaneous Opcodes *)
include | undefined | display | multind |
(* Character-Definition Opcodes *)
space | punctuation | digit | uplow | grouping | letter | lowercase | uppercase | litdigit | sign | math |
(* Braille Indicator Opcodes *)
capsletter | begcapsword | endcapsword | capsmodechars | begcaps | endcaps | begcapsphrase | endcapsphrase |
lencapsphrase | letsign | noletsign | noletsignbefore | noletsignafter | nocontractsign | numsign | numericnocontchars |
numericmodechars | midendnumericmodechars |
seqdelimiter | seqbeforechars | seqafterchars | seqafterpattern | seqafterexpression |
(* Emphasis Opcodes *)
class | (* FIXME: doesnt seem to be documented *)
emphclass | noemphchars | emphletter | begemphword | endemphword | emphmodechars | begemphphrase | endemphphrase |
lenemphphrase | begemph | endemph |
(* Special Symbol Opcodes *)
decpoint | hyphen |
(* Special Processing Opcodes *)
capsnocont |
(* Translation Opcodes *)
compbrl | comp6 | nocont | replace | always | repeated | repword | rependword | largesign | word | syllable | joinword |
lowword | contraction | sufword | prfword | begword | begmidword | midword | midendword | endword | partword |
prepunc | postpunc | begnum | midnum | endnum | joinnum |
(* Computer braille *)
begcomp | endcomp |
(* Character-Class Opcodes *)
attribute |
(* Swap Opcodes *)
swapcd | swapdd | swapcc |
(* Context and Multipass Opcodes *)
context | pass2 | pass3 | pass4 |
(* correct Opcode *)
correct |
(* match Opcode *)
match |
literal;
include ::= <"include"> sp file_name;
undefined ::= <"undefined"> sp dots_with_zero;
display ::= prefix? <"display"> sp chars sp dots_with_zero; (* FIXME: Why does display need a nofor prefix? *)
multind ::= prefix? <"multind"> sp dots sp chars;
space ::= prefix? <"space"> sp chars sp dots_with_zero;
punctuation ::= prefix? <"punctuation"> sp chars sp dots_with_zero;
digit ::= <"digit"> sp chars sp dots;
uplow ::= prefix? <"uplow"> sp chars sp dots (<","> dots)?;
grouping ::= <"grouping"> sp chars sp chars sp dots <","> dots;
letter ::= prefix? <"letter"> sp chars sp dots_with_zero;
lowercase ::= prefix? <"lowercase"> sp char sp dots;
uppercase ::= prefix? <"uppercase"> sp char sp dots;
litdigit ::= <"litdigit"> sp char sp dots;
sign ::= prefix? <"sign"> sp char sp dots_with_zero;
math ::= prefix? <"math"> sp char sp dots_with_zero;
capsletter ::= prefix? <"capsletter"> sp dots;
begcapsword ::= prefix? <"begcapsword"> sp dots;
endcapsword ::= prefix? <"endcapsword"> sp dots;
capsmodechars ::= <"capsmodechars"> sp chars;
begcaps ::= <"begcaps"> sp dots;
endcaps ::= <"endcaps"> sp dots;
begcapsphrase ::= <"begcapsphrase"> sp dots;
endcapsphrase ::= <"endcapsphrase"> sp ("before" | "after") sp dots;
lencapsphrase ::= <"lencapsphrase"> sp ascii_digit;
letsign ::= <"letsign"> sp dots;
noletsign ::= <"noletsign"> sp chars;
noletsignbefore ::= <"noletsignbefore"> sp chars;
noletsignafter ::= <"noletsignafter"> sp chars;
nocontractsign ::= <"nocontractsign"> sp dots;
numsign ::= <"numsign"> sp dots;
numericnocontchars ::= <"numericnocontchars"> sp chars;
numericmodechars ::= <"numericmodechars"> sp chars;
midendnumericmodechars ::= <"midendnumericmodechars"> sp chars;
seqdelimiter ::= <"seqdelimiter"> sp chars;
seqbeforechars ::= <"seqbeforechars"> sp chars;
seqafterchars ::= <"seqafterchars"> sp chars;
seqafterpattern ::= <"seqafterpattern"> sp chars;
seqafterexpression ::= <"seqafterexpression"> sp chars;
class ::= <"class"> sp ascii_chars sp chars;
emphclass ::= <"emphclass"> sp ascii_chars;
begemph ::= prefix? <"begemph"> sp ascii_chars sp dots;
endemph ::= prefix? <"endemph"> sp ascii_chars sp dots;
noemphchars ::= <"noemphchars"> sp ascii_chars sp chars;
emphletter ::= <"emphletter"> sp ascii_chars sp dots;
begemphword ::= <"begemphword"> sp ascii_chars sp dots;
endemphword ::= <"endemphword"> sp ascii_chars sp dots;
emphmodechars ::= <"emphmodechars"> sp ascii_chars sp chars;
begemphphrase ::= <"begemphphrase"> sp ascii_chars sp dots_with_zero;
endemphphrase ::= <"endemphphrase"> sp ascii_chars sp ("before" | "after") sp dots_with_zero;
lenemphphrase ::= <"lenemphphrase"> sp ascii_chars sp ascii_digit;
decpoint ::= <"decpoint"> sp chars sp dots;
hyphen ::= prefix? <"hyphen"> sp chars sp dots; (* FIXME: Does hyphen really need a nofor prefix? *)
capsnocont ::= <"capsnocont">;
compbrl ::= prefix? <"compbrl"> sp chars;
comp6 ::= <"comp6"> sp chars sp dots;
nocont ::= <"nocont"> sp chars;
replace ::= <"replace"> sp chars (sp chars)?;
always ::= prefix? with_class? <"always"> sp chars sp dots_with_zero;
repeated ::= prefix? <"repeated"> sp chars sp dots_with_zero;
repword ::= <"repword"> sp chars sp dots;
rependword ::= <"rependword"> sp chars sp dots "," dots;
largesign ::= <"largesign"> sp chars sp dots;
word ::= prefix? with_class? "word" sp chars sp dots_with_zero;
syllable ::= <"syllable"> sp chars sp dots;
joinword ::= <"joinword"> sp chars sp dots;
lowword ::= prefix? <"lowword"> sp chars sp dots;
contraction ::= <"contraction"> sp chars;
sufword ::= prefix? with_class? <"sufword"> sp chars sp dots;
prfword ::= prefix? <"prfword"> sp chars sp dots;
begword ::= prefix? with_class? <"begword"> sp chars sp dots_with_zero;
begmidword ::= prefix? with_class? <"begmidword"> sp chars sp dots;
midword ::= prefix? with_class? <"midword"> sp chars sp dots_with_zero;
midendword ::= prefix? with_class? <"midendword"> sp chars sp dots;
endword ::= prefix? with_class? <"endword"> sp chars sp dots_with_zero;
partword ::= prefix? with_class? <"partword"> sp chars sp dots;
begcomp ::= prefix? <"begcomp"> sp dots;
endcomp ::= <"endcomp"> sp dots;
prepunc ::= prefix? <"prepunc"> sp chars sp dots;
postpunc ::= prefix? <"postpunc"> sp chars sp dots;
begnum ::= prefix? <"begnum"> sp chars sp dots_with_zero;
midnum ::= prefix? <"midnum"> sp chars sp dots_with_zero;
endnum ::= prefix? <"endnum"> sp chars sp dots_with_zero;
joinnum ::= prefix? <"joinnum"> sp chars sp dots;
attribute ::= <"attribute"> sp (ascii_chars | oct_digit ) sp chars;
swapcd ::= "swapcd" sp ascii_chars sp chars sp dots (<","> dots)*;
swapdd ::= "swapdd" sp ascii_chars sp dots (<","> dots)*;
swapcc ::= "swapcc" sp ascii_chars sp chars sp chars;
(* Context and Multipass Opcodes *)
context ::= prefix? <"context"> sp multipass_test sp multipass_action;
pass2 ::= prefix? <"pass2"> sp multipass_test sp multipass_action;
pass3 ::= prefix? <"pass3"> sp multipass_test sp multipass_action;
pass4 ::= prefix? <"pass4"> sp multipass_test sp multipass_action;
(* Correct Opcode *)
correct ::= prefix? <"correct"> sp multipass_test sp multipass_action;
multipass_test ::= chars;
multipass_action ::= chars;
(* Match Opcode *)
match ::= prefix? with_class? with_match? <"match"> sp pre_pattern sp chars sp post_pattern sp dots;
with_match ::= ("empmatchafter" | "empmatchbefore" |
"empmatchafter" sp "empmatchbefore" |
"empmatchbefore" sp "empmatchafter") sp;
pre_pattern ::= chars;
post_pattern ::= chars;
literal ::= <"literal"> sp chars;
prefix ::= ((("noback" | "nofor") (sp "nocross")?) | "nocross") sp;
with_class ::= (("before" | "after") sp ascii_chars sp)+;
<sp> ::= <(" " | "\t")+>;
<sp_maybe> ::= <(" " | "\t")*>;
newline ::= "\n" | "\r\n" | "\r"; (* see https://en.wikipedia.org/wiki/Newline *)
esc_seq ::= "\\\\" | "\\f" | "\\n" | "\\r" | "\\s" | "\\t" | "\\v" | "\\e";
chars ::= esc_seq | #'[^ \t\n]+';
ascii_chars ::= #'[a-zA-Z][a-zA-Z0-9]*';
char ::= esc_seq | #'[^ \t\n]' | hex_char;
hex_char ::= "\\x" #'[0-9a-fA-F]{4}';
<file_name> ::= #'[-a-zA-Z0-9._/]+'
dots ::= "=" | dot ( <"-"> dot)*;
dot ::= #'[1-9a-f]+'
dots_with_zero ::= "=" | dot_with_zero ( <"-"> dot_with_zero)*;
dot_with_zero ::= #'[0-9a-f]+';
oct_digit ::= #'[0-7]'
ascii_digit ::= #'[0-9]'
nonzero_digits ::= #'[1-9]+'