module Text.Highlighter.Lexers.Haskell (lexer) where

import Text.Regex.PCRE.Light
import Text.Highlighter.Types

lexer :: Lexer
lexer = Lexer
    { lName = "\72\97\115\107\101\108\108"
    , lAliases = ["\104\97\115\107\101\108\108", "\104\115"]
    , lExtensions = ["\46\104\115"]
    , lMimetypes = ["\116\101\120\116\47\120\45\104\97\115\107\101\108\108"]
    , lStart = root'
    , lFlags = [multiline]
    }

comment' :: TokenMatcher
comment' =
    [ tok "\91\94\45\123\125\93\43" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\77\117\108\116\105\108\105\110\101")
    , tokNext "\123\45" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\77\117\108\116\105\108\105\110\101") Push
    , tokNext "\45\125" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\77\117\108\116\105\108\105\110\101") Pop
    , tok "\91\45\123\125\93" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\77\117\108\116\105\108\105\110\101")
    ]

funclist' :: TokenMatcher
funclist' =
    [ tok "\92\115\43" (Arbitrary "\84\101\120\116")
    , tok "\91\65\45\90\93\91\97\45\122\65\45\90\48\45\57\95\93\42" (Arbitrary "\75\101\121\119\111\114\100" :. Arbitrary "\84\121\112\101")
    , tok "\91\95\97\45\122\93\91\92\119\92\39\93\43" (Arbitrary "\78\97\109\101" :. Arbitrary "\70\117\110\99\116\105\111\110")
    , tok "\45\45\46\42\36" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\83\105\110\103\108\101")
    , tokNext "\123\45" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\77\117\108\116\105\108\105\110\101") (GoTo comment')
    , tok "\44" (Arbitrary "\80\117\110\99\116\117\97\116\105\111\110")
    , tok "\91\58\33\35\36\37\38\42\43\46\92\92\47\60\61\62\63\64\94\124\126\45\93\43" (Arbitrary "\79\112\101\114\97\116\111\114")
    , tokNext "\92\40" (Arbitrary "\80\117\110\99\116\117\97\116\105\111\110") (DoAll [(GoTo funclist'), (GoTo funclist')])
    , tokNext "\92\41" (Arbitrary "\80\117\110\99\116\117\97\116\105\111\110") (PopNum 2)
    ]

string' :: TokenMatcher
string' =
    [ tok "\91\94\92\92\34\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tokNext "\92\92" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103" :. Arbitrary "\69\115\99\97\112\101") (GoTo escape')
    , tokNext "\34" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Pop
    ]

import' :: TokenMatcher
import' =
    [ tok "\92\115\43" (Arbitrary "\84\101\120\116")
    , tokNext "\92\41" (Arbitrary "\80\117\110\99\116\117\97\116\105\111\110") Pop
    , tok "\113\117\97\108\105\102\105\101\100\92\98" (Arbitrary "\75\101\121\119\111\114\100")
    , tokNext "\40\91\65\45\90\93\91\97\45\122\65\45\90\48\45\57\95\46\93\42\41\40\92\115\43\41\40\97\115\41\40\92\115\43\41\40\91\65\45\90\93\91\97\45\122\65\45\90\48\45\57\95\46\93\42\41" (ByGroups [(Arbitrary "\78\97\109\101" :. Arbitrary "\78\97\109\101\115\112\97\99\101"), (Arbitrary "\84\101\120\116"), (Arbitrary "\75\101\121\119\111\114\100"), (Arbitrary "\84\101\120\116"), (Arbitrary "\78\97\109\101")]) Pop
    , tokNext "\40\91\65\45\90\93\91\97\45\122\65\45\90\48\45\57\95\46\93\42\41\40\92\115\43\41\40\104\105\100\105\110\103\41\40\92\115\43\41\40\92\40\41" (ByGroups [(Arbitrary "\78\97\109\101" :. Arbitrary "\78\97\109\101\115\112\97\99\101"), (Arbitrary "\84\101\120\116"), (Arbitrary "\75\101\121\119\111\114\100"), (Arbitrary "\84\101\120\116"), (Arbitrary "\80\117\110\99\116\117\97\116\105\111\110")]) (GoTo funclist')
    , tokNext "\40\91\65\45\90\93\91\97\45\122\65\45\90\48\45\57\95\46\93\42\41\40\92\115\43\41\40\92\40\41" (ByGroups [(Arbitrary "\78\97\109\101" :. Arbitrary "\78\97\109\101\115\112\97\99\101"), (Arbitrary "\84\101\120\116"), (Arbitrary "\80\117\110\99\116\117\97\116\105\111\110")]) (GoTo funclist')
    , tokNext "\91\97\45\122\65\45\90\48\45\57\95\46\93\43" (Arbitrary "\78\97\109\101" :. Arbitrary "\78\97\109\101\115\112\97\99\101") Pop
    ]

escape' :: TokenMatcher
escape' =
    [ tokNext "\91\97\98\102\110\114\116\118\34\92\39\38\92\92\93" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103" :. Arbitrary "\69\115\99\97\112\101") Pop
    , tokNext "\92\94\91\93\91\65\45\90\64\92\94\95\93" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103" :. Arbitrary "\69\115\99\97\112\101") Pop
    , tokNext "\78\85\76\124\83\79\72\124\91\83\69\93\84\88\124\69\79\84\124\69\78\81\124\65\67\75\124\66\69\76\124\66\83\124\72\84\124\76\70\124\86\84\124\70\70\124\67\82\124\83\91\79\73\93\124\68\76\69\124\68\67\91\49\45\52\93\124\78\65\75\124\83\89\78\124\69\84\66\124\67\65\78\124\69\77\124\83\85\66\124\69\83\67\124\91\70\71\82\85\93\83\124\83\80\124\68\69\76" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103" :. Arbitrary "\69\115\99\97\112\101") Pop
    , tokNext "\111\91\48\45\55\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103" :. Arbitrary "\69\115\99\97\112\101") Pop
    , tokNext "\120\91\92\100\97\45\102\65\45\70\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103" :. Arbitrary "\69\115\99\97\112\101") Pop
    , tokNext "\92\100\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103" :. Arbitrary "\69\115\99\97\112\101") Pop
    , tokNext "\92\115\43\92\92" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103" :. Arbitrary "\69\115\99\97\112\101") Pop
    ]

root' :: TokenMatcher
root' =
    [ tok "\92\115\43" (Arbitrary "\84\101\120\116")
    , tok "\45\45\40\63\33\91\33\35\36\37\38\42\43\46\47\60\61\62\63\64\92\94\124\95\126\93\41\46\42\63\36" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\83\105\110\103\108\101")
    , tokNext "\123\45" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\77\117\108\116\105\108\105\110\101") (GoTo comment')
    , tokNext "\92\98\105\109\112\111\114\116\92\98" (Arbitrary "\75\101\121\119\111\114\100" :. Arbitrary "\82\101\115\101\114\118\101\100") (GoTo import')
    , tokNext "\92\98\109\111\100\117\108\101\92\98" (Arbitrary "\75\101\121\119\111\114\100" :. Arbitrary "\82\101\115\101\114\118\101\100") (GoTo module')
    , tok "\92\98\101\114\114\111\114\92\98" (Arbitrary "\78\97\109\101" :. Arbitrary "\69\120\99\101\112\116\105\111\110")
    , tok "\92\98\40\99\97\115\101\124\99\108\97\115\115\124\100\97\116\97\124\100\101\102\97\117\108\116\124\100\101\114\105\118\105\110\103\124\100\111\124\101\108\115\101\124\105\102\124\105\110\124\105\110\102\105\120\91\108\114\93\63\124\105\110\115\116\97\110\99\101\124\108\101\116\124\110\101\119\116\121\112\101\124\111\102\124\116\104\101\110\124\116\121\112\101\124\119\104\101\114\101\124\95\41\40\63\33\92\39\41\92\98" (Arbitrary "\75\101\121\119\111\114\100" :. Arbitrary "\82\101\115\101\114\118\101\100")
    , tok "\94\91\95\97\45\122\93\91\92\119\92\39\93\42" (Arbitrary "\78\97\109\101" :. Arbitrary "\70\117\110\99\116\105\111\110")
    , tok "\91\95\97\45\122\93\91\92\119\92\39\93\42" (Arbitrary "\78\97\109\101")
    , tok "\91\65\45\90\93\91\92\119\92\39\93\42" (Arbitrary "\75\101\121\119\111\114\100" :. Arbitrary "\84\121\112\101")
    , tok "\92\92\40\63\33\91\58\33\35\36\37\38\42\43\46\92\92\47\60\61\62\63\64\94\124\126\45\93\43\41" (Arbitrary "\78\97\109\101" :. Arbitrary "\70\117\110\99\116\105\111\110")
    , tok "\40\60\45\124\58\58\124\45\62\124\61\62\124\61\41\40\63\33\91\58\33\35\36\37\38\42\43\46\92\92\47\60\61\62\63\64\94\124\126\45\93\43\41" (Arbitrary "\79\112\101\114\97\116\111\114" :. Arbitrary "\87\111\114\100")
    , tok "\58\91\58\33\35\36\37\38\42\43\46\92\92\47\60\61\62\63\64\94\124\126\45\93\42" (Arbitrary "\75\101\121\119\111\114\100" :. Arbitrary "\84\121\112\101")
    , tok "\91\58\33\35\36\37\38\42\43\46\92\92\47\60\61\62\63\64\94\124\126\45\93\43" (Arbitrary "\79\112\101\114\97\116\111\114")
    , tok "\92\100\43\91\101\69\93\91\43\45\93\63\92\100\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\78\117\109\98\101\114" :. Arbitrary "\70\108\111\97\116")
    , tok "\92\100\43\92\46\92\100\43\40\91\101\69\93\91\43\45\93\63\92\100\43\41\63" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\78\117\109\98\101\114" :. Arbitrary "\70\108\111\97\116")
    , tok "\48\91\111\79\93\91\48\45\55\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\78\117\109\98\101\114" :. Arbitrary "\79\99\116")
    , tok "\48\91\120\88\93\91\92\100\97\45\102\65\45\70\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\78\117\109\98\101\114" :. Arbitrary "\72\101\120")
    , tok "\92\100\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\78\117\109\98\101\114" :. Arbitrary "\73\110\116\101\103\101\114")
    , tokNext "\39" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103" :. Arbitrary "\67\104\97\114") (GoTo character')
    , tokNext "\34" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") (GoTo string')
    , tok "\92\91\92\93" (Arbitrary "\75\101\121\119\111\114\100" :. Arbitrary "\84\121\112\101")
    , tok "\92\40\92\41" (Arbitrary "\78\97\109\101" :. Arbitrary "\66\117\105\108\116\105\110")
    , tok "\91\93\91\40\41\44\59\96\123\125\93" (Arbitrary "\80\117\110\99\116\117\97\116\105\111\110")
    ]

module' :: TokenMatcher
module' =
    [ tok "\92\115\43" (Arbitrary "\84\101\120\116")
    , tokNext "\40\91\65\45\90\93\91\97\45\122\65\45\90\48\45\57\95\46\93\42\41\40\92\115\43\41\40\92\40\41" (ByGroups [(Arbitrary "\78\97\109\101" :. Arbitrary "\78\97\109\101\115\112\97\99\101"), (Arbitrary "\84\101\120\116"), (Arbitrary "\80\117\110\99\116\117\97\116\105\111\110")]) (GoTo funclist')
    , tokNext "\91\65\45\90\93\91\97\45\122\65\45\90\48\45\57\95\46\93\42" (Arbitrary "\78\97\109\101" :. Arbitrary "\78\97\109\101\115\112\97\99\101") Pop
    ]

character' :: TokenMatcher
character' =
    [ tok "\91\94\92\92\39\93" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103" :. Arbitrary "\67\104\97\114")
    , tokNext "\92\92" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103" :. Arbitrary "\69\115\99\97\112\101") (GoTo escape')
    , tokNext "\39" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103" :. Arbitrary "\67\104\97\114") Pop
    ]