@@ -83,7 +83,6 @@ var xml_grammar = {
83
83
" Extra" : {
84
84
85
85
" fold" : " xml"
86
- // "match" : "xml"
87
86
// "electricChars" : "<"
88
87
89
88
},
@@ -113,33 +112,34 @@ var xml_grammar = {
113
112
," doctype:block" : [" RE::/<!doctype\\ b/i" , " >" ]
114
113
," meta:block" : [" RE::/<\\ ?[_a-zA-Z][\\ w\\ ._\\ -]*/" , " ?>" ]
115
114
," cdata:block" : [" <![CDATA[" , " ]]>" ]
116
- ," open_tag" : " RE::/<([_a-zA-Z][_a-zA-Z0-9\\ -]*) /"
117
- ," close_tag" : " RE::/<\\ /([_a-zA-Z][_a-zA-Z0-9\\ -]*)>/"
115
+ ," open_tag" : " RE::/<((?: [_a-zA-Z][_a-zA-Z0-9\\ -]*:)?[_a-zA-Z][_a-zA-Z0-9 \\ -]*) \\ b /"
116
+ ," close_tag" : " RE::/<\\ /((?:[_a-zA-Z][_a-zA-Z0-9 \\ -]*:)? [_a-zA-Z][_a-zA-Z0-9\\ -]*)>/"
118
117
," attribute" : " RE::/[_a-zA-Z][_a-zA-Z0-9\\ -]*/"
119
118
," string:line-block" : [[" \" " ], [" '" ]]
120
119
," number" : [" RE::/[0-9]\\ d*/" , " RE::/#[0-9a-fA-F]+/" ]
121
120
," atom" : [" RE::/&#x[a-fA-F\\ d]+;/" , " RE::/&#[\\ d]+;/" , " RE::/&[a-zA-Z][a-zA-Z0-9]*;/" ]
122
121
," text" : " RE::/[^<&]+/"
123
122
124
123
// actions
125
- ," tag_ctx:action" : {" context" : true }
126
- ," \\ tag_ctx:action" : {" context" : false }
127
- ," unique_id:action" : {" unique" : [" xml" , " $1" ]," msg" : " Duplicate id value \" $0\" " }
128
- ," unique_att:action" : {" unique" : [" tag" , " $0" ]," msg" : " Duplicate attribute \" $0\" " ," in-context" : true }
129
- ," tag_opened:action" : {" push" : " <$1>" ," ci" : true }
130
- ," tag_closed:action" : {" pop" : " <$1>" ," ci" : true ," msg" : " Tags \" $0\" and \" $1\" do not match" }
131
- ," tag_autoclosed:action" : {" pop" : null }
132
- ," out_of_place:error" : " \" $2$3\" can only be at the beginning of XML document"
124
+ ," @tag:action" : {" context" : true }
125
+ ," tag@:action" : {" context" : false }
126
+ ," @unique_id:action" : {" unique" : [" xml" , " $1" ]," msg" : " Duplicate id value \" $0\" " ," mode" : " hash" }
127
+ ," @unique_att:action" : {" unique" : [" att" , " $0" ]," msg" : " Duplicate attribute \" $0\" " ," mode" : " hash" ," in-context" : true }
128
+ ," @tag_opened:action" : {" push" : " <$1>" ," ci" : true }
129
+ ," @tag_closed:action" : {" pop" : " <$1>" ," ci" : true ," msg" : " Tags \" $0\" and \" $1\" do not match" }
130
+ ," @tag_autoclosed:action" : {" pop" : null }
131
+ ," @autocomplete:action" : {" define" : [" autocomplete" ," $1" ]," msg" : false ," autocomplete" : true ," mode" : " hash" }
132
+ ," @out_of_place:error" : " \" $2$3\" can only be at the beginning of XML document"
133
133
134
134
},
135
135
136
136
// Syntax model (optional)
137
137
" Syntax" : {
138
138
139
- " tag_att" : " 'id'.attribute unique_att '=' string unique_id | attribute unique_att '=' (string | number)"
140
- ," start_tag" : " open_tag.tag tag_ctx tag_opened tag_att* ('>'.tag | '/>'.tag tag_autoclosed) \\ tag_ctx "
141
- ," end_tag" : " close_tag.tag tag_closed"
142
- ," xml" : " (^^1 declaration? doctype?) (declaration.error out_of_place | doctype.error out_of_place | comment | meta | cdata | start_tag | end_tag | atom | text)*"
139
+ " tag_att" : " 'id'.attribute @ unique_att '=' string @ unique_id | attribute @ unique_att '=' (string | number)"
140
+ ," start_tag" : " open_tag.tag @tag @autocomplete @ tag_opened tag_att* ('>'.tag | '/>'.tag @ tag_autoclosed) tag@ "
141
+ ," end_tag" : " close_tag.tag @autocomplete @ tag_closed"
142
+ ," xml" : " (^^1 declaration? doctype?) (declaration.error @ out_of_place | doctype.error @ out_of_place | comment | meta | cdata | start_tag | end_tag | atom | text)*"
143
143
144
144
},
145
145
@@ -210,6 +210,7 @@ Result:
210
210
211
211
![ xml-grammar-1] ( /test/grammar-xml.png )
212
212
![ xml-grammar-2] ( /test/grammar-xml-2.png )
213
+ ![ xml-grammar-2] ( /test/grammar-xml-3.png )
213
214
214
215
215
216
0 commit comments