'*******************************************************************************
' EverEdit Syntax File
' Language:    XML
' Maintainer:  www.everedit.net  
' History:
'   2012/02/15 First Version
'   2014/08/28 Improved XML tag match
'*******************************************************************************
Helper.Include( ".\const.mac" )

Set xml=Parser.CreateParser()
xml.Name="source.xml"
'comment
Set rXmlBlockComment=xml.CreateRegion( COLOR_COMMENT1, "+<!--+", "+-->+", False )
'<>tags
Set rXmlTag=xml.CreateRegion( COLOR_TAG, "<[^>\s/]+|</[^>\s]+", "/?>", False )
'string in tag
Set rXmlString2	=xml.CreateStringRegion( COLOR_STRING2, """", "", True )
Set rXmlString1	=xml.CreateStringRegion( COLOR_STRING1, "'", "", True )
rXmlTag.AddRegion( rXmlString2 )
rXmlTag.AddRegion( rXmlString1 )

Set rXmlTitle=xml.CreateRegion(COLOR_COMMENT2, "+<!+", "+>+", False)
Set rXmlDocType=xml.CreateRegion(COLOR_COMMENT2, "+<?+", "+?>+", False)
Set rXmlCData=xml.CreateRegion(COLOR_COMMENT2, "+<![CDATA[+", "+]]>+", False)

'word in tag
rXmlTag.AddItem( xml.CreateItem(COLOR_WORD2, "\b[\w\-]+\s*=", False) )

xml.AddRegion( rXmlCData )
xml.AddRegion( rXmlBlockComment )
xml.AddRegion( rXmlTitle )
xml.AddRegion( rXmlDocType )
xml.AddRegion( rXmlTag )

xml.SetPairs( "<>[]{}()""""''" )
xml.CommentBlock "<!--", "-->"
xml.FoldText "<[\w\-_]+.*?(?<!/)>", False
xml.UnfoldText "</[\w\-_]+>", False
