//Language: XML


// tokens
Token=tnone
Token=tXMLcomment
Token=tXMLident
Token=tXMLinteger
Token=tXMLfloat
Token=tXMLresword
Token=tXMLattrname
Token=tXMLattrvalue
Token=tXMLcdata
Token=tXMLdoctype
Token=tXMLinstr
Token=tXMLsymbol
Token=turl
Token=twhitespace


// states
State=snormal
State=sXMLstring
State=sXMLcomment
State=sXMLcdata
State=sXMLtag
State=sXSLtag
State=sXMLtagname
State=sXMLdoctype1
State=sXMLdoctype2
State=sXMLinstr

//delims
Delimiters=;.,:'"<>{}[]()?!@#$%^&*+=|\/

// This is the tag
//------------------------------------------------------------------------------

//Common
snormal <                                 sXMLtagname  tXMLsymbol
sXMLtagname [a-z_A-Z][a-z_A-Z0-9\-\:]*    sXMLtag      tXMLident
sXMLtagname :                             sXMLtagname  tXMLsymbol
sXMLtag  [^\>^\'^\"^#32^\=]*              sXMLtag      tXMLattrname
sXMLtagname /                             sXMLtagname  tXMLsymbol
sXMLtag [\/=]                             sXMLtag      tXMLsymbol
sXMLtagname >                             snormal      tXMLsymbol
sXMLtag >                                 snormal      tXMLsymbol

sXSLtag [a-z_A-Z0-9\-]*                   sXMLtag      tXMLident
sXSLtag :                                 sXSLtag      tXMLsymbol
sXSLtag >                                 snormal      tXMLsymbol

// reswords
sXMLtagname 'fo'                sXMLtag      tXMLresword
sXMLtagname 'xsl'               sXSLtag      tXMLresword

sXSLtag 'apply-imports'        	sXMLtag      tXMLresword
sXSLtag 'apply-templates'      	sXMLtag      tXMLresword
sXSLtag 'attribute'            	sXMLtag      tXMLresword
sXSLtag 'attribute-set'        	sXMLtag      tXMLresword
sXSLtag 'call-template'        	sXMLtag      tXMLresword
sXSLtag 'choose'               	sXMLtag      tXMLresword
sXSLtag 'comment'              	sXMLtag      tXMLresword
sXSLtag 'copy'                 	sXMLtag      tXMLresword
sXSLtag 'copy-of'              	sXMLtag      tXMLresword
sXSLtag 'decimal-format'       	sXMLtag      tXMLresword
sXSLtag 'element'              	sXMLtag      tXMLresword
sXSLtag 'fallback'             	sXMLtag      tXMLresword
sXSLtag 'for-each'             	sXMLtag      tXMLresword
sXSLtag 'if'                   	sXMLtag      tXMLresword
sXSLtag 'import'               	sXMLtag      tXMLresword
sXSLtag 'include'              	sXMLtag      tXMLresword
sXSLtag 'key'                  	sXMLtag      tXMLresword
sXSLtag 'message'              	sXMLtag      tXMLresword
sXSLtag 'namespace-alias'      	sXMLtag      tXMLresword
sXSLtag 'number'               	sXMLtag      tXMLresword
sXSLtag 'otherwise'            	sXMLtag      tXMLresword
sXSLtag 'output'               	sXMLtag      tXMLresword
sXSLtag 'param'                	sXMLtag      tXMLresword
sXSLtag 'preserve-space'       	sXMLtag      tXMLresword
sXSLtag 'processing-instruction'  sXMLtag      tXMLresword
sXSLtag 'sort'                 	sXMLtag      tXMLresword
sXSLtag 'strip-space'          	sXMLtag      tXMLresword
sXSLtag 'stylesheet'           	sXMLtag      tXMLresword
sXSLtag 'template'             	sXMLtag      tXMLresword
sXSLtag 'text'                 	sXMLtag      tXMLresword
sXSLtag 'transform'            	sXMLtag      tXMLresword
sXSLtag 'value-of'             	sXMLtag      tXMLresword
sXSLtag 'variable'             	sXMLtag      tXMLresword
sXSLtag 'when'                 	sXMLtag      tXMLresword
sXSLtag 'with-param'           	sXMLtag      tXMLresword

// numbers
sXMLstring [0-9][0-9]*                            sXMLstring  tXMLinteger
sXMLstring [1-9][0-9]*\.[0-9]*                    sXMLstring  tXMLfloat
sXMLstring [1-9][0-9]*{\.[0-9]+}|e{[\+\-]}|[0-9]+ sXMLstring  tXMLfloat

//white space
sXMLtag #32*                    sXMLtag      twhitespace

//strings
sXMLtag    \"                  sXMLstring   tXMLsymbol
sXMLstring   [^\"]*            sXMLstring   tXMLattrvalue
sXMLstring   \"                sXMLtag      tXMLsymbol
sXMLstring   \"\"              sXMLstring   tXMLattrvalue
sXMLstring   $                 sXMLtag      tXMLattrvalue

//comments
snormal   <\!--                sXMLcomment  tXMLcomment
sXMLcomment -                  sXMLcomment  tXMLcomment
sXMLcomment  -->               snormal      tXMLcomment
sXMLcomment [^\-]*             sXMLcomment  tXMLcomment

//------------------------------------------------------------------------------
// This is the CDATA

//idents
sXMLcdata   [^\]]                      sXMLcdata   tXMLcdata
sXMLcdata   [\]]*[^>]                  sXMLcdata   tXMLcdata

//CDATA
snormal        <\!\[CDATA\[            sXMLcdata   tXMLcdata
sXMLcdata      \]\]>                   snormal     tXMLcdata

//------------------------------------------------------------------------------
// This is the DOCTYPE

//idents
sXMLdoctype1   [^\>^\[]*               sXMLdoctype1   tXMLdoctype
sXMLdoctype2   [^\]]*                  sXMLdoctype2   tXMLdoctype


// DOCTYPE
snormal         <\!DOCTYPE             sXMLdoctype1   tXMLdoctype
sXMLdoctype1    >                      snormal        tXMLdoctype
sXMLdoctype1    \[                     sXMLdoctype2   tXMLdoctype
sXMLdoctype2    \]                     sXMLdoctype1   tXMLdoctype

//------------------------------------------------------------------------------
// This is the ?

//idents
sXMLinstr   [^\?]*               sXMLinstr   tXMLinstr
sXMLinstr   \?[^\>]*             sXMLinstr   tXMLinstr

//?
snormal      <\?                 sXMLinstr   tXMLinstr
sXMLinstr    \?>                 snormal     tXMLinstr
 
 
