{- This module was generated from data in the Kate syntax highlighting file makefile.xml, version 1.09,
by Per Wigren (wigren@home.se) -}moduleText.Highlighting.Kate.Syntax.Makefile(highlight,parseExpression,syntaxName,syntaxExtensions)whereimportText.Highlighting.Kate.DefinitionsimportText.Highlighting.Kate.CommonimportText.ParserCombinators.ParsecimportData.List(nub)importData.Map(fromList)importData.Maybe(fromMaybe)-- | Full name of language.syntaxName::StringsyntaxName="Makefile"-- | Filename extensions for this language.syntaxExtensions::StringsyntaxExtensions="GNUmakefile;Makefile*;makefile*"-- | Highlight source code using this syntax definition.highlight::String->EitherString[SourceLine]highlightinput=caserunParserparseSourcestartingState"source"inputofLefterr->Left$showerrRightresult->Rightresult-- | Parse an expression using appropriate local context.parseExpression::GenParserCharSyntaxStateLabeledSourceparseExpression=dost<-getStateletoldLang=synStLanguagestsetState$st{synStLanguage="Makefile"}context<-currentContext<|>(pushContext"Normal">>currentContext)result<-parseRulescontextupdateState$\st->st{synStLanguage=oldLang}returnresultparseSource=dolineContents<-lookAheadwholeLineupdateState$\st->st{synStCurrentLine=lineContents}result<-manyTillparseSourceLineeofreturn$mapnormalizeHighlightingresultstartingState=SyntaxState{synStContexts=fromList[("Makefile",["Normal"])],synStLanguage="Makefile",synStCurrentLine="",synStCharsParsedInLine=0,synStCaseSensitive=True,synStKeywordCaseSensitive=True,synStCaptures=[]}parseSourceLine=manyTillparseExpressionInternalpEndLinepEndLine=donewline<|>(eof>>return'\n')context<-currentContextcasecontextof"Normal"->return()"String"->(popContext>>return())"Value"->return()"VarFromValue"->return()"VarFromNormal"->return()"Commands"->(popContext>>return())_->return()lineContents<-lookAheadwholeLineupdateState$\st->st{synStCurrentLine=lineContents,synStCharsParsedInLine=0}withAttributeattrtxt=doifnulltxtthenfail"Parser matched no text"elsereturn()letstyle=fromMaybe""$lookupattrstylesst<-getStateletoldCharsParsed=synStCharsParsedInLinestupdateState$\st->st{synStCharsParsedInLine=oldCharsParsed+lengthtxt}return(nub[style,attr],txt)styles=[("Normal Text","Normal"),("Keyword","Keyword"),("Comment","Comment"),("String","String"),("Variable","DataType"),("Target","DecVal"),("Section","Others"),("Operator","Char"),("Commands","BaseN"),("Special","Float")]parseExpressionInternal=docontext<-currentContextparseRulescontext<|>(pDefault>>=withAttribute(fromMaybe""$lookupcontextdefaultAttributes))defaultAttributes=[("Normal","Normal Text"),("String","String"),("Value","String"),("VarFromValue","Variable"),("VarFromNormal","Variable"),("Commands","Normal Text")]parseRules"Normal"=do(attr,result)<-(((pKeyword" \n\t.():!+,-<=>%&*/;?[]^{|}~\\"["include","define","else","endef","endif","ifdef","ifeq","ifndef","ifneq"]>>=withAttribute"Keyword"))<|>((pRegExpr(compileRegex"[_\\w\\d]*\\s*(?=:=|=)")>>=withAttribute"Variable")>>~pushContext"Value")<|>((pFirstNonSpace>>pRegExpr(compileRegex"[_\\w\\d-]*\\s*:")>>=withAttribute"Target"))<|>((pColumn0>>pRegExpr(compileRegex"[.].*:")>>=withAttribute"Section"))<|>((pDetectCharFalse'"'>>=withAttribute"String")>>~pushContext"String")<|>((pRegExpr(compileRegex"[$][\\({]")>>=withAttribute"Operator")>>~pushContext"VarFromNormal")<|>((pDetect2CharsFalse'\\''#'>>=withAttribute"Special"))<|>((pDetect2CharsFalse'\\''\\'>>=withAttribute"Special"))<|>((pAnyChar"+*=%$():\\;">>=withAttribute"Operator"))<|>((pFirstNonSpace>>pAnyChar"@-">>=withAttribute"Operator")>>~pushContext"Commands")<|>((pRegExpr(compileRegex"#.*$")>>=withAttribute"Comment")))return(attr,result)parseRules"String"=do(attr,result)<-(((pLineContinue>>=withAttribute"String"))<|>((pDetectCharFalse'"'>>=withAttribute"String")>>~(popContext>>return())))return(attr,result)parseRules"Value"=do(attr,result)<-(((pRegExpr(compileRegex"\\\\$")>>=withAttribute"Operator"))<|>((pRegExpr(compileRegex"[^\\\\]?$")>>=withAttribute"String")>>~(popContext>>return()))<|>((pRegExpr(compileRegex"[$][\\({]")>>=withAttribute"Operator")>>~pushContext"VarFromValue")<|>((pRegExpr(compileRegex"@[-_\\d\\w]*@")>>=withAttribute"Special")>>~(popContext>>return()))<|>((pDetectCharFalse';'>>=withAttribute"Operator")>>~(popContext>>return())))return(attr,result)parseRules"VarFromValue"=do(attr,result)<-(((pRegExpr(compileRegex"[\\)}](?=/)")>>=withAttribute"Operator")>>~(popContext>>return()))<|>((pRegExpr(compileRegex"[\\)}][^$]")>>=withAttribute"Operator")>>~(popContext>>return()))<|>((pRegExpr(compileRegex"[\\)}]$")>>=withAttribute"Operator")>>~(popContext>>popContext>>return())))return(attr,result)parseRules"VarFromNormal"=do(attr,result)<-((pAnyChar")}">>=withAttribute"Operator")>>~(popContext>>return()))return(attr,result)parseRules"Commands"=do(attr,result)<-(((pRegExpr(compileRegex"[$][\\({]")>>=withAttribute"Operator")>>~pushContext"VarFromNormal")<|>((pRegExpr(compileRegex"[_\\w-]*\\b")>>=withAttribute"Commands")>>~(popContext>>return())))return(attr,result)parseRulesx=fail$"Unknown context"++x