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

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

lexer :: Lexer
lexer = Lexer
    { lName = "\68"
    , lAliases = ["\100"]
    , lExtensions = ["\46\100", "\46\100\105"]
    , lMimetypes = ["\116\101\120\116\47\120\45\100\115\114\99"]
    , lStart = root'
    , lFlags = [multiline]
    }

delimited_parenthesis' :: TokenMatcher
delimited_parenthesis' =
    [ tok "\91\94\92\40\92\41\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tokNext "\92\40" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") (GoTo delimited_inside_parenthesis')
    , tokNext "\92\41\34" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Pop
    ]

delimited_curly' :: TokenMatcher
delimited_curly' =
    [ tok "\91\94\123\125\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tokNext "\123" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") (GoTo delimited_inside_curly')
    , tokNext "\125\34" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Pop
    ]

delimited_angle' :: TokenMatcher
delimited_angle' =
    [ tok "\91\94\60\62\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tokNext "\60" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") (GoTo delimited_inside_angle')
    , tokNext "\62\34" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Pop
    ]

delimited_inside_parenthesis' :: TokenMatcher
delimited_inside_parenthesis' =
    [ tok "\91\94\92\40\92\41\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tokNext "\92\40" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Push
    , tokNext "\92\41" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Pop
    ]

delimited_inside_curly' :: TokenMatcher
delimited_inside_curly' =
    [ tok "\91\94\123\125\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tokNext "\123" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Push
    , tokNext "\125" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Pop
    ]

delimited_inside_bracket' :: TokenMatcher
delimited_inside_bracket' =
    [ tok "\91\94\92\91\92\93\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tokNext "\92\91" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Push
    , tokNext "\92\93" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Pop
    ]

token_string_nest' :: TokenMatcher
token_string_nest' =
    [ tokNext "\123" (Arbitrary "\80\117\110\99\116\117\97\116\105\111\110") Push
    , tokNext "\125" (Arbitrary "\80\117\110\99\116\117\97\116\105\111\110") Pop
    , anyOf root'
    ]

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

token_string' :: TokenMatcher
token_string' =
    [ tokNext "\123" (Arbitrary "\80\117\110\99\116\117\97\116\105\111\110") (GoTo token_string_nest')
    , tokNext "\125" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Pop
    , anyOf root'
    ]

delimited_inside_angle' :: TokenMatcher
delimited_inside_angle' =
    [ tok "\91\94\60\62\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tokNext "\60" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Push
    , tokNext "\62" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Pop
    ]

root' :: TokenMatcher
root' =
    [ tok "\92\110" (Arbitrary "\84\101\120\116")
    , tok "\92\115\43" (Arbitrary "\84\101\120\116")
    , tok "\47\47\40\46\42\63\41\92\110" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\83\105\110\103\108\101")
    , tok "\47\40\92\92\92\110\41\63\91\42\93\40\46\124\92\110\41\42\63\91\42\93\40\92\92\92\110\41\63\47" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\77\117\108\116\105\108\105\110\101")
    , tokNext "\47\92\43" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\77\117\108\116\105\108\105\110\101") (GoTo nested_comment')
    , tok "\40\97\98\115\116\114\97\99\116\124\97\108\105\97\115\124\97\108\105\103\110\124\97\115\109\124\97\115\115\101\114\116\124\97\117\116\111\124\98\111\100\121\124\98\114\101\97\107\124\99\97\115\101\124\99\97\115\116\124\99\97\116\99\104\124\99\108\97\115\115\124\99\111\110\115\116\124\99\111\110\116\105\110\117\101\124\100\101\98\117\103\124\100\101\102\97\117\108\116\124\100\101\108\101\103\97\116\101\124\100\101\108\101\116\101\124\100\101\112\114\101\99\97\116\101\100\124\100\111\124\101\108\115\101\124\101\110\117\109\124\101\120\112\111\114\116\124\101\120\116\101\114\110\124\102\105\110\97\108\108\121\124\102\105\110\97\108\124\102\111\114\101\97\99\104\95\114\101\118\101\114\115\101\124\102\111\114\101\97\99\104\124\102\111\114\124\102\117\110\99\116\105\111\110\124\103\111\116\111\124\105\102\124\105\109\112\111\114\116\124\105\110\111\117\116\124\105\110\116\101\114\102\97\99\101\124\105\110\118\97\114\105\97\110\116\124\105\110\124\105\115\124\108\97\122\121\124\109\105\120\105\110\124\109\111\100\117\108\101\124\110\101\119\124\110\111\116\104\114\111\119\124\111\117\116\124\111\118\101\114\114\105\100\101\124\112\97\99\107\97\103\101\124\112\114\97\103\109\97\124\112\114\105\118\97\116\101\124\112\114\111\116\101\99\116\101\100\124\112\117\98\108\105\99\124\112\117\114\101\124\114\101\102\124\114\101\116\117\114\110\124\115\99\111\112\101\124\115\116\97\116\105\99\124\115\116\114\117\99\116\124\115\117\112\101\114\124\115\119\105\116\99\104\124\115\121\110\99\104\114\111\110\105\122\101\100\124\116\101\109\112\108\97\116\101\124\116\104\105\115\124\116\104\114\111\119\124\116\114\121\124\116\121\112\101\100\101\102\124\116\121\112\101\105\100\124\116\121\112\101\111\102\124\117\110\105\111\110\124\117\110\105\116\116\101\115\116\124\118\101\114\115\105\111\110\124\118\111\108\97\116\105\108\101\124\119\104\105\108\101\124\119\105\116\104\124\95\95\116\114\97\105\116\115\41\92\98" (Arbitrary "\75\101\121\119\111\114\100")
    , tok "\40\98\111\111\108\124\98\121\116\101\124\99\100\111\117\98\108\101\124\99\101\110\116\124\99\102\108\111\97\116\124\99\104\97\114\124\99\114\101\97\108\124\100\99\104\97\114\124\100\111\117\98\108\101\124\102\108\111\97\116\124\105\100\111\117\98\108\101\124\105\102\108\111\97\116\124\105\110\116\124\105\114\101\97\108\124\108\111\110\103\124\114\101\97\108\124\115\104\111\114\116\124\117\98\121\116\101\124\117\99\101\110\116\124\117\105\110\116\124\117\108\111\110\103\124\117\115\104\111\114\116\124\118\111\105\100\124\119\99\104\97\114\41\92\98" (Arbitrary "\75\101\121\119\111\114\100" :. Arbitrary "\84\121\112\101")
    , tok "\40\102\97\108\115\101\124\116\114\117\101\124\110\117\108\108\41\92\98" (Arbitrary "\75\101\121\119\111\114\100" :. Arbitrary "\67\111\110\115\116\97\110\116")
    , tok "\109\97\99\114\111\92\98" (Arbitrary "\75\101\121\119\111\114\100" :. Arbitrary "\82\101\115\101\114\118\101\100")
    , tok "\40\115\116\114\105\110\103\124\119\115\116\114\105\110\103\124\100\115\116\114\105\110\103\41\92\98" (Arbitrary "\78\97\109\101" :. Arbitrary "\66\117\105\108\116\105\110")
    , tok "\48\91\120\88\93\40\91\48\45\57\97\45\102\65\45\70\95\93\42\92\46\91\48\45\57\97\45\102\65\45\70\95\93\43\124\91\48\45\57\97\45\102\65\45\70\95\93\43\41\91\112\80\93\91\43\92\45\93\63\91\48\45\57\95\93\43\91\102\70\76\93\63\91\105\93\63" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\78\117\109\98\101\114" :. Arbitrary "\70\108\111\97\116")
    , tok "\91\48\45\57\95\93\43\40\92\46\91\48\45\57\95\93\43\91\101\69\93\91\43\92\45\93\63\91\48\45\57\95\93\43\124\92\46\91\48\45\57\95\93\42\124\91\101\69\93\91\43\92\45\93\63\91\48\45\57\95\93\43\41\91\102\70\76\93\63\91\105\93\63" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\78\117\109\98\101\114" :. Arbitrary "\70\108\111\97\116")
    , tok "\92\46\40\48\124\91\49\45\57\93\91\48\45\57\95\93\42\41\40\91\101\69\93\91\43\92\45\93\63\91\48\45\57\95\93\43\41\63\91\102\70\76\93\63\91\105\93\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\66\98\93\91\48\49\95\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\78\117\109\98\101\114")
    , tok "\48\91\48\45\55\95\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\48\45\57\97\45\102\65\45\70\95\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\78\117\109\98\101\114" :. Arbitrary "\72\101\120")
    , tok "\40\48\124\91\49\45\57\93\91\48\45\57\95\93\42\41\40\91\76\85\117\93\124\76\117\124\76\85\124\117\76\124\85\76\41\63" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\78\117\109\98\101\114" :. Arbitrary "\73\110\116\101\103\101\114")
    , tok "\39\40\92\92\91\39\34\63\92\92\97\98\102\110\114\116\118\93\124\92\92\120\91\48\45\57\97\45\102\65\45\70\93\123\50\125\124\92\92\91\48\45\55\93\123\49\44\51\125\124\92\92\117\91\48\45\57\97\45\102\65\45\70\93\123\52\125\124\92\92\85\91\48\45\57\97\45\102\65\45\70\93\123\56\125\124\92\92\38\92\119\43\59\124\46\41\39" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103" :. Arbitrary "\67\104\97\114")
    , tok "\114\34\91\94\34\93\42\34\91\99\119\100\93\63" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tok "\96\91\94\96\93\42\96\91\99\119\100\93\63" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tok "\34\40\92\92\92\92\124\92\92\34\124\91\94\34\93\41\42\34\91\99\119\100\93\63" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tok "\92\92\40\91\39\92\34\63\92\92\97\98\102\110\114\116\118\93\124\120\91\48\45\57\97\45\102\65\45\70\93\123\50\125\124\91\48\45\55\93\123\49\44\51\125\124\117\91\48\45\57\97\45\102\65\45\70\93\123\52\125\124\85\91\48\45\57\97\45\102\65\45\70\93\123\56\125\124\38\92\119\43\59\41" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tok "\120\34\91\48\45\57\97\45\102\65\45\70\95\92\115\93\42\34\91\99\119\100\93\63" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tokNext "\113\34\92\91" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") (GoTo delimited_bracket')
    , tokNext "\113\34\92\40" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") (GoTo delimited_parenthesis')
    , tokNext "\113\34\60" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") (GoTo delimited_angle')
    , tokNext "\113\34\123" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") (GoTo delimited_curly')
    , tok "\113\34\40\91\97\45\122\65\45\90\95\93\92\119\42\41\92\110\46\42\63\92\110\92\49\34" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tok "\113\34\40\46\41\46\42\63\92\49\34" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tokNext "\113\123" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") (GoTo token_string')
    , tok "\40\126\61\124\92\94\61\124\37\61\124\92\42\61\124\61\61\124\33\62\61\124\33\60\61\124\33\60\62\61\124\33\60\62\124\33\60\124\33\62\124\33\61\124\62\62\62\61\124\62\62\62\124\62\62\61\124\62\62\124\62\61\124\60\62\61\124\60\62\124\60\60\61\124\60\60\124\60\61\124\92\43\92\43\124\92\43\61\124\45\45\124\45\61\124\92\124\92\124\124\92\124\61\124\38\38\124\38\61\124\92\46\92\46\92\46\124\92\46\92\46\124\47\61\41\124\91\47\46\38\124\92\45\43\60\62\33\40\41\92\91\92\93\123\125\63\44\59\58\36\61\42\37\94\126\93" (Arbitrary "\80\117\110\99\116\117\97\116\105\111\110")
    , tok "\91\97\45\122\65\45\90\95\93\92\119\42" (Arbitrary "\78\97\109\101")
    ]

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