{- This module was generated from data in the Kate syntax highlighting file awk.xml, version 0.90,
by -}moduleText.Highlighting.Kate.Syntax.Awk(highlight,parseExpression,syntaxName,syntaxExtensions)whereimportText.Highlighting.Kate.DefinitionsimportText.Highlighting.Kate.CommonimportqualifiedText.Highlighting.Kate.Syntax.AlertimportText.ParserCombinators.ParsecimportData.List(nub)importData.Map(fromList)importData.Maybe(fromMaybe)-- | Full name of language.syntaxName::StringsyntaxName="AWK"-- | Filename extensions for this language.syntaxExtensions::StringsyntaxExtensions="*.awk"-- | 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="AWK"}context<-currentContext<|>(pushContext"Base">>currentContext)result<-parseRulescontextupdateState$\st->st{synStLanguage=oldLang}returnresultparseSource=dolineContents<-lookAheadwholeLineupdateState$\st->st{synStCurrentLine=lineContents}result<-manyTillparseSourceLineeofreturn$mapnormalizeHighlightingresultstartingState=SyntaxState{synStContexts=fromList[("AWK",["Base"])],synStLanguage="AWK",synStCurrentLine="",synStCharsParsedInLine=0,synStCaseSensitive=True,synStKeywordCaseSensitive=True,synStCaptures=[]}parseSourceLine=manyTillparseExpressionInternalpEndLinepEndLine=donewline<|>(eof>>return'\n')context<-currentContextcasecontextof"Base"->return()"String"->return()"Comment"->(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","Normal"),("Keyword","Keyword"),("Builtin","DataType"),("Function","Function"),("Decimal","DecVal"),("Float","Float"),("String","String"),("Comment","Comment"),("Pattern","String"),("Field","Others")]parseExpressionInternal=docontext<-currentContextparseRulescontext<|>(pDefault>>=withAttribute(fromMaybe""$lookupcontextdefaultAttributes))defaultAttributes=[("Base","Normal"),("String","String"),("Comment","Comment")]parseRules"Base"=do(attr,result)<-(((pRegExpr(compileRegex"\\b(BEGIN|END)\\b")>>=withAttribute"Pattern"))<|>((pRegExpr(compileRegex"/([^\\/[]|\\\\.|\\[\\]?(\\[[^]]+\\]|.)+\\])+/")>>=withAttribute"Pattern"))<|>((pDetectCharFalse'{'>>=withAttribute"Keyword"))<|>((pDetectCharFalse'}'>>=withAttribute"Keyword"))<|>((pDetectCharFalse'#'>>=withAttribute"Comment")>>~pushContext"Comment")<|>((pDetectCharFalse'"'>>=withAttribute"String")>>~pushContext"String")<|>((pKeyword" \n\t.():!+,-<=>%&*/;?[]^{|}~\\"["if","else","while","do","for","in","continue","break","print","printf","getline","function","return","next","exit"]>>=withAttribute"Keyword"))<|>((pKeyword" \n\t.():!+,-<=>%&*/;?[]^{|}~\\"["ARGC","ARGV","CONVFMT","ENVIRON","FILENAME","FNR","FS","NF","NR","OFMT","OFS","ORS","RS","RSTART","RLENGTH","SUBSEP"]>>=withAttribute"Builtin"))<|>((pKeyword" \n\t.():!+,-<=>%&*/;?[]^{|}~\\"["gsub","gensub","index","length","match","split","sprintf","sub","substr","tolower","toupper","atan2","cos","exp","int","log","rand","sin","sqrt","srand","close","fflush","system"]>>=withAttribute"Function"))<|>((pFloat>>=withAttribute"Float"))<|>((pInt>>=withAttribute"Decimal"))<|>((pRegExpr(compileRegex"\\$[A-Za-z0-9_]+")>>=withAttribute"Field")))return(attr,result)parseRules"String"=do(attr,result)<-(((pDetectCharFalse'"'>>=withAttribute"String")>>~(popContext>>return()))<|>((pHlCStringChar>>=withAttribute"String")))return(attr,result)parseRules"Comment"=do(attr,result)<-((Text.Highlighting.Kate.Syntax.Alert.parseExpression>>=((withAttribute"").snd)))return(attr,result)parseRulesx=fail$"Unknown context"++x