File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,17 @@ function clumpStrings(vals) {
28
28
}
29
29
return ret
30
30
}
31
+
32
+ function convertAttr (attr , error ) {
33
+ const ret = {}
34
+ for (const {name , value , loc } of attr) {
35
+ if (ret[name]) {
36
+ error (` Duplicate attribute "${ name} "` , loc)
37
+ }
38
+ ret[name] = value
39
+ }
40
+ return ret
41
+ }
31
42
}}
32
43
{
33
44
const names = []
@@ -173,13 +184,14 @@ element
173
184
STag = '<' name :pushName attr :(S @ Attribute )* S ? '>' { return {
174
185
type: ' element' ,
175
186
name,
176
- attr,
187
+ attr: convertAttr (attr, error) ,
177
188
}}
178
189
179
190
Attribute = name :Name Eq value :AttValue { return {
180
191
type: ' attribute' ,
181
192
name,
182
193
value,
194
+ loc: location (),
183
195
}}
184
196
ETag = '</' popName S ? '>'
185
197
@@ -210,7 +222,7 @@ content = c1:CharData? children:((element / Reference / CDSect / PI / Comment) C
210
222
EmptyElemTag = '<' name :Name attr :(S @ Attribute )* S ? '/>' { return {
211
223
type: ' element' ,
212
224
name,
213
- attr,
225
+ attr: convertAttr (attr, error) ,
214
226
}}
215
227
216
228
// Elements in the DTD
You can’t perform that action at this time.
0 commit comments