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

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

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

classname' :: TokenMatcher
classname' =
    [ tokNext "\91\97\45\122\65\45\90\95\93\91\97\45\122\65\45\90\48\45\57\95\93\42" (Arbitrary "\78\97\109\101" :. Arbitrary "\67\108\97\115\115") Pop
    , tokNext "\92\115\42\40\63\61\62\41" (Arbitrary "\84\101\120\116") Pop
    ]

macro' :: TokenMatcher
macro' =
    [ tok "\91\94\47\92\110\93\43" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\80\114\101\112\114\111\99")
    , tok "\47\91\42\93\40\46\124\92\110\41\42\63\91\42\93\47" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\77\117\108\116\105\108\105\110\101")
    , tokNext "\47\47\46\42\63\92\110" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\83\105\110\103\108\101") Pop
    , tok "\47" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\80\114\101\112\114\111\99")
    , tok "\40\63\60\61\92\92\41\92\110" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\80\114\101\112\114\111\99")
    , tokNext "\92\110" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\80\114\101\112\114\111\99") Pop
    ]

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

string' :: TokenMatcher
string' =
    [ tokNext "\34" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103") Pop
    , tok "\92\92\40\91\92\92\97\98\102\110\114\116\118\34\92\39\93\124\120\91\97\45\102\65\45\70\48\45\57\93\123\50\44\52\125\124\91\48\45\55\93\123\49\44\51\125\41" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103" :. Arbitrary "\69\115\99\97\112\101")
    , tok "\91\94\92\92\34\92\110\93\43" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tok "\92\92\92\110" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    , tok "\92\92" (Arbitrary "\76\105\116\101\114\97\108" :. Arbitrary "\83\116\114\105\110\103")
    ]

if0' :: TokenMatcher
if0' =
    [ tokNext "\94\92\115\42\35\105\102\46\42\63\40\63\60\33\92\92\41\92\110" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\80\114\101\112\114\111\99") Push
    , tokNext "\94\92\115\42\35\101\110\100\105\102\46\42\63\40\63\60\33\92\92\41\92\110" (Arbitrary "\67\111\109\109\101\110\116" :. Arbitrary "\80\114\101\112\114\111\99") Pop
    , tok "\46\42\63\92\110" (Arbitrary "\67\111\109\109\101\110\116")
    ]