@@ -83,7 +83,6 @@ var xml_grammar = {
8383" Extra" : {
8484
8585 " fold" : " xml"
86- // "match" : "xml"
8786 // "electricChars" : "<"
8887
8988},
@@ -113,33 +112,34 @@ var xml_grammar = {
113112 ," doctype:block" : [" RE::/<!doctype\\ b/i" , " >" ]
114113 ," meta:block" : [" RE::/<\\ ?[_a-zA-Z][\\ w\\ ._\\ -]*/" , " ?>" ]
115114 ," 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\\ -]*)>/"
118117 ," attribute" : " RE::/[_a-zA-Z][_a-zA-Z0-9\\ -]*/"
119118 ," string:line-block" : [[" \" " ], [" '" ]]
120119 ," number" : [" RE::/[0-9]\\ d*/" , " RE::/#[0-9a-fA-F]+/" ]
121120 ," atom" : [" RE::/&#x[a-fA-F\\ d]+;/" , " RE::/&#[\\ d]+;/" , " RE::/&[a-zA-Z][a-zA-Z0-9]*;/" ]
122121 ," text" : " RE::/[^<&]+/"
123122
124123 // 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"
133133
134134},
135135
136136// Syntax model (optional)
137137" Syntax" : {
138138
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)*"
143143
144144},
145145
@@ -210,6 +210,7 @@ Result:
210210
211211![ xml-grammar-1] ( /test/grammar-xml.png )
212212![ xml-grammar-2] ( /test/grammar-xml-2.png )
213+ ![ xml-grammar-2] ( /test/grammar-xml-3.png )
213214
214215
215216
0 commit comments