comparison tests/agcl/parsifal/xml2.syn @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 // Document
2
3 // [1]
4 document $
5 -> prolog, element, Misc?...
6
7
8 // Character Range
9
10 // [2]
11 //Char = 0x9 + 0xA + 0x20..0xd7ff + 0xe000..0xfffd + 0x0000-0x10ffff
12 Char = 0x9 + 0xA + 0x20..0xff // 8 bit characters only pro tem
13
14
15 // White Space
16
17 // [3]
18 SpaceChar
19 -> 0x20 + 0x9 + 0xd + 0xa
20 S
21 -> SpaceChar...
22
23
24 // Names and Tokens
25
26 // [4]
27 NameChar = Letter + Digit + '.' + '-' + ':' + CombiningChar + Extender
28
29 // [5]
30 Name
31 -> Letter + '_' + ':', NameChar?...
32
33 // [6]
34 Names
35 -> Name, [S, Name]...
36
37 // [7]
38 Nmtoken
39 -> NameChar...
40
41 // [8]
42 Nmtokens
43 -> Nmtoken, [S, Nmtoken]...
44
45
46 // Literals
47
48 // [9]
49 EntityValue
50 -> '"', [~(eof + '%' + '&' + '"') | PEReference | Reference]..., '"'
51 -> '\'', [~(eof + '%' + '&' + '\'') | PEReference | Reference]..., '\''
52
53 // [10]
54 AttValue
55 -> '"', [~(eof + '%' + '&' + '"') | Reference]..., '"'
56 -> '\'', [~(eof + '%' + '&' + '\'') | Reference]..., '\''
57
58 // [11]
59 SystemLiteral
60 -> '"', ~(eof + '"')?..., '"'
61 -> '\'', ~(eof + '\'')?..., '\''
62
63 // [12]
64 PubidLiteral
65 -> '"', PubidChar?..., '"'
66 -> '\'', PubidChar?..., '\''
67
68 // [13]
69 PubidChar = 0x20 + 0xd + 0xa + 'a-z' + 'A-Z' + '0-9' +
70 '-' + '\'' + '(' + ')' + '+' + ',' + '.' +
71 '/' + ':' + '?' + ';' + '!' + '*' + '#' +
72 '@' + '$' + '_' + '%'
73
74
75 // Character Data
76
77 // [14]
78 CharData
79 -> ~(eof + '<' + '&')?...
80 // Note that use of keyword "]]>" will take care of CDATA problem
81
82
83 // Comments
84
85 // [15]
86 Comment
87 -> "<!--", Char?..., "--", '>'
88
89
90 // Processing Instructions
91
92 // [16]
93 PI
94 -> "<?", PITarget, [S, char?...], "?>"
95
96 // [17]
97 PITarget
98 -> Name // Name lookup mechanism should reject "xml"
99
100
101 // CDATA Sections
102
103 // [18]
104 CDSect
105 -> CDStart, CData, CDEnd
106
107 // [19]
108 CDStart
109 -> "<![CDATA["
110
111 // [20]
112 CData
113 -> Char?...
114 // Keyword recognition logic overrides character recognition
115
116 // [21]
117 -> "]]>"
118
119
120 // Prolog
121
122 // [22]
123 prolog
124 -> XMLDecl?, Misc?..., [doctypedecl, Misc?...]
125
126 // [23]
127 XMLDecl
128 // -> "<?xml", VersionInfo, EncodingDecl?, SDDecl?, S?, "?>"
129 -> "<?xml", VersionInfo, EncodingDecl?, [SDDecl, S? | S], "?>"
130
131 // [24]
132 VersionInfo
133 -> S, "version", Eq, {'\'', VersionNum, '\'' | '"', VersionNum, '"'}
134
135 // [25]
136 Eq
137 -> S?, '=', S?
138
139 // [26]
140 VersionNum
141 -> 'a-z' + 'A-Z' + '0-9' + '_' + '.' + ':' + '-'...
142
143 // [27]
144 Misc
145 // -> Comment | PI | S
146 -> Comment | PI | SpaceChar // Avoid double recursion
147
148
149 // Document Type Definition
150
151 // [28]
152 doctypedecl
153 // -> "<!DOCTYPE", S, Name, [S, ExternalID], S?, [ '[', [markupdecl | PEReference | S]..., ']', S?], '>'
154 // -> "<!DOCTYPE", S, Name, [S, ExternalID], S?, [ '[', [markupdecl | PEReference | SpaceChar]..., ']', S?], '>'
155 -> "<!DOCTYPE", S, Name, [S, [ExternalID, S?]], [ '[', [markupdecl | PEReference | SpaceChar]..., ']', S?], '>'
156
157 // [29]
158 markupdecl
159 -> elementdecl
160 -> AttlistDecl
161 -> EntityDecl
162 -> NotationDecl
163 -> PI
164 -> Comment
165
166
167 // External Subset
168
169 // [30]
170
171 extSubset
172 -> TextDecl?, extSubsetDecl
173
174 // [31]
175 extSubsetDecl
176 -> [markupdecl | conditionalSect | PEReference | SpaceChar]...
177
178
179 // Standalone Document Declaration
180
181 // [32]
182 SDDecl
183 -> S, "standalone", Eq, "'yes'" | "\"yes\"" | "'no'" | "\"no\""
184
185
186 // Language Identification
187
188 // [33]
189 Language Id
190 -> Langcode, ['-', Subcode]...
191
192 // [34]
193 Langcode
194 -> ISO639Code | IanaCode | UserCode
195
196 // [35]
197 ISO639Code
198 -> 'a-z' + 'A-Z' -('i' + 'I' + 'x' + 'X'), 'a-z' + 'A-Z'
199
200 // [36]
201 IanaCode
202 -> 'i' + 'I', '-', 'a-z' + 'A-Z'...
203
204 // [37]
205 UserCode
206 -> 'x' + 'X', '-', 'a-z' + 'A-Z'...
207
208 // [38]
209 Subcode
210 -> 'a-z' + 'A-Z'...
211
212
213 // Element
214
215 // [39]
216 element
217 -> EmptyElemTag | STag, content, ETag
218
219
220 // Start-Tags, End-Tags, and Empty-Element Tags
221
222 // Start-tag
223
224 // [40]
225 STag
226 -> '<', Name, [{S, Attribute}... | S], '>'
227
228 // [41]
229 Attribute
230 -> Name, Eq, AttValue
231
232 // End-tag
233
234 // [42]
235 ETag
236 -> "</", Name, S?, '>'
237
238 // Content of Elements
239
240 // [43]
241
242 content
243 -> [element | CharData | Reference | CDSect | PI | Comment]...
244