{- This module was generated from data in the Kate syntax highlighting file matlab.xml, version 1.20,
by -}moduleText.Highlighting.Kate.Syntax.Matlab(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="Matlab"-- | Filename extensions for this language.syntaxExtensions::StringsyntaxExtensions="*.m;*.M"-- | 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="Matlab"}context<-currentContext<|>(pushContext"_normal">>currentContext)result<-parseRulescontextupdateState$\st->st{synStLanguage=oldLang}returnresultparseSource=dolineContents<-lookAheadwholeLineupdateState$\st->st{synStCurrentLine=lineContents}result<-manyTillparseSourceLineeofreturn$mapnormalizeHighlightingresultstartingState=SyntaxState{synStContexts=fromList[("Matlab",["_normal"])],synStLanguage="Matlab",synStCurrentLine="",synStCharsParsedInLine=0,synStCaseSensitive=True,synStKeywordCaseSensitive=True,synStCaptures=[]}parseSourceLine=manyTillparseExpressionInternalpEndLinepEndLine=donewline<|>(eof>>return'\n')context<-currentContextcasecontextof"_normal"->(popContext>>return())"_adjoint"->(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"),("Variable","Normal"),("Operator","Normal"),("Number","Float"),("Delimiter","Normal"),("String","String"),("System","BaseN"),("Incomplete String","Char"),("Keyword","Normal"),("Comment","Comment")]parseExpressionInternal=docontext<-currentContextparseRulescontext<|>(pDefault>>=withAttribute(fromMaybe""$lookupcontextdefaultAttributes))defaultAttributes=[("_normal","Normal Text"),("_adjoint","Operator")]parseRules"_normal"=do(attr,result)<-(((pRegExpr(compileRegex"[a-zA-Z]\\w*(?=')")>>=withAttribute"Variable")>>~pushContext"_adjoint")<|>((pRegExpr(compileRegex"(\\d+(\\.\\d+)?|\\.\\d+)([eE][+-]?\\d+)?[ij]?(?=')")>>=withAttribute"Number")>>~pushContext"_adjoint")<|>((pRegExpr(compileRegex"[\\)\\]}](?=')")>>=withAttribute"Delimiter")>>~pushContext"_adjoint")<|>((pRegExpr(compileRegex"\\.'(?=')")>>=withAttribute"Operator")>>~pushContext"_adjoint")<|>((pRegExpr(compileRegex"'[^']*(''[^']*)*'(?=[^']|$)")>>=withAttribute"String"))<|>((pRegExpr(compileRegex"'[^']*(''[^']*)*")>>=withAttribute"Incomplete String"))<|>((pKeyword" \n\t.():!+,-<=>%&*/;?[]^{|}~\\"["break","case","catch","continue","else","elseif","end","for","function","global","if","otherwise","persistent","return","switch","try","while"]>>=withAttribute"Keyword"))<|>((pRegExpr(compileRegex"%.*$")>>=withAttribute"Comment"))<|>((pRegExpr(compileRegex"!.*$")>>=withAttribute"System"))<|>((pRegExpr(compileRegex"[a-zA-Z]\\w*")>>=withAttribute"Variable"))<|>((pRegExpr(compileRegex"(\\d+(\\.\\d+)?|\\.\\d+)([eE][+-]?\\d+)?[ij]?")>>=withAttribute"Number"))<|>((pAnyChar"()[]{}">>=withAttribute"Delimiter"))<|>((pStringFalse"...">>=withAttribute"Operator"))<|>((pStringFalse"==">>=withAttribute"Operator"))<|>((pStringFalse"~=">>=withAttribute"Operator"))<|>((pStringFalse"<=">>=withAttribute"Operator"))<|>((pStringFalse">=">>=withAttribute"Operator"))<|>((pStringFalse"&&">>=withAttribute"Operator"))<|>((pStringFalse"||">>=withAttribute"Operator"))<|>((pStringFalse".*">>=withAttribute"Operator"))<|>((pStringFalse".^">>=withAttribute"Operator"))<|>((pStringFalse"./">>=withAttribute"Operator"))<|>((pStringFalse".'">>=withAttribute"Operator"))<|>((pAnyChar"*+-/\\&|<>~^=,;:@">>=withAttribute"Operator")))return(attr,result)parseRules"_adjoint"=do(attr,result)<-((pRegExpr(compileRegex"'+")>>=withAttribute"Operator")>>~(popContext>>return()))return(attr,result)parseRulesx=fail$"Unknown context"++x