module Text.Highlighter.Lexers.Mxml (lexer) where
import qualified Text.Highlighter.Lexers.ActionScript3 as ActionScript3
import Text.Regex.PCRE.Light
import Text.Highlighter.Types

lexer :: Lexer
lexer = Lexer
    { lName = "\65\99\116\105\111\110\83\99\114\105\112\116\51"
    , lAliases = ["\109\120\109\108"]
    , lExtensions = ["\46\109\120\109\108"]
    , lMimetypes = []
    , lStart = root'
    , lFlags = [multiline, dotall]
    }

comment' :: TokenMatcher
comment' =
    [ tok "\91\94\45\93\43" (Arbitrary "\67\111\109\109\101\110\116")
    , tokNext "\45\45\62" (Arbitrary "\67\111\109\109\101\110\116") Pop
    , tok "\45" (Arbitrary "\67\111\109\109\101\110\116")
    ]

tag' :: TokenMatcher
tag' =
    [ tok "\92\115\43" (Arbitrary "\84\101\120\116")
    , tokNext "\91\97\45\122\65\45\90\48\45\57\95\46\58\45\93\43\92\115\42\61" (Arbitrary "\78\97\109\101" :. Arbitrary "\65\116\116\114\105\98\117\116\101") (GoTo attr')
    , tokNext "\47\63\92\115\42\62" (Arbitrary "\78\97\109\101" :. Arbitrary "\84\97\103") Pop
    ]

root' :: TokenMatcher
root' =
    [ tok "\91\94\60\38\93\43" (Arbitrary "\84\101\120\116")
    , tok "\38\92\83\42\63\59" (Arbitrary "\78\97\109\101" :. Arbitrary "\69\110\116\105\116\121")
    , tok "\40\92\60\92\33\92\91\67\68\65\84\65\92\91\41\40\46\42\63\41\40\92\93\92\93\92\62\41" (ByGroups [(Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103"), (Using ActionScript3.lexer), (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")])
    , tokNext "\60\33\45\45" (Arbitrary "\67\111\109\109\101\110\116") (GoTo comment')
    , tok "\60\92\63\46\42\63\92\63\62" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\80\114\101\112\114\111\99")
    , tok "\60\33\91\94\62\93\42\62" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\80\114\101\112\114\111\99")
    , tokNext "\60\92\115\42\91\97\45\122\65\45\90\48\45\57\58\46\95\45\93\43" (Arbitrary "\78\97\109\101" :. Arbitrary "\84\97\103") (GoTo tag')
    , tok "\60\92\115\42\47\92\115\42\91\97\45\122\65\45\90\48\45\57\58\46\95\45\93\43\92\115\42\62" (Arbitrary "\78\97\109\101" :. Arbitrary "\84\97\103")
    ]

attr' :: TokenMatcher
attr' =
    [ tok "\92\115\43" (Arbitrary "\84\101\120\116")
    , tokNext "\34\46\42\63\34" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Pop
    , tokNext "\39\46\42\63\39" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Pop
    , tokNext "\91\94\92\115\62\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Pop
    ]