I'm looking at the definition of the mx:Script tag. It seems to differ from the way other tags are supported. For one, the < and > characters do not include the meta.tag label and are thus not properly colored. Also - and of less importance (to me) - the punctuation.definition.tag.(m)xml label is missing from the bracket and slash characters.
The way I dealt with this was to match the script tags with a look behind and look ahead. Both are zero-width, and thus don't actually include the script tags themselves in the match, leaving the standard tag matching to do the job.
{ begin = '(?<=mx:Script)'; end = '(?=</mx:Script>)'; patterns = ( { include = '#script-stuff'; } ); }
I then let #script-stuff handle the parsing of internal stuff:
script-stuff = { begin = '<![CDATA['; end = ']]>'; beginCaptures = { 0 = { name = 'string.unquoted.cdata.xml.mxml punctuation.definition.string.begin.xml.mxml'; }; }; endCaptures = { 0 = { name = 'string.unquoted.cdata.xml.mxml punctuation.definition.string.end.xml.mxml'; }; }; patterns = ( { include = 'source.actionscript3'; } ); contentName = 'source.actionscript3.embeded.mxml'; };
This defines the CDATA tags properly and gives everything else the scope of "source.actionscript3.embeded.mxml".
For this to work, though, you need to move the including of text.xml down on the grammar so that it doesn't match the CDATA first.