packages feed

highlighting-kate 0.5.3 → 0.5.3.1

raw patch · 97 files changed

+4423/−1715 lines, 97 files

Files

ParseSyntaxFiles.hs view
@@ -206,16 +206,11 @@                    text "updateState $ \\st -> st { synStPrevChar = last txt" $$                    text "                        , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) }" $$                    text "return (attr, txt)")-      lang = synLanguage syntax       parseExpression = text "-- | Parse an expression using appropriate local context." $$                         text "parseExpression :: KateParser Token" $$                         text "parseExpression = do" $$ (nest 2 $                           text "(lang,cont) <- currentContext" $$-                          text "let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes" $$-                          text ("result <- if lang == " ++ show lang) $$-                          text ("             then parseRules (lang,cont) <|>") $$-                          text ("                    (pDefault >>= withAttribute defAttr)") $$-                          text ("             else parseRules " ++ show (lang, contName (head $ synContexts syntax))) $$+                          text ("result <- parseRules (lang,cont)") $$                           text "optional $ do eof" $$                           text "              updateState $ \\st -> st{ synStPrevChar = '\\n' }" $$                           text "              pEndLine" $$@@ -232,7 +227,7 @@                      filter isIncludeRules $                      concatMap contParsers $ synContexts syntax       foreignContexts = vcat $ map (\l -> text ("parseRules (" ++ show l ++ ", _) = " ++ langNameToModule l ++ ".parseExpression")) includeLangs-      contextCatchAll = text $ "parseRules x = fail $ \"Unknown context\" ++ show x"+      contextCatchAll = text $ "parseRules x = parseRules " ++ show (synLanguage syntax, contName startingContext) ++ " <|> fail (\"Unknown context\" ++ show x)"       contexts = map (mkRules syntax) $ synContexts syntax       initialContextStack = [(synLanguage syntax, contName startingContext)]       startingState = SyntaxState { synStContexts = initialContextStack@@ -281,11 +276,12 @@  mkRules :: SyntaxDefinition -> SyntaxContext -> Doc mkRules syntax context =-  let fallthroughParser = if contFallthrough context+  let ctx = (synLanguage syntax, contName context)+      fallthroughParser = if contFallthrough context                              then [parens (switchContext (synLanguage syntax, contFallthroughContext context) (<> text " >> ") <>                                    text "currentContext >>= parseRules")]-                             else []-  in  text ("parseRules " ++ show (synLanguage syntax, contName context) ++ " =") $$+                             else [parens $ text $ "currentContext >>= \\x -> guard (x == " ++ show ctx ++ ") >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup " ++ show ctx ++ " defaultAttributes)"]+  in  text ("parseRules " ++ show ctx ++ " =") $$       if null (contParsers context) && null fallthroughParser          then nest 2 (text "pzero")          else nest 2 $ mkAlternatives $ (map (mkSyntaxParser syntax context) $ contParsers context) ++ fallthroughParser
Text/Highlighting/Kate/Syntax.hs view
@@ -40,6 +40,7 @@ import qualified Text.Highlighting.Kate.Syntax.Diff as Diff import qualified Text.Highlighting.Kate.Syntax.Djangotemplate as Djangotemplate import qualified Text.Highlighting.Kate.Syntax.Doxygen as Doxygen+import qualified Text.Highlighting.Kate.Syntax.Doxygenlua as Doxygenlua import qualified Text.Highlighting.Kate.Syntax.Dtd as Dtd import qualified Text.Highlighting.Kate.Syntax.Eiffel as Eiffel import qualified Text.Highlighting.Kate.Syntax.Email as Email@@ -108,11 +109,11 @@  -- | List of supported languages. languages :: [String]-languages = ["Actionscript","Ada","Alert","Alert_indent","Apache","Asn1","Asp","Awk","Bash","Bibtex","Boo","C","Changelog","Clojure","Cmake","Coffee","Coldfusion","Commonlisp","Cpp","Cs","Css","D","Diff","Djangotemplate","Doxygen","Dtd","Eiffel","Email","Erlang","Fortran","Fsharp","Gnuassembler","Go","Haskell","Haxe","Html","Ini","Java","Javadoc","Javascript","Json","Jsp","Latex","Lex","LiterateHaskell","Lua","Makefile","Mandoc","Matlab","Maxima","Metafont","Mips","Modula2","Modula3","Monobasic","Nasm","Noweb","Objectivec","Objectivecpp","Ocaml","Octave","Pascal","Perl","Php","Pike","Postscript","Prolog","Python","R","Relaxngcompact","Rhtml","Ruby","Scala","Scheme","Sci","Sed","Sgml","Sql","SqlMysql","SqlPostgresql","Tcl","Texinfo","Verilog","Vhdl","Xml","Xorg","Xslt","Xul","Yacc","Yaml"]+languages = ["Actionscript","Ada","Alert","Alert_indent","Apache","Asn1","Asp","Awk","Bash","Bibtex","Boo","C","Changelog","Clojure","Cmake","Coffee","Coldfusion","Commonlisp","Cpp","Cs","Css","D","Diff","Djangotemplate","Doxygen","Doxygenlua","Dtd","Eiffel","Email","Erlang","Fortran","Fsharp","Gnuassembler","Go","Haskell","Haxe","Html","Ini","Java","Javadoc","Javascript","Json","Jsp","Latex","Lex","LiterateHaskell","Lua","Makefile","Mandoc","Matlab","Maxima","Metafont","Mips","Modula2","Modula3","Monobasic","Nasm","Noweb","Objectivec","Objectivecpp","Ocaml","Octave","Pascal","Perl","Php","Pike","Postscript","Prolog","Python","R","Relaxngcompact","Rhtml","Ruby","Scala","Scheme","Sci","Sed","Sgml","Sql","SqlMysql","SqlPostgresql","Tcl","Texinfo","Verilog","Vhdl","Xml","Xorg","Xslt","Xul","Yacc","Yaml"]  -- | List of language extensions. languageExtensions :: [(String, String)]-languageExtensions = [("Actionscript", Actionscript.syntaxExtensions), ("Ada", Ada.syntaxExtensions), ("Alert", Alert.syntaxExtensions), ("Alert_indent", Alert_indent.syntaxExtensions), ("Apache", Apache.syntaxExtensions), ("Asn1", Asn1.syntaxExtensions), ("Asp", Asp.syntaxExtensions), ("Awk", Awk.syntaxExtensions), ("Bash", Bash.syntaxExtensions), ("Bibtex", Bibtex.syntaxExtensions), ("Boo", Boo.syntaxExtensions), ("C", C.syntaxExtensions), ("Changelog", Changelog.syntaxExtensions), ("Clojure", Clojure.syntaxExtensions), ("Cmake", Cmake.syntaxExtensions), ("Coffee", Coffee.syntaxExtensions), ("Coldfusion", Coldfusion.syntaxExtensions), ("Commonlisp", Commonlisp.syntaxExtensions), ("Cpp", Cpp.syntaxExtensions), ("Cs", Cs.syntaxExtensions), ("Css", Css.syntaxExtensions), ("D", D.syntaxExtensions), ("Diff", Diff.syntaxExtensions), ("Djangotemplate", Djangotemplate.syntaxExtensions), ("Doxygen", Doxygen.syntaxExtensions), ("Dtd", Dtd.syntaxExtensions), ("Eiffel", Eiffel.syntaxExtensions), ("Email", Email.syntaxExtensions), ("Erlang", Erlang.syntaxExtensions), ("Fortran", Fortran.syntaxExtensions), ("Fsharp", Fsharp.syntaxExtensions), ("Gnuassembler", Gnuassembler.syntaxExtensions), ("Go", Go.syntaxExtensions), ("Haskell", Haskell.syntaxExtensions), ("Haxe", Haxe.syntaxExtensions), ("Html", Html.syntaxExtensions), ("Ini", Ini.syntaxExtensions), ("Java", Java.syntaxExtensions), ("Javadoc", Javadoc.syntaxExtensions), ("Javascript", Javascript.syntaxExtensions), ("Json", Json.syntaxExtensions), ("Jsp", Jsp.syntaxExtensions), ("Latex", Latex.syntaxExtensions), ("Lex", Lex.syntaxExtensions), ("LiterateHaskell", LiterateHaskell.syntaxExtensions), ("Lua", Lua.syntaxExtensions), ("Makefile", Makefile.syntaxExtensions), ("Mandoc", Mandoc.syntaxExtensions), ("Matlab", Matlab.syntaxExtensions), ("Maxima", Maxima.syntaxExtensions), ("Metafont", Metafont.syntaxExtensions), ("Mips", Mips.syntaxExtensions), ("Modula2", Modula2.syntaxExtensions), ("Modula3", Modula3.syntaxExtensions), ("Monobasic", Monobasic.syntaxExtensions), ("Nasm", Nasm.syntaxExtensions), ("Noweb", Noweb.syntaxExtensions), ("Objectivec", Objectivec.syntaxExtensions), ("Objectivecpp", Objectivecpp.syntaxExtensions), ("Ocaml", Ocaml.syntaxExtensions), ("Octave", Octave.syntaxExtensions), ("Pascal", Pascal.syntaxExtensions), ("Perl", Perl.syntaxExtensions), ("Php", Php.syntaxExtensions), ("Pike", Pike.syntaxExtensions), ("Postscript", Postscript.syntaxExtensions), ("Prolog", Prolog.syntaxExtensions), ("Python", Python.syntaxExtensions), ("R", R.syntaxExtensions), ("Relaxngcompact", Relaxngcompact.syntaxExtensions), ("Rhtml", Rhtml.syntaxExtensions), ("Ruby", Ruby.syntaxExtensions), ("Scala", Scala.syntaxExtensions), ("Scheme", Scheme.syntaxExtensions), ("Sci", Sci.syntaxExtensions), ("Sed", Sed.syntaxExtensions), ("Sgml", Sgml.syntaxExtensions), ("Sql", Sql.syntaxExtensions), ("SqlMysql", SqlMysql.syntaxExtensions), ("SqlPostgresql", SqlPostgresql.syntaxExtensions), ("Tcl", Tcl.syntaxExtensions), ("Texinfo", Texinfo.syntaxExtensions), ("Verilog", Verilog.syntaxExtensions), ("Vhdl", Vhdl.syntaxExtensions), ("Xml", Xml.syntaxExtensions), ("Xorg", Xorg.syntaxExtensions), ("Xslt", Xslt.syntaxExtensions), ("Xul", Xul.syntaxExtensions), ("Yacc", Yacc.syntaxExtensions), ("Yaml", Yaml.syntaxExtensions)]+languageExtensions = [("Actionscript", Actionscript.syntaxExtensions), ("Ada", Ada.syntaxExtensions), ("Alert", Alert.syntaxExtensions), ("Alert_indent", Alert_indent.syntaxExtensions), ("Apache", Apache.syntaxExtensions), ("Asn1", Asn1.syntaxExtensions), ("Asp", Asp.syntaxExtensions), ("Awk", Awk.syntaxExtensions), ("Bash", Bash.syntaxExtensions), ("Bibtex", Bibtex.syntaxExtensions), ("Boo", Boo.syntaxExtensions), ("C", C.syntaxExtensions), ("Changelog", Changelog.syntaxExtensions), ("Clojure", Clojure.syntaxExtensions), ("Cmake", Cmake.syntaxExtensions), ("Coffee", Coffee.syntaxExtensions), ("Coldfusion", Coldfusion.syntaxExtensions), ("Commonlisp", Commonlisp.syntaxExtensions), ("Cpp", Cpp.syntaxExtensions), ("Cs", Cs.syntaxExtensions), ("Css", Css.syntaxExtensions), ("D", D.syntaxExtensions), ("Diff", Diff.syntaxExtensions), ("Djangotemplate", Djangotemplate.syntaxExtensions), ("Doxygen", Doxygen.syntaxExtensions), ("Doxygenlua", Doxygenlua.syntaxExtensions), ("Dtd", Dtd.syntaxExtensions), ("Eiffel", Eiffel.syntaxExtensions), ("Email", Email.syntaxExtensions), ("Erlang", Erlang.syntaxExtensions), ("Fortran", Fortran.syntaxExtensions), ("Fsharp", Fsharp.syntaxExtensions), ("Gnuassembler", Gnuassembler.syntaxExtensions), ("Go", Go.syntaxExtensions), ("Haskell", Haskell.syntaxExtensions), ("Haxe", Haxe.syntaxExtensions), ("Html", Html.syntaxExtensions), ("Ini", Ini.syntaxExtensions), ("Java", Java.syntaxExtensions), ("Javadoc", Javadoc.syntaxExtensions), ("Javascript", Javascript.syntaxExtensions), ("Json", Json.syntaxExtensions), ("Jsp", Jsp.syntaxExtensions), ("Latex", Latex.syntaxExtensions), ("Lex", Lex.syntaxExtensions), ("LiterateHaskell", LiterateHaskell.syntaxExtensions), ("Lua", Lua.syntaxExtensions), ("Makefile", Makefile.syntaxExtensions), ("Mandoc", Mandoc.syntaxExtensions), ("Matlab", Matlab.syntaxExtensions), ("Maxima", Maxima.syntaxExtensions), ("Metafont", Metafont.syntaxExtensions), ("Mips", Mips.syntaxExtensions), ("Modula2", Modula2.syntaxExtensions), ("Modula3", Modula3.syntaxExtensions), ("Monobasic", Monobasic.syntaxExtensions), ("Nasm", Nasm.syntaxExtensions), ("Noweb", Noweb.syntaxExtensions), ("Objectivec", Objectivec.syntaxExtensions), ("Objectivecpp", Objectivecpp.syntaxExtensions), ("Ocaml", Ocaml.syntaxExtensions), ("Octave", Octave.syntaxExtensions), ("Pascal", Pascal.syntaxExtensions), ("Perl", Perl.syntaxExtensions), ("Php", Php.syntaxExtensions), ("Pike", Pike.syntaxExtensions), ("Postscript", Postscript.syntaxExtensions), ("Prolog", Prolog.syntaxExtensions), ("Python", Python.syntaxExtensions), ("R", R.syntaxExtensions), ("Relaxngcompact", Relaxngcompact.syntaxExtensions), ("Rhtml", Rhtml.syntaxExtensions), ("Ruby", Ruby.syntaxExtensions), ("Scala", Scala.syntaxExtensions), ("Scheme", Scheme.syntaxExtensions), ("Sci", Sci.syntaxExtensions), ("Sed", Sed.syntaxExtensions), ("Sgml", Sgml.syntaxExtensions), ("Sql", Sql.syntaxExtensions), ("SqlMysql", SqlMysql.syntaxExtensions), ("SqlPostgresql", SqlPostgresql.syntaxExtensions), ("Tcl", Tcl.syntaxExtensions), ("Texinfo", Texinfo.syntaxExtensions), ("Verilog", Verilog.syntaxExtensions), ("Vhdl", Vhdl.syntaxExtensions), ("Xml", Xml.syntaxExtensions), ("Xorg", Xorg.syntaxExtensions), ("Xslt", Xslt.syntaxExtensions), ("Xul", Xul.syntaxExtensions), ("Yacc", Yacc.syntaxExtensions), ("Yaml", Yaml.syntaxExtensions)]  -- | Returns a list of languages appropriate for the given file extension. languagesByExtension :: String -> [String]@@ -128,7 +129,7 @@ -- extension (if unique). -- The parsers read the input lazily and parse line by line; -- results are returned immediately.--- Supported languages: @actionscript@, @ada@, @alert@, @alert_indent@, @apache@, @asn1@, @asp@, @awk@, @bash@, @bibtex@, @boo@, @c@, @changelog@, @clojure@, @cmake@, @coffee@, @coldfusion@, @commonlisp@, @cpp@, @cs@, @css@, @d@, @diff@, @djangotemplate@, @doxygen@, @dtd@, @eiffel@, @email@, @erlang@, @fortran@, @fsharp@, @gnuassembler@, @go@, @haskell@, @haxe@, @html@, @ini@, @java@, @javadoc@, @javascript@, @json@, @jsp@, @latex@, @lex@, @literatehaskell@, @lua@, @makefile@, @mandoc@, @matlab@, @maxima@, @metafont@, @mips@, @modula2@, @modula3@, @monobasic@, @nasm@, @noweb@, @objectivec@, @objectivecpp@, @ocaml@, @octave@, @pascal@, @perl@, @php@, @pike@, @postscript@, @prolog@, @python@, @r@, @relaxngcompact@, @rhtml@, @ruby@, @scala@, @scheme@, @sci@, @sed@, @sgml@, @sql@, @sqlmysql@, @sqlpostgresql@, @tcl@, @texinfo@, @verilog@, @vhdl@, @xml@, @xorg@, @xslt@, @xul@, @yacc@, @yaml@.+-- Supported languages: @actionscript@, @ada@, @alert@, @alert_indent@, @apache@, @asn1@, @asp@, @awk@, @bash@, @bibtex@, @boo@, @c@, @changelog@, @clojure@, @cmake@, @coffee@, @coldfusion@, @commonlisp@, @cpp@, @cs@, @css@, @d@, @diff@, @djangotemplate@, @doxygen@, @doxygenlua@, @dtd@, @eiffel@, @email@, @erlang@, @fortran@, @fsharp@, @gnuassembler@, @go@, @haskell@, @haxe@, @html@, @ini@, @java@, @javadoc@, @javascript@, @json@, @jsp@, @latex@, @lex@, @literatehaskell@, @lua@, @makefile@, @mandoc@, @matlab@, @maxima@, @metafont@, @mips@, @modula2@, @modula3@, @monobasic@, @nasm@, @noweb@, @objectivec@, @objectivecpp@, @ocaml@, @octave@, @pascal@, @perl@, @php@, @pike@, @postscript@, @prolog@, @python@, @r@, @relaxngcompact@, @rhtml@, @ruby@, @scala@, @scheme@, @sci@, @sed@, @sgml@, @sql@, @sqlmysql@, @sqlpostgresql@, @tcl@, @texinfo@, @verilog@, @vhdl@, @xml@, @xorg@, @xslt@, @xul@, @yacc@, @yaml@. highlightAs :: String         -- ^ Language syntax (e.g. "haskell") or extension (e.g. "hs").             -> String         -- ^ Source code to highlight             -> [SourceLine]   -- ^ List of highlighted source lines@@ -165,6 +166,7 @@         "diff" -> Diff.highlight         "djangotemplate" -> Djangotemplate.highlight         "doxygen" -> Doxygen.highlight+        "doxygenlua" -> Doxygenlua.highlight         "dtd" -> Dtd.highlight         "eiffel" -> Eiffel.highlight         "email" -> Email.highlight
Text/Highlighting/Kate/Syntax/Actionscript.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "ActionScript 2.0"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("ActionScript 2.0","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -145,14 +141,18 @@    <|>    ((pRegExpr regex_'5b'2e'5d'7b1'2c1'7d >>= withAttribute NormalTok) >>~ pushContext ("ActionScript 2.0","Member"))    <|>-   ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok)))+   ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("ActionScript 2.0","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ActionScript 2.0","Normal") defaultAttributes)))  parseRules ("ActionScript 2.0","String") =   (((pLineContinue >>= withAttribute StringTok))    <|>    ((pHlCStringChar >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ActionScript 2.0","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ActionScript 2.0","String") defaultAttributes)))  parseRules ("ActionScript 2.0","Member") =   (((pRegExpr regex_'5cb'5b'5fa'2dzA'2dZ'5d'5cw'2a'28'3f'3d'5b'5cs'5d'2a'29 >>= withAttribute FunctionTok) >>~ (popContext))@@ -160,17 +160,23 @@    ((popContext) >> currentContext >>= parseRules))  parseRules ("ActionScript 2.0","StaticImports") =-  ((pRegExpr regex_'5cs'2a'2e'2a'24 >>= withAttribute KeywordTok) >>~ (popContext))+  (((pRegExpr regex_'5cs'2a'2e'2a'24 >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ActionScript 2.0","StaticImports")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ActionScript 2.0","StaticImports") defaultAttributes)))  parseRules ("ActionScript 2.0","Imports") =-  ((pRegExpr regex_'5cs'2a'2e'2a'24 >>= withAttribute KeywordTok) >>~ (popContext))+  (((pRegExpr regex_'5cs'2a'2e'2a'24 >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ActionScript 2.0","Imports")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ActionScript 2.0","Imports") defaultAttributes)))  parseRules ("ActionScript 2.0","Commentar 1") =-  pzero+  (currentContext >>= \x -> guard (x == ("ActionScript 2.0","Commentar 1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ActionScript 2.0","Commentar 1") defaultAttributes))  parseRules ("ActionScript 2.0","Commentar 2") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ActionScript 2.0","Commentar 2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ActionScript 2.0","Commentar 2") defaultAttributes)))  parseRules ("Javadoc", _) = Text.Highlighting.Kate.Syntax.Javadoc.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("ActionScript 2.0","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Ada.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Ada"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Ada","Default")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -124,16 +120,20 @@    <|>    ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("Ada","Comment"))    <|>-   ((pAnyChar ":!%&()+,-/.*<=>|" >>= withAttribute NormalTok)))+   ((pAnyChar ":!%&()+,-/.*<=>|" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ada","Default")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ada","Default") defaultAttributes)))  parseRules ("Ada","Region Marker") =-  pzero+  (currentContext >>= \x -> guard (x == ("Ada","Region Marker")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ada","Region Marker") defaultAttributes))  parseRules ("Ada","String") =-  ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+  (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ada","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ada","String") defaultAttributes)))  parseRules ("Ada","Comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("Ada","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ada","Comment") defaultAttributes))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Ada","Default") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Alert.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Alerts"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Alerts","Normal Text")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -62,7 +58,9 @@ defaultAttributes = [(("Alerts","Normal Text"),NormalTok)]  parseRules ("Alerts","Normal Text") =-  ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_alerts >>= withAttribute AlertTok))+  (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_alerts >>= withAttribute AlertTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Alerts","Normal Text")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Alerts","Normal Text") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Alerts","Normal Text") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Alert_indent.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Alerts_indent"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Alerts_indent","Normal Text")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -62,7 +58,9 @@ defaultAttributes = [(("Alerts_indent","Normal Text"),NormalTok)]  parseRules ("Alerts_indent","Normal Text") =-  ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_alerts >>= withAttribute AlertTok))+  (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_alerts >>= withAttribute AlertTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Alerts_indent","Normal Text")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Alerts_indent","Normal Text") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Alerts_indent","Normal Text") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Apache.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Apache Configuration"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Apache Configuration","apache")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -88,19 +84,25 @@    <|>    ((pRegExpr regex_'3c'2f'5cw'2b >>= withAttribute FunctionTok) >>~ pushContext ("Apache Configuration","Container Close"))    <|>-   ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("Apache Configuration","Comment")))+   ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("Apache Configuration","Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("Apache Configuration","apache")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Apache Configuration","apache") defaultAttributes)))  parseRules ("Apache Configuration","String Directives") =   (((pRegExpr regex_'5b'5e'23'5d'2a >>= withAttribute StringTok))    <|>-   ((parseRules ("Apache Configuration","Comment Alert"))))+   ((parseRules ("Apache Configuration","Comment Alert")))+   <|>+   (currentContext >>= \x -> guard (x == ("Apache Configuration","String Directives")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Apache Configuration","String Directives") defaultAttributes)))  parseRules ("Apache Configuration","Integer Directives") =   (((pFloat >>= withAttribute FloatTok) >>~ pushContext ("Apache Configuration","Integer Directives"))    <|>    ((pInt >>= withAttribute FloatTok) >>~ pushContext ("Apache Configuration","Integer Directives"))    <|>-   ((parseRules ("Apache Configuration","Comment Alert"))))+   ((parseRules ("Apache Configuration","Comment Alert")))+   <|>+   (currentContext >>= \x -> guard (x == ("Apache Configuration","Integer Directives")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Apache Configuration","Integer Directives") defaultAttributes)))  parseRules ("Apache Configuration","Alternative Directives") =   (((pKeyword " \n\t.():!+-<=>%&*/;?[]^{|}~\\" list_Alternates >>= withAttribute KeywordTok))@@ -109,31 +111,41 @@    <|>    ((pDetectChar False '+' >>= withAttribute KeywordTok))    <|>-   ((parseRules ("Apache Configuration","Comment Alert"))))+   ((parseRules ("Apache Configuration","Comment Alert")))+   <|>+   (currentContext >>= \x -> guard (x == ("Apache Configuration","Alternative Directives")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Apache Configuration","Alternative Directives") defaultAttributes)))  parseRules ("Apache Configuration","Comment") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Apache Configuration","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Apache Configuration","Comment") defaultAttributes)))  parseRules ("Apache Configuration","Container Open") =   (((pDetectChar False '>' >>= withAttribute FunctionTok) >>~ pushContext ("Apache Configuration","Alert"))    <|>    ((pRegExpr regex_'5b'5e'23'3e'5d'2a >>= withAttribute OtherTok))    <|>-   ((parseRules ("Apache Configuration","Comment Alert"))))+   ((parseRules ("Apache Configuration","Comment Alert")))+   <|>+   (currentContext >>= \x -> guard (x == ("Apache Configuration","Container Open")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Apache Configuration","Container Open") defaultAttributes)))  parseRules ("Apache Configuration","Container Close") =-  ((pDetectChar False '>' >>= withAttribute FunctionTok) >>~ pushContext ("Apache Configuration","Alert"))+  (((pDetectChar False '>' >>= withAttribute FunctionTok) >>~ pushContext ("Apache Configuration","Alert"))+   <|>+   (currentContext >>= \x -> guard (x == ("Apache Configuration","Container Close")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Apache Configuration","Container Close") defaultAttributes)))  parseRules ("Apache Configuration","Comment Alert") =-  ((pDetectChar False '#' >>= withAttribute ErrorTok) >>~ pushContext ("Apache Configuration","Alert"))+  (((pDetectChar False '#' >>= withAttribute ErrorTok) >>~ pushContext ("Apache Configuration","Alert"))+   <|>+   (currentContext >>= \x -> guard (x == ("Apache Configuration","Comment Alert")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Apache Configuration","Comment Alert") defaultAttributes)))  parseRules ("Apache Configuration","Alert") =-  pzero+  (currentContext >>= \x -> guard (x == ("Apache Configuration","Alert")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Apache Configuration","Alert") defaultAttributes))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Apache Configuration","apache") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Asn1.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "ASN.1"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("ASN.1","Normal Text")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -68,10 +64,12 @@    <|>    ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_types >>= withAttribute DataTypeTok))    <|>-   ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("ASN.1","Comment")))+   ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("ASN.1","Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("ASN.1","Normal Text")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASN.1","Normal Text") defaultAttributes)))  parseRules ("ASN.1","Comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("ASN.1","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASN.1","Comment") defaultAttributes))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("ASN.1","Normal Text") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Asp.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "ASP"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("ASP","nosource")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -117,7 +113,9 @@    <|>    ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5ba'2dzA'2dZ'5f'3a'5d'5ba'2dzA'2dZ0'2d9'2e'5f'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("ASP","htmltag"))    <|>-   ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("ASP","htmlcomment")))+   ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("ASP","htmlcomment"))+   <|>+   (currentContext >>= \x -> guard (x == ("ASP","nosource")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASP","nosource") defaultAttributes)))  parseRules ("ASP","aspsource") =   (((pString False "%>" >>= withAttribute KeywordTok) >>~ (popContext))@@ -198,10 +196,14 @@    <|>    ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_control_structures >>= withAttribute KeywordTok))    <|>-   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_functions >>= withAttribute KeywordTok)))+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_functions >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("ASP","aspsource")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASP","aspsource") defaultAttributes)))  parseRules ("ASP","asp_onelinecomment") =-  ((pString False "%>" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+  (((pString False "%>" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ASP","asp_onelinecomment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASP","asp_onelinecomment") defaultAttributes)))  parseRules ("ASP","doublequotestring") =   (((pDetect2Chars False '"' '"' >>= withAttribute KeywordTok))@@ -210,12 +212,16 @@    <|>    ((pRegExpr regex_'5c'5cx'5b0'2d9A'2dFa'2df'5d'7b1'2c2'7d >>= withAttribute KeywordTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ASP","doublequotestring")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASP","doublequotestring") defaultAttributes)))  parseRules ("ASP","singlequotestring") =   (((pDetect2Chars False '\'' '\'' >>= withAttribute KeywordTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ASP","singlequotestring")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASP","singlequotestring") defaultAttributes)))  parseRules ("ASP","htmltag") =   (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext))@@ -226,7 +232,9 @@    <|>    ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource"))    <|>-   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("ASP","identifiers")))+   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("ASP","identifiers"))+   <|>+   (currentContext >>= \x -> guard (x == ("ASP","htmltag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASP","htmltag") defaultAttributes)))  parseRules ("ASP","htmlcomment") =   (((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource"))@@ -235,28 +243,36 @@    <|>    ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("ASP","identifiers")))+   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("ASP","identifiers"))+   <|>+   (currentContext >>= \x -> guard (x == ("ASP","htmlcomment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASP","htmlcomment") defaultAttributes)))  parseRules ("ASP","identifiers") =   (((pRegExpr regex_'5cs'2a'23'3f'5ba'2dzA'2dZ0'2d9'5d'2a >>= withAttribute StringTok) >>~ (popContext))    <|>    ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ pushContext ("ASP","types1"))    <|>-   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("ASP","types2")))+   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("ASP","types2"))+   <|>+   (currentContext >>= \x -> guard (x == ("ASP","identifiers")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASP","identifiers") defaultAttributes)))  parseRules ("ASP","types1") =   (((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource"))    <|>    ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource"))    <|>-   ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ASP","types1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASP","types1") defaultAttributes)))  parseRules ("ASP","types2") =   (((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource"))    <|>    ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource"))    <|>-   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ASP","types2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASP","types2") defaultAttributes)))  parseRules ("ASP","scripts") =   (((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("ASP","scripts_onelinecomment"))@@ -291,13 +307,19 @@    <|>    ((pAnyChar ";()}{:,[]" >>= withAttribute OtherTok))    <|>-   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" Set.empty >>= withAttribute OtherTok)))+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" Set.empty >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("ASP","scripts")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASP","scripts") defaultAttributes)))  parseRules ("ASP","scripts_onelinecomment") =-  ((pRegExpr regex_'3c'5cs'2a'5c'2f'5cs'2ascript'5cs'2a'3e >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+  (((pRegExpr regex_'3c'5cs'2a'5c'2f'5cs'2ascript'5cs'2a'3e >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ASP","scripts_onelinecomment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASP","scripts_onelinecomment") defaultAttributes)))  parseRules ("ASP","twolinecomment") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ASP","twolinecomment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ASP","twolinecomment") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("ASP","nosource") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Awk.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "AWK"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("AWK","Base")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -89,16 +85,22 @@    <|>    ((pInt >>= withAttribute DecValTok))    <|>-   ((pRegExpr regex_'5c'24'5bA'2dZa'2dz0'2d9'5f'5d'2b >>= withAttribute OtherTok)))+   ((pRegExpr regex_'5c'24'5bA'2dZa'2dz0'2d9'5f'5d'2b >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("AWK","Base")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("AWK","Base") defaultAttributes)))  parseRules ("AWK","String") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((pHlCStringChar >>= withAttribute StringTok)))+   ((pHlCStringChar >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("AWK","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("AWK","String") defaultAttributes)))  parseRules ("AWK","Comment") =-  ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+  (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("AWK","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("AWK","Comment") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("AWK","Base") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Bash.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Bash"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Bash","Start")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -185,7 +181,9 @@ defaultAttributes = [(("Bash","Start"),NormalTok),(("Bash","FindAll"),NormalTok),(("Bash","FindMost"),NormalTok),(("Bash","FindComments"),NormalTok),(("Bash","Comment"),CommentTok),(("Bash","FindCommentsParen"),NormalTok),(("Bash","CommentParen"),CommentTok),(("Bash","FindCommentsBackq"),NormalTok),(("Bash","CommentBackq"),CommentTok),(("Bash","FindCommands"),NormalTok),(("Bash","FindOthers"),NormalTok),(("Bash","FindStrings"),NormalTok),(("Bash","FindSubstitutions"),NormalTok),(("Bash","FindTests"),NormalTok),(("Bash","ExprDblParen"),NormalTok),(("Bash","ExprDblParenSubst"),NormalTok),(("Bash","ExprSubParen"),NormalTok),(("Bash","ExprBracket"),NormalTok),(("Bash","ExprDblBracket"),NormalTok),(("Bash","Group"),NormalTok),(("Bash","SubShell"),NormalTok),(("Bash","Assign"),NormalTok),(("Bash","AssignArray"),NormalTok),(("Bash","AssignSubscr"),NormalTok),(("Bash","Subscript"),OtherTok),(("Bash","FunctionDef"),FunctionTok),(("Bash","VarName"),NormalTok),(("Bash","ProcessSubst"),NormalTok),(("Bash","StringSQ"),StringTok),(("Bash","StringDQ"),StringTok),(("Bash","StringEsc"),StringTok),(("Bash","VarBrace"),ErrorTok),(("Bash","VarAlt"),NormalTok),(("Bash","VarSubst"),NormalTok),(("Bash","VarSubst2"),NormalTok),(("Bash","VarSub"),ErrorTok),(("Bash","VarSub2"),ErrorTok),(("Bash","SubstFile"),NormalTok),(("Bash","SubstCommand"),NormalTok),(("Bash","SubstBackq"),NormalTok),(("Bash","Case"),NormalTok),(("Bash","CaseIn"),NormalTok),(("Bash","CaseExpr"),NormalTok),(("Bash","HereDoc"),NormalTok),(("Bash","HereDocRemainder"),NormalTok),(("Bash","HereDocQ"),NormalTok),(("Bash","HereDocNQ"),NormalTok),(("Bash","HereDocIQ"),NormalTok),(("Bash","HereDocINQ"),NormalTok)]  parseRules ("Bash","Start") =-  ((parseRules ("Bash","FindAll")))+  (((parseRules ("Bash","FindAll")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","Start")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","Start") defaultAttributes)))  parseRules ("Bash","FindAll") =   (((parseRules ("Bash","FindComments")))@@ -196,7 +194,9 @@    <|>    ((parseRules ("Bash","FindSubstitutions")))    <|>-   ((parseRules ("Bash","FindOthers"))))+   ((parseRules ("Bash","FindOthers")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","FindAll")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","FindAll") defaultAttributes)))  parseRules ("Bash","FindMost") =   (((parseRules ("Bash","FindComments")))@@ -205,35 +205,49 @@    <|>    ((parseRules ("Bash","FindSubstitutions")))    <|>-   ((parseRules ("Bash","FindOthers"))))+   ((parseRules ("Bash","FindOthers")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","FindMost")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","FindMost") defaultAttributes)))  parseRules ("Bash","FindComments") =   (((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("Bash","Comment"))    <|>-   ((pRegExpr regex_'5b'5cs'3b'5d'28'3f'3d'23'29 >>= withAttribute NormalTok) >>~ pushContext ("Bash","Comment")))+   ((pRegExpr regex_'5b'5cs'3b'5d'28'3f'3d'23'29 >>= withAttribute NormalTok) >>~ pushContext ("Bash","Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","FindComments")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","FindComments") defaultAttributes)))  parseRules ("Bash","Comment") =-  ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+  (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","Comment") defaultAttributes)))  parseRules ("Bash","FindCommentsParen") =   (((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("Bash","CommentParen"))    <|>-   ((pRegExpr regex_'5b'5cs'3b'5d'28'3f'3d'23'29 >>= withAttribute NormalTok) >>~ pushContext ("Bash","CommentParen")))+   ((pRegExpr regex_'5b'5cs'3b'5d'28'3f'3d'23'29 >>= withAttribute NormalTok) >>~ pushContext ("Bash","CommentParen"))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","FindCommentsParen")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","FindCommentsParen") defaultAttributes)))  parseRules ("Bash","CommentParen") =   (((pRegExpr regex_'5b'5e'29'5d'28'3f'3d'5c'29'29 >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","CommentParen")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","CommentParen") defaultAttributes)))  parseRules ("Bash","FindCommentsBackq") =   (((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("Bash","CommentBackq"))    <|>-   ((pRegExpr regex_'5b'5cs'3b'5d'28'3f'3d'23'29 >>= withAttribute NormalTok) >>~ pushContext ("Bash","CommentBackq")))+   ((pRegExpr regex_'5b'5cs'3b'5d'28'3f'3d'23'29 >>= withAttribute NormalTok) >>~ pushContext ("Bash","CommentBackq"))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","FindCommentsBackq")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","FindCommentsBackq") defaultAttributes)))  parseRules ("Bash","CommentBackq") =   (((pRegExpr regex_'5b'5e'60'5d'28'3f'3d'60'29 >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","CommentBackq")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","CommentBackq") defaultAttributes)))  parseRules ("Bash","FindCommands") =   (((pDetect2Chars False '(' '(' >>= withAttribute KeywordTok) >>~ pushContext ("Bash","ExprDblParen"))@@ -292,7 +306,9 @@    <|>    ((pRegExpr regex_'28'5b'7c'26'5d'29'5c1'3f >>= withAttribute KeywordTok))    <|>-   ((pRegExpr regex_'5bA'2dZa'2dz'5f'3a'5d'5bA'2dZa'2dz0'2d9'5f'3a'23'25'40'2d'5d'2a'5cs'2a'5c'28'5c'29 >>= withAttribute FunctionTok)))+   ((pRegExpr regex_'5bA'2dZa'2dz'5f'3a'5d'5bA'2dZa'2dz0'2d9'5f'3a'23'25'40'2d'5d'2a'5cs'2a'5c'28'5c'29 >>= withAttribute FunctionTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","FindCommands")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","FindCommands") defaultAttributes)))  parseRules ("Bash","FindOthers") =   (((pRegExpr regex_'5c'5c'5b'5d'5b'3b'5c'5c'24'60'7b'7d'28'29'7c'26'3c'3e'2a_'5d >>= withAttribute DataTypeTok))@@ -305,7 +321,9 @@    <|>    ((pRegExpr regex_'7e'5cw'2a >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'2f'28'5b'5cw'5f'40'2e'25'2a'3f'2b'2d'5d'7c'5c'5c_'29'2a'28'3f'3d'28'5b'5cs'2f'29'3a'3b'24'60'27'22'5d'7c'24'29'29 >>= withAttribute NormalTok)))+   ((pRegExpr regex_'2f'28'5b'5cw'5f'40'2e'25'2a'3f'2b'2d'5d'7c'5c'5c_'29'2a'28'3f'3d'28'5b'5cs'2f'29'3a'3b'24'60'27'22'5d'7c'24'29'29 >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","FindOthers")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","FindOthers") defaultAttributes)))  parseRules ("Bash","FindStrings") =   (((pDetect2Chars False '*' '\'' >>= withAttribute DataTypeTok))@@ -318,7 +336,9 @@    <|>    ((pDetect2Chars False '$' '\'' >>= withAttribute StringTok) >>~ pushContext ("Bash","StringEsc"))    <|>-   ((pDetect2Chars False '$' '"' >>= withAttribute StringTok) >>~ pushContext ("Bash","StringDQ")))+   ((pDetect2Chars False '$' '"' >>= withAttribute StringTok) >>~ pushContext ("Bash","StringDQ"))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","FindStrings")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","FindStrings") defaultAttributes)))  parseRules ("Bash","FindSubstitutions") =   (((pRegExpr regex_'5c'24'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'5c'5b >>= withAttribute OtherTok) >>~ pushContext ("Bash","Subscript"))@@ -345,7 +365,9 @@    <|>    ((pDetectChar False '`' >>= withAttribute KeywordTok) >>~ pushContext ("Bash","SubstBackq"))    <|>-   ((pRegExpr regex_'5c'5c'5b'60'24'5c'5c'5d >>= withAttribute DataTypeTok)))+   ((pRegExpr regex_'5c'5c'5b'60'24'5c'5c'5d >>= withAttribute DataTypeTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","FindSubstitutions")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","FindSubstitutions") defaultAttributes)))  parseRules ("Bash","FindTests") =   (((pRegExpr regex_'2d'5babcdefghkprstuwxOGLSNozn'5d'28'3f'3d'5cs'29 >>= withAttribute OtherTok))@@ -354,28 +376,36 @@    <|>    ((pRegExpr regex_'28'5b'21'3d'5d'3d'3f'7c'5b'3e'3c'5d'29'28'3f'3d'5cs'29 >>= withAttribute OtherTok))    <|>-   ((pRegExpr regex_'2d'28eq'7cne'7c'5bgl'5d'5bte'5d'29'28'3f'3d'5cs'29 >>= withAttribute OtherTok)))+   ((pRegExpr regex_'2d'28eq'7cne'7c'5bgl'5d'5bte'5d'29'28'3f'3d'5cs'29 >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","FindTests")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","FindTests") defaultAttributes)))  parseRules ("Bash","ExprDblParen") =   (((pDetect2Chars False ')' ')' >>= withAttribute KeywordTok) >>~ (popContext))    <|>    ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Bash","ExprSubParen"))    <|>-   ((parseRules ("Bash","FindMost"))))+   ((parseRules ("Bash","FindMost")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","ExprDblParen")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","ExprDblParen") defaultAttributes)))  parseRules ("Bash","ExprDblParenSubst") =   (((pDetect2Chars False ')' ')' >>= withAttribute OtherTok) >>~ (popContext))    <|>    ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Bash","ExprSubParen"))    <|>-   ((parseRules ("Bash","FindMost"))))+   ((parseRules ("Bash","FindMost")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","ExprDblParenSubst")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","ExprDblParenSubst") defaultAttributes)))  parseRules ("Bash","ExprSubParen") =   (((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>    ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Bash","ExprSubParen"))    <|>-   ((parseRules ("Bash","FindMost"))))+   ((parseRules ("Bash","FindMost")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","ExprSubParen")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","ExprSubParen") defaultAttributes)))  parseRules ("Bash","ExprBracket") =   (((pRegExpr regex_'5cs'5c'5d'28'3f'3d'28'24'7c'5b'5cs'3b'7c'26'5d'29'29 >>= withAttribute KeywordTok) >>~ (popContext))@@ -386,7 +416,9 @@    <|>    ((parseRules ("Bash","FindTests")))    <|>-   ((parseRules ("Bash","FindMost"))))+   ((parseRules ("Bash","FindMost")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","ExprBracket")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","ExprBracket") defaultAttributes)))  parseRules ("Bash","ExprDblBracket") =   (((pRegExpr regex_'5cs'5c'5d'5c'5d'28'3f'3d'28'24'7c'5b'5cs'3b'7c'26'5d'29'29 >>= withAttribute KeywordTok) >>~ (popContext))@@ -397,17 +429,23 @@    <|>    ((parseRules ("Bash","FindTests")))    <|>-   ((parseRules ("Bash","FindMost"))))+   ((parseRules ("Bash","FindMost")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","ExprDblBracket")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","ExprDblBracket") defaultAttributes)))  parseRules ("Bash","Group") =   (((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("Bash","FindAll"))))+   ((parseRules ("Bash","FindAll")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","Group")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","Group") defaultAttributes)))  parseRules ("Bash","SubShell") =   (((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("Bash","FindAll"))))+   ((parseRules ("Bash","FindAll")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","SubShell")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","SubShell") defaultAttributes)))  parseRules ("Bash","Assign") =   (((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext ("Bash","AssignArray"))@@ -429,7 +467,9 @@    <|>    ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("Bash","Assign"))    <|>-   ((parseRules ("Bash","FindMost"))))+   ((parseRules ("Bash","FindMost")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","AssignArray")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","AssignArray") defaultAttributes)))  parseRules ("Bash","AssignSubscr") =   (((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext ("Bash","Subscript"))@@ -453,7 +493,9 @@    <|>    ((parseRules ("Bash","FindSubstitutions")))    <|>-   ((parseRules ("Bash","FindOthers"))))+   ((parseRules ("Bash","FindOthers")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","Subscript")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","Subscript") defaultAttributes)))  parseRules ("Bash","FunctionDef") =   (((pRegExpr regex_'5cs'2b'5bA'2dZa'2dz'5f'3a'5d'5bA'2dZa'2dz0'2d9'5f'3a'23'25'40'2d'5d'2a'28'5cs'2a'5c'28'5c'29'29'3f >>= withAttribute FunctionTok) >>~ (popContext))@@ -488,24 +530,32 @@    <|>    ((parseRules ("Bash","FindSubstitutions")))    <|>-   ((parseRules ("Bash","FindOthers"))))+   ((parseRules ("Bash","FindOthers")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","ProcessSubst")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","ProcessSubst") defaultAttributes)))  parseRules ("Bash","StringSQ") =-  ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+  (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","StringSQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","StringSQ") defaultAttributes)))  parseRules ("Bash","StringDQ") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>    ((pRegExpr regex_'5c'5c'5b'60'22'5c'5c'24'5cn'5d >>= withAttribute DataTypeTok))    <|>-   ((parseRules ("Bash","FindSubstitutions"))))+   ((parseRules ("Bash","FindSubstitutions")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","StringDQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","StringDQ") defaultAttributes)))  parseRules ("Bash","StringEsc") =   (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))    <|>    ((pRegExpr regex_'5c'5c'5babefnrtv'5c'5c'27'5d >>= withAttribute DataTypeTok))    <|>-   ((pRegExpr regex_'5c'5c'28'5b0'2d7'5d'7b1'2c3'7d'7cx'5bA'2dFa'2df0'2d9'5d'7b1'2c2'7d'7cc'2e'29 >>= withAttribute DataTypeTok)))+   ((pRegExpr regex_'5c'5c'28'5b0'2d7'5d'7b1'2c3'7d'7cx'5bA'2dFa'2df0'2d9'5d'7b1'2c2'7d'7cc'2e'29 >>= withAttribute DataTypeTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","StringEsc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","StringEsc") defaultAttributes)))  parseRules ("Bash","VarBrace") =   (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext))@@ -516,14 +566,18 @@    <|>    ((pRegExpr regex_'2f'2f'3f >>= withAttribute OtherTok) >>~ pushContext ("Bash","VarSubst"))    <|>-   ((pDetectChar False ':' >>= withAttribute OtherTok) >>~ pushContext ("Bash","VarSub")))+   ((pDetectChar False ':' >>= withAttribute OtherTok) >>~ pushContext ("Bash","VarSub"))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","VarBrace")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","VarBrace") defaultAttributes)))  parseRules ("Bash","VarAlt") =   (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext))    <|>    ((parseRules ("Bash","FindStrings")))    <|>-   ((parseRules ("Bash","FindSubstitutions"))))+   ((parseRules ("Bash","FindSubstitutions")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","VarAlt")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","VarAlt") defaultAttributes)))  parseRules ("Bash","VarSubst") =   (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext))@@ -532,14 +586,18 @@    <|>    ((parseRules ("Bash","FindStrings")))    <|>-   ((parseRules ("Bash","FindSubstitutions"))))+   ((parseRules ("Bash","FindSubstitutions")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","VarSubst")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","VarSubst") defaultAttributes)))  parseRules ("Bash","VarSubst2") =   (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext >> popContext))    <|>    ((parseRules ("Bash","FindStrings")))    <|>-   ((parseRules ("Bash","FindSubstitutions"))))+   ((parseRules ("Bash","FindSubstitutions")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","VarSubst2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","VarSubst2") defaultAttributes)))  parseRules ("Bash","VarSub") =   (((pDetectChar False ':' >>= withAttribute OtherTok) >>~ pushContext ("Bash","VarSub2"))@@ -550,7 +608,9 @@    <|>    ((pRegExpr regex_'5b0'2d9'5d'2b'28'3f'3d'5b'3a'7d'5d'29 >>= withAttribute OtherTok))    <|>-   ((parseRules ("Bash","FindSubstitutions"))))+   ((parseRules ("Bash","FindSubstitutions")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","VarSub")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","VarSub") defaultAttributes)))  parseRules ("Bash","VarSub2") =   (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext >> popContext))@@ -559,7 +619,9 @@    <|>    ((pRegExpr regex_'5b0'2d9'5d'28'3f'3d'5b'3a'7d'5d'29 >>= withAttribute OtherTok))    <|>-   ((parseRules ("Bash","FindSubstitutions"))))+   ((parseRules ("Bash","FindSubstitutions")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","VarSub2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","VarSub2") defaultAttributes)))  parseRules ("Bash","SubstFile") =   (((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ (popContext))@@ -570,7 +632,9 @@    <|>    ((parseRules ("Bash","FindSubstitutions")))    <|>-   ((parseRules ("Bash","FindOthers"))))+   ((parseRules ("Bash","FindOthers")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","SubstFile")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","SubstFile") defaultAttributes)))  parseRules ("Bash","SubstCommand") =   (((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext))@@ -583,7 +647,9 @@    <|>    ((parseRules ("Bash","FindSubstitutions")))    <|>-   ((parseRules ("Bash","FindOthers"))))+   ((parseRules ("Bash","FindOthers")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","SubstCommand")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","SubstCommand") defaultAttributes)))  parseRules ("Bash","SubstBackq") =   (((pDetectChar False '`' >>= withAttribute KeywordTok) >>~ (popContext))@@ -596,12 +662,16 @@    <|>    ((parseRules ("Bash","FindSubstitutions")))    <|>-   ((parseRules ("Bash","FindOthers"))))+   ((parseRules ("Bash","FindOthers")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","SubstBackq")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","SubstBackq") defaultAttributes)))  parseRules ("Bash","Case") =   (((pRegExpr regex_'5csin'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Bash","CaseIn"))    <|>-   ((parseRules ("Bash","FindMost"))))+   ((parseRules ("Bash","FindMost")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","Case")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","Case") defaultAttributes)))  parseRules ("Bash","CaseIn") =   (((pRegExpr regex_'5cbesac'28'3f'3d'24'7c'5b'5cs'3b'29'5d'29 >>= withAttribute KeywordTok) >>~ (popContext >> popContext))@@ -610,14 +680,18 @@    <|>    ((pAnyChar "(|" >>= withAttribute KeywordTok))    <|>-   ((parseRules ("Bash","FindMost"))))+   ((parseRules ("Bash","FindMost")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","CaseIn")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","CaseIn") defaultAttributes)))  parseRules ("Bash","CaseExpr") =   (((pDetect2Chars False ';' ';' >>= withAttribute KeywordTok) >>~ (popContext))    <|>    ((pFirstNonSpace >> lookAhead (pRegExpr regex_esac'28'3f'3d'24'7c'5b'5cs'3b'29'5d'29) >> (popContext) >> currentContext >>= parseRules))    <|>-   ((parseRules ("Bash","FindAll"))))+   ((parseRules ("Bash","FindAll")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","CaseExpr")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","CaseExpr") defaultAttributes)))  parseRules ("Bash","HereDoc") =   (((lookAhead (pRegExpr regex_'28'3c'3c'2d'5cs'2a'22'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'22'29) >> pushContext ("Bash","HereDocIQ") >> currentContext >>= parseRules))@@ -636,35 +710,47 @@    <|>    ((lookAhead (pRegExpr regex_'28'3c'3c'5cs'2a'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'29) >> pushContext ("Bash","HereDocNQ") >> currentContext >>= parseRules))    <|>-   ((pString False "<<" >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pString False "<<" >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","HereDoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","HereDoc") defaultAttributes)))  parseRules ("Bash","HereDocRemainder") =-  ((parseRules ("Bash","FindAll")))+  (((parseRules ("Bash","FindAll")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","HereDocRemainder")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","HereDocRemainder") defaultAttributes)))  parseRules ("Bash","HereDocQ") =   (((pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ pushContext ("Bash","HereDocRemainder"))    <|>-   ((pColumn 0 >> pRegExprDynamic "%2\\b" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)))+   ((pColumn 0 >> pRegExprDynamic "%2\\b" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","HereDocQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","HereDocQ") defaultAttributes)))  parseRules ("Bash","HereDocNQ") =   (((pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ pushContext ("Bash","HereDocRemainder"))    <|>    ((pColumn 0 >> pRegExprDynamic "%2\\b" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("Bash","FindSubstitutions"))))+   ((parseRules ("Bash","FindSubstitutions")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","HereDocNQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","HereDocNQ") defaultAttributes)))  parseRules ("Bash","HereDocIQ") =   (((pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ pushContext ("Bash","HereDocRemainder"))    <|>-   ((pColumn 0 >> pRegExprDynamic "\\t*%2\\b" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)))+   ((pColumn 0 >> pRegExprDynamic "\\t*%2\\b" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","HereDocIQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","HereDocIQ") defaultAttributes)))  parseRules ("Bash","HereDocINQ") =   (((pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ pushContext ("Bash","HereDocRemainder"))    <|>    ((pColumn 0 >> pRegExprDynamic "\\t*%2\\b" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("Bash","FindSubstitutions"))))+   ((parseRules ("Bash","FindSubstitutions")))+   <|>+   (currentContext >>= \x -> guard (x == ("Bash","HereDocINQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Bash","HereDocINQ") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Bash","Start") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Bibtex.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "BibTeX"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("BibTeX","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -81,7 +77,9 @@    <|>    ((pString False "@preamble" >>= withAttribute FunctionTok) >>~ pushContext ("BibTeX","PreambleCommand"))    <|>-   ((pString False "@comment" >>= withAttribute CommentTok)))+   ((pString False "@comment" >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("BibTeX","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("BibTeX","Normal") defaultAttributes)))  parseRules ("BibTeX","PreambleCommand") =   (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("BibTeX","CurlyBracket"))@@ -102,7 +100,9 @@    <|>    ((pDetectChar False ',' >>= withAttribute NormalTok) >>~ pushContext ("BibTeX","Field"))    <|>-   ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)))+   ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("BibTeX","Entry")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("BibTeX","Entry") defaultAttributes)))  parseRules ("BibTeX","Field") =   (((pFirstNonSpace >> pRegExpr regex_'5ba'2dzA'2dZ0'2d9'5c'2d'5f'5c'2e'5d'2b >>= withAttribute DataTypeTok))@@ -129,7 +129,9 @@    <|>    ((pDetectSpaces >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'2e >>= withAttribute AlertTok)))+   ((pRegExpr regex_'2e >>= withAttribute AlertTok))+   <|>+   (currentContext >>= \x -> guard (x == ("BibTeX","Field")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("BibTeX","Field") defaultAttributes)))  parseRules ("BibTeX","CurlyBracket") =   (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("BibTeX","CurlyBracket"))@@ -138,12 +140,16 @@    <|>    ((pRegExpr regex_'7d'24 >>= withAttribute NormalTok) >>~ (popContext >> popContext))    <|>-   ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)))+   ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("BibTeX","CurlyBracket")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("BibTeX","CurlyBracket") defaultAttributes)))  parseRules ("BibTeX","QuotedText") =   (((pDetectChar False '"' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5c'5c'28'5ba'2dzA'2dZ'40'5d'2b'7c'5b'5e_'5d'29 >>= withAttribute CharTok)))+   ((pRegExpr regex_'5c'5c'28'5ba'2dzA'2dZ'40'5d'2b'7c'5b'5e_'5d'29 >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("BibTeX","QuotedText")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("BibTeX","QuotedText") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("BibTeX","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Boo.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Boo"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Boo","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -167,21 +163,31 @@    <|>    ((pRegExpr regex_'5b'2b'2a'2f'25'5c'7c'3d'3b'5c'21'3c'3e'21'5e'26'7e'2d'5d >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'25'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok)))+   ((pRegExpr regex_'25'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Normal") defaultAttributes)))  parseRules ("Boo","parenthesised") =-  ((parseRules ("Boo","Normal")))+  (((parseRules ("Boo","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","parenthesised")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","parenthesised") defaultAttributes)))  parseRules ("Boo","Quasi-Quotation") =-  ((parseRules ("Boo","Normal")))+  (((parseRules ("Boo","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Quasi-Quotation")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Quasi-Quotation") defaultAttributes)))  parseRules ("Boo","Tripple A-comment") =-  ((pString False "'''" >>= withAttribute CommentTok) >>~ (popContext))+  (((pString False "'''" >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Tripple A-comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Tripple A-comment") defaultAttributes)))  parseRules ("Boo","Tripple Q-comment") =   (((pHlCChar >>= withAttribute CommentTok))    <|>-   ((pRegExpr regex_'22'22'22 >>= withAttribute CommentTok) >>~ (popContext)))+   ((pRegExpr regex_'22'22'22 >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Tripple Q-comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Tripple Q-comment") defaultAttributes)))  parseRules ("Boo","Tripple A-string") =   (((pHlCStringChar >>= withAttribute CharTok))@@ -190,7 +196,9 @@    <|>    ((pRegExpr regex_'25'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'27'27'27 >>= withAttribute StringTok) >>~ (popContext)))+   ((pRegExpr regex_'27'27'27 >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Tripple A-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Tripple A-string") defaultAttributes)))  parseRules ("Boo","Raw Tripple A-string") =   (((pHlCStringChar >>= withAttribute StringTok))@@ -199,7 +207,9 @@    <|>    ((pRegExpr regex_'25'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'27'27'27 >>= withAttribute StringTok) >>~ (popContext)))+   ((pRegExpr regex_'27'27'27 >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Raw Tripple A-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Raw Tripple A-string") defaultAttributes)))  parseRules ("Boo","Tripple Q-string") =   (((pHlCStringChar >>= withAttribute CharTok))@@ -208,7 +218,9 @@    <|>    ((pRegExpr regex_'25'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'22'22'22 >>= withAttribute StringTok) >>~ (popContext)))+   ((pRegExpr regex_'22'22'22 >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Tripple Q-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Tripple Q-string") defaultAttributes)))  parseRules ("Boo","Raw Tripple Q-string") =   (((pHlCStringChar >>= withAttribute StringTok))@@ -217,20 +229,28 @@    <|>    ((pRegExpr regex_'25'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'22'22'22 >>= withAttribute StringTok) >>~ (popContext)))+   ((pRegExpr regex_'22'22'22 >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Raw Tripple Q-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Raw Tripple Q-string") defaultAttributes)))  parseRules ("Boo","Comment SlashSlash") =-  ((pLineContinue >>= withAttribute CommentTok))+  (((pLineContinue >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Comment SlashSlash")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Comment SlashSlash") defaultAttributes)))  parseRules ("Boo","Single A-comment") =   (((pHlCStringChar >>= withAttribute CommentTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute CommentTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Single A-comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Single A-comment") defaultAttributes)))  parseRules ("Boo","Single Q-comment") =   (((pHlCStringChar >>= withAttribute CommentTok))    <|>-   ((pDetectChar False '"' >>= withAttribute CommentTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Single Q-comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Single Q-comment") defaultAttributes)))  parseRules ("Boo","Single A-string") =   (((pHlCStringChar >>= withAttribute CharTok))@@ -239,7 +259,9 @@    <|>    ((pRegExpr regex_'25'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Single A-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Single A-string") defaultAttributes)))  parseRules ("Boo","Single Q-string") =   (((pHlCStringChar >>= withAttribute CharTok))@@ -248,7 +270,9 @@    <|>    ((pRegExpr regex_'25'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Single Q-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Single Q-string") defaultAttributes)))  parseRules ("Boo","Raw A-string") =   (((pHlCStringChar >>= withAttribute StringTok))@@ -257,7 +281,9 @@    <|>    ((pRegExpr regex_'25'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Raw A-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Raw A-string") defaultAttributes)))  parseRules ("Boo","Raw Q-string") =   (((pHlCStringChar >>= withAttribute StringTok))@@ -266,7 +292,9 @@    <|>    ((pRegExpr regex_'25'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Boo","Raw Q-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Boo","Raw Q-string") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Boo","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/C.hs view
@@ -33,11 +33,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "C"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("C","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -135,27 +131,35 @@    <|>    ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("C","Commentar 2"))    <|>-   ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok)))+   ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("C","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C","Normal") defaultAttributes)))  parseRules ("C","String") =   (((pLineContinue >>= withAttribute StringTok))    <|>    ((pHlCStringChar >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("C","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C","String") defaultAttributes)))  parseRules ("C","Region Marker") =-  pzero+  (currentContext >>= \x -> guard (x == ("C","Region Marker")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C","Region Marker") defaultAttributes))  parseRules ("C","Commentar 1") =   (((pLineContinue >>= withAttribute CommentTok))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("C","Commentar 1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C","Commentar 1") defaultAttributes)))  parseRules ("C","Commentar 2") =   (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("C","Commentar 2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C","Commentar 2") defaultAttributes)))  parseRules ("C","AfterHash") =   (((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'28'3f'3adef'7cndef'29'3f'28'3f'3d'5cs'2b'5cS'29 >>= withAttribute OtherTok) >>~ pushContext ("C","Preprocessor"))@@ -166,7 +170,9 @@    <|>    ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2a'28'3f'3ael'28'3f'3ase'7cif'29'7cinclude'28'3f'3a'5fnext'29'3f'7cdefine'7cundef'7cline'7cerror'7cwarning'7cpragma'29 >>= withAttribute OtherTok) >>~ pushContext ("C","Preprocessor"))    <|>-   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2b'5b0'2d9'5d'2b >>= withAttribute OtherTok) >>~ pushContext ("C","Preprocessor")))+   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2b'5b0'2d9'5d'2b >>= withAttribute OtherTok) >>~ pushContext ("C","Preprocessor"))+   <|>+   (currentContext >>= \x -> guard (x == ("C","AfterHash")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C","AfterHash") defaultAttributes)))  parseRules ("C","Preprocessor") =   (((pLineContinue >>= withAttribute OtherTok))@@ -179,13 +185,19 @@    <|>    ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("C","Commentar/Preprocessor"))    <|>-   ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("C","Commentar 1")))+   ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("C","Commentar 1"))+   <|>+   (currentContext >>= \x -> guard (x == ("C","Preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C","Preprocessor") defaultAttributes)))  parseRules ("C","Define") =-  ((pLineContinue >>= withAttribute OtherTok))+  (((pLineContinue >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("C","Define")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C","Define") defaultAttributes)))  parseRules ("C","Commentar/Preprocessor") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("C","Commentar/Preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C","Commentar/Preprocessor") defaultAttributes)))  parseRules ("C","Outscoped") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -206,7 +218,9 @@    <|>    ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2ael'28'3f'3ase'7cif'29 >>= withAttribute OtherTok) >>~ (popContext))    <|>-   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute OtherTok) >>~ (popContext)))+   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("C","Outscoped")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C","Outscoped") defaultAttributes)))  parseRules ("C","Outscoped intern") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -225,9 +239,11 @@    <|>    ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext ("C","Outscoped intern"))    <|>-   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute CommentTok) >>~ (popContext)))+   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("C","Outscoped intern")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C","Outscoped intern") defaultAttributes)))  parseRules ("Doxygen", _) = Text.Highlighting.Kate.Syntax.Doxygen.parseExpression parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("C","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Changelog.hs view
@@ -30,11 +30,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "ChangeLog"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("ChangeLog","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -68,15 +64,21 @@ parseRules ("ChangeLog","Normal") =   (((pFirstNonSpace >> pDetectChar False '*' >>= withAttribute DecValTok) >>~ pushContext ("ChangeLog","entry"))    <|>-   ((pColumn 0 >> pRegExpr regex_'5cd'5cd'5cd'5cd'5cs'2a'2d'5cs'2a'5cd'5cd'5cs'2a'2d'5cs'2a'5cd'5cd'5cs'2a >>= withAttribute DataTypeTok) >>~ pushContext ("ChangeLog","line")))+   ((pColumn 0 >> pRegExpr regex_'5cd'5cd'5cd'5cd'5cs'2a'2d'5cs'2a'5cd'5cd'5cs'2a'2d'5cs'2a'5cd'5cd'5cs'2a >>= withAttribute DataTypeTok) >>~ pushContext ("ChangeLog","line"))+   <|>+   (currentContext >>= \x -> guard (x == ("ChangeLog","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ChangeLog","Normal") defaultAttributes)))  parseRules ("ChangeLog","line") =   (((pRegExpr regex_'28'5cw'5cs'2a'29'2b >>= withAttribute KeywordTok))    <|>-   ((pRegExpr regex_'3c'2e'2a'3e'5cs'2a'24 >>= withAttribute OtherTok) >>~ (popContext)))+   ((pRegExpr regex_'3c'2e'2a'3e'5cs'2a'24 >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ChangeLog","line")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ChangeLog","line") defaultAttributes)))  parseRules ("ChangeLog","entry") =-  ((pRegExpr regex_'2e'2a'3a >>= withAttribute DecValTok) >>~ (popContext))+  (((pRegExpr regex_'2e'2a'3a >>= withAttribute DecValTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ChangeLog","entry")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ChangeLog","entry") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("ChangeLog","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Clojure.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Clojure"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Clojure","Level0")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -84,7 +80,9 @@    <|>    ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level1"))    <|>-   ((parseRules ("Clojure","Default"))))+   ((parseRules ("Clojure","Default")))+   <|>+   (currentContext >>= \x -> guard (x == ("Clojure","Level0")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Clojure","Level0") defaultAttributes)))  parseRules ("Clojure","Default") =   (((pRegExpr regex_'3b'2e'2a'24 >>= withAttribute CommentTok))@@ -125,10 +123,14 @@    <|>    ((pInt >>= withAttribute DecValTok))    <|>-   ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level1")))+   ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level1"))+   <|>+   (currentContext >>= \x -> guard (x == ("Clojure","Default")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Clojure","Default") defaultAttributes)))  parseRules ("Clojure","function_decl") =-  ((pRegExpr regex_'5cs'2a'5bA'2dZa'2dz0'2d9'2d'2b'5c'3c'5c'3e'2f'2f'5c'2a'5d'2a'5cs'2a >>= withAttribute FunctionTok) >>~ (popContext))+  (((pRegExpr regex_'5cs'2a'5bA'2dZa'2dz0'2d9'2d'2b'5c'3c'5c'3e'2f'2f'5c'2a'5d'2a'5cs'2a >>= withAttribute FunctionTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Clojure","function_decl")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Clojure","function_decl") defaultAttributes)))  parseRules ("Clojure","SpecialNumber") =   (((pFloat >>= withAttribute FloatTok) >>~ (popContext))@@ -137,14 +139,18 @@    <|>    ((pHlCOct >>= withAttribute BaseNTok) >>~ (popContext))    <|>-   ((pHlCHex >>= withAttribute FloatTok) >>~ (popContext)))+   ((pHlCHex >>= withAttribute FloatTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Clojure","SpecialNumber")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Clojure","SpecialNumber") defaultAttributes)))  parseRules ("Clojure","String") =   (((pRegExpr regex_'23'5c'5c'2e >>= withAttribute CharTok))    <|>    ((pHlCStringChar >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Clojure","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Clojure","String") defaultAttributes)))  parseRules ("Clojure","Level1") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level2"))@@ -153,7 +159,9 @@    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("Clojure","Default"))))+   ((parseRules ("Clojure","Default")))+   <|>+   (currentContext >>= \x -> guard (x == ("Clojure","Level1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Clojure","Level1") defaultAttributes)))  parseRules ("Clojure","Level2") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level3"))@@ -162,7 +170,9 @@    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("Clojure","Default"))))+   ((parseRules ("Clojure","Default")))+   <|>+   (currentContext >>= \x -> guard (x == ("Clojure","Level2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Clojure","Level2") defaultAttributes)))  parseRules ("Clojure","Level3") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level4"))@@ -171,7 +181,9 @@    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("Clojure","Default"))))+   ((parseRules ("Clojure","Default")))+   <|>+   (currentContext >>= \x -> guard (x == ("Clojure","Level3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Clojure","Level3") defaultAttributes)))  parseRules ("Clojure","Level4") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level5"))@@ -180,7 +192,9 @@    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("Clojure","Default"))))+   ((parseRules ("Clojure","Default")))+   <|>+   (currentContext >>= \x -> guard (x == ("Clojure","Level4")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Clojure","Level4") defaultAttributes)))  parseRules ("Clojure","Level5") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level6"))@@ -189,7 +203,9 @@    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("Clojure","Default"))))+   ((parseRules ("Clojure","Default")))+   <|>+   (currentContext >>= \x -> guard (x == ("Clojure","Level5")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Clojure","Level5") defaultAttributes)))  parseRules ("Clojure","Level6") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level1"))@@ -198,7 +214,9 @@    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("Clojure","Default"))))+   ((parseRules ("Clojure","Default")))+   <|>+   (currentContext >>= \x -> guard (x == ("Clojure","Level6")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Clojure","Level6") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Clojure","Level0") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Cmake.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "CMake"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("CMake","Normal Text")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -95,12 +91,16 @@    <|>    ((parseRules ("CMake","Detect Variables")))    <|>-   ((pRegExpr regex_'5cw'2b'5cs'2a'28'3f'3d'5c'28'29 >>= withAttribute FunctionTok) >>~ pushContext ("CMake","Macro Args")))+   ((pRegExpr regex_'5cw'2b'5cs'2a'28'3f'3d'5c'28'29 >>= withAttribute FunctionTok) >>~ pushContext ("CMake","Macro Args"))+   <|>+   (currentContext >>= \x -> guard (x == ("CMake","Normal Text")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CMake","Normal Text") defaultAttributes)))  parseRules ("CMake","Detect Variables") =   (((pRegExpr regex_'5c'24ENV'5c'7b'5cs'2a'5cw'2b'5cs'2a'5c'7d >>= withAttribute FloatTok))    <|>-   ((pRegExpr regex_'5c'24'5c'7b'5cs'2a'5cw'2b'5cs'2a'5c'7d >>= withAttribute DecValTok)))+   ((pRegExpr regex_'5c'24'5c'7b'5cs'2a'5cw'2b'5cs'2a'5c'7d >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("CMake","Detect Variables")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CMake","Detect Variables") defaultAttributes)))  parseRules ("CMake","Command Args") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_special'5fargs >>= withAttribute OtherTok))@@ -111,7 +111,9 @@    <|>    ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_extra'5fproperties >>= withAttribute OtherTok))    <|>-   ((parseRules ("CMake","Macro Args"))))+   ((parseRules ("CMake","Macro Args")))+   <|>+   (currentContext >>= \x -> guard (x == ("CMake","Command Args")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CMake","Command Args") defaultAttributes)))  parseRules ("CMake","Macro Args") =   (((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))@@ -122,18 +124,24 @@    <|>    ((pRegExpr regex_'23'2e'2a'24 >>= withAttribute CommentTok))    <|>-   ((parseRules ("CMake","Detect Variables"))))+   ((parseRules ("CMake","Detect Variables")))+   <|>+   (currentContext >>= \x -> guard (x == ("CMake","Macro Args")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CMake","Macro Args") defaultAttributes)))  parseRules ("CMake","Comment") =-  ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+  (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("CMake","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CMake","Comment") defaultAttributes)))  parseRules ("CMake","String") =   (((pRegExpr regex_'22'28'3f'3d'5b_'29'3b'5d'7c'24'29 >>= withAttribute StringTok) >>~ (popContext))    <|>    ((pRegExpr regex_'5c'5c'5b'22'24n'5c'5c'5d >>= withAttribute CharTok))    <|>-   ((parseRules ("CMake","Detect Variables"))))+   ((parseRules ("CMake","Detect Variables")))+   <|>+   (currentContext >>= \x -> guard (x == ("CMake","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CMake","String") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("CMake","Normal Text") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Coffee.hs view
@@ -33,11 +33,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "CoffeeScript"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("CoffeeScript","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -135,61 +131,83 @@    <|>    ((pRegExpr regex_'2f'28'5b'5e'2f'5c'5c'5cr'5cn'5d'7c'5c'5c'2e'29'2a'2f'5bmig'5d'7b0'2c3'7d >>= withAttribute StringTok))    <|>-   ((pAnyChar "():!%&+,-/.*<=>?[]|~^;{}" >>= withAttribute KeywordTok)))+   ((pAnyChar "():!%&+,-/.*<=>?[]|~^;{}" >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("CoffeeScript","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CoffeeScript","Normal") defaultAttributes)))  parseRules ("CoffeeScript","Multiline Regex") =   (((pHlCStringChar >>= withAttribute StringTok))    <|>    ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("CoffeeScript","Comment"))    <|>-   ((pRegExpr regex_'2f'2f'2f'5bmig'5d'7b0'2c3'7d >>= withAttribute StringTok) >>~ (popContext)))+   ((pRegExpr regex_'2f'2f'2f'5bmig'5d'7b0'2c3'7d >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("CoffeeScript","Multiline Regex")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CoffeeScript","Multiline Regex") defaultAttributes)))  parseRules ("CoffeeScript","Class") =   (((pDetectSpaces >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'5b'40'24'3a'2e'5cw'5c'5b'5c'5d'5d'2b >>= withAttribute DataTypeTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'40'24'3a'2e'5cw'5c'5b'5c'5d'5d'2b >>= withAttribute DataTypeTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("CoffeeScript","Class")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CoffeeScript","Class") defaultAttributes)))  parseRules ("CoffeeScript","Comment") =-  ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd)))+  (((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("CoffeeScript","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CoffeeScript","Comment") defaultAttributes)))  parseRules ("CoffeeScript","Multiline Comment") =   (((pString False "###" >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("CoffeeScript","Multiline Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CoffeeScript","Multiline Comment") defaultAttributes)))  parseRules ("CoffeeScript","String") =   (((pHlCStringChar >>= withAttribute StringTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("CoffeeScript","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CoffeeScript","String") defaultAttributes)))  parseRules ("CoffeeScript","Rich String") =   (((pHlCStringChar >>= withAttribute StringTok))    <|>    ((pDetect2Chars False '#' '{' >>= withAttribute CharTok) >>~ pushContext ("CoffeeScript","Embedding"))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("CoffeeScript","Rich String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CoffeeScript","Rich String") defaultAttributes)))  parseRules ("CoffeeScript","Heredoc") =   (((pHlCStringChar >>= withAttribute StringTok))    <|>-   ((pString False "'''" >>= withAttribute StringTok) >>~ (popContext)))+   ((pString False "'''" >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("CoffeeScript","Heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CoffeeScript","Heredoc") defaultAttributes)))  parseRules ("CoffeeScript","Rich Heredoc") =   (((pHlCStringChar >>= withAttribute StringTok))    <|>    ((pDetect2Chars False '#' '{' >>= withAttribute CharTok) >>~ pushContext ("CoffeeScript","Embedding"))    <|>-   ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ (popContext)))+   ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("CoffeeScript","Rich Heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CoffeeScript","Rich Heredoc") defaultAttributes)))  parseRules ("CoffeeScript","Embedding") =-  ((pDetectChar False '}' >>= withAttribute CharTok) >>~ (popContext))+  (((pDetectChar False '}' >>= withAttribute CharTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("CoffeeScript","Embedding")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CoffeeScript","Embedding") defaultAttributes)))  parseRules ("CoffeeScript","Javascript") =   (((pDetectChar False '`' >>= withAttribute AlertTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Javascript.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Javascript.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("CoffeeScript","Javascript")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CoffeeScript","Javascript") defaultAttributes)))  parseRules ("Alerts_indent", _) = Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression parseRules ("JavaScript", _) = Text.Highlighting.Kate.Syntax.Javascript.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("CoffeeScript","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Coldfusion.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "ColdFusion"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("ColdFusion","Normal Text")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -126,7 +122,9 @@    <|>    ((pRegExpr regex_'3c'5c'2f'3f'5biI'5d'5bmM'5d'5bgG'5d_ >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxImage Tag"))    <|>-   ((pRegExpr regex_'3c'21'3f'5c'2f'3f'5ba'2dzA'2dZ0'2d9'5f'5d'2b >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxTag")))+   ((pRegExpr regex_'3c'21'3f'5c'2f'3f'5ba'2dzA'2dZ0'2d9'5f'5d'2b >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxTag"))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","Normal Text")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","Normal Text") defaultAttributes)))  parseRules ("ColdFusion","ctxCFSCRIPT Tag") =   (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxCFSCRIPT Block"))@@ -135,7 +133,9 @@    <|>    ((pRegExpr regex_'22'5b'5e'22'5d'2a'22 >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok)))+   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxCFSCRIPT Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxCFSCRIPT Tag") defaultAttributes)))  parseRules ("ColdFusion","ctxSCRIPT Tag") =   (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxSCRIPT Block"))@@ -144,7 +144,9 @@    <|>    ((pRegExpr regex_'22'5b'5e'22'5d'2a'22 >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok)))+   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxSCRIPT Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxSCRIPT Tag") defaultAttributes)))  parseRules ("ColdFusion","ctxSTYLE Tag") =   (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxSTYLE Block"))@@ -153,7 +155,9 @@    <|>    ((pRegExpr regex_'22'5b'5e'22'5d'2a'22 >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok)))+   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxSTYLE Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxSTYLE Tag") defaultAttributes)))  parseRules ("ColdFusion","ctxTag") =   (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ (popContext))@@ -162,7 +166,9 @@    <|>    ((pRegExpr regex_'22'5b'5e'22'5d'2a'22 >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok)))+   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxTag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxTag") defaultAttributes)))  parseRules ("ColdFusion","ctxTable Tag") =   (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ (popContext))@@ -171,7 +177,9 @@    <|>    ((pRegExpr regex_'22'5b'5e'22'5d'2a'22 >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok)))+   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxTable Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxTable Tag") defaultAttributes)))  parseRules ("ColdFusion","ctxAnchor Tag") =   (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ (popContext))@@ -180,7 +188,9 @@    <|>    ((pRegExpr regex_'22'5b'5e'22'5d'2a'22 >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok)))+   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxAnchor Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxAnchor Tag") defaultAttributes)))  parseRules ("ColdFusion","ctxImage Tag") =   (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ (popContext))@@ -189,7 +199,9 @@    <|>    ((pRegExpr regex_'22'5b'5e'22'5d'2a'22 >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok)))+   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxImage Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxImage Tag") defaultAttributes)))  parseRules ("ColdFusion","ctxCF Tag") =   (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ (popContext))@@ -198,7 +210,9 @@    <|>    ((pRegExpr regex_'22'5b'5e'22'5d'2a'22 >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok)))+   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxCF Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxCF Tag") defaultAttributes)))  parseRules ("ColdFusion","ctxCustom Tag") =   (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ (popContext))@@ -207,7 +221,9 @@    <|>    ((pRegExpr regex_'22'5b'5e'22'5d'2a'22 >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok)))+   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxCustom Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxCustom Tag") defaultAttributes)))  parseRules ("ColdFusion","ctxCFX Tag") =   (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ (popContext))@@ -216,24 +232,34 @@    <|>    ((pRegExpr regex_'22'5b'5e'22'5d'2a'22 >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok)))+   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxCFX Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxCFX Tag") defaultAttributes)))  parseRules ("ColdFusion","ctxHTML Comment") =   (((pString False "<!---" >>= withAttribute CommentTok) >>~ pushContext ("ColdFusion","ctxCF Comment"))    <|>-   ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext)))+   ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxHTML Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxHTML Comment") defaultAttributes)))  parseRules ("ColdFusion","ctxCF Comment") =-  ((pString False "--->" >>= withAttribute CommentTok) >>~ (popContext))+  (((pString False "--->" >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxCF Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxCF Comment") defaultAttributes)))  parseRules ("ColdFusion","ctxC Style Comment") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxC Style Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxC Style Comment") defaultAttributes)))  parseRules ("ColdFusion","ctxOne Line Comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("ColdFusion","ctxOne Line Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxOne Line Comment") defaultAttributes))  parseRules ("ColdFusion","ctxHTML Entities") =-  ((pDetectChar False ';' >>= withAttribute NormalTok) >>~ (popContext))+  (((pDetectChar False ';' >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxHTML Entities")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxHTML Entities") defaultAttributes)))  parseRules ("ColdFusion","ctxCFSCRIPT Block") =   (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("ColdFusion","ctxC Style Comment"))@@ -256,7 +282,9 @@    <|>    ((pKeyword " \n\t.():!+,<=>%&*/;?[]^{|}~\\" list_CFSCRIPT_Functions >>= withAttribute FunctionTok))    <|>-   ((pRegExpr regex_'3c'2f'5bcC'5d'5bfF'5d'5bsS'5d'5bcC'5d'5brR'5d'5biI'5d'5bpP'5d'5btT'5d'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'3c'2f'5bcC'5d'5bfF'5d'5bsS'5d'5bcC'5d'5brR'5d'5biI'5d'5bpP'5d'5btT'5d'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxCFSCRIPT Block")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxCFSCRIPT Block") defaultAttributes)))  parseRules ("ColdFusion","ctxSCRIPT Block") =   (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("ColdFusion","ctxC Style Comment"))@@ -281,21 +309,27 @@    <|>    ((pKeyword " \n\t.():!+,<=>%&*/;?[]^{|}~\\" list_Script_Methods >>= withAttribute FunctionTok))    <|>-   ((pRegExpr regex_'3c'2f'5bsS'5d'5bcC'5d'5brR'5d'5biI'5d'5bpP'5d'5btT'5d'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'3c'2f'5bsS'5d'5bcC'5d'5brR'5d'5biI'5d'5bpP'5d'5btT'5d'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxSCRIPT Block")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxSCRIPT Block") defaultAttributes)))  parseRules ("ColdFusion","ctxSTYLE Block") =   (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("ColdFusion","ctxC Style Comment"))    <|>    ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxStyle Properties"))    <|>-   ((pRegExpr regex_'3c'2f'5bsS'5d'5btT'5d'5byY'5d'5blL'5d'5beE'5d'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'3c'2f'5bsS'5d'5btT'5d'5byY'5d'5blL'5d'5beE'5d'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxSTYLE Block")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxSTYLE Block") defaultAttributes)))  parseRules ("ColdFusion","ctxStyle Properties") =   (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext))    <|>    ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("ColdFusion","ctxC Style Comment"))    <|>-   ((pDetectChar False ':' >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxStyle Values")))+   ((pDetectChar False ':' >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxStyle Values"))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxStyle Properties")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxStyle Properties") defaultAttributes)))  parseRules ("ColdFusion","ctxStyle Values") =   (((pDetectChar False ';' >>= withAttribute NormalTok) >>~ (popContext))@@ -310,7 +344,9 @@    <|>    ((pRegExpr regex_'22'5b'5e'22'5d'2a'22 >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok)))+   ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("ColdFusion","ctxStyle Values")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("ColdFusion","ctxStyle Values") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("ColdFusion","Normal Text") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Commonlisp.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Common Lisp"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Common Lisp","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -109,13 +105,19 @@    <|>    ((pFloat >>= withAttribute FloatTok))    <|>-   ((pInt >>= withAttribute DecValTok)))+   ((pInt >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Common Lisp","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Common Lisp","Normal") defaultAttributes)))  parseRules ("Common Lisp","MultiLineComment") =-  ((pDetect2Chars False '|' '#' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '|' '#' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Common Lisp","MultiLineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Common Lisp","MultiLineComment") defaultAttributes)))  parseRules ("Common Lisp","function_decl") =-  ((pRegExpr regex_'5cs'2a'5bA'2dZa'2dz0'2d9'2d'2b'5c'3c'5c'3e'2f'2f'5c'2a'5d'2a'5cs'2a >>= withAttribute FunctionTok) >>~ (popContext))+  (((pRegExpr regex_'5cs'2a'5bA'2dZa'2dz0'2d9'2d'2b'5c'3c'5c'3e'2f'2f'5c'2a'5d'2a'5cs'2a >>= withAttribute FunctionTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Common Lisp","function_decl")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Common Lisp","function_decl") defaultAttributes)))  parseRules ("Common Lisp","SpecialNumber") =   (((pFloat >>= withAttribute FloatTok) >>~ (popContext))@@ -124,14 +126,18 @@    <|>    ((pHlCOct >>= withAttribute BaseNTok) >>~ (popContext))    <|>-   ((pHlCHex >>= withAttribute FloatTok) >>~ (popContext)))+   ((pHlCHex >>= withAttribute FloatTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Common Lisp","SpecialNumber")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Common Lisp","SpecialNumber") defaultAttributes)))  parseRules ("Common Lisp","String") =   (((pRegExpr regex_'23'5c'5c'2e >>= withAttribute CharTok))    <|>    ((pHlCStringChar >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Common Lisp","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Common Lisp","String") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Common Lisp","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Cpp.hs view
@@ -33,11 +33,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "C++"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("C++","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -138,17 +134,21 @@    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok))    <|>-   ((pAnyChar ":!%&()+,-/.*<=>?[]{|}~^;" >>= withAttribute NormalTok)))+   ((pAnyChar ":!%&()+,-/.*<=>?[]{|}~^;" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("C++","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C++","Normal") defaultAttributes)))  parseRules ("C++","String") =   (((pLineContinue >>= withAttribute StringTok))    <|>    ((pHlCStringChar >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("C++","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C++","String") defaultAttributes)))  parseRules ("C++","Region Marker") =-  pzero+  (currentContext >>= \x -> guard (x == ("C++","Region Marker")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C++","Region Marker") defaultAttributes))  parseRules ("C++","Commentar 1") =   (((pLineContinue >>= withAttribute CommentTok))@@ -157,7 +157,9 @@    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("C++","Commentar 1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C++","Commentar 1") defaultAttributes)))  parseRules ("C++","Commentar 2") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -166,7 +168,9 @@    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("C++","Commentar 2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C++","Commentar 2") defaultAttributes)))  parseRules ("C++","AfterHash") =   (((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'28'3f'3adef'7cndef'29'3f'28'3f'3d'5cs'2b'5cS'29 >>= withAttribute OtherTok) >>~ pushContext ("C++","Preprocessor"))@@ -177,7 +181,9 @@    <|>    ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2a'28'3f'3ael'28'3f'3ase'7cif'29'7cinclude'28'3f'3a'5fnext'29'3f'7cdefine'7cundef'7cline'7cerror'7cwarning'7cpragma'29 >>= withAttribute OtherTok) >>~ pushContext ("C++","Preprocessor"))    <|>-   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2b'5b0'2d9'5d'2b >>= withAttribute OtherTok) >>~ pushContext ("C++","Preprocessor")))+   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2b'5b0'2d9'5d'2b >>= withAttribute OtherTok) >>~ pushContext ("C++","Preprocessor"))+   <|>+   (currentContext >>= \x -> guard (x == ("C++","AfterHash")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C++","AfterHash") defaultAttributes)))  parseRules ("C++","Preprocessor") =   (((pLineContinue >>= withAttribute OtherTok))@@ -190,17 +196,23 @@    <|>    ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("C++","Commentar/Preprocessor"))    <|>-   ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("C++","Commentar 1")))+   ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("C++","Commentar 1"))+   <|>+   (currentContext >>= \x -> guard (x == ("C++","Preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C++","Preprocessor") defaultAttributes)))  parseRules ("C++","Define") =-  ((pLineContinue >>= withAttribute OtherTok))+  (((pLineContinue >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("C++","Define")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C++","Define") defaultAttributes)))  parseRules ("C++","Commentar/Preprocessor") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("C++","Commentar/Preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C++","Commentar/Preprocessor") defaultAttributes)))  parseRules ("C++","Outscoped") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -219,7 +231,9 @@    <|>    ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2ael'28'3f'3ase'7cif'29 >>= withAttribute OtherTok) >>~ (popContext))    <|>-   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute OtherTok) >>~ (popContext)))+   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("C++","Outscoped")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C++","Outscoped") defaultAttributes)))  parseRules ("C++","Outscoped intern") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -238,9 +252,11 @@    <|>    ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext ("C++","Outscoped intern"))    <|>-   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute CommentTok) >>~ (popContext)))+   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("C++","Outscoped intern")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C++","Outscoped intern") defaultAttributes)))  parseRules ("Doxygen", _) = Text.Highlighting.Kate.Syntax.Doxygen.parseExpression parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("C++","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Cs.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "C#"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("C#","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -136,14 +132,18 @@    <|>    ((pRegExpr regex_'5b'2e'5d'7b1'2c1'7d >>= withAttribute NormalTok) >>~ pushContext ("C#","Member"))    <|>-   ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok)))+   ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("C#","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C#","Normal") defaultAttributes)))  parseRules ("C#","String") =   (((pLineContinue >>= withAttribute StringTok) >>~ (popContext))    <|>    ((pHlCStringChar >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("C#","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C#","String") defaultAttributes)))  parseRules ("C#","Member") =   (((pRegExpr regex_'5cb'5b'5f'5cw'5d'5b'5f'5cw'5cd'5d'2a'28'3f'3d'5b'5cs'5d'2a'29 >>= withAttribute FunctionTok) >>~ (popContext))@@ -151,11 +151,13 @@    ((popContext) >> currentContext >>= parseRules))  parseRules ("C#","Commentar 1") =-  pzero+  (currentContext >>= \x -> guard (x == ("C#","Commentar 1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C#","Commentar 1") defaultAttributes))  parseRules ("C#","Commentar 2") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("C#","Commentar 2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("C#","Commentar 2") defaultAttributes)))  parseRules ("Doxygen", _) = Text.Highlighting.Kate.Syntax.Doxygen.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("C#","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Css.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "CSS"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("CSS","Base")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -107,7 +103,9 @@    <|>    ((pDetectSpaces >>= withAttribute NormalTok))    <|>-   ((parseRules ("CSS","FindRuleSets"))))+   ((parseRules ("CSS","FindRuleSets")))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","Base")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","Base") defaultAttributes)))  parseRules ("CSS","FindRuleSets") =   (((pRegExpr regex_'40media'5cb >>= withAttribute DecValTok) >>~ pushContext ("CSS","Media"))@@ -130,26 +128,34 @@    <|>    ((parseRules ("CSS","FindStrings")))    <|>-   ((parseRules ("CSS","FindComments"))))+   ((parseRules ("CSS","FindComments")))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","FindRuleSets")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","FindRuleSets") defaultAttributes)))  parseRules ("CSS","FindValues") =   (((pRegExpr regex_'5b'2d'2b'5d'3f'5b0'2d9'2e'5d'2b'28em'7cex'7cch'7crem'7cvw'7cvh'7cvm'7cpx'7cin'7ccm'7cmm'7cpt'7cpc'7cdeg'7crad'7cgrad'7cturn'7cms'7cs'7cHz'7ckHz'29'5cb >>= withAttribute DataTypeTok))    <|>    ((pRegExpr regex_'5b'2d'2b'5d'3f'5b0'2d9'2e'5d'2b'5b'25'5d'3f >>= withAttribute DataTypeTok))    <|>-   ((pRegExpr regex_'5b'5cw'5c'2d'5d'2b >>= withAttribute NormalTok)))+   ((pRegExpr regex_'5b'5cw'5c'2d'5d'2b >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","FindValues")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","FindValues") defaultAttributes)))  parseRules ("CSS","FindStrings") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("CSS","StringDQ"))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("CSS","StringSQ")))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("CSS","StringSQ"))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","FindStrings")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","FindStrings") defaultAttributes)))  parseRules ("CSS","FindComments") =   (((pRegExpr regex_'2f'5c'2aBEGIN'2e'2a'5c'2a'2f >>= withAttribute RegionMarkerTok))    <|>    ((pRegExpr regex_'2f'5c'2aEND'2e'2a'5c'2a'2f >>= withAttribute RegionMarkerTok))    <|>-   ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("CSS","Comment")))+   ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("CSS","Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","FindComments")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","FindComments") defaultAttributes)))  parseRules ("CSS","Media") =   (((pDetectChar False '{' >>= withAttribute DecValTok) >>~ pushContext ("CSS","Media2"))@@ -160,17 +166,23 @@    <|>    ((parseRules ("CSS","FindComments")))    <|>-   ((pRegExpr regex_'5cS'2b >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS'2b >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","Media")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","Media") defaultAttributes)))  parseRules ("CSS","Media2") =   (((pDetectChar False '}' >>= withAttribute DecValTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("CSS","FindRuleSets"))))+   ((parseRules ("CSS","FindRuleSets")))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","Media2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","Media2") defaultAttributes)))  parseRules ("CSS","SelAttr") =   (((pDetectChar False ']' >>= withAttribute CharTok) >>~ (popContext))    <|>-   ((parseRules ("CSS","FindStrings"))))+   ((parseRules ("CSS","FindStrings")))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","SelAttr")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","SelAttr") defaultAttributes)))  parseRules ("CSS","SelPseudo") =   (((pKeyword " \n\t.():!+,<=>&*/;?[]^{|}~\\" list_pseudoclasses >>= withAttribute DecValTok) >>~ (popContext))@@ -186,7 +198,9 @@    <|>    ((parseRules ("CSS","FindStrings")))    <|>-   ((parseRules ("CSS","FindComments"))))+   ((parseRules ("CSS","FindComments")))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","Import")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","Import") defaultAttributes)))  parseRules ("CSS","Comment") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -195,7 +209,9 @@    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","Comment") defaultAttributes)))  parseRules ("CSS","RuleSet") =   (((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext))@@ -206,12 +222,16 @@    <|>    ((parseRules ("CSS","FindComments")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","RuleSet")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","RuleSet") defaultAttributes)))  parseRules ("CSS","Rule") =   (((pDetectChar False ':' >>= withAttribute KeywordTok) >>~ pushContext ("CSS","Rule2"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","Rule")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","Rule") defaultAttributes)))  parseRules ("CSS","Rule2") =   (((pDetectChar False ';' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))@@ -232,14 +252,18 @@    <|>    ((parseRules ("CSS","FindStrings")))    <|>-   ((parseRules ("CSS","FindComments"))))+   ((parseRules ("CSS","FindComments")))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","Rule2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","Rule2") defaultAttributes)))  parseRules ("CSS","PropParen") =   (((pDetectChar False '(' >>= withAttribute DataTypeTok) >>~ pushContext ("CSS","PropParen2"))    <|>    ((parseRules ("CSS","FindComments")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","PropParen")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","PropParen") defaultAttributes)))  parseRules ("CSS","PropParen2") =   (((pDetectChar False ')' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))@@ -248,23 +272,31 @@    <|>    ((parseRules ("CSS","FindStrings")))    <|>-   ((parseRules ("CSS","FindComments"))))+   ((parseRules ("CSS","FindComments")))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","PropParen2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","PropParen2") defaultAttributes)))  parseRules ("CSS","StringDQ") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("CSS","InsideString"))))+   ((parseRules ("CSS","InsideString")))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","StringDQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","StringDQ") defaultAttributes)))  parseRules ("CSS","StringSQ") =   (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("CSS","InsideString"))))+   ((parseRules ("CSS","InsideString")))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","StringSQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","StringSQ") defaultAttributes)))  parseRules ("CSS","InsideString") =   (((pRegExpr regex_'5c'5c'5b'22'27'5d >>= withAttribute StringTok))    <|>-   ((pDetectIdentifier >>= withAttribute StringTok)))+   ((pDetectIdentifier >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("CSS","InsideString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("CSS","InsideString") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("CSS","Base") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/D.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "D"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("D","normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -197,7 +193,9 @@    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok))    <|>-   ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok)))+   ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("D","normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","normal") defaultAttributes)))  parseRules ("D","StartingLetter") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -250,7 +248,9 @@    <|>    ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_userkeywords >>= withAttribute DataTypeTok))    <|>-   ((pDetectIdentifier >>= withAttribute NormalTok)))+   ((pDetectIdentifier >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("D","StartingLetter")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","StartingLetter") defaultAttributes)))  parseRules ("D","Properties") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_properties >>= withAttribute DataTypeTok) >>~ (popContext))@@ -283,13 +283,19 @@    <|>    ((parseRules ("D","CommentRules")))    <|>-   ((pRegExpr regex_'2e'2b >>= withAttribute ErrorTok) >>~ (popContext)))+   ((pRegExpr regex_'2e'2b >>= withAttribute ErrorTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("D","LinePragma")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","LinePragma") defaultAttributes)))  parseRules ("D","UnicodeShort") =-  ((pRegExpr regex_'5b'5cda'2dfA'2dF'5d'7b4'7d >>= withAttribute StringTok) >>~ (popContext))+  (((pRegExpr regex_'5b'5cda'2dfA'2dF'5d'7b4'7d >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("D","UnicodeShort")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","UnicodeShort") defaultAttributes)))  parseRules ("D","UnicodeLong") =-  ((pRegExpr regex_'5b'5cda'2dfA'2dF'5d'7b8'7d >>= withAttribute StringTok) >>~ (popContext))+  (((pRegExpr regex_'5b'5cda'2dfA'2dF'5d'7b8'7d >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("D","UnicodeLong")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","UnicodeLong") defaultAttributes)))  parseRules ("D","HTMLEntity") =   (((pRegExpr regex_'5ba'2dzA'2dZ'5d'5cw'2b'3b >>= withAttribute StringTok) >>~ (popContext))@@ -301,7 +307,9 @@    <|>    ((parseRules ("D","CommentRules")))    <|>-   ((lookAhead (pRegExpr regex_'5b'5e'5cs'5cw'2e'3a'2c'3d'5d) >> (popContext) >> currentContext >>= parseRules)))+   ((lookAhead (pRegExpr regex_'5b'5e'5cs'5cw'2e'3a'2c'3d'5d) >> (popContext) >> currentContext >>= parseRules))+   <|>+   (currentContext >>= \x -> guard (x == ("D","ModuleName")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","ModuleName") defaultAttributes)))  parseRules ("D","Linkage") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -323,7 +331,9 @@    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext >> popContext))    <|>-   ((pRegExpr regex_'5b'5e'29'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'5b'5e'29'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("D","Linkage2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","Linkage2") defaultAttributes)))  parseRules ("D","Version") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -334,7 +344,9 @@    <|>    ((parseRules ("D","CommentRules")))    <|>-   ((pRegExpr regex_'5b'5e'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'5e'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("D","Version")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","Version") defaultAttributes)))  parseRules ("D","Version2") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -349,7 +361,9 @@    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext >> popContext))    <|>-   ((pRegExpr regex_'5b'5e'29'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'5b'5e'29'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("D","Version2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","Version2") defaultAttributes)))  parseRules ("D","Scope") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -369,7 +383,9 @@    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext >> popContext))    <|>-   ((pRegExpr regex_'5b'5e'29'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'5b'5e'29'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("D","Scope2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","Scope2") defaultAttributes)))  parseRules ("D","Pragma") =   (((pDetectSpaces >>= withAttribute KeywordTok))@@ -378,7 +394,9 @@    <|>    ((parseRules ("D","CommentRules")))    <|>-   ((pRegExpr regex_'5b'5e'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'5e'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("D","Pragma")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","Pragma") defaultAttributes)))  parseRules ("D","Pragma2") =   (((pDetectSpaces >>= withAttribute KeywordTok))@@ -391,18 +409,26 @@    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext >> popContext))    <|>-   ((pRegExpr regex_'5b'5e'29'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'5b'5e'29'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("D","Pragma2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","Pragma2") defaultAttributes)))  parseRules ("D","RawString") =-  ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+  (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("D","RawString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","RawString") defaultAttributes)))  parseRules ("D","BQString") =-  ((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext))+  (((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("D","BQString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","BQString") defaultAttributes)))  parseRules ("D","HexString") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5b'5e'5csa'2dfA'2dF'5cd'22'5d'2b >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5b'5e'5csa'2dfA'2dF'5cd'22'5d'2b >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("D","HexString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","HexString") defaultAttributes)))  parseRules ("D","CharLiteral") =   (((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext))@@ -437,7 +463,9 @@    <|>    ((pDetect2Chars False '\\' 'U' >>= withAttribute StringTok) >>~ pushContext ("D","UnicodeLong"))    <|>-   ((pDetect2Chars False '\\' '&' >>= withAttribute StringTok) >>~ pushContext ("D","HTMLEntity")))+   ((pDetect2Chars False '\\' '&' >>= withAttribute StringTok) >>~ pushContext ("D","HTMLEntity"))+   <|>+   (currentContext >>= \x -> guard (x == ("D","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","String") defaultAttributes)))  parseRules ("D","CommentRules") =   (((parseRules ("D","DdocNormal")))@@ -446,22 +474,28 @@    <|>    ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("D","CommentBlock"))    <|>-   ((pDetect2Chars False '/' '+' >>= withAttribute CommentTok) >>~ pushContext ("D","CommentNested")))+   ((pDetect2Chars False '/' '+' >>= withAttribute CommentTok) >>~ pushContext ("D","CommentNested"))+   <|>+   (currentContext >>= \x -> guard (x == ("D","CommentRules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","CommentRules") defaultAttributes)))  parseRules ("D","Region Marker") =-  pzero+  (currentContext >>= \x -> guard (x == ("D","Region Marker")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","Region Marker") defaultAttributes))  parseRules ("D","CommentLine") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("D","CommentLine")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","CommentLine") defaultAttributes)))  parseRules ("D","CommentBlock") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("D","CommentBlock")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","CommentBlock") defaultAttributes)))  parseRules ("D","CommentNested") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -470,14 +504,18 @@    <|>    ((pDetect2Chars False '+' '/' >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("D","CommentNested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","CommentNested") defaultAttributes)))  parseRules ("D","DdocNormal") =   (((pRegExpr regex_'2f'7b3'2c'7d >>= withAttribute CommentTok) >>~ pushContext ("D","DdocLine"))    <|>    ((pRegExpr regex_'2f'5c'2a'7b2'2c'7d'28'3f'21'2f'29 >>= withAttribute CommentTok) >>~ pushContext ("D","DdocBlock"))    <|>-   ((pRegExpr regex_'2f'5c'2b'7b2'2c'7d'28'3f'21'2f'29 >>= withAttribute CommentTok) >>~ pushContext ("D","DdocNested")))+   ((pRegExpr regex_'2f'5c'2b'7b2'2c'7d'28'3f'21'2f'29 >>= withAttribute CommentTok) >>~ pushContext ("D","DdocNested"))+   <|>+   (currentContext >>= \x -> guard (x == ("D","DdocNormal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","DdocNormal") defaultAttributes)))  parseRules ("D","DdocLine") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -488,7 +526,9 @@    <|>    ((pRegExpr regex_'5b'5cw'5f'5d'2b'3a'28'24'7c'5cs'29 >>= withAttribute KeywordTok))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("D","DdocLine")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","DdocLine") defaultAttributes)))  parseRules ("D","DdocBlock") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -507,7 +547,9 @@    <|>    ((pRegExpr regex_'5b'5e'2d'5d'2d'7b3'2c'7d >>= withAttribute CommentTok))    <|>-   ((pRegExpr regex_'2d'7b3'2c'7d'28'24'7c'5cs'29 >>= withAttribute CommentTok) >>~ pushContext ("D","DdocBlockCode")))+   ((pRegExpr regex_'2d'7b3'2c'7d'28'24'7c'5cs'29 >>= withAttribute CommentTok) >>~ pushContext ("D","DdocBlockCode"))+   <|>+   (currentContext >>= \x -> guard (x == ("D","DdocBlock")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","DdocBlock") defaultAttributes)))  parseRules ("D","DdocNested") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -528,7 +570,9 @@    <|>    ((pRegExpr regex_'5b'5e'2d'5d'2d'7b3'2c'7d >>= withAttribute CommentTok))    <|>-   ((pRegExpr regex_'2d'7b3'2c'7d'28'24'7c'5cs'29 >>= withAttribute CommentTok) >>~ pushContext ("D","DdocNestedCode")))+   ((pRegExpr regex_'2d'7b3'2c'7d'28'24'7c'5cs'29 >>= withAttribute CommentTok) >>~ pushContext ("D","DdocNestedCode"))+   <|>+   (currentContext >>= \x -> guard (x == ("D","DdocNested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","DdocNested") defaultAttributes)))  parseRules ("D","DdocNested2") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -537,7 +581,9 @@    <|>    ((pRegExpr regex_'5c'2b'2b'2f >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((parseRules ("D","DdocNested"))))+   ((parseRules ("D","DdocNested")))+   <|>+   (currentContext >>= \x -> guard (x == ("D","DdocNested2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","DdocNested2") defaultAttributes)))  parseRules ("D","DdocMacro") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -546,24 +592,32 @@    <|>    ((parseRules ("D","MacroRules")))    <|>-   ((pDetectIdentifier >>= withAttribute OtherTok) >>~ pushContext ("D","DdocMacro2")))+   ((pDetectIdentifier >>= withAttribute OtherTok) >>~ pushContext ("D","DdocMacro2"))+   <|>+   (currentContext >>= \x -> guard (x == ("D","DdocMacro")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","DdocMacro") defaultAttributes)))  parseRules ("D","DdocMacro2") =   (((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("D","MacroRules"))))+   ((parseRules ("D","MacroRules")))+   <|>+   (currentContext >>= \x -> guard (x == ("D","DdocMacro2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","DdocMacro2") defaultAttributes)))  parseRules ("D","DdocMacro3") =   (((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("D","MacroRules"))))+   ((parseRules ("D","MacroRules")))+   <|>+   (currentContext >>= \x -> guard (x == ("D","DdocMacro3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","DdocMacro3") defaultAttributes)))  parseRules ("D","MacroRules") =   (((pDetect2Chars False '$' '(' >>= withAttribute OtherTok) >>~ pushContext ("D","DdocMacro"))    <|>    ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("D","DdocMacro3"))    <|>-   ((pFirstNonSpace >> pDetectChar False '*' >>= withAttribute CommentTok)))+   ((pFirstNonSpace >> pDetectChar False '*' >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("D","MacroRules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","MacroRules") defaultAttributes)))  parseRules ("D","DdocBlockCode") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -576,7 +630,9 @@    <|>    ((pRegExpr regex_'2d'7b3'2c'7d'28'24'7c'5cs'29 >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.D.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.D.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("D","DdocBlockCode")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","DdocBlockCode") defaultAttributes)))  parseRules ("D","DdocNestedCode") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -589,9 +645,11 @@    <|>    ((pRegExpr regex_'2d'7b3'2c'7d'28'24'7c'5cs'29 >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.D.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.D.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("D","DdocNestedCode")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("D","DdocNestedCode") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression parseRules ("D", _) = Text.Highlighting.Kate.Syntax.D.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("D","normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Diff.hs view
@@ -30,11 +30,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Diff"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Diff","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -101,7 +97,9 @@    <|>    ((parseRules ("Diff","FindDiff")))    <|>-   ((pColumn 0 >> pDetectChar False '!' >>= withAttribute NormalTok) >>~ pushContext ("Diff","ChangedOld")))+   ((pColumn 0 >> pDetectChar False '!' >>= withAttribute NormalTok) >>~ pushContext ("Diff","ChangedOld"))+   <|>+   (currentContext >>= \x -> guard (x == ("Diff","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","Normal") defaultAttributes)))  parseRules ("Diff","FindDiff") =   (((pColumn 0 >> pRegExpr regex_'5c'2d'5c'2d'5c'2d'2e'2a'24 >>= withAttribute KeywordTok))@@ -110,7 +108,9 @@    <|>    ((pColumn 0 >> pAnyChar "+>" >>= withAttribute OtherTok) >>~ pushContext ("Diff","Added"))    <|>-   ((pColumn 0 >> pAnyChar "-<" >>= withAttribute StringTok) >>~ pushContext ("Diff","Removed")))+   ((pColumn 0 >> pAnyChar "-<" >>= withAttribute StringTok) >>~ pushContext ("Diff","Removed"))+   <|>+   (currentContext >>= \x -> guard (x == ("Diff","FindDiff")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","FindDiff") defaultAttributes)))  parseRules ("Diff","File") =   (((parseRules ("Diff","FindDiff")))@@ -121,14 +121,18 @@    <|>    ((pColumn 0 >> pRegExpr regex_'28'3d'3d'3d'3d'7c'5c'2a'5c'2a'5c'2a'7c'5c'2d'5c'2d'5c'2d'7cdiff'7cOnly_in_'2e'2a'3a'29'2e'2a'24 >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((pColumn 0 >> pDetectChar False '!' >>= withAttribute StringTok) >>~ pushContext ("Diff","ChangedOld")))+   ((pColumn 0 >> pDetectChar False '!' >>= withAttribute StringTok) >>~ pushContext ("Diff","ChangedOld"))+   <|>+   (currentContext >>= \x -> guard (x == ("Diff","File")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","File") defaultAttributes)))  parseRules ("Diff","Chunk") =   (((parseRules ("Diff","FindDiff")))    <|>    ((pColumn 0 >> lookAhead (pRegExpr regex_'28'5c'40'5c'40'7c'5cd'29'2e'2a'24) >> (popContext) >> currentContext >>= parseRules))    <|>-   ((pColumn 0 >> pDetectChar False '!' >>= withAttribute StringTok) >>~ pushContext ("Diff","ChangedOld")))+   ((pColumn 0 >> pDetectChar False '!' >>= withAttribute StringTok) >>~ pushContext ("Diff","ChangedOld"))+   <|>+   (currentContext >>= \x -> guard (x == ("Diff","Chunk")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","Chunk") defaultAttributes)))  parseRules ("Diff","ChunkInFile") =   (((parseRules ("Diff","FindDiff")))@@ -139,7 +143,9 @@    <|>    ((pColumn 0 >> lookAhead (pRegExpr regex_'28'3d'3d'3d'3d'7c'5c'2a'5c'2a'5c'2a'7c'5c'2d'5c'2d'5c'2d'7cdiff'7cOnly_in_'2e'2a'3a'29'2e'2a'24) >> (popContext) >> currentContext >>= parseRules))    <|>-   ((pColumn 0 >> pDetectChar False '!' >>= withAttribute StringTok) >>~ pushContext ("Diff","ChangedOld")))+   ((pColumn 0 >> pDetectChar False '!' >>= withAttribute StringTok) >>~ pushContext ("Diff","ChangedOld"))+   <|>+   (currentContext >>= \x -> guard (x == ("Diff","ChunkInFile")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","ChunkInFile") defaultAttributes)))  parseRules ("Diff","RFile") =   (((pColumn 0 >> lookAhead (pRegExpr regex_'28diff'7cOnly_in_'2e'2a'3a'29'2e'2a'24) >> (popContext) >> currentContext >>= parseRules))@@ -148,28 +154,36 @@    <|>    ((pColumn 0 >> pRegExpr regex_'5c'2a'2b'24 >>= withAttribute DataTypeTok) >>~ pushContext ("Diff","RChunkInFile"))    <|>-   ((parseRules ("Diff","File"))))+   ((parseRules ("Diff","File")))+   <|>+   (currentContext >>= \x -> guard (x == ("Diff","RFile")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","RFile") defaultAttributes)))  parseRules ("Diff","RChunk") =   (((pColumn 0 >> pRegExpr regex_'5c'2a'5c'2a'5c'2a_'2e'2a_'5c'2a'5c'2a'5c'2a'5c'2a'24 >>= withAttribute DataTypeTok))    <|>    ((pColumn 0 >> pRegExpr regex_'5c'2d'5c'2d'5c'2d_'2e'2a_'5c'2d'5c'2d'5c'2d'5c'2d'24 >>= withAttribute DataTypeTok) >>~ pushContext ("Diff","RChunkNew"))    <|>-   ((parseRules ("Diff","Chunk"))))+   ((parseRules ("Diff","Chunk")))+   <|>+   (currentContext >>= \x -> guard (x == ("Diff","RChunk")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","RChunk") defaultAttributes)))  parseRules ("Diff","RChunkInFile") =   (((pColumn 0 >> pRegExpr regex_'5c'2a'5c'2a'5c'2a_'2e'2a_'5c'2a'5c'2a'5c'2a'5c'2a'24 >>= withAttribute DataTypeTok))    <|>    ((pColumn 0 >> pRegExpr regex_'5c'2d'5c'2d'5c'2d_'2e'2a_'5c'2d'5c'2d'5c'2d'5c'2d'24 >>= withAttribute DataTypeTok) >>~ pushContext ("Diff","RChunkInFileNew"))    <|>-   ((parseRules ("Diff","ChunkInFile"))))+   ((parseRules ("Diff","ChunkInFile")))+   <|>+   (currentContext >>= \x -> guard (x == ("Diff","RChunkInFile")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","RChunkInFile") defaultAttributes)))  parseRules ("Diff","RChunkNew") =   (((pColumn 0 >> lookAhead (pRegExpr regex_'28'5c'40'5c'40'7c'5cd'29'2e'2a'24) >> (popContext >> popContext) >> currentContext >>= parseRules))    <|>    ((pColumn 0 >> pDetectChar False '!' >>= withAttribute OtherTok) >>~ pushContext ("Diff","ChangedNew"))    <|>-   ((parseRules ("Diff","FindDiff"))))+   ((parseRules ("Diff","FindDiff")))+   <|>+   (currentContext >>= \x -> guard (x == ("Diff","RChunkNew")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","RChunkNew") defaultAttributes)))  parseRules ("Diff","RChunkInFileNew") =   (((pColumn 0 >> lookAhead (pRegExpr regex_'28'5c'40'5c'40'7c'5cd'29'2e'2a'24) >> (popContext >> popContext) >> currentContext >>= parseRules))@@ -178,22 +192,24 @@    <|>    ((pColumn 0 >> pDetectChar False '!' >>= withAttribute OtherTok) >>~ pushContext ("Diff","ChangedNew"))    <|>-   ((parseRules ("Diff","FindDiff"))))+   ((parseRules ("Diff","FindDiff")))+   <|>+   (currentContext >>= \x -> guard (x == ("Diff","RChunkInFileNew")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","RChunkInFileNew") defaultAttributes)))  parseRules ("Diff","File") =-  pzero+  (currentContext >>= \x -> guard (x == ("Diff","File")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","File") defaultAttributes))  parseRules ("Diff","Removed") =-  pzero+  (currentContext >>= \x -> guard (x == ("Diff","Removed")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","Removed") defaultAttributes))  parseRules ("Diff","Added") =-  pzero+  (currentContext >>= \x -> guard (x == ("Diff","Added")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","Added") defaultAttributes))  parseRules ("Diff","ChangedOld") =-  pzero+  (currentContext >>= \x -> guard (x == ("Diff","ChangedOld")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","ChangedOld") defaultAttributes))  parseRules ("Diff","ChangedNew") =-  pzero+  (currentContext >>= \x -> guard (x == ("Diff","ChangedNew")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Diff","ChangedNew") defaultAttributes))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Diff","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Djangotemplate.hs view
@@ -34,11 +34,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Django HTML Template"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Django HTML Template","Start")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -136,24 +132,32 @@    <|>    ((parseRules ("Django HTML Template","FindTemplate")))    <|>-   ((parseRules ("Django HTML Template","FindHTML"))))+   ((parseRules ("Django HTML Template","FindHTML")))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Start")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Start") defaultAttributes)))  parseRules ("Django HTML Template","In Block") =   (((lookAhead (pRegExpr regex_'5c'7b'25'5cs'2aend'5ba'2dz'5d'2b'5cs'2a'25'5c'7d) >> (popContext) >> currentContext >>= parseRules))    <|>    ((parseRules ("Django HTML Template","FindTemplate")))    <|>-   ((parseRules ("Django HTML Template","FindHTML"))))+   ((parseRules ("Django HTML Template","FindHTML")))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","In Block")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","In Block") defaultAttributes)))  parseRules ("Django HTML Template","FindTemplate") =   (((pRegExpr regex_'5c'7b'25'5cs'2acomment'5cs'2a'25'5c'7d >>= withAttribute CommentTok) >>~ pushContext ("Django HTML Template","Template Comment"))    <|>    ((pDetect2Chars False '{' '{' >>= withAttribute FunctionTok) >>~ pushContext ("Django HTML Template","Template Var"))    <|>-   ((pDetect2Chars False '{' '%' >>= withAttribute FunctionTok) >>~ pushContext ("Django HTML Template","Template Tag")))+   ((pDetect2Chars False '{' '%' >>= withAttribute FunctionTok) >>~ pushContext ("Django HTML Template","Template Tag"))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","FindTemplate")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","FindTemplate") defaultAttributes)))  parseRules ("Django HTML Template","Template Comment") =-  ((pRegExpr regex_'5c'7b'25'5cs'2aendcomment'5cs'2a'25'5c'7d >>= withAttribute CommentTok) >>~ (popContext))+  (((pRegExpr regex_'5c'7b'25'5cs'2aendcomment'5cs'2a'25'5c'7d >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Template Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Template Comment") defaultAttributes)))  parseRules ("Django HTML Template","Template Var") =   (((pDetect2Chars False '}' '}' >>= withAttribute FunctionTok) >>~ (popContext))@@ -164,7 +168,9 @@    <|>    ((pDetect2Chars False '{' '%' >>= withAttribute ErrorTok))    <|>-   ((pDetect2Chars False '%' '}' >>= withAttribute ErrorTok)))+   ((pDetect2Chars False '%' '}' >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Template Var")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Template Var") defaultAttributes)))  parseRules ("Django HTML Template","Template Filter") =   (((pDetect2Chars False '}' '}' >>= withAttribute FunctionTok) >>~ (popContext >> popContext))@@ -177,15 +183,21 @@    <|>    ((pDetect2Chars False '{' '%' >>= withAttribute ErrorTok))    <|>-   ((pDetect2Chars False '%' '}' >>= withAttribute ErrorTok)))+   ((pDetect2Chars False '%' '}' >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Template Filter")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Template Filter") defaultAttributes)))  parseRules ("Django HTML Template","Template Tag") =   (((lookAhead (pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_blocktags) >> pushContext ("Django HTML Template","Found Block Tag") >> currentContext >>= parseRules))    <|>-   ((pDetectIdentifier >>= withAttribute FunctionTok) >>~ pushContext ("Django HTML Template","In Template Tag")))+   ((pDetectIdentifier >>= withAttribute FunctionTok) >>~ pushContext ("Django HTML Template","In Template Tag"))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Template Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Template Tag") defaultAttributes)))  parseRules ("Django HTML Template","Found Block Tag") =-  ((pRegExpr regex_'28'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29 >>= withAttribute FunctionTok) >>~ pushContext ("Django HTML Template","In Block Tag"))+  (((pRegExpr regex_'28'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29 >>= withAttribute FunctionTok) >>~ pushContext ("Django HTML Template","In Block Tag"))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Found Block Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Found Block Tag") defaultAttributes)))  parseRules ("Django HTML Template","In Block Tag") =   (((pRegExprDynamic "\\{%\\s*end%1\\s*%\\}" >>= withAttribute FunctionTok) >>~ (popContext >> popContext >> popContext))@@ -194,12 +206,16 @@    <|>    ((pDetect2Chars False '%' '}' >>= withAttribute FunctionTok) >>~ pushContext ("Django HTML Template","In Block"))    <|>-   ((parseRules ("Django HTML Template","In Template Tag"))))+   ((parseRules ("Django HTML Template","In Template Tag")))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","In Block Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","In Block Tag") defaultAttributes)))  parseRules ("Django HTML Template","Non Matching Tag") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_endblocktags >>= withAttribute ErrorTok) >>~ (popContext))    <|>-   ((pDetectIdentifier >>= withAttribute FunctionTok) >>~ (popContext)))+   ((pDetectIdentifier >>= withAttribute FunctionTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Non Matching Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Non Matching Tag") defaultAttributes)))  parseRules ("Django HTML Template","In Template Tag") =   (((pDetect2Chars False '%' '}' >>= withAttribute FunctionTok) >>~ (popContext >> popContext))@@ -212,17 +228,23 @@    <|>    ((pDetect2Chars False '{' '%' >>= withAttribute ErrorTok))    <|>-   ((pDetect2Chars False '}' '}' >>= withAttribute ErrorTok)))+   ((pDetect2Chars False '}' '}' >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","In Template Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","In Template Tag") defaultAttributes)))  parseRules ("Django HTML Template","Single A-string") =   (((pHlCStringChar >>= withAttribute StringTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Single A-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Single A-string") defaultAttributes)))  parseRules ("Django HTML Template","Single Q-string") =   (((pHlCStringChar >>= withAttribute StringTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Single Q-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Single Q-string") defaultAttributes)))  parseRules ("Django HTML Template","FindHTML") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -259,29 +281,39 @@    <|>    ((parseRules ("Django HTML Template","FindDTDRules")))    <|>-   ((parseRules ("Django HTML Template","FindEntityRefs"))))+   ((parseRules ("Django HTML Template","FindEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","FindHTML")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","FindHTML") defaultAttributes)))  parseRules ("Django HTML Template","FindEntityRefs") =   (((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok))    <|>-   ((pAnyChar "&<" >>= withAttribute ErrorTok)))+   ((pAnyChar "&<" >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","FindEntityRefs")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","FindEntityRefs") defaultAttributes)))  parseRules ("Django HTML Template","FindPEntityRefs") =   (((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok))    <|>    ((pRegExpr regex_'25'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'3b >>= withAttribute DecValTok))    <|>-   ((pAnyChar "&%" >>= withAttribute ErrorTok)))+   ((pAnyChar "&%" >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","FindPEntityRefs")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","FindPEntityRefs") defaultAttributes)))  parseRules ("Django HTML Template","FindAttributes") =   (((pColumn 0 >> pRegExpr regex_'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute OtherTok))    <|>    ((pRegExpr regex_'5cs'2b'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute OtherTok))    <|>-   ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("Django HTML Template","Value")))+   ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("Django HTML Template","Value"))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","FindAttributes")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","FindAttributes") defaultAttributes)))  parseRules ("Django HTML Template","FindDTDRules") =-  ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("Django HTML Template","Doctype Markupdecl"))+  (((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("Django HTML Template","Doctype Markupdecl"))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","FindDTDRules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","FindDTDRules") defaultAttributes)))  parseRules ("Django HTML Template","Comment") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -294,7 +326,9 @@    <|>    ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'2d'28'2d'28'3f'21'2d'3e'29'29'2b >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'2d'28'2d'28'3f'21'2d'3e'29'29'2b >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Comment") defaultAttributes)))  parseRules ("Django HTML Template","CDATA") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -303,15 +337,21 @@    <|>    ((pString False "]]>" >>= withAttribute BaseNTok) >>~ (popContext))    <|>-   ((pString False "]]&gt;" >>= withAttribute DecValTok)))+   ((pString False "]]&gt;" >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","CDATA")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","CDATA") defaultAttributes)))  parseRules ("Django HTML Template","PI") =-  ((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext))+  (((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","PI")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","PI") defaultAttributes)))  parseRules ("Django HTML Template","Doctype") =   (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext))    <|>-   ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("Django HTML Template","Doctype Internal Subset")))+   ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("Django HTML Template","Doctype Internal Subset"))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Doctype")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Doctype") defaultAttributes)))  parseRules ("Django HTML Template","Doctype Internal Subset") =   (((pDetectChar False ']' >>= withAttribute DataTypeTok) >>~ (popContext))@@ -322,24 +362,32 @@    <|>    ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","PI"))    <|>-   ((parseRules ("Django HTML Template","FindPEntityRefs"))))+   ((parseRules ("Django HTML Template","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Doctype Internal Subset")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Doctype Internal Subset") defaultAttributes)))  parseRules ("Django HTML Template","Doctype Markupdecl") =   (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext))    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Django HTML Template","Doctype Markupdecl DQ"))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Django HTML Template","Doctype Markupdecl SQ")))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Django HTML Template","Doctype Markupdecl SQ"))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Doctype Markupdecl")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Doctype Markupdecl") defaultAttributes)))  parseRules ("Django HTML Template","Doctype Markupdecl DQ") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("Django HTML Template","FindPEntityRefs"))))+   ((parseRules ("Django HTML Template","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Doctype Markupdecl DQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Doctype Markupdecl DQ") defaultAttributes)))  parseRules ("Django HTML Template","Doctype Markupdecl SQ") =   (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("Django HTML Template","FindPEntityRefs"))))+   ((parseRules ("Django HTML Template","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Doctype Markupdecl SQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Doctype Markupdecl SQ") defaultAttributes)))  parseRules ("Django HTML Template","El Open") =   (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext))@@ -350,22 +398,30 @@    <|>    ((parseRules ("Django HTML Template","FindTemplate")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","El Open")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","El Open") defaultAttributes)))  parseRules ("Django HTML Template","El Close") =   (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","El Close")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","El Close") defaultAttributes)))  parseRules ("Django HTML Template","El Close 2") =   (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","El Close 2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","El Close 2") defaultAttributes)))  parseRules ("Django HTML Template","El Close 3") =   (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext >> popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","El Close 3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","El Close 3") defaultAttributes)))  parseRules ("Django HTML Template","CSS") =   (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext))@@ -376,14 +432,18 @@    <|>    ((parseRules ("Django HTML Template","FindTemplate")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","CSS")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","CSS") defaultAttributes)))  parseRules ("Django HTML Template","CSS content") =   (((pRegExpr regex_'3c'2fstyle'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","El Close 2"))    <|>    ((parseRules ("Django HTML Template","FindTemplate")))    <|>-   ((Text.Highlighting.Kate.Syntax.Css.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Css.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","CSS content")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","CSS content") defaultAttributes)))  parseRules ("Django HTML Template","JS") =   (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext))@@ -394,7 +454,9 @@    <|>    ((parseRules ("Django HTML Template","FindAttributes")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","JS")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","JS") defaultAttributes)))  parseRules ("Django HTML Template","JS content") =   (((pRegExpr regex_'3c'2fscript'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","El Close 2"))@@ -403,14 +465,18 @@    <|>    ((parseRules ("Django HTML Template","FindTemplate")))    <|>-   ((Text.Highlighting.Kate.Syntax.Javascript.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Javascript.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","JS content")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","JS content") defaultAttributes)))  parseRules ("Django HTML Template","JS comment close") =   (((pRegExpr regex_'3c'2fscript'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","El Close 3"))    <|>    ((parseRules ("Django HTML Template","FindTemplate")))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","JS comment close")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","JS comment close") defaultAttributes)))  parseRules ("Django HTML Template","Value") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Django HTML Template","Value DQ"))@@ -437,17 +503,21 @@    <|>    ((parseRules ("Django HTML Template","FindTemplate")))    <|>-   ((parseRules ("Django HTML Template","FindEntityRefs"))))+   ((parseRules ("Django HTML Template","FindEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Value DQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Value DQ") defaultAttributes)))  parseRules ("Django HTML Template","Value SQ") =   (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext >> popContext))    <|>    ((parseRules ("Django HTML Template","FindTemplate")))    <|>-   ((parseRules ("Django HTML Template","FindEntityRefs"))))+   ((parseRules ("Django HTML Template","FindEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("Django HTML Template","Value SQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Django HTML Template","Value SQ") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression parseRules ("CSS", _) = Text.Highlighting.Kate.Syntax.Css.parseExpression parseRules ("JavaScript", _) = Text.Highlighting.Kate.Syntax.Javascript.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Django HTML Template","Start") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Doxygen.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Doxygen"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Doxygen","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -138,7 +134,9 @@    <|>    ((pRegExpr regex_'2f'5c'2a'5cs'2a'40'5c'7b'5cs'2a'5c'2a'2f >>= withAttribute RegionMarkerTok))    <|>-   ((pRegExpr regex_'2f'5c'2a'5cs'2a'40'5c'7d'5cs'2a'5c'2a'2f >>= withAttribute RegionMarkerTok)))+   ((pRegExpr regex_'2f'5c'2a'5cs'2a'40'5c'7d'5cs'2a'5c'2a'2f >>= withAttribute RegionMarkerTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","Normal") defaultAttributes)))  parseRules ("Doxygen","LineComment") =   (((pLineContinue >>= withAttribute CommentTok))@@ -169,7 +167,9 @@    <|>    ((pDetect2Chars False '<' '<' >>= withAttribute CommentTok))    <|>-   ((pRegExpr regex_'3c'5c'2f'3f'5ba'2dzA'2dZ'5f'3a'5d'5ba'2dzA'2dZ0'2d9'2e'5f'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","SL_htmltag")))+   ((pRegExpr regex_'3c'5c'2f'3f'5ba'2dzA'2dZ'5f'3a'5d'5ba'2dzA'2dZ0'2d9'2e'5f'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","SL_htmltag"))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","LineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","LineComment") defaultAttributes)))  parseRules ("Doxygen","BlockComment") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -206,12 +206,16 @@    <|>    ((pRegExpr regex_'3c'5c'2f'3f'5ba'2dzA'2dZ'5f'3a'5d'5ba'2dzA'2dZ0'2d9'2e'5f'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","ML_htmltag"))    <|>-   ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("Doxygen","ML_htmlcomment")))+   ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("Doxygen","ML_htmlcomment"))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","BlockComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","BlockComment") defaultAttributes)))  parseRules ("Doxygen","ML_TagWord") =   (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))    <|>-   ((parseRules ("Doxygen","SL_TagWord"))))+   ((parseRules ("Doxygen","SL_TagWord")))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","ML_TagWord")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","ML_TagWord") defaultAttributes)))  parseRules ("Doxygen","ML_TagParam") =   (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))@@ -226,7 +230,9 @@    <|>    ((pRegExpr regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok)))+   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","ML_TagParam")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","ML_TagParam") defaultAttributes)))  parseRules ("Doxygen","ML_TagWordWord") =   (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))@@ -235,12 +241,16 @@    <|>    ((pRegExpr regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","ML_Tag2ndWord"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok)))+   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","ML_TagWordWord")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","ML_TagWordWord") defaultAttributes)))  parseRules ("Doxygen","ML_Tag2ndWord") =   (((lookAhead (pDetect2Chars False '*' '/') >> (popContext >> popContext) >> currentContext >>= parseRules))    <|>-   ((parseRules ("Doxygen","SL_Tag2ndWord"))))+   ((parseRules ("Doxygen","SL_Tag2ndWord")))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","ML_Tag2ndWord")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","ML_Tag2ndWord") defaultAttributes)))  parseRules ("Doxygen","ML_TagString") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -253,12 +263,16 @@    <|>    ((pRegExpr regex_'3c'5c'2f'3f'5ba'2dzA'2dZ'5f'3a'5d'5ba'2dzA'2dZ0'2d9'2e'5f'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","ML_htmltag"))    <|>-   ((pRegExpr regex_'2e >>= withAttribute StringTok)))+   ((pRegExpr regex_'2e >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","ML_TagString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","ML_TagString") defaultAttributes)))  parseRules ("Doxygen","ML_TagWordString") =   (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))    <|>-   ((parseRules ("Doxygen","SL_TagWordString"))))+   ((parseRules ("Doxygen","SL_TagWordString")))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","ML_TagWordString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","ML_TagWordString") defaultAttributes)))  parseRules ("Doxygen","ML_htmltag") =   (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))@@ -267,14 +281,18 @@    <|>    ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("Doxygen","ML_identifiers")))+   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("Doxygen","ML_identifiers"))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","ML_htmltag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","ML_htmltag") defaultAttributes)))  parseRules ("Doxygen","ML_htmlcomment") =   (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext)))+   ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","ML_htmlcomment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","ML_htmlcomment") defaultAttributes)))  parseRules ("Doxygen","ML_identifiers") =   (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))@@ -283,17 +301,23 @@    <|>    ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ pushContext ("Doxygen","ML_types1"))    <|>-   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("Doxygen","ML_types2")))+   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("Doxygen","ML_types2"))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","ML_identifiers")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","ML_identifiers") defaultAttributes)))  parseRules ("Doxygen","ML_types1") =   (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))    <|>-   ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","ML_types1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","ML_types1") defaultAttributes)))  parseRules ("Doxygen","ML_types2") =   (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))    <|>-   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","ML_types2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","ML_types2") defaultAttributes)))  parseRules ("Doxygen","SL_TagWord") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -302,7 +326,9 @@    <|>    ((pRegExpr regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok)))+   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","SL_TagWord")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","SL_TagWord") defaultAttributes)))  parseRules ("Doxygen","SL_TagParam") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -315,21 +341,27 @@    <|>    ((pRegExpr regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok)))+   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","SL_TagParam")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","SL_TagParam") defaultAttributes)))  parseRules ("Doxygen","SL_TagWordWord") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((pRegExpr regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","SL_Tag2ndWord"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok)))+   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","SL_TagWordWord")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","SL_TagWordWord") defaultAttributes)))  parseRules ("Doxygen","SL_Tag2ndWord") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((pRegExpr regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok)))+   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","SL_Tag2ndWord")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","SL_Tag2ndWord") defaultAttributes)))  parseRules ("Doxygen","SL_TagString") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -340,39 +372,53 @@    <|>    ((pRegExpr regex_'3c'5c'2f'3f'5ba'2dzA'2dZ'5f'3a'5d'5ba'2dzA'2dZ0'2d9'2e'5f'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","SL_htmltag"))    <|>-   ((pRegExpr regex_'2e >>= withAttribute StringTok)))+   ((pRegExpr regex_'2e >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","SL_TagString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","SL_TagString") defaultAttributes)))  parseRules ("Doxygen","SL_TagWordString") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((pRegExpr regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok)))+   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","SL_TagWordString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","SL_TagWordString") defaultAttributes)))  parseRules ("Doxygen","SL_htmltag") =   (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext))    <|>    ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("Doxygen","SL_identifiers")))+   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("Doxygen","SL_identifiers"))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","SL_htmltag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","SL_htmltag") defaultAttributes)))  parseRules ("Doxygen","SL_htmlcomment") =   (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext)))+   ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","SL_htmlcomment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","SL_htmlcomment") defaultAttributes)))  parseRules ("Doxygen","SL_identifiers") =   (((pRegExpr regex_'5cs'2a'23'3f'5ba'2dzA'2dZ0'2d9'5d'2a >>= withAttribute NormalTok) >>~ (popContext))    <|>    ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ pushContext ("Doxygen","SL_types1"))    <|>-   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("Doxygen","SL_types2")))+   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("Doxygen","SL_types2"))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","SL_identifiers")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","SL_identifiers") defaultAttributes)))  parseRules ("Doxygen","SL_types1") =-  ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+  (((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","SL_types1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","SL_types1") defaultAttributes)))  parseRules ("Doxygen","SL_types2") =-  ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+  (((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","SL_types2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","SL_types2") defaultAttributes)))  parseRules ("Doxygen","SL_DetectEnv") =   (((pRegExpr regex_'5b'40'5c'5c'5dcode'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","Code"))@@ -393,40 +439,54 @@    <|>    ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_Todo >>= withAttribute KeywordTok))    <|>-   ((pRegExpr regex_'26'5bA'2dZa'2dz'5d'2b'3b >>= withAttribute OtherTok)))+   ((pRegExpr regex_'26'5bA'2dZa'2dz'5d'2b'3b >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","SL_DetectEnv")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","SL_DetectEnv") defaultAttributes)))  parseRules ("Doxygen","SL_DetectComment") =   (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext))    <|>    ((pDetectChar False '*' >>= withAttribute CommentTok))    <|>-   ((pString False "///" >>= withAttribute CommentTok)))+   ((pString False "///" >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","SL_DetectComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","SL_DetectComment") defaultAttributes)))  parseRules ("Doxygen","Code") =   (((parseRules ("Doxygen","SL_DetectComment")))    <|>-   ((pRegExpr regex_'5b'40'5c'5c'5dendcode'5cb >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'40'5c'5c'5dendcode'5cb >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","Code")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","Code") defaultAttributes)))  parseRules ("Doxygen","Verbatim") =   (((parseRules ("Doxygen","SL_DetectComment")))    <|>-   ((pRegExpr regex_'5b'40'5c'5c'5dendverbatim'5cb >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'40'5c'5c'5dendverbatim'5cb >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","Verbatim")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","Verbatim") defaultAttributes)))  parseRules ("Doxygen","Formula") =   (((parseRules ("Doxygen","SL_DetectComment")))    <|>-   ((pRegExpr regex_'5b'40'5c'5c'5df'5c'5d >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'40'5c'5c'5df'5c'5d >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","Formula")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","Formula") defaultAttributes)))  parseRules ("Doxygen","Msc") =   (((parseRules ("Doxygen","SL_DetectComment")))    <|>-   ((pRegExpr regex_'5b'40'5c'5c'5dendmsc'5cb >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'40'5c'5c'5dendmsc'5cb >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","Msc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","Msc") defaultAttributes)))  parseRules ("Doxygen","Dot") =   (((parseRules ("Doxygen","SL_DetectComment")))    <|>-   ((pRegExpr regex_'5b'40'5c'5c'5denddot'5cb >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'40'5c'5c'5denddot'5cb >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Doxygen","Dot")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Doxygen","Dot") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Doxygen","Normal") <|> fail ("Unknown context" ++ show x)
+ Text/Highlighting/Kate/Syntax/Doxygenlua.hs view
@@ -0,0 +1,378 @@+{- This module was generated from data in the Kate syntax+   highlighting file doxygenlua.xml, version 1.01, by Bruno Massa (brmassa@gmail.com) -}++module Text.Highlighting.Kate.Syntax.Doxygenlua+          (highlight, parseExpression, syntaxName, syntaxExtensions)+where+import Text.Highlighting.Kate.Types+import Text.Highlighting.Kate.Common+import qualified Text.Highlighting.Kate.Syntax.Alert+import Text.ParserCombinators.Parsec hiding (State)+import Control.Monad.State+import Data.Char (isSpace)+import Data.Maybe (fromMaybe)+import qualified Data.Set as Set++-- | Full name of language.+syntaxName :: String+syntaxName = "DoxygenLua"++-- | Filename extensions for this language.+syntaxExtensions :: String+syntaxExtensions = "*.dox;*.doxygen"++-- | Highlight source code using this syntax definition.+highlight :: String -> [SourceLine]+highlight input = evalState (mapM parseSourceLine $ lines input) startingState++parseSourceLine :: String -> State SyntaxState SourceLine+parseSourceLine = mkParseSourceLine parseExpression++-- | Parse an expression using appropriate local context.+parseExpression :: KateParser Token+parseExpression = do+  (lang,cont) <- currentContext+  result <- parseRules (lang,cont)+  optional $ do eof+                updateState $ \st -> st{ synStPrevChar = '\n' }+                pEndLine+  return result++startingState = SyntaxState {synStContexts = [("DoxygenLua","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}++pEndLine = do+  updateState $ \st -> st{ synStPrevNonspace = False }+  context <- currentContext+  case context of+    ("DoxygenLua","Normal") -> return ()+    ("DoxygenLua","LineComment") -> (popContext) >> pEndLine+    ("DoxygenLua","BlockComment") -> return ()+    ("DoxygenLua","ML_TagWord") -> (popContext) >> pEndLine+    ("DoxygenLua","ML_TagParam") -> (popContext) >> pEndLine+    ("DoxygenLua","ML_TagWordWord") -> (popContext) >> pEndLine+    ("DoxygenLua","ML_Tag2ndWord") -> (popContext >> popContext) >> pEndLine+    ("DoxygenLua","ML_TagString") -> (popContext) >> pEndLine+    ("DoxygenLua","ML_TagWordString") -> (popContext) >> pEndLine+    ("DoxygenLua","ML_htmltag") -> return ()+    ("DoxygenLua","ML_htmlcomment") -> return ()+    ("DoxygenLua","ML_identifiers") -> return ()+    ("DoxygenLua","ML_types1") -> return ()+    ("DoxygenLua","ML_types2") -> return ()+    ("DoxygenLua","SL_TagWord") -> (popContext) >> pEndLine+    ("DoxygenLua","SL_TagParam") -> (popContext) >> pEndLine+    ("DoxygenLua","SL_TagWordWord") -> (popContext) >> pEndLine+    ("DoxygenLua","SL_Tag2ndWord") -> (popContext >> popContext) >> pEndLine+    ("DoxygenLua","SL_TagString") -> (popContext) >> pEndLine+    ("DoxygenLua","SL_TagWordString") -> (popContext) >> pEndLine+    ("DoxygenLua","SL_htmltag") -> (popContext) >> pEndLine+    ("DoxygenLua","SL_htmlcomment") -> (popContext) >> pEndLine+    ("DoxygenLua","SL_identifiers") -> (popContext) >> pEndLine+    ("DoxygenLua","SL_types1") -> (popContext) >> pEndLine+    ("DoxygenLua","SL_types2") -> (popContext) >> pEndLine+    _ -> return ()++withAttribute attr txt = do+  when (null txt) $ fail "Parser matched no text"+  updateState $ \st -> st { synStPrevChar = last txt+                          , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) }+  return (attr, txt)++list_TagOnly = Set.fromList $ words $ "\\arg \\attention \\author \\callgraph \\code \\dot \\else \\endcode \\endcond \\enddot \\endhtmlonly \\endif \\endlatexonly \\endlink \\endmanonly \\endverbatim \\endxmlonly \\f[ \\f] \\f$ \\hideinitializer \\htmlonly \\interface \\internal \\invariant \\~ \\@ \\$ \\\\ \\# \\latexonly \\li \\manonly \\n \\nosubgrouping \\note \\only \\post \\pre \\remarks \\return \\returns \\sa \\see \\showinitializer \\since \\test \\todo \\verbatim \\warning \\xmlonly @arg @attention @author @callgraph @code @dot @else @endcode @endcond @enddot @endhtmlonly @endif @endlatexonly @endlink @endmanonly @endverbatim @endxmlonly @f[ @f] @f$ @hideinitializer @htmlonly @interface @internal @invariant @~ @@ @$ @\\ @# @latexonly @li @manonly @n @nosubgrouping @note @only @post @pre @remarks @return @returns @sa @see @showinitializer @since @test @todo @verbatim @warning @xmlonly"+list_TagWord = Set.fromList $ words $ "\\addtogroup \\a \\anchor \\b \\c \\class \\cond \\copydoc \\def \\dontinclude \\dotfile \\e \\elseif \\em \\enum \\example \\exception \\exceptions \\file \\htmlinclude \\if \\ifnot \\include \\link \\namespace \\p \\package \\ref \\relatesalso \\relates \\retval \\throw \\throws \\verbinclude \\version \\xrefitem @addtogroup @a @anchor @b @c @class @cond @copydoc @def @dontinclude @dotfile @e @elseif @em @enum @example @exception @exceptions @file @htmlinclude @if @ifnot @include @link @namespace @p @package @ref @relatesalso @relates @retval @throw @throws @verbinclude @version @xrefitem"+list_TagParam = Set.fromList $ words $ "\\param @param"+list_TagWordWord = Set.fromList $ words $ "\\image @image"+list_TagWordString = Set.fromList $ words $ "\\defgroup \\page \\paragraph \\section \\struct \\subsection \\subsubsection \\union \\weakgroup @defgroup @page @paragraph @section @struct @subsection @subsubsection @union @weakgroup"+list_TagString = Set.fromList $ words $ "\\addindex \\brief \\bug \\date \\deprecated \\fn \\ingroup \\line \\mainpage \\name \\overload \\par \\short \\skip \\skipline \\typedef \\until \\var @addindex @brief @bug @date @deprecated @fn @ingroup @line @mainpage @name @overload @par @short @skip @skipline @typedef @until @var"++regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5ba'2dzA'2dZ'5f'3a'5d'5ba'2dzA'2dZ0'2d9'2e'5f'3a'2d'5d'2a = compileRegex "<\\s*\\/?\\s*[a-zA-Z_:][a-zA-Z0-9._:-]*"+regex_'5c'5c'28'3c'7c'3e'29 = compileRegex "\\\\(<|>)"+regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 = compileRegex "\\S(?=([][,?;()]|\\.$|\\.?\\s))"+regex_'5cS = compileRegex "\\S"+regex_'2e = compileRegex "."+regex_'5cs'2a'3d'5cs'2a = compileRegex "\\s*=\\s*"+regex_'5cs'2a'23'3f'5ba'2dzA'2dZ0'2d9'5d'2a = compileRegex "\\s*#?[a-zA-Z0-9]*"++defaultAttributes = [(("DoxygenLua","Normal"),NormalTok),(("DoxygenLua","LineComment"),CommentTok),(("DoxygenLua","BlockComment"),CommentTok),(("DoxygenLua","ML_TagWord"),CommentTok),(("DoxygenLua","ML_TagParam"),CommentTok),(("DoxygenLua","ML_TagWordWord"),CommentTok),(("DoxygenLua","ML_Tag2ndWord"),CommentTok),(("DoxygenLua","ML_TagString"),CommentTok),(("DoxygenLua","ML_TagWordString"),CommentTok),(("DoxygenLua","ML_htmltag"),OtherTok),(("DoxygenLua","ML_htmlcomment"),CommentTok),(("DoxygenLua","ML_identifiers"),OtherTok),(("DoxygenLua","ML_types1"),DataTypeTok),(("DoxygenLua","ML_types2"),DataTypeTok),(("DoxygenLua","SL_TagWord"),CommentTok),(("DoxygenLua","SL_TagParam"),CommentTok),(("DoxygenLua","SL_TagWordWord"),CommentTok),(("DoxygenLua","SL_Tag2ndWord"),CommentTok),(("DoxygenLua","SL_TagString"),CommentTok),(("DoxygenLua","SL_TagWordString"),CommentTok),(("DoxygenLua","SL_htmltag"),OtherTok),(("DoxygenLua","SL_htmlcomment"),CommentTok),(("DoxygenLua","SL_identifiers"),OtherTok),(("DoxygenLua","SL_types1"),DataTypeTok),(("DoxygenLua","SL_types2"),DataTypeTok)]++parseRules ("DoxygenLua","Normal") =+  (((pRegExprDynamic "--\\[(=*)\\[" >>= withAttribute CommentTok) >>~ pushContext ("DoxygenLua","BlockComment"))+   <|>+   ((pString False "--" >>= withAttribute CommentTok) >>~ pushContext ("DoxygenLua","LineComment"))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","Normal") defaultAttributes)))++parseRules ("DoxygenLua","LineComment") =+  (((pDetectSpaces >>= withAttribute CommentTok))+   <|>+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagOnly >>= withAttribute KeywordTok))+   <|>+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWord >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","SL_TagWord"))+   <|>+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagParam >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","SL_TagParam"))+   <|>+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWordWord >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","SL_TagWordWord"))+   <|>+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagString >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","SL_TagString"))+   <|>+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWordString >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","SL_TagWordString"))+   <|>+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("DoxygenLua","SL_htmlcomment"))+   <|>+   ((pDetect2Chars False '<' '<' >>= withAttribute CommentTok))+   <|>+   ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5ba'2dzA'2dZ'5f'3a'5d'5ba'2dzA'2dZ0'2d9'2e'5f'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","SL_htmltag"))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","LineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","LineComment") defaultAttributes)))++parseRules ("DoxygenLua","BlockComment") =+  (((pDetectSpaces >>= withAttribute CommentTok))+   <|>+   ((pRegExprDynamic "\\]%1\\]" >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   ((pDetect2Chars False '@' '{' >>= withAttribute RegionMarkerTok))+   <|>+   ((pDetect2Chars False '@' '}' >>= withAttribute RegionMarkerTok))+   <|>+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagOnly >>= withAttribute KeywordTok))+   <|>+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWord >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","ML_TagWord"))+   <|>+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagParam >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","ML_TagParam"))+   <|>+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWordWord >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","ML_TagWordWord"))+   <|>+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagString >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","ML_TagString"))+   <|>+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWordString >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","ML_TagWordString"))+   <|>+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   ((pRegExpr regex_'5c'5c'28'3c'7c'3e'29 >>= withAttribute KeywordTok))+   <|>+   ((pDetect2Chars False '<' '<' >>= withAttribute CommentTok))+   <|>+   ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5ba'2dzA'2dZ'5f'3a'5d'5ba'2dzA'2dZ0'2d9'2e'5f'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","ML_htmltag"))+   <|>+   ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("DoxygenLua","ML_htmlcomment"))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","BlockComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","BlockComment") defaultAttributes)))++parseRules ("DoxygenLua","ML_TagWord") =+  (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))+   <|>+   ((parseRules ("DoxygenLua","SL_TagWord")))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","ML_TagWord")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","ML_TagWord") defaultAttributes)))++parseRules ("DoxygenLua","ML_TagParam") =+  (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))+   <|>+   ((pDetectSpaces >>= withAttribute CommentTok))+   <|>+   ((pString False "[in]" >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","ML_Tag2ndWord"))+   <|>+   ((pString False "[out]" >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","ML_Tag2ndWord"))+   <|>+   ((pString False "[in,out]" >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","ML_Tag2ndWord"))+   <|>+   ((pRegExpr regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","ML_TagParam")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","ML_TagParam") defaultAttributes)))++parseRules ("DoxygenLua","ML_TagWordWord") =+  (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))+   <|>+   ((pDetectSpaces >>= withAttribute CommentTok))+   <|>+   ((pRegExpr regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","ML_Tag2ndWord"))+   <|>+   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","ML_TagWordWord")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","ML_TagWordWord") defaultAttributes)))++parseRules ("DoxygenLua","ML_Tag2ndWord") =+  (((lookAhead (pDetect2Chars False '*' '/') >> (popContext >> popContext) >> currentContext >>= parseRules))+   <|>+   ((parseRules ("DoxygenLua","SL_Tag2ndWord")))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","ML_Tag2ndWord")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","ML_Tag2ndWord") defaultAttributes)))++parseRules ("DoxygenLua","ML_TagString") =+  (((pDetectSpaces >>= withAttribute CommentTok))+   <|>+   ((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))+   <|>+   ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("DoxygenLua","ML_htmlcomment"))+   <|>+   ((pDetect2Chars False '<' '<' >>= withAttribute CommentTok))+   <|>+   ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5ba'2dzA'2dZ'5f'3a'5d'5ba'2dzA'2dZ0'2d9'2e'5f'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","ML_htmltag"))+   <|>+   ((pRegExpr regex_'2e >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","ML_TagString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","ML_TagString") defaultAttributes)))++parseRules ("DoxygenLua","ML_TagWordString") =+  (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))+   <|>+   ((parseRules ("DoxygenLua","SL_TagWordString")))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","ML_TagWordString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","ML_TagWordString") defaultAttributes)))++parseRules ("DoxygenLua","ML_htmltag") =+  (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))+   <|>+   ((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("DoxygenLua","ML_identifiers"))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","ML_htmltag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","ML_htmltag") defaultAttributes)))++parseRules ("DoxygenLua","ML_htmlcomment") =+  (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))+   <|>+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","ML_htmlcomment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","ML_htmlcomment") defaultAttributes)))++parseRules ("DoxygenLua","ML_identifiers") =+  (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))+   <|>+   ((pRegExpr regex_'5cs'2a'23'3f'5ba'2dzA'2dZ0'2d9'5d'2a >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ pushContext ("DoxygenLua","ML_types1"))+   <|>+   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("DoxygenLua","ML_types2"))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","ML_identifiers")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","ML_identifiers") defaultAttributes)))++parseRules ("DoxygenLua","ML_types1") =+  (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))+   <|>+   ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","ML_types1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","ML_types1") defaultAttributes)))++parseRules ("DoxygenLua","ML_types2") =+  (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules))+   <|>+   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","ML_types2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","ML_types2") defaultAttributes)))++parseRules ("DoxygenLua","SL_TagWord") =+  (((pDetectSpaces >>= withAttribute CommentTok))+   <|>+   ((lookAhead (pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWord) >> (popContext) >> currentContext >>= parseRules))+   <|>+   ((pRegExpr regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","SL_TagWord")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","SL_TagWord") defaultAttributes)))++parseRules ("DoxygenLua","SL_TagParam") =+  (((pDetectSpaces >>= withAttribute CommentTok))+   <|>+   ((pString False "[in]" >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","SL_Tag2ndWord"))+   <|>+   ((pString False "[out]" >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","SL_Tag2ndWord"))+   <|>+   ((pString False "[in,out]" >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","SL_Tag2ndWord"))+   <|>+   ((pRegExpr regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","SL_TagParam")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","SL_TagParam") defaultAttributes)))++parseRules ("DoxygenLua","SL_TagWordWord") =+  (((pDetectSpaces >>= withAttribute CommentTok))+   <|>+   ((pRegExpr regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","SL_Tag2ndWord"))+   <|>+   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","SL_TagWordWord")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","SL_TagWordWord") defaultAttributes)))++parseRules ("DoxygenLua","SL_Tag2ndWord") =+  (((pDetectSpaces >>= withAttribute CommentTok))+   <|>+   ((pRegExpr regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","SL_Tag2ndWord")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","SL_Tag2ndWord") defaultAttributes)))++parseRules ("DoxygenLua","SL_TagString") =+  (((pDetectSpaces >>= withAttribute CommentTok))+   <|>+   ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("DoxygenLua","SL_htmlcomment"))+   <|>+   ((pDetect2Chars False '<' '<' >>= withAttribute CommentTok))+   <|>+   ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5ba'2dzA'2dZ'5f'3a'5d'5ba'2dzA'2dZ0'2d9'2e'5f'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("DoxygenLua","SL_htmltag"))+   <|>+   ((pRegExpr regex_'2e >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","SL_TagString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","SL_TagString") defaultAttributes)))++parseRules ("DoxygenLua","SL_TagWordString") =+  (((pDetectSpaces >>= withAttribute CommentTok))+   <|>+   ((pRegExpr regex_'5cS'28'3f'3d'28'5b'5d'5b'2c'3f'3b'28'29'5d'7c'5c'2e'24'7c'5c'2e'3f'5cs'29'29 >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","SL_TagWordString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","SL_TagWordString") defaultAttributes)))++parseRules ("DoxygenLua","SL_htmltag") =+  (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("DoxygenLua","SL_identifiers"))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","SL_htmltag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","SL_htmltag") defaultAttributes)))++parseRules ("DoxygenLua","SL_htmlcomment") =+  (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","SL_htmlcomment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","SL_htmlcomment") defaultAttributes)))++parseRules ("DoxygenLua","SL_identifiers") =+  (((pRegExpr regex_'5cs'2a'23'3f'5ba'2dzA'2dZ0'2d9'5d'2a >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ pushContext ("DoxygenLua","SL_types1"))+   <|>+   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("DoxygenLua","SL_types2"))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","SL_identifiers")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","SL_identifiers") defaultAttributes)))++parseRules ("DoxygenLua","SL_types1") =+  (((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","SL_types1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","SL_types1") defaultAttributes)))++parseRules ("DoxygenLua","SL_types2") =+  (((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("DoxygenLua","SL_types2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DoxygenLua","SL_types2") defaultAttributes)))++parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression++parseRules x = parseRules ("DoxygenLua","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Dtd.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "DTD"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("DTD","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -88,7 +84,9 @@    <|>    ((pString False "<!ENTITY" >>= withAttribute DataTypeTok) >>~ pushContext ("DTD","Declaration"))    <|>-   ((pDetectIdentifier >>= withAttribute NormalTok)))+   ((pDetectIdentifier >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("DTD","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DTD","Normal") defaultAttributes)))  parseRules ("DTD","Comment") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -97,10 +95,14 @@    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("DTD","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DTD","Comment") defaultAttributes)))  parseRules ("DTD","PI") =-  ((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext))+  (((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("DTD","PI")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DTD","PI") defaultAttributes)))  parseRules ("DTD","Declaration") =   (((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("DTD","Comment"))@@ -125,14 +127,18 @@    <|>    ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_Keywords >>= withAttribute KeywordTok))    <|>-   ((pRegExpr regex_'5cb'5b'5c'2d'5cw'5cd'5c'2e'3a'5f'5d'2b'5cb >>= withAttribute FunctionTok)))+   ((pRegExpr regex_'5cb'5b'5c'2d'5cw'5cd'5c'2e'3a'5f'5d'2b'5cb >>= withAttribute FunctionTok))+   <|>+   (currentContext >>= \x -> guard (x == ("DTD","Declaration")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DTD","Declaration") defaultAttributes)))  parseRules ("DTD","String") =   (((pDetectSpaces >>= withAttribute StringTok))    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'25'5b'5c'2d'5cw'5cd'5c'2e'3a'5f'5d'2b'3b >>= withAttribute DecValTok)))+   ((pRegExpr regex_'25'5b'5c'2d'5cw'5cd'5c'2e'3a'5f'5d'2b'3b >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("DTD","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DTD","String") defaultAttributes)))  parseRules ("DTD","InlineComment") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -141,8 +147,10 @@    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("DTD","InlineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("DTD","InlineComment") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("DTD","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Eiffel.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Eiffel"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Eiffel","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -80,13 +76,17 @@    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Eiffel","Quoted String"))    <|>-   ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("Eiffel","Documentation")))+   ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("Eiffel","Documentation"))+   <|>+   (currentContext >>= \x -> guard (x == ("Eiffel","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Eiffel","Normal") defaultAttributes)))  parseRules ("Eiffel","Quoted String") =-  ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+  (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Eiffel","Quoted String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Eiffel","Quoted String") defaultAttributes)))  parseRules ("Eiffel","Documentation") =-  pzero+  (currentContext >>= \x -> guard (x == ("Eiffel","Documentation")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Eiffel","Documentation") defaultAttributes))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Eiffel","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Email.hs view
@@ -30,11 +30,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Email"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Email","headder")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -230,7 +226,9 @@    <|>    ((pColumn 0 >> pRegExpr regex_'5bA'2dZa'2dz0'2d9'2b'3d'2f'5d'2b'3d'24 >>= withAttribute RegionMarkerTok))    <|>-   ((pColumn 0 >> pRegExpr regex_'28'2d_'29'3f'2d'2d'28'2d'2d'2e'2a'29'3f >>= withAttribute AlertTok)))+   ((pColumn 0 >> pRegExpr regex_'28'2d_'29'3f'2d'2d'28'2d'2d'2e'2a'29'3f >>= withAttribute AlertTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Email","headder")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Email","headder") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Email","headder") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Erlang.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Erlang"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Erlang","Normal Text")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -116,24 +112,34 @@    <|>    ((pRegExpr regex_'5c'24'5cS >>= withAttribute DecValTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5b0'2d9'5d'2b >>= withAttribute DecValTok) >>~ (popContext)))+   ((pRegExpr regex_'5b0'2d9'5d'2b >>= withAttribute DecValTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Erlang","Normal Text")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Erlang","Normal Text") defaultAttributes)))  parseRules ("Erlang","isfunction") =-  ((pRegExpr regex_'5cb'5ba'2dz'5d'5b'5fa'2dz'40'2dZ0'2d9'5d'2a'28'3f'3a'28'3f'3d'5b'5e'5fa'2dz'40'2dZ0'2d9'5d'29'7c'24'29 >>= withAttribute FunctionTok) >>~ (popContext))+  (((pRegExpr regex_'5cb'5ba'2dz'5d'5b'5fa'2dz'40'2dZ0'2d9'5d'2a'28'3f'3a'28'3f'3d'5b'5e'5fa'2dz'40'2dZ0'2d9'5d'29'7c'24'29 >>= withAttribute FunctionTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Erlang","isfunction")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Erlang","isfunction") defaultAttributes)))  parseRules ("Erlang","atomquote") =-  ((pRegExpr regex_'28'3f'3a'28'3f'3a'5c'5c'27'29'3f'5b'5e'27'5d'2a'29'2a'27 >>= withAttribute CharTok) >>~ (popContext))+  (((pRegExpr regex_'28'3f'3a'28'3f'3a'5c'5c'27'29'3f'5b'5e'27'5d'2a'29'2a'27 >>= withAttribute CharTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Erlang","atomquote")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Erlang","atomquote") defaultAttributes)))  parseRules ("Erlang","stringquote") =-  ((pRegExpr regex_'28'3f'3a'28'3f'3a'5c'5c'22'29'3f'5b'5e'22'5d'2a'29'2a'22 >>= withAttribute StringTok) >>~ (popContext))+  (((pRegExpr regex_'28'3f'3a'28'3f'3a'5c'5c'22'29'3f'5b'5e'22'5d'2a'29'2a'22 >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Erlang","stringquote")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Erlang","stringquote") defaultAttributes)))  parseRules ("Erlang","comment") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Erlang","comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Erlang","comment") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Erlang","Normal Text") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Fortran.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Fortran"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Fortran","default")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -156,22 +152,30 @@    <|>    ((parseRules ("Fortran","find_end_stmnts")))    <|>-   ((parseRules ("Fortran","find_mid_stmnts"))))+   ((parseRules ("Fortran","find_mid_stmnts")))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","default")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","default") defaultAttributes)))  parseRules ("Fortran","find_preprocessor") =-  ((pColumn 0 >> pRegExpr regex_'28'23'7ccDEC'5c'24'7cCDEC'5c'24'29'2e'2a'24 >>= withAttribute OtherTok))+  (((pColumn 0 >> pRegExpr regex_'28'23'7ccDEC'5c'24'7cCDEC'5c'24'29'2e'2a'24 >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","find_preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","find_preprocessor") defaultAttributes)))  parseRules ("Fortran","find_op_and_log") =   (((pRegExpr regex_'5c'2e'28true'7cfalse'29'5c'2e >>= withAttribute OtherTok))    <|>    ((pRegExpr regex_'5c'2e'5bA'2dZa'2dz'5d'2b'5c'2e >>= withAttribute KeywordTok))    <|>-   ((pRegExpr regex_'28'3d'3d'7c'2f'3d'7c'3c'7c'3c'3d'7c'3e'7c'3e'3d'29 >>= withAttribute KeywordTok)))+   ((pRegExpr regex_'28'3d'3d'7c'2f'3d'7c'3c'7c'3c'3d'7c'3e'7c'3e'3d'29 >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","find_op_and_log")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","find_op_and_log") defaultAttributes)))  parseRules ("Fortran","find_comments") =   (((pColumn 0 >> pRegExpr regex_'5bcC'5c'2a'5d'2e'2a'24 >>= withAttribute CommentTok))    <|>-   ((pRegExpr regex_'21'2e'2a'24 >>= withAttribute CommentTok)))+   ((pRegExpr regex_'21'2e'2a'24 >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","find_comments")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","find_comments") defaultAttributes)))  parseRules ("Fortran","find_symbols") =   (((pDetect2Chars False '*' '*' >>= withAttribute KeywordTok))@@ -182,7 +186,9 @@    <|>    ((pAnyChar "&+-*/=?[]^{|}~" >>= withAttribute KeywordTok))    <|>-   ((pAnyChar "()," >>= withAttribute NormalTok)))+   ((pAnyChar "()," >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","find_symbols")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","find_symbols") defaultAttributes)))  parseRules ("Fortran","inside_func_paren") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Fortran","inside_func_paren"))@@ -193,7 +199,9 @@    <|>    ((parseRules ("Fortran","find_intrinsics")))    <|>-   ((parseRules ("Fortran","find_numbers"))))+   ((parseRules ("Fortran","find_numbers")))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","inside_func_paren")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","inside_func_paren") defaultAttributes)))  parseRules ("Fortran","find_io_stmnts") =   (((pRegExpr regex_'5cb'28read'7cwrite'7cbackspace'7crewind'7cend'5cs'2afile'7cclose'29'5cs'2a'5b'28'5d >>= withAttribute FunctionTok) >>~ pushContext ("Fortran","find_io_paren"))@@ -206,7 +214,9 @@    <|>    ((pRegExpr regex_'5cbend'5cs'2afile'5cb >>= withAttribute FunctionTok))    <|>-   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_io'5ffunctions >>= withAttribute FunctionTok)))+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_io'5ffunctions >>= withAttribute FunctionTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","find_io_stmnts")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","find_io_stmnts") defaultAttributes)))  parseRules ("Fortran","find_io_paren") =   (((pDetectChar False '*' >>= withAttribute FunctionTok))@@ -227,7 +237,9 @@    <|>    ((parseRules ("Fortran","find_numbers")))    <|>-   ((parseRules ("Fortran","find_symbols"))))+   ((parseRules ("Fortran","find_symbols")))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","find_io_paren")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","find_io_paren") defaultAttributes)))  parseRules ("Fortran","format_stmnt") =   (((pDetectChar False '(' >>= withAttribute FunctionTok) >>~ pushContext ("Fortran","format_stmnt"))@@ -240,7 +252,9 @@    <|>    ((parseRules ("Fortran","find_strings")))    <|>-   ((parseRules ("Fortran","find_symbols"))))+   ((parseRules ("Fortran","find_symbols")))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","format_stmnt")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","format_stmnt") defaultAttributes)))  parseRules ("Fortran","find_begin_stmnts") =   (((pRegExpr regex_'5cbmodule'5cs'2bprocedure'5cb >>= withAttribute KeywordTok))@@ -249,7 +263,9 @@    <|>    ((pRegExpr regex_'5cb'28program'7cmodule'7cblock'5cs'2adata'29'5cb >>= withAttribute KeywordTok))    <|>-   ((pRegExpr regex_'5cb'28then'7cdo'29'5cb >>= withAttribute KeywordTok)))+   ((pRegExpr regex_'5cb'28then'7cdo'29'5cb >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","find_begin_stmnts")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","find_begin_stmnts") defaultAttributes)))  parseRules ("Fortran","find_end_stmnts") =   (((pRegExpr regex_'5cbend'5cs'2a'28subroutine'7cfunction'7cblock'5cs'2adata'29'5cb >>= withAttribute KeywordTok))@@ -262,12 +278,16 @@    <|>    ((pRegExpr regex_'5cbelse'5cs'2aif'5cb >>= withAttribute KeywordTok))    <|>-   ((pRegExpr regex_'5cbend'5cb >>= withAttribute KeywordTok)))+   ((pRegExpr regex_'5cbend'5cb >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","find_end_stmnts")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","find_end_stmnts") defaultAttributes)))  parseRules ("Fortran","find_mid_stmnts") =   (((pRegExpr regex_'5cbelse'5cb >>= withAttribute KeywordTok))    <|>-   ((pRegExpr regex_'5cbcontains'5cb >>= withAttribute KeywordTok)))+   ((pRegExpr regex_'5cbcontains'5cb >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","find_mid_stmnts")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","find_mid_stmnts") defaultAttributes)))  parseRules ("Fortran","find_decls") =   (((pRegExpr regex_'5cbinteger'5b'5c'2a'5d'5cd'7b1'2c2'7d >>= withAttribute DataTypeTok))@@ -292,12 +312,16 @@    <|>    ((pRegExpr regex_'5cb'28type'7cinteger'7ccomplex'7ccharacter'7clogical'7cintent'7cdimension'29'5cb >>= withAttribute DataTypeTok))    <|>-   ((pDetect2Chars False ':' ':' >>= withAttribute DataTypeTok)))+   ((pDetect2Chars False ':' ':' >>= withAttribute DataTypeTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","find_decls")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","find_decls") defaultAttributes)))  parseRules ("Fortran","find_paren") =   (((pDetectChar False '(' >>= withAttribute DataTypeTok) >>~ pushContext ("Fortran","find_paren"))    <|>-   ((pDetectChar False ')' >>= withAttribute DataTypeTok) >>~ (popContext)))+   ((pDetectChar False ')' >>= withAttribute DataTypeTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","find_paren")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","find_paren") defaultAttributes)))  parseRules ("Fortran","find_intrinsics") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok))@@ -308,7 +332,9 @@    <|>    ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_transform'5ffn >>= withAttribute FunctionTok))    <|>-   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_non'5felem'5fsubr >>= withAttribute KeywordTok)))+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_non'5felem'5fsubr >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","find_intrinsics")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","find_intrinsics") defaultAttributes)))  parseRules ("Fortran","find_numbers") =   (((pRegExpr regex_'5b0'2d9'5d'2a'5c'2e'5b0'2d9'5d'2b'28'5bde'5d'5b'2b'2d'5d'3f'5b0'2d9'5d'2b'29'3f'28'5b'5f'5d'28'5b0'2d9'5d'2b'7c'5ba'2dz'5d'5b'5cw'5f'5d'2a'29'29'3f >>= withAttribute FloatTok))@@ -319,12 +345,16 @@    <|>    ((pRegExpr regex_'5cb'5b0'2d9'5d'2b'28'5b'5f'5d'28'5b0'2d9'5d'2b'7c'5ba'2dzA'2dZ'5d'5b'5cw'5f'5d'2a'29'29'3f >>= withAttribute DecValTok))    <|>-   ((pRegExpr regex_'5cb'5bbozx'5d'28'5b'27'5d'5b0'2d9a'2df'5d'2b'5b'27'5d'7c'5b'22'5d'5b0'2d9a'2df'5d'2b'5b'22'5d'29 >>= withAttribute DecValTok)))+   ((pRegExpr regex_'5cb'5bbozx'5d'28'5b'27'5d'5b0'2d9a'2df'5d'2b'5b'27'5d'7c'5b'22'5d'5b0'2d9a'2df'5d'2b'5b'22'5d'29 >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","find_numbers")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","find_numbers") defaultAttributes)))  parseRules ("Fortran","find_strings") =   (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Fortran","string_1"))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Fortran","string_2")))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Fortran","string_2"))+   <|>+   (currentContext >>= \x -> guard (x == ("Fortran","find_strings")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Fortran","find_strings") defaultAttributes)))  parseRules ("Fortran","string_1") =   (((pRegExpr regex_'5b'5e'27'5d'2a'27 >>= withAttribute StringTok) >>~ (popContext))@@ -356,4 +386,4 @@    ((popContext >> popContext) >> currentContext >>= parseRules))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Fortran","default") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Fsharp.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "FSharp"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("FSharp","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -166,42 +162,56 @@    <|>    ((pRegExpr regex_'2d'3f'5b0'2d9'5d'5b0'2d9'5f'5d'2a'28'28'5c'2e'28'5b0'2d9'5d'5b0'2d9'5f'5d'2a'29'3f'28'5beE'5d'5b'2d'2b'5d'3f'5b0'2d9'5d'5b0'2d9'5f'5d'2a'29'3f'29'7c'28'5beE'5d'5b'2d'2b'5d'3f'5b0'2d9'5d'5b0'2d9'5f'5d'2a'29'29 >>= withAttribute FloatTok))    <|>-   ((pRegExpr regex_'2d'3f'5b0'2d9'5d'5b0'2d9'5f'5d'2a >>= withAttribute DecValTok)))+   ((pRegExpr regex_'2d'3f'5b0'2d9'5d'5b0'2d9'5f'5d'2a >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("FSharp","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("FSharp","Normal") defaultAttributes)))  parseRules ("FSharp","Singleline Comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("FSharp","Singleline Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("FSharp","Singleline Comment") defaultAttributes))  parseRules ("FSharp","Multiline Comment") =   (((pDetect2Chars False '*' ')' >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("FSharp","Multiline Comment")))+   ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("FSharp","Multiline Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("FSharp","Multiline Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("FSharp","Multiline Comment") defaultAttributes)))  parseRules ("FSharp","String Constant") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>    ((pRegExpr regex_'28'5c'5c'5bntbr'27'22'5c'5c'5d'7c'5c'5c'5b0'2d9'5d'7b3'7d'7c'5c'5cx'5b0'2d9A'2dFa'2df'5d'7b2'7d'29 >>= withAttribute CharTok))    <|>-   ((pRegExpr regex_'5c'5c'24 >>= withAttribute CharTok)))+   ((pRegExpr regex_'5c'5c'24 >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("FSharp","String Constant")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("FSharp","String Constant") defaultAttributes)))  parseRules ("FSharp","Block") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("FSharp","Normal"))))+   ((parseRules ("FSharp","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("FSharp","Block")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("FSharp","Block") defaultAttributes)))  parseRules ("FSharp","Sig") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("FSharp","Normal"))))+   ((parseRules ("FSharp","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("FSharp","Sig")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("FSharp","Sig") defaultAttributes)))  parseRules ("FSharp","Struct") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("FSharp","Normal"))))+   ((parseRules ("FSharp","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("FSharp","Struct")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("FSharp","Struct") defaultAttributes)))  parseRules ("FSharp","Object") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("FSharp","Normal"))))+   ((parseRules ("FSharp","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("FSharp","Object")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("FSharp","Object") defaultAttributes)))  parseRules ("FSharp","ModuleEnv") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -217,7 +227,9 @@    <|>    ((pDetectSpaces >>= withAttribute NormalTok))    <|>-   ((pString False "." >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pString False "." >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("FSharp","ModuleEnv2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("FSharp","ModuleEnv2") defaultAttributes)))  parseRules ("FSharp","Camlp4 Quotation Constant") =   (((pDetect2Chars False '>' '>' >>= withAttribute StringTok) >>~ (popContext))@@ -228,7 +240,9 @@    <|>    ((pRegExpr regex_'5c'5c'28'5c'5c'7c'3e'3e'7c'3c'3c'29 >>= withAttribute CharTok))    <|>-   ((pRegExpr regex_'5c'5c'3c'3a'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c0377'5f'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a'3c >>= withAttribute CharTok)))+   ((pRegExpr regex_'5c'5c'3c'3a'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c0377'5f'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a'3c >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("FSharp","Camlp4 Quotation Constant")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("FSharp","Camlp4 Quotation Constant") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("FSharp","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Gnuassembler.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "GNU Assembler"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("GNU Assembler","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -112,32 +108,42 @@    <|>    ((pAnyChar "@;#" >>= withAttribute CommentTok) >>~ pushContext ("GNU Assembler","Commentar 2"))    <|>-   ((pAnyChar "!#%&*()+,-<=>?/:[]^{|}~" >>= withAttribute NormalTok)))+   ((pAnyChar "!#%&*()+,-<=>?/:[]^{|}~" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("GNU Assembler","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("GNU Assembler","Normal") defaultAttributes)))  parseRules ("GNU Assembler","Commentar 1") =   (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)))+   ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("GNU Assembler","Commentar 1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("GNU Assembler","Commentar 1") defaultAttributes)))  parseRules ("GNU Assembler","Commentar 2") =-  ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+  (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("GNU Assembler","Commentar 2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("GNU Assembler","Commentar 2") defaultAttributes)))  parseRules ("GNU Assembler","String") =   (((pLineContinue >>= withAttribute StringTok) >>~ pushContext ("GNU Assembler","Some Context"))    <|>    ((pHlCStringChar >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("GNU Assembler","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("GNU Assembler","String") defaultAttributes)))  parseRules ("GNU Assembler","Preprocessor") =-  pzero+  (currentContext >>= \x -> guard (x == ("GNU Assembler","Preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("GNU Assembler","Preprocessor") defaultAttributes))  parseRules ("GNU Assembler","Define") =-  ((pLineContinue >>= withAttribute OtherTok))+  (((pLineContinue >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("GNU Assembler","Define")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("GNU Assembler","Define") defaultAttributes)))  parseRules ("GNU Assembler","Some Context") =-  pzero+  (currentContext >>= \x -> guard (x == ("GNU Assembler","Some Context")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("GNU Assembler","Some Context") defaultAttributes))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("GNU Assembler","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Go.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Go"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Go","normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -96,7 +92,9 @@    <|>    ((pDetectChar False '`' >>= withAttribute NormalTok) >>~ pushContext ("Go","Multiline String"))    <|>-   ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok)))+   ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Go","normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Go","normal") defaultAttributes)))  parseRules ("Go","Commentar 1") =   (((pLineContinue >>= withAttribute CommentTok))@@ -105,7 +103,9 @@    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Go","Commentar 1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Go","Commentar 1") defaultAttributes)))  parseRules ("Go","Commentar 2") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -114,22 +114,28 @@    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Go","Commentar 2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Go","Commentar 2") defaultAttributes)))  parseRules ("Go","String") =   (((pLineContinue >>= withAttribute StringTok))    <|>    ((pHlCStringChar >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Go","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Go","String") defaultAttributes)))  parseRules ("Go","Multiline String") =   (((pLineContinue >>= withAttribute StringTok))    <|>    ((pHlCStringChar >>= withAttribute CharTok))    <|>-   ((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Go","Multiline String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Go","Multiline String") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Go","normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Haskell.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Haskell"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Haskell","code")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -127,26 +123,36 @@    <|>    ((pDetect2Chars False '.' '.' >>= withAttribute OtherTok))    <|>-   ((pAnyChar "\8229" >>= withAttribute OtherTok)))+   ((pAnyChar "\8229" >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Haskell","code")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Haskell","code") defaultAttributes)))  parseRules ("Haskell","comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("Haskell","comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Haskell","comment") defaultAttributes))  parseRules ("Haskell","comments") =-  ((pDetect2Chars False '-' '}' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '-' '}' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Haskell","comments")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Haskell","comments") defaultAttributes)))  parseRules ("Haskell","char") =   (((pRegExpr regex_'5c'5c'2e >>= withAttribute CharTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Haskell","char")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Haskell","char") defaultAttributes)))  parseRules ("Haskell","string") =   (((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Haskell","string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Haskell","string") defaultAttributes)))  parseRules ("Haskell","infix") =-  ((pDetectChar False '`' >>= withAttribute OtherTok) >>~ (popContext))+  (((pDetectChar False '`' >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Haskell","infix")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Haskell","infix") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Haskell","code") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Haxe.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Haxe"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Haxe","normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -113,17 +109,23 @@    <|>    ((pRegExpr regex_0'5bxX'5d'5b'5cda'2dfA'2dF'5d'2b >>= withAttribute BaseNTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5cd'2b >>= withAttribute DecValTok) >>~ (popContext)))+   ((pRegExpr regex_'5cd'2b >>= withAttribute DecValTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Haxe","normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Haxe","normal") defaultAttributes)))  parseRules ("Haxe","ModuleName") =   (((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Haxe","CommentLine"))    <|>    ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Haxe","CommentBlock"))    <|>-   ((pRegExpr regex_'5b'5e'5cs'5cw'2e'3a'2c'5d >>= withAttribute NormalTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'5e'5cs'5cw'2e'3a'2c'5d >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Haxe","ModuleName")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Haxe","ModuleName") defaultAttributes)))  parseRules ("Haxe","RawString") =-  ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+  (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Haxe","RawString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Haxe","RawString") defaultAttributes)))  parseRules ("Haxe","String") =   (((pDetect2Chars False '\\' '"' >>= withAttribute StringTok))@@ -132,13 +134,17 @@    <|>    ((pHlCStringChar >>= withAttribute StringTok))    <|>-   ((pRegExpr regex_'5c'5c'28u'5b'5cda'2dfA'2dF'5d'7b4'7d'7cU'5b'5cda'2dfA'2dF'5d'7b8'7d'7c'26'5ba'2dzA'2dZ'5d'5cw'2b'3b'29 >>= withAttribute StringTok)))+   ((pRegExpr regex_'5c'5c'28u'5b'5cda'2dfA'2dF'5d'7b4'7d'7cU'5b'5cda'2dfA'2dF'5d'7b8'7d'7c'26'5ba'2dzA'2dZ'5d'5cw'2b'3b'29 >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Haxe","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Haxe","String") defaultAttributes)))  parseRules ("Haxe","CommentLine") =-  pzero+  (currentContext >>= \x -> guard (x == ("Haxe","CommentLine")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Haxe","CommentLine") defaultAttributes))  parseRules ("Haxe","CommentBlock") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Haxe","CommentBlock")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Haxe","CommentBlock") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Haxe","normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Html.hs view
@@ -33,11 +33,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "HTML"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("HTML","Start")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -119,7 +115,9 @@ defaultAttributes = [(("HTML","Start"),NormalTok),(("HTML","FindHTML"),NormalTok),(("HTML","FindEntityRefs"),NormalTok),(("HTML","FindPEntityRefs"),NormalTok),(("HTML","FindAttributes"),NormalTok),(("HTML","FindDTDRules"),NormalTok),(("HTML","Comment"),CommentTok),(("HTML","CDATA"),NormalTok),(("HTML","PI"),NormalTok),(("HTML","Doctype"),NormalTok),(("HTML","Doctype Internal Subset"),NormalTok),(("HTML","Doctype Markupdecl"),NormalTok),(("HTML","Doctype Markupdecl DQ"),StringTok),(("HTML","Doctype Markupdecl SQ"),StringTok),(("HTML","El Open"),NormalTok),(("HTML","El Close"),NormalTok),(("HTML","El Close 2"),NormalTok),(("HTML","El Close 3"),NormalTok),(("HTML","CSS"),NormalTok),(("HTML","CSS content"),NormalTok),(("HTML","JS"),NormalTok),(("HTML","JS content"),NormalTok),(("HTML","JS comment close"),CommentTok),(("HTML","Value"),NormalTok),(("HTML","Value NQ"),NormalTok),(("HTML","Value DQ"),StringTok),(("HTML","Value SQ"),StringTok)]  parseRules ("HTML","Start") =-  ((parseRules ("HTML","FindHTML")))+  (((parseRules ("HTML","FindHTML")))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","Start")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","Start") defaultAttributes)))  parseRules ("HTML","FindHTML") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -168,29 +166,39 @@    <|>    ((parseRules ("HTML","FindDTDRules")))    <|>-   ((parseRules ("HTML","FindEntityRefs"))))+   ((parseRules ("HTML","FindEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","FindHTML")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","FindHTML") defaultAttributes)))  parseRules ("HTML","FindEntityRefs") =   (((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok))    <|>-   ((pAnyChar "&<" >>= withAttribute ErrorTok)))+   ((pAnyChar "&<" >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","FindEntityRefs")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","FindEntityRefs") defaultAttributes)))  parseRules ("HTML","FindPEntityRefs") =   (((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok))    <|>    ((pRegExpr regex_'25'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'3b >>= withAttribute DecValTok))    <|>-   ((pAnyChar "&%" >>= withAttribute ErrorTok)))+   ((pAnyChar "&%" >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","FindPEntityRefs")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","FindPEntityRefs") defaultAttributes)))  parseRules ("HTML","FindAttributes") =   (((pColumn 0 >> pRegExpr regex_'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute OtherTok))    <|>    ((pRegExpr regex_'5cs'2b'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute OtherTok))    <|>-   ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("HTML","Value")))+   ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("HTML","Value"))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","FindAttributes")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","FindAttributes") defaultAttributes)))  parseRules ("HTML","FindDTDRules") =-  ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("HTML","Doctype Markupdecl"))+  (((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("HTML","Doctype Markupdecl"))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","FindDTDRules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","FindDTDRules") defaultAttributes)))  parseRules ("HTML","Comment") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -201,7 +209,9 @@    <|>    ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'2d'28'2d'28'3f'21'2d'3e'29'29'2b >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'2d'28'2d'28'3f'21'2d'3e'29'29'2b >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","Comment") defaultAttributes)))  parseRules ("HTML","CDATA") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -210,15 +220,21 @@    <|>    ((pString False "]]>" >>= withAttribute BaseNTok) >>~ (popContext))    <|>-   ((pString False "]]&gt;" >>= withAttribute DecValTok)))+   ((pString False "]]&gt;" >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","CDATA")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","CDATA") defaultAttributes)))  parseRules ("HTML","PI") =-  ((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext))+  (((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","PI")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","PI") defaultAttributes)))  parseRules ("HTML","Doctype") =   (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext))    <|>-   ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("HTML","Doctype Internal Subset")))+   ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("HTML","Doctype Internal Subset"))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","Doctype")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","Doctype") defaultAttributes)))  parseRules ("HTML","Doctype Internal Subset") =   (((pDetectChar False ']' >>= withAttribute DataTypeTok) >>~ (popContext))@@ -229,24 +245,32 @@    <|>    ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("HTML","PI"))    <|>-   ((parseRules ("HTML","FindPEntityRefs"))))+   ((parseRules ("HTML","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","Doctype Internal Subset")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","Doctype Internal Subset") defaultAttributes)))  parseRules ("HTML","Doctype Markupdecl") =   (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext))    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("HTML","Doctype Markupdecl DQ"))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("HTML","Doctype Markupdecl SQ")))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("HTML","Doctype Markupdecl SQ"))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","Doctype Markupdecl")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","Doctype Markupdecl") defaultAttributes)))  parseRules ("HTML","Doctype Markupdecl DQ") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("HTML","FindPEntityRefs"))))+   ((parseRules ("HTML","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","Doctype Markupdecl DQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","Doctype Markupdecl DQ") defaultAttributes)))  parseRules ("HTML","Doctype Markupdecl SQ") =   (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("HTML","FindPEntityRefs"))))+   ((parseRules ("HTML","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","Doctype Markupdecl SQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","Doctype Markupdecl SQ") defaultAttributes)))  parseRules ("HTML","El Open") =   (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext))@@ -255,22 +279,30 @@    <|>    ((parseRules ("HTML","FindAttributes")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","El Open")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","El Open") defaultAttributes)))  parseRules ("HTML","El Close") =   (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","El Close")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","El Close") defaultAttributes)))  parseRules ("HTML","El Close 2") =   (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","El Close 2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","El Close 2") defaultAttributes)))  parseRules ("HTML","El Close 3") =   (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext >> popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","El Close 3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","El Close 3") defaultAttributes)))  parseRules ("HTML","CSS") =   (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext))@@ -279,12 +311,16 @@    <|>    ((parseRules ("HTML","FindAttributes")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","CSS")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","CSS") defaultAttributes)))  parseRules ("HTML","CSS content") =   (((pRegExpr regex_'3c'2fstyle'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Close 2"))    <|>-   ((Text.Highlighting.Kate.Syntax.Css.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Css.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","CSS content")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","CSS content") defaultAttributes)))  parseRules ("HTML","JS") =   (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext))@@ -293,19 +329,25 @@    <|>    ((parseRules ("HTML","FindAttributes")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","JS")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","JS") defaultAttributes)))  parseRules ("HTML","JS content") =   (((pRegExpr regex_'3c'2fscript'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Close 2"))    <|>    ((pRegExpr regex_'2f'2f'28'3f'3d'2e'2a'3c'2fscript'5cb'29 >>= withAttribute CommentTok) >>~ pushContext ("HTML","JS comment close"))    <|>-   ((Text.Highlighting.Kate.Syntax.Javascript.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Javascript.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","JS content")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","JS content") defaultAttributes)))  parseRules ("HTML","JS comment close") =   (((pRegExpr regex_'3c'2fscript'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Close 3"))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","JS comment close")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","JS comment close") defaultAttributes)))  parseRules ("HTML","Value") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("HTML","Value DQ"))@@ -328,15 +370,19 @@ parseRules ("HTML","Value DQ") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("HTML","FindEntityRefs"))))+   ((parseRules ("HTML","FindEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","Value DQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","Value DQ") defaultAttributes)))  parseRules ("HTML","Value SQ") =   (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("HTML","FindEntityRefs"))))+   ((parseRules ("HTML","FindEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("HTML","Value SQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("HTML","Value SQ") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression parseRules ("CSS", _) = Text.Highlighting.Kate.Syntax.Css.parseExpression parseRules ("JavaScript", _) = Text.Highlighting.Kate.Syntax.Javascript.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("HTML","Start") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Ini.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "INI Files"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("INI Files","ini")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -73,7 +69,9 @@    <|>    ((pFirstNonSpace >> pDetectChar False ';' >>= withAttribute CommentTok) >>~ pushContext ("INI Files","Comment"))    <|>-   ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("INI Files","Comment")))+   ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("INI Files","Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("INI Files","ini")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("INI Files","ini") defaultAttributes)))  parseRules ("INI Files","Value") =   (((pFloat >>= withAttribute FloatTok))@@ -84,15 +82,19 @@    <|>    ((pRegExpr regex_'3b'2e'2a'24 >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'23'2e'2a'24 >>= withAttribute CommentTok) >>~ (popContext)))+   ((pRegExpr regex_'23'2e'2a'24 >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("INI Files","Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("INI Files","Value") defaultAttributes)))  parseRules ("INI Files","Comment") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("INI Files","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("INI Files","Comment") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("INI Files","ini") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Java.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Java"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Java","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -138,12 +134,16 @@    <|>    ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Java","InFunctionCall"))    <|>-   ((pAnyChar ":!%&+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok)))+   ((pAnyChar ":!%&+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Java","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Java","Normal") defaultAttributes)))  parseRules ("Java","InFunctionCall") =   (((parseRules ("Java","Normal")))    <|>-   ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)))+   ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Java","InFunctionCall")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Java","InFunctionCall") defaultAttributes)))  parseRules ("Java","String") =   (((pLineContinue >>= withAttribute StringTok))@@ -152,7 +152,9 @@    <|>    ((pRegExpr regex_'5c'5cu'5b0'2d9a'2dfA'2dF'5d'7b4'7d >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Java","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Java","String") defaultAttributes)))  parseRules ("Java","EnterPrintf") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Java","Printf"))@@ -164,7 +166,9 @@ parseRules ("Java","Printf") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Java","PrintfString"))    <|>-   ((parseRules ("Java","InFunctionCall"))))+   ((parseRules ("Java","InFunctionCall")))+   <|>+   (currentContext >>= \x -> guard (x == ("Java","Printf")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Java","Printf") defaultAttributes)))  parseRules ("Java","PrintfString") =   (((pLineContinue >>= withAttribute StringTok))@@ -177,7 +181,9 @@    <|>    ((pRegExpr regex_'25'28'5cd'2b'5c'24'29'3f'28'2d'7c'23'7c'5c'2b'7c'5c_'7c0'7c'2c'7c'5c'28'29'2a'5cd'2a'28t'7cT'29'28a'7cA'7cb'7cB'7cc'7cC'7cd'7cD'7ce'7cF'7ch'7cH'7cI'7cj'7ck'7cl'7cL'7cm'7cM'7cN'7cp'7cP'7cQ'7cr'7cR'7cs'7cS'7cT'7cy'7cY'7cz'7cZ'29 >>= withAttribute CharTok))    <|>-   ((pRegExpr regex_'25'28'25'7cn'29 >>= withAttribute CharTok)))+   ((pRegExpr regex_'25'28'25'7cn'29 >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Java","PrintfString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Java","PrintfString") defaultAttributes)))  parseRules ("Java","Member") =   (((pRegExpr regex_'5cb'5b'5fa'2dzA'2dZ'5d'5cw'2a'28'3f'3d'5b'5cs'5d'2a'29 >>= withAttribute FunctionTok) >>~ (popContext))@@ -185,17 +191,23 @@    ((popContext) >> currentContext >>= parseRules))  parseRules ("Java","StaticImports") =-  ((pRegExpr regex_'5cs'2a'2e'2a'3b >>= withAttribute KeywordTok) >>~ (popContext))+  (((pRegExpr regex_'5cs'2a'2e'2a'3b >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Java","StaticImports")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Java","StaticImports") defaultAttributes)))  parseRules ("Java","Imports") =-  ((pRegExpr regex_'5cs'2a'2e'2a'3b >>= withAttribute KeywordTok) >>~ (popContext))+  (((pRegExpr regex_'5cs'2a'2e'2a'3b >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Java","Imports")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Java","Imports") defaultAttributes)))  parseRules ("Java","Commentar 1") =-  pzero+  (currentContext >>= \x -> guard (x == ("Java","Commentar 1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Java","Commentar 1") defaultAttributes))  parseRules ("Java","Commentar 2") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Java","Commentar 2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Java","Commentar 2") defaultAttributes)))  parseRules ("Javadoc", _) = Text.Highlighting.Kate.Syntax.Javadoc.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Java","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Javadoc.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Javadoc"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Javadoc","Start")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -75,12 +71,16 @@ defaultAttributes = [(("Javadoc","Start"),NormalTok),(("Javadoc","FindJavadoc"),NormalTok),(("Javadoc","JavadocFSar"),CommentTok),(("Javadoc","Javadocar"),CommentTok),(("Javadoc","JavadocParam"),CommentTok),(("Javadoc","InlineTagar"),KeywordTok),(("Javadoc","LiteralTagar"),KeywordTok),(("Javadoc","SeeTag"),KeywordTok)]  parseRules ("Javadoc","Start") =-  ((parseRules ("Javadoc","FindJavadoc")))+  (((parseRules ("Javadoc","FindJavadoc")))+   <|>+   (currentContext >>= \x -> guard (x == ("Javadoc","Start")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Javadoc","Start") defaultAttributes)))  parseRules ("Javadoc","FindJavadoc") =   (((pString False "/**/" >>= withAttribute CommentTok))    <|>-   ((pString False "/**" >>= withAttribute CommentTok) >>~ pushContext ("Javadoc","JavadocFSar")))+   ((pString False "/**" >>= withAttribute CommentTok) >>~ pushContext ("Javadoc","JavadocFSar"))+   <|>+   (currentContext >>= \x -> guard (x == ("Javadoc","FindJavadoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Javadoc","FindJavadoc") defaultAttributes)))  parseRules ("Javadoc","JavadocFSar") =   (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))@@ -119,7 +119,9 @@    <|>    ((pString False "{@value " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","InlineTagar"))    <|>-   ((Text.Highlighting.Kate.Syntax.Html.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Html.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Javadoc","JavadocFSar")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Javadoc","JavadocFSar") defaultAttributes)))  parseRules ("Javadoc","Javadocar") =   (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext))@@ -200,32 +202,42 @@    <|>    ((pString False "{@value " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","InlineTagar"))    <|>-   ((Text.Highlighting.Kate.Syntax.Html.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Html.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Javadoc","Javadocar")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Javadoc","Javadocar") defaultAttributes)))  parseRules ("Javadoc","JavadocParam") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((pRegExpr regex_'5cS'2a'28'3f'3d'5c'2a'2f'29 >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((pRegExpr regex_'5cS'2a'28'5cs'7c'24'29 >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pRegExpr regex_'5cS'2a'28'5cs'7c'24'29 >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Javadoc","JavadocParam")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Javadoc","JavadocParam") defaultAttributes)))  parseRules ("Javadoc","InlineTagar") =   (((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext))    <|>    ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Html.parseExpression >>= ((withAttribute KeywordTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Html.parseExpression >>= ((withAttribute KeywordTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Javadoc","InlineTagar")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Javadoc","InlineTagar") defaultAttributes)))  parseRules ("Javadoc","LiteralTagar") =   (((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext >> popContext)))+   ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Javadoc","LiteralTagar")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Javadoc","LiteralTagar") defaultAttributes)))  parseRules ("Javadoc","SeeTag") =   (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Html.parseExpression >>= ((withAttribute KeywordTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Html.parseExpression >>= ((withAttribute KeywordTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Javadoc","SeeTag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Javadoc","SeeTag") defaultAttributes)))  parseRules ("HTML", _) = Text.Highlighting.Kate.Syntax.Html.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Javadoc","Start") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Javascript.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "JavaScript"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("JavaScript","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -134,7 +130,9 @@    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok))    <|>-   ((pAnyChar ":!%&+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok)))+   ((pAnyChar ":!%&+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("JavaScript","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JavaScript","Normal") defaultAttributes)))  parseRules ("JavaScript","String") =   (((pDetectIdentifier >>= withAttribute StringTok))@@ -143,7 +141,9 @@    <|>    ((pLineContinue >>= withAttribute StringTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JavaScript","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JavaScript","String") defaultAttributes)))  parseRules ("JavaScript","String 1") =   (((pDetectIdentifier >>= withAttribute CharTok))@@ -152,19 +152,25 @@    <|>    ((pLineContinue >>= withAttribute StringTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JavaScript","String 1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JavaScript","String 1") defaultAttributes)))  parseRules ("JavaScript","Comment") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("JavaScript","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JavaScript","Comment") defaultAttributes)))  parseRules ("JavaScript","Multi/inline Comment") =   (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)))+   ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JavaScript","Multi/inline Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JavaScript","Multi/inline Comment") defaultAttributes)))  parseRules ("JavaScript","Regular Expression") =   (((pRegExpr regex_'2f'5big'5d'7b0'2c2'7d >>= withAttribute OtherTok) >>~ (popContext >> popContext >> popContext))@@ -181,7 +187,9 @@    <|>    ((pRegExpr regex_'5c'24'28'3f'3d'2f'29 >>= withAttribute FloatTok))    <|>-   ((pAnyChar "?+*()|" >>= withAttribute FloatTok)))+   ((pAnyChar "?+*()|" >>= withAttribute FloatTok))+   <|>+   (currentContext >>= \x -> guard (x == ("JavaScript","Regular Expression")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JavaScript","Regular Expression") defaultAttributes)))  parseRules ("JavaScript","(Internal regex catch)") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -201,7 +209,9 @@    <|>    ((pRegExpr regex_'5c'5c'2e >>= withAttribute FloatTok))    <|>-   ((pDetectChar False ']' >>= withAttribute BaseNTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ']' >>= withAttribute BaseNTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JavaScript","Regular Expression Character Class")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JavaScript","Regular Expression Character Class") defaultAttributes)))  parseRules ("JavaScript","(regex caret first check)") =   (((pDetectChar False '^' >>= withAttribute FloatTok) >>~ pushContext ("JavaScript","Regular Expression"))@@ -216,7 +226,9 @@ parseRules ("JavaScript","region_marker") =   (((pDetectIdentifier >>= withAttribute RegionMarkerTok))    <|>-   ((pDetectSpaces >>= withAttribute RegionMarkerTok)))+   ((pDetectSpaces >>= withAttribute RegionMarkerTok))+   <|>+   (currentContext >>= \x -> guard (x == ("JavaScript","region_marker")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JavaScript","region_marker") defaultAttributes)))  parseRules ("JavaScript","ObjectMember") =   (((pDetectChar False '.' >>= withAttribute NormalTok))@@ -225,8 +237,10 @@    <|>    ((pDetectSpaces >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((lookAhead (pAnyChar "(){}:!%&+,-/.*<=>?[]|~^;") >> (popContext) >> currentContext >>= parseRules)))+   ((lookAhead (pAnyChar "(){}:!%&+,-/.*<=>?[]|~^;") >> (popContext) >> currentContext >>= parseRules))+   <|>+   (currentContext >>= \x -> guard (x == ("JavaScript","ObjectMember")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JavaScript","ObjectMember") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("JavaScript","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Json.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "JSON"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("JSON","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -74,7 +70,9 @@    <|>    ((pDetectChar False '[' >>= withAttribute NormalTok) >>~ pushContext ("JSON","Array"))    <|>-   ((pDetectSpaces >>= withAttribute NormalTok)))+   ((pDetectSpaces >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("JSON","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSON","Normal") defaultAttributes)))  parseRules ("JSON","Pair") =   (((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("JSON","String_Key"))@@ -85,12 +83,16 @@    <|>    ((pDetectChar False ',' >>= withAttribute NormalTok))    <|>-   ((pDetectSpaces >>= withAttribute NormalTok)))+   ((pDetectSpaces >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("JSON","Pair")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSON","Pair") defaultAttributes)))  parseRules ("JSON","String_Key") =   (((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5c'5c'28'3f'3a'5b'22'5c'5c'2fbfnrt'5d'7cu'5b0'2d9a'2dfA'2df'5d'7b4'7d'29 >>= withAttribute DataTypeTok)))+   ((pRegExpr regex_'5c'5c'28'3f'3a'5b'22'5c'5c'2fbfnrt'5d'7cu'5b0'2d9a'2dfA'2df'5d'7b4'7d'29 >>= withAttribute DataTypeTok))+   <|>+   (currentContext >>= \x -> guard (x == ("JSON","String_Key")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSON","String_Key") defaultAttributes)))  parseRules ("JSON","Value") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("JSON","String_Value"))@@ -109,12 +111,16 @@    <|>    ((pRegExpr regex_'2d'3f'28'3f'3a'5b0'2d9'5d'7c'5b1'2d9'5d'5b0'2d9'5d'2b'29'5c'2e'5b0'2d9'5d'2b'28'3f'3a'5beE'5d'5b'2b'2d'5d'3f'5b0'2d9'5d'2b'29'3f >>= withAttribute FloatTok))    <|>-   ((pRegExpr regex_'2d'3f'28'3f'3a'5b0'2d9'5d'7c'5b1'2d9'5d'5b0'2d9'5d'2b'29'28'3f'3a'5beE'5d'5b'2b'2d'5d'3f'5b0'2d9'5d'2b'29'3f >>= withAttribute DecValTok)))+   ((pRegExpr regex_'2d'3f'28'3f'3a'5b0'2d9'5d'7c'5b1'2d9'5d'5b0'2d9'5d'2b'29'28'3f'3a'5beE'5d'5b'2b'2d'5d'3f'5b0'2d9'5d'2b'29'3f >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("JSON","Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSON","Value") defaultAttributes)))  parseRules ("JSON","String_Value") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5c'5c'28'3f'3a'5b'22'5c'5c'2fbfnrt'5d'7cu'5b0'2d9a'2dfA'2df'5d'7b4'7d'29 >>= withAttribute StringTok)))+   ((pRegExpr regex_'5c'5c'28'3f'3a'5b'22'5c'5c'2fbfnrt'5d'7cu'5b0'2d9a'2dfA'2df'5d'7b4'7d'29 >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("JSON","String_Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSON","String_Value") defaultAttributes)))  parseRules ("JSON","Array") =   (((pDetectChar False ',' >>= withAttribute NormalTok))@@ -133,7 +139,9 @@    <|>    ((pRegExpr regex_'2d'3f'28'3f'3a'5b0'2d9'5d'7c'5b1'2d9'5d'5b0'2d9'5d'2b'29'5c'2e'5b0'2d9'5d'2b'28'3f'3a'5beE'5d'5b'2b'2d'5d'3f'5b0'2d9'5d'2b'29'3f >>= withAttribute FloatTok))    <|>-   ((pRegExpr regex_'2d'3f'28'3f'3a'5b0'2d9'5d'7c'5b1'2d9'5d'5b0'2d9'5d'2b'29'28'3f'3a'5beE'5d'5b'2b'2d'5d'3f'5b0'2d9'5d'2b'29'3f >>= withAttribute DecValTok)))+   ((pRegExpr regex_'2d'3f'28'3f'3a'5b0'2d9'5d'7c'5b1'2d9'5d'5b0'2d9'5d'2b'29'28'3f'3a'5beE'5d'5b'2b'2d'5d'3f'5b0'2d9'5d'2b'29'3f >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("JSON","Array")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSON","Array") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("JSON","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Jsp.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "JSP"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("JSP","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -124,7 +120,9 @@    <|>    ((pString False "]]>" >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5ba'2dzA'2dZ0'2d9'5f'5d'2a >>= withAttribute NormalTok) >>~ pushContext ("JSP","Html Attribute")))+   ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5ba'2dzA'2dZ0'2d9'5f'5d'2a >>= withAttribute NormalTok) >>~ pushContext ("JSP","Html Attribute"))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Normal") defaultAttributes)))  parseRules ("JSP","Jsp Standard Directive") =   (((pDetect2Chars False '%' '>' >>= withAttribute NormalTok) >>~ (popContext))@@ -137,7 +135,9 @@    <|>    ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))    <|>-   ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5c'24'3f'5cw'2a'3a'5c'24'3f'5cw'2a >>= withAttribute KeywordTok) >>~ pushContext ("JSP","Jsp Custom Tag")))+   ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5c'24'3f'5cw'2a'3a'5c'24'3f'5cw'2a >>= withAttribute KeywordTok) >>~ pushContext ("JSP","Jsp Custom Tag"))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Jsp Standard Directive")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Jsp Standard Directive") defaultAttributes)))  parseRules ("JSP","Jsp Xml Directive") =   (((pRegExpr regex_'5cs'2a'5c'2f'3f'5cs'2a'3e >>= withAttribute NormalTok) >>~ (popContext))@@ -148,10 +148,14 @@    <|>    ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet"))    <|>-   ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression")))+   ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Jsp Xml Directive")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Jsp Xml Directive") defaultAttributes)))  parseRules ("JSP","Jsp Comment") =-  ((pString False "--%>" >>= withAttribute CommentTok) >>~ (popContext))+  (((pString False "--%>" >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Jsp Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Jsp Comment") defaultAttributes)))  parseRules ("JSP","Jsp Custom Tag") =   (((pRegExpr regex_'5c'2f'3f'3e >>= withAttribute KeywordTok) >>~ (popContext))@@ -162,7 +166,9 @@    <|>    ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet"))    <|>-   ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression")))+   ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Jsp Custom Tag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Jsp Custom Tag") defaultAttributes)))  parseRules ("JSP","Jsp Standard Directive Value") =   (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment"))@@ -175,7 +181,9 @@    <|>    ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("JSP","Jsp Single Quoted Param Value"))    <|>-   ((pDetect2Chars False '%' '>' >>= withAttribute NormalTok) >>~ (popContext >> popContext)))+   ((pDetect2Chars False '%' '>' >>= withAttribute NormalTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Jsp Standard Directive Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Jsp Standard Directive Value") defaultAttributes)))  parseRules ("JSP","Jsp Xml Directive Value") =   (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment"))@@ -188,7 +196,9 @@    <|>    ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("JSP","Jsp Single Quoted Param Value"))    <|>-   ((pRegExpr regex_'5cs'2a'5c'2f'3f'5cs'2a'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'5cs'2a'5c'2f'3f'5cs'2a'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Jsp Xml Directive Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Jsp Xml Directive Value") defaultAttributes)))  parseRules ("JSP","Jsp Custom Tag Value") =   (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment"))@@ -201,7 +211,9 @@    <|>    ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ pushContext ("JSP","Jsp Single Quoted Custom Tag Value"))    <|>-   ((pRegExpr regex_'5c'2f'3f'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'5c'2f'3f'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Jsp Custom Tag Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Jsp Custom Tag Value") defaultAttributes)))  parseRules ("JSP","Jsp Double Quoted Param Value") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext >> popContext))@@ -210,7 +222,9 @@    <|>    ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet"))    <|>-   ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression")))+   ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Jsp Double Quoted Param Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Jsp Double Quoted Param Value") defaultAttributes)))  parseRules ("JSP","Jsp Single Quoted Param Value") =   (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext >> popContext))@@ -219,7 +233,9 @@    <|>    ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet"))    <|>-   ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression")))+   ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Jsp Single Quoted Param Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Jsp Single Quoted Param Value") defaultAttributes)))  parseRules ("JSP","Jsp Double Quoted Custom Tag Value") =   (((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))@@ -228,7 +244,9 @@    <|>    ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet"))    <|>-   ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression")))+   ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Jsp Double Quoted Custom Tag Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Jsp Double Quoted Custom Tag Value") defaultAttributes)))  parseRules ("JSP","Jsp Single Quoted Custom Tag Value") =   (((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))@@ -237,7 +255,9 @@    <|>    ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet"))    <|>-   ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression")))+   ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Jsp Single Quoted Custom Tag Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Jsp Single Quoted Custom Tag Value") defaultAttributes)))  parseRules ("JSP","Jsp Scriptlet") =   (((pDetect2Chars False '%' '>' >>= withAttribute NormalTok) >>~ (popContext))@@ -290,7 +310,9 @@    <|>    ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("JSP","Java Single-Line Comment"))    <|>-   ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("JSP","Java Multi-Line Comment")))+   ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("JSP","Java Multi-Line Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Jsp Scriptlet")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Jsp Scriptlet") defaultAttributes)))  parseRules ("JSP","Jsp Expression") =   (((pString False "'${'" >>= withAttribute NormalTok))@@ -331,18 +353,24 @@    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("JSP","Java String"))    <|>-   ((pAnyChar "!%&()+,-<=>?[]^{|}~" >>= withAttribute NormalTok)))+   ((pAnyChar "!%&()+,-<=>?[]^{|}~" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Jsp Expression")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Jsp Expression") defaultAttributes)))  parseRules ("JSP","Java Single-Line Comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("JSP","Java Single-Line Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Java Single-Line Comment") defaultAttributes))  parseRules ("JSP","Java Multi-Line Comment") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Java Multi-Line Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Java Multi-Line Comment") defaultAttributes)))  parseRules ("JSP","Java String") =   (((pDetect2Chars False '\\' '"' >>= withAttribute StringTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Java String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Java String") defaultAttributes)))  parseRules ("JSP","Html Attribute") =   (((pRegExpr regex_'5c'2f'3f'3e >>= withAttribute NormalTok) >>~ (popContext))@@ -353,7 +381,9 @@    <|>    ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet"))    <|>-   ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression")))+   ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Html Attribute")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Html Attribute") defaultAttributes)))  parseRules ("JSP","Html Value") =   (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment"))@@ -370,7 +400,9 @@    <|>    ((pRegExpr regex_'5cs'2a'23'3f'2d'3f'5f'3f'5c'2e'3f'5ba'2dzA'2dZ0'2d9'5d'2a >>= withAttribute DataTypeTok) >>~ pushContext ("JSP","Html Unquoted Value"))    <|>-   ((pRegExpr regex_'5c'2f'3f'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'5c'2f'3f'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Html Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Html Value") defaultAttributes)))  parseRules ("JSP","Html Double Quoted Value") =   (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment"))@@ -381,7 +413,9 @@    <|>    ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5c'24'3f'5cw'2a'3a'5c'24'3f'5cw'2a >>= withAttribute KeywordTok) >>~ pushContext ("JSP","Jsp Custom Tag"))    <|>-   ((pRegExpr regex_'28'22'7c'26quot'3b'7c'26'2334'3b'29 >>= withAttribute DataTypeTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'28'22'7c'26quot'3b'7c'26'2334'3b'29 >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Html Double Quoted Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Html Double Quoted Value") defaultAttributes)))  parseRules ("JSP","Html Single Quoted Value") =   (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment"))@@ -392,7 +426,9 @@    <|>    ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5c'24'3f'5cw'2a'3a'5c'24'3f'5cw'2a >>= withAttribute KeywordTok) >>~ pushContext ("JSP","Jsp Custom Tag"))    <|>-   ((pRegExpr regex_'28'27'7c'26'2339'3b'29 >>= withAttribute DataTypeTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'28'27'7c'26'2339'3b'29 >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Html Single Quoted Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Html Single Quoted Value") defaultAttributes)))  parseRules ("JSP","Html Unquoted Value") =   (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment"))@@ -405,7 +441,9 @@    <|>    ((pRegExpr regex_'5c'2f'3f'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((pRegExpr regex_'5cs'2b >>= withAttribute DataTypeTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'5cs'2b >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Html Unquoted Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Html Unquoted Value") defaultAttributes)))  parseRules ("JSP","Html Comment") =   (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment"))@@ -414,7 +452,9 @@    <|>    ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))    <|>-   ((pRegExpr regex_'5c'2f'2a'2d'2d'3e >>= withAttribute CommentTok) >>~ (popContext)))+   ((pRegExpr regex_'5c'2f'2a'2d'2d'3e >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("JSP","Html Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("JSP","Html Comment") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("JSP","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Latex.hs view
@@ -30,11 +30,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "LaTeX"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("LaTeX","Normal Text")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -217,10 +213,14 @@    <|>    ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment"))    <|>-   ((pDetectChar False '\215' >>= withAttribute NormalTok)))+   ((pDetectChar False '\215' >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","Normal Text")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","Normal Text") defaultAttributes)))  parseRules ("LaTeX","NoWeb") =-  ((pColumn 0 >> pRegExpr regex_'5cs'2a'40'5cs'2a >>= withAttribute NormalTok) >>~ (popContext))+  (((pColumn 0 >> pRegExpr regex_'5cs'2a'40'5cs'2a >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","NoWeb")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","NoWeb") defaultAttributes)))  parseRules ("LaTeX","Sectioning") =   (((pRegExpr regex_'5c'5b'5b'5e'5c'5d'5d'2a'5c'5d >>= withAttribute NormalTok))@@ -248,14 +248,18 @@    <|>    ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment"))    <|>-   ((pDetectChar False '\215' >>= withAttribute NormalTok)))+   ((pDetectChar False '\215' >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","SectioningInside")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","SectioningInside") defaultAttributes)))  parseRules ("LaTeX","SectioningContrSeq") =   (((pDetectChar False '\215' >>= withAttribute NormalTok))    <|>    ((pRegExpr regex_'5ba'2dzA'2dZ'5d'2b'28'5c'2b'3f'7c'5c'2a'7b0'2c3'7d'29 >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","SectioningContrSeq")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","SectioningContrSeq") defaultAttributes)))  parseRules ("LaTeX","SectioningMathMode") =   (((pString False "$$" >>= withAttribute AlertTok))@@ -270,14 +274,18 @@    <|>    ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment"))    <|>-   ((pDetectChar False '\215' >>= withAttribute NormalTok)))+   ((pDetectChar False '\215' >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","SectioningMathMode")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","SectioningMathMode") defaultAttributes)))  parseRules ("LaTeX","SectioningMathContrSeq") =   (((pDetectChar False '\215' >>= withAttribute NormalTok))    <|>    ((pRegExpr regex_'5ba'2dzA'2dZ'5d'2b'5c'2a'3f >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","SectioningMathContrSeq")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","SectioningMathContrSeq") defaultAttributes)))  parseRules ("LaTeX","Footnoting") =   (((pRegExpr regex_'5c'5b'5b'5e'5c'5d'5d'2a'5c'5d >>= withAttribute NormalTok))@@ -301,7 +309,9 @@    <|>    ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","FootnotingMathMode"))    <|>-   ((parseRules ("LaTeX","Normal Text"))))+   ((parseRules ("LaTeX","Normal Text")))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","FootnotingInside")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","FootnotingInside") defaultAttributes)))  parseRules ("LaTeX","FootnotingMathMode") =   (((pString False "$$" >>= withAttribute AlertTok))@@ -312,7 +322,9 @@    <|>    ((pDetect2Chars False '\\' ']' >>= withAttribute AlertTok))    <|>-   ((parseRules ("LaTeX","MathMode"))))+   ((parseRules ("LaTeX","MathMode")))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","FootnotingMathMode")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","FootnotingMathMode") defaultAttributes)))  parseRules ("LaTeX","NewCommand") =   (((pRegExpr regex_'5cs'2a'5c'7b'5cs'2a'5c'5c'5ba'2dzA'2dZ'5d'2b'5cs'2a'5c'7d'28'5c'5b'5cd'5c'5d'28'5c'5b'5b'5e'5c'5d'5d'2a'5c'5d'29'3f'29'3f'5c'7b >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","CommandParameterStart"))@@ -335,7 +347,9 @@    <|>    ((pRegExpr regex_'5c'5c'2e >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment")))+   ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","CommandParameterStart")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","CommandParameterStart") defaultAttributes)))  parseRules ("LaTeX","CommandParameter") =   (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","CommandParameter"))@@ -344,7 +358,9 @@    <|>    ((pRegExpr regex_'5c'5c'2e >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment")))+   ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","CommandParameter")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","CommandParameter") defaultAttributes)))  parseRules ("LaTeX","ContrSeq") =   (((pString False "verb*" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Verb"))@@ -355,27 +371,35 @@    <|>    ((pRegExpr regex_'5ba'2dzA'2dZ'40'5d'2b'28'5c'2b'3f'7c'5c'2a'7b0'2c3'7d'29 >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","ContrSeq")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","ContrSeq") defaultAttributes)))  parseRules ("LaTeX","ToEndOfLine") =-  pzero+  (currentContext >>= \x -> guard (x == ("LaTeX","ToEndOfLine")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","ToEndOfLine") defaultAttributes))  parseRules ("LaTeX","Verb") =-  ((pRegExprDynamic "(.)" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","VerbEnd"))+  (((pRegExprDynamic "(.)" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","VerbEnd"))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","Verb")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","Verb") defaultAttributes)))  parseRules ("LaTeX","VerbEnd") =   (((pString True "%1" >>= withAttribute NormalTok) >>~ (popContext >> popContext >> popContext))    <|>    ((pDetectChar False '\215' >>= withAttribute NormalTok))    <|>-   ((pRegExprDynamic "[^%1\\xd7]*" >>= withAttribute NormalTok)))+   ((pRegExprDynamic "[^%1\\xd7]*" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","VerbEnd")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","VerbEnd") defaultAttributes)))  parseRules ("LaTeX","Label") =   (((pRegExpr regex_'5cs'2a'5c'7b'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","LabelParameter"))    <|>    ((pRegExpr regex_'5cs'2a'5c'5b'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","LabelOption"))    <|>-   ((pRegExpr regex_'5b'5e'5c'5b'5c'7b'5d'2b >>= withAttribute AlertTok)))+   ((pRegExpr regex_'5b'5e'5c'5b'5c'7b'5d'2b >>= withAttribute AlertTok))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","Label")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","Label") defaultAttributes)))  parseRules ("LaTeX","LabelOption") =   (((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathMode"))@@ -388,12 +412,16 @@    <|>    ((pDetectChar False '\215' >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'5cs'2a'5c'5d'5cs'2a >>= withAttribute NormalTok) >>~ (popContext)))+   ((pRegExpr regex_'5cs'2a'5c'5d'5cs'2a >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","LabelOption")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","LabelOption") defaultAttributes)))  parseRules ("LaTeX","LabelParameter") =   (((pDetectChar False '\215' >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'5cs'2a'5c'7d'5cs'2a >>= withAttribute NormalTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'5cs'2a'5c'7d'5cs'2a >>= withAttribute NormalTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","LabelParameter")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","LabelParameter") defaultAttributes)))  parseRules ("LaTeX","FancyLabel") =   (((pRegExpr regex_'5cs'2a'5c'7b'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","FancyLabelParameter"))@@ -407,7 +435,9 @@ parseRules ("LaTeX","FancyLabelParameter") =   (((pDetectChar False '\215' >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'5cs'2a'5c'7d'5cs'2a >>= withAttribute NormalTok) >>~ (popContext)))+   ((pRegExpr regex_'5cs'2a'5c'7d'5cs'2a >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","FancyLabelParameter")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","FancyLabelParameter") defaultAttributes)))  parseRules ("LaTeX","FancyLabelRoundBrackets") =   (((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathMode"))@@ -420,19 +450,25 @@    <|>    ((pDetectChar False '\215' >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'5cs'2a'5c'29'5cs'2a >>= withAttribute NormalTok) >>~ (popContext)))+   ((pRegExpr regex_'5cs'2a'5c'29'5cs'2a >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","FancyLabelRoundBrackets")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","FancyLabelRoundBrackets") defaultAttributes)))  parseRules ("LaTeX","FindEndEnvironment") =   (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","EndEnvironment"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute NormalTok) >>~ (popContext)))+   ((pRegExpr regex_'5cS >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","FindEndEnvironment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","FindEndEnvironment") defaultAttributes)))  parseRules ("LaTeX","EndEnvironment") =   (((pRegExpr regex_'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","EndLatexEnv"))    <|>    ((pRegExpr regex_'5cs'2b >>= withAttribute AlertTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute AlertTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute AlertTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","EndEnvironment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","EndEnvironment") defaultAttributes)))  parseRules ("LaTeX","EndLatexEnv") =   (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext >> popContext >> popContext))@@ -441,12 +477,16 @@    <|>    ((pRegExpr regex_'5cs'2b >>= withAttribute AlertTok))    <|>-   ((pRegExpr regex_'5ba'2dzA'2dZ'5d >>= withAttribute AlertTok) >>~ (popContext >> popContext >> popContext)))+   ((pRegExpr regex_'5ba'2dzA'2dZ'5d >>= withAttribute AlertTok) >>~ (popContext >> popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","EndLatexEnv")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","EndLatexEnv") defaultAttributes)))  parseRules ("LaTeX","FindBeginEnvironment") =   (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","BeginEnvironment"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute NormalTok) >>~ (popContext)))+   ((pRegExpr regex_'5cS >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","FindBeginEnvironment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","FindBeginEnvironment") defaultAttributes)))  parseRules ("LaTeX","BeginEnvironment") =   (((pRegExpr regex_'28lstlisting'7c'28B'7cL'29'3fVerbatim'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","VerbatimEnvParam"))@@ -467,7 +507,9 @@    <|>    ((pRegExpr regex_'5cs'2b >>= withAttribute AlertTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5cxd7'5d >>= withAttribute AlertTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5cxd7'5d >>= withAttribute AlertTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","BeginEnvironment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","BeginEnvironment") defaultAttributes)))  parseRules ("LaTeX","LatexEnv") =   (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext >> popContext >> popContext))@@ -476,7 +518,9 @@    <|>    ((pRegExpr regex_'5cs'2b >>= withAttribute AlertTok))    <|>-   ((parseRules ("LaTeX","EnvCommon"))))+   ((parseRules ("LaTeX","EnvCommon")))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","LatexEnv")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","LatexEnv") defaultAttributes)))  parseRules ("LaTeX","VerbatimEnv") =   (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Verbatim"))@@ -492,12 +536,16 @@    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Verbatim"))    <|>-   ((pDetectChar False ']' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Verbatim")))+   ((pDetectChar False ']' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Verbatim"))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","VerbatimEnvParam")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","VerbatimEnvParam") defaultAttributes)))  parseRules ("LaTeX","Verbatim") =   (((pDetectChar False '\215' >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'5c'5cend'28'3f'3d'5cs'2a'5c'7b'28verbatim'7clstlisting'7cboxedverbatim'7c'28B'7cL'29'3fVerbatim'29'5c'2a'3f'5c'7d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","VerbFindEnd")))+   ((pRegExpr regex_'5c'5cend'28'3f'3d'5cs'2a'5c'7b'28verbatim'7clstlisting'7cboxedverbatim'7c'28B'7cL'29'3fVerbatim'29'5c'2a'3f'5c'7d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","VerbFindEnd"))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","Verbatim")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","Verbatim") defaultAttributes)))  parseRules ("LaTeX","VerbFindEnd") =   (((pRegExpr regex_'5cs'2a'5c'7b >>= withAttribute NormalTok))@@ -520,7 +568,9 @@ parseRules ("LaTeX","BlockComment") =   (((pDetectChar False '\215' >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'5c'5cend'28'3f'3d'5cs'2a'5c'7bcomment'5c'2a'3f'5c'7d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","CommFindEnd")))+   ((pRegExpr regex_'5c'5cend'28'3f'3d'5cs'2a'5c'7bcomment'5c'2a'3f'5c'7d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","CommFindEnd"))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","BlockComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","BlockComment") defaultAttributes)))  parseRules ("LaTeX","CommFindEnd") =   (((pRegExpr regex_'5cs'2a'5c'7b >>= withAttribute NormalTok))@@ -536,7 +586,9 @@    <|>    ((lookAhead (pRegExpr regex_'5ba'2dzA'2dZ'5d) >> (popContext) >> currentContext >>= parseRules))    <|>-   ((parseRules ("LaTeX","EnvCommon"))))+   ((parseRules ("LaTeX","EnvCommon")))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","MathEnv")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","MathEnv") defaultAttributes)))  parseRules ("LaTeX","MathEnvParam") =   (((pRegExpr regex_'5c'7d'5c'7b'5b'5e'5c'7d'5d'2a'5c'7d >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeEnv"))@@ -545,7 +597,9 @@    <|>    ((lookAhead (pRegExpr regex_'5ba'2dzA'2dZ'5d) >> (popContext) >> currentContext >>= parseRules))    <|>-   ((parseRules ("LaTeX","EnvCommon"))))+   ((parseRules ("LaTeX","EnvCommon")))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","MathEnvParam")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","MathEnvParam") defaultAttributes)))  parseRules ("LaTeX","EnvCommon") =   (((pDetectChar False '\215' >>= withAttribute NormalTok))@@ -554,7 +608,9 @@    <|>    ((pRegExpr regex_'5c'2a'5b'5e'5c'7d'5d'2a >>= withAttribute AlertTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5cxd7'5d'5b'5e'5c'7d'5d'2a >>= withAttribute AlertTok) >>~ (popContext >> popContext >> popContext)))+   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5cxd7'5d'5b'5e'5c'7d'5d'2a >>= withAttribute AlertTok) >>~ (popContext >> popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","EnvCommon")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","EnvCommon") defaultAttributes)))  parseRules ("LaTeX","MathModeEnv") =   (((pRegExpr regex_'5c'5cbegin'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","FindBeginEnvironment"))@@ -583,7 +639,9 @@    <|>    ((pFirstNonSpace >> pRegExpr regex_'25'5cs'2aBEGIN'2e'2a'24 >>= withAttribute RegionMarkerTok))    <|>-   ((pFirstNonSpace >> pRegExpr regex_'25'5cs'2aEND'2e'2a'24 >>= withAttribute RegionMarkerTok)))+   ((pFirstNonSpace >> pRegExpr regex_'25'5cs'2aEND'2e'2a'24 >>= withAttribute RegionMarkerTok))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","MathModeEnv")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","MathModeEnv") defaultAttributes)))  parseRules ("LaTeX","MathFindEnd") =   (((pRegExpr regex_'5cs'2a'5c'7b >>= withAttribute NormalTok))@@ -610,14 +668,18 @@    <|>    ((pRegExpr regex_'5c'5cend'28'3f'3d'5cs'2a'5c'7b'28tabularx'7ctabular'7csupertabular'7cmpsupertabular'7cxtabular'7cmpxtabular'7clongtable'29'5c'2a'3f'5c'7d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","TabFindEnd"))    <|>-   ((parseRules ("LaTeX","Normal Text"))))+   ((parseRules ("LaTeX","Normal Text")))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","Tab")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","Tab") defaultAttributes)))  parseRules ("LaTeX","Column Separator") =   (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Column Separator"))    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'2e >>= withAttribute NormalTok)))+   ((pRegExpr regex_'2e >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","Column Separator")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","Column Separator") defaultAttributes)))  parseRules ("LaTeX","TabFindEnd") =   (((pRegExpr regex_'5cs'2a'5c'7b >>= withAttribute NormalTok))@@ -637,7 +699,9 @@    <|>    ((pDetect2Chars False '\\' ']' >>= withAttribute AlertTok))    <|>-   ((parseRules ("LaTeX","MathModeCommon"))))+   ((parseRules ("LaTeX","MathModeCommon")))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","MathMode")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","MathMode") defaultAttributes)))  parseRules ("LaTeX","MathModeDisplay") =   (((pString False "$$" >>= withAttribute NormalTok) >>~ (popContext))@@ -648,7 +712,9 @@    <|>    ((pDetect2Chars False '\\' ')' >>= withAttribute AlertTok))    <|>-   ((parseRules ("LaTeX","MathModeCommon"))))+   ((parseRules ("LaTeX","MathModeCommon")))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","MathModeDisplay")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","MathModeDisplay") defaultAttributes)))  parseRules ("LaTeX","MathModeEquation") =   (((pDetect2Chars False '\\' ']' >>= withAttribute NormalTok) >>~ (popContext))@@ -659,14 +725,18 @@    <|>    ((pDetect2Chars False '\\' ')' >>= withAttribute AlertTok))    <|>-   ((parseRules ("LaTeX","MathModeCommon"))))+   ((parseRules ("LaTeX","MathModeCommon")))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","MathModeEquation")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","MathModeEquation") defaultAttributes)))  parseRules ("LaTeX","MathModeEnsure") =   (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeEnsure"))    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("LaTeX","MathModeCommon"))))+   ((parseRules ("LaTeX","MathModeCommon")))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","MathModeEnsure")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","MathModeEnsure") defaultAttributes)))  parseRules ("LaTeX","MathModeCommon") =   (((pRegExpr regex_'5c'5c'28begin'7cend'29'5cs'2a'5c'7b'28equation'7cdisplaymath'7ceqnarray'7csubeqnarray'7cmath'7cmultline'7cgather'7calign'7cflalign'7calignat'7cxalignat'7cxxalignat'7cIEEEeqnarray'29'5c'2a'3f'5c'7d >>= withAttribute AlertTok))@@ -685,17 +755,23 @@    <|>    ((pFirstNonSpace >> pRegExpr regex_'25'5cs'2aEND'2e'2a'24 >>= withAttribute RegionMarkerTok))    <|>-   ((pDetectChar False '\215' >>= withAttribute NormalTok)))+   ((pDetectChar False '\215' >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","MathModeCommon")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","MathModeCommon") defaultAttributes)))  parseRules ("LaTeX","MathContrSeq") =   (((pDetectChar False '\215' >>= withAttribute NormalTok))    <|>    ((pRegExpr regex_'5ba'2dzA'2dZ'5d'2b'5c'2a'3f >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","MathContrSeq")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","MathContrSeq") defaultAttributes)))  parseRules ("LaTeX","MathModeText") =-  ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeTextParameterStart"))+  (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeTextParameterStart"))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","MathModeText")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","MathModeText") defaultAttributes)))  parseRules ("LaTeX","MathModeTextParameterStart") =   (((pRegExpr regex_'5c'5c'2e >>= withAttribute NormalTok))@@ -708,7 +784,9 @@    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext >> popContext))    <|>-   ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment")))+   ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","MathModeTextParameterStart")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","MathModeTextParameterStart") defaultAttributes)))  parseRules ("LaTeX","MathModeTextParameter") =   (((pRegExpr regex_'5c'5c'2e >>= withAttribute NormalTok))@@ -719,19 +797,25 @@    <|>    ((pDetectChar False '\215' >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment")))+   ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","MathModeTextParameter")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","MathModeTextParameter") defaultAttributes)))  parseRules ("LaTeX","Multiline Comment") =   (((pString False "\\fi" >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((pString False "\\else" >>= withAttribute CommentTok) >>~ (popContext)))+   ((pString False "\\else" >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","Multiline Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","Multiline Comment") defaultAttributes)))  parseRules ("LaTeX","Comment") =   (((pRegExpr regex_'28FIXME'7cTODO'29'3a'3f >>= withAttribute AlertTok))    <|>    ((pString False "\\KileResetHL" >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Normal Text"))    <|>-   ((pString False "\\KateResetHL" >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Normal Text")))+   ((pString False "\\KateResetHL" >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Normal Text"))+   <|>+   (currentContext >>= \x -> guard (x == ("LaTeX","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("LaTeX","Comment") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("LaTeX","Normal Text") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Lex.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Lex/Flex"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Lex/Flex","Pre Start")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -92,7 +88,9 @@ defaultAttributes = [(("Lex/Flex","Pre Start"),NormalTok),(("Lex/Flex","Definitions"),NormalTok),(("Lex/Flex","Rules"),NormalTok),(("Lex/Flex","User Code"),NormalTok),(("Lex/Flex","Percent Command"),KeywordTok),(("Lex/Flex","Comment"),CommentTok),(("Lex/Flex","Definition RegExpr"),StringTok),(("Lex/Flex","Rule RegExpr"),StringTok),(("Lex/Flex","RegExpr ("),StringTok),(("Lex/Flex","RegExpr ["),StringTok),(("Lex/Flex","RegExpr {"),StringTok),(("Lex/Flex","RegExpr Q"),StringTok),(("Lex/Flex","RegExpr Base"),StringTok),(("Lex/Flex","Start Conditions Scope"),NormalTok),(("Lex/Flex","Action"),NormalTok),(("Lex/Flex","Detect C"),NormalTok),(("Lex/Flex","Indented C"),NormalTok),(("Lex/Flex","Lex C Bloc"),NormalTok),(("Lex/Flex","Lex Rule C Bloc"),NormalTok),(("Lex/Flex","Normal C Bloc"),NormalTok),(("Lex/Flex","Action C"),NormalTok)]  parseRules ("Lex/Flex","Pre Start") =-  ((lookAhead (pRegExpr regex_'2e) >> pushContext ("Lex/Flex","Definitions") >> currentContext >>= parseRules))+  (((lookAhead (pRegExpr regex_'2e) >> pushContext ("Lex/Flex","Definitions") >> currentContext >>= parseRules))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","Pre Start")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","Pre Start") defaultAttributes)))  parseRules ("Lex/Flex","Definitions") =   (((parseRules ("Lex/Flex","Detect C")))@@ -103,7 +101,9 @@    <|>    ((pColumn 0 >> pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Lex/Flex","Comment"))    <|>-   ((pColumn 0 >> pRegExpr regex_'5bA'2dZa'2dz'5f'5d'5cw'2a'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext ("Lex/Flex","Definition RegExpr")))+   ((pColumn 0 >> pRegExpr regex_'5bA'2dZa'2dz'5f'5d'5cw'2a'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext ("Lex/Flex","Definition RegExpr"))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","Definitions")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","Definitions") defaultAttributes)))  parseRules ("Lex/Flex","Rules") =   (((parseRules ("Lex/Flex","Detect C")))@@ -113,20 +113,26 @@    (pushContext ("Lex/Flex","Rule RegExpr") >> currentContext >>= parseRules))  parseRules ("Lex/Flex","User Code") =-  ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+  (((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","User Code")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","User Code") defaultAttributes)))  parseRules ("Lex/Flex","Percent Command") =-  pzero+  (currentContext >>= \x -> guard (x == ("Lex/Flex","Percent Command")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","Percent Command") defaultAttributes))  parseRules ("Lex/Flex","Comment") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","Comment") defaultAttributes)))  parseRules ("Lex/Flex","Definition RegExpr") =   (((parseRules ("Lex/Flex","RegExpr Base")))    <|>    ((pRegExpr regex_'5cS >>= withAttribute StringTok))    <|>-   ((pRegExpr regex_'2e'2a >>= withAttribute AlertTok)))+   ((pRegExpr regex_'2e'2a >>= withAttribute AlertTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","Definition RegExpr")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","Definition RegExpr") defaultAttributes)))  parseRules ("Lex/Flex","Rule RegExpr") =   (((pRegExpr regex_'5c'7b'24 >>= withAttribute BaseNTok) >>~ pushContext ("Lex/Flex","Start Conditions Scope"))@@ -135,35 +141,45 @@    <|>    ((pRegExpr regex_'5cS >>= withAttribute StringTok))    <|>-   ((pRegExpr regex_'5cs'2b >>= withAttribute NormalTok) >>~ pushContext ("Lex/Flex","Action")))+   ((pRegExpr regex_'5cs'2b >>= withAttribute NormalTok) >>~ pushContext ("Lex/Flex","Action"))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","Rule RegExpr")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","Rule RegExpr") defaultAttributes)))  parseRules ("Lex/Flex","RegExpr (") =   (((parseRules ("Lex/Flex","RegExpr Base")))    <|>    ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'2e >>= withAttribute StringTok)))+   ((pRegExpr regex_'2e >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","RegExpr (")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","RegExpr (") defaultAttributes)))  parseRules ("Lex/Flex","RegExpr [") =   (((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok))    <|>    ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'2e >>= withAttribute StringTok)))+   ((pRegExpr regex_'2e >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","RegExpr [")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","RegExpr [") defaultAttributes)))  parseRules ("Lex/Flex","RegExpr {") =   (((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok))    <|>    ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'2e >>= withAttribute StringTok)))+   ((pRegExpr regex_'2e >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","RegExpr {")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","RegExpr {") defaultAttributes)))  parseRules ("Lex/Flex","RegExpr Q") =   (((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok))    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'2e >>= withAttribute StringTok)))+   ((pRegExpr regex_'2e >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","RegExpr Q")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","RegExpr Q") defaultAttributes)))  parseRules ("Lex/Flex","RegExpr Base") =   (((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok))@@ -174,7 +190,9 @@    <|>    ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Lex/Flex","RegExpr {"))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Lex/Flex","RegExpr Q")))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Lex/Flex","RegExpr Q"))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","RegExpr Base")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","RegExpr Base") defaultAttributes)))  parseRules ("Lex/Flex","Start Conditions Scope") =   (((pRegExpr regex_'5cs'2a'5c'7d >>= withAttribute BaseNTok) >>~ (popContext))@@ -193,35 +211,47 @@ parseRules ("Lex/Flex","Detect C") =   (((pColumn 0 >> pRegExpr regex_'5cs >>= withAttribute NormalTok) >>~ pushContext ("Lex/Flex","Indented C"))    <|>-   ((pColumn 0 >> pDetect2Chars False '%' '{' >>= withAttribute BaseNTok) >>~ pushContext ("Lex/Flex","Lex C Bloc")))+   ((pColumn 0 >> pDetect2Chars False '%' '{' >>= withAttribute BaseNTok) >>~ pushContext ("Lex/Flex","Lex C Bloc"))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","Detect C")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","Detect C") defaultAttributes)))  parseRules ("Lex/Flex","Indented C") =-  ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+  (((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","Indented C")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","Indented C") defaultAttributes)))  parseRules ("Lex/Flex","Lex C Bloc") =   (((pColumn 0 >> pDetect2Chars False '%' '}' >>= withAttribute BaseNTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","Lex C Bloc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","Lex C Bloc") defaultAttributes)))  parseRules ("Lex/Flex","Lex Rule C Bloc") =   (((pDetect2Chars False '%' '}' >>= withAttribute BaseNTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","Lex Rule C Bloc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","Lex Rule C Bloc") defaultAttributes)))  parseRules ("Lex/Flex","Normal C Bloc") =   (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("Lex/Flex","Normal C Bloc"))    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","Normal C Bloc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","Normal C Bloc") defaultAttributes)))  parseRules ("Lex/Flex","Action C") =   (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("Lex/Flex","Normal C Bloc"))    <|>    ((pDetectChar False '}' >>= withAttribute AlertTok))    <|>-   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Lex/Flex","Action C")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lex/Flex","Action C") defaultAttributes)))  parseRules ("C++", _) = Text.Highlighting.Kate.Syntax.Cpp.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Lex/Flex","Pre Start") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/LiterateHaskell.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Literate Haskell"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Literate Haskell","text")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -73,31 +69,43 @@    <|>    ((pString False "\\begin{code}" >>= withAttribute NormalTok) >>~ pushContext ("Literate Haskell","normals"))    <|>-   ((pString False "\\begin{spec}" >>= withAttribute NormalTok) >>~ pushContext ("Literate Haskell","normals")))+   ((pString False "\\begin{spec}" >>= withAttribute NormalTok) >>~ pushContext ("Literate Haskell","normals"))+   <|>+   (currentContext >>= \x -> guard (x == ("Literate Haskell","text")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Literate Haskell","text") defaultAttributes)))  parseRules ("Literate Haskell","normal") =   (((pRegExpr regex_'5c'7b'2d'5b'5e'23'5d >>= withAttribute CommentTok) >>~ pushContext ("Literate Haskell","comments'"))    <|>-   ((Text.Highlighting.Kate.Syntax.Haskell.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Haskell.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Literate Haskell","normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Literate Haskell","normal") defaultAttributes)))  parseRules ("Literate Haskell","normals") =   (((pString False "\\end{code}" >>= withAttribute NormalTok) >>~ (popContext))    <|>    ((pString False "\\end{spec}" >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Haskell.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Haskell.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Literate Haskell","normals")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Literate Haskell","normals") defaultAttributes)))  parseRules ("Literate Haskell","comments'") =-  ((pDetect2Chars False '-' '}' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '-' '}' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Literate Haskell","comments'")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Literate Haskell","comments'") defaultAttributes)))  parseRules ("Literate Haskell","uncomments") =   (((pColumn 0 >> pDetectChar False '>' >>= withAttribute OtherTok) >>~ pushContext ("Literate Haskell","recomments"))    <|>-   ((pColumn 0 >> pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext ("Literate Haskell","recomments")))+   ((pColumn 0 >> pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext ("Literate Haskell","recomments"))+   <|>+   (currentContext >>= \x -> guard (x == ("Literate Haskell","uncomments")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Literate Haskell","uncomments") defaultAttributes)))  parseRules ("Literate Haskell","recomments") =-  ((pDetect2Chars False '-' '}' >>= withAttribute CommentTok) >>~ (popContext >> popContext >> popContext))+  (((pDetect2Chars False '-' '}' >>= withAttribute CommentTok) >>~ (popContext >> popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Literate Haskell","recomments")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Literate Haskell","recomments") defaultAttributes)))  parseRules ("Haskell", _) = Text.Highlighting.Kate.Syntax.Haskell.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Literate Haskell","text") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Lua.hs view
@@ -6,6 +6,7 @@ where import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common+import qualified Text.Highlighting.Kate.Syntax.Doxygenlua import Text.ParserCombinators.Parsec hiding (State) import Control.Monad.State import Data.Char (isSpace)@@ -31,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Lua"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Lua","Base")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -93,8 +90,10 @@    (pushContext ("Lua","Normal") >> currentContext >>= parseRules))  parseRules ("Lua","Normal") =-  (((pKeyword " \n\t():!+,-<=>%&*/;?[]^{|}~\\\"" list_deprecated >>= withAttribute ErrorTok))+  (((Text.Highlighting.Kate.Syntax.Doxygenlua.parseExpression))    <|>+   ((pKeyword " \n\t():!+,-<=>%&*/;?[]^{|}~\\\"" list_deprecated >>= withAttribute ErrorTok))+   <|>    ((pDetectSpaces >>= withAttribute NormalTok))    <|>    ((pRegExprDynamic "--\\[(=*)\\[" >>= withAttribute CommentTok) >>~ pushContext ("Lua","Block Comment"))@@ -151,37 +150,50 @@    <|>    ((pDetect2Chars False '.' '=' >>= withAttribute ErrorTok))    <|>-   ((pAnyChar "[]().=~+-*/^><#;" >>= withAttribute OtherTok)))+   ((pAnyChar "[]().=~+-*/^><#;" >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Lua","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lua","Normal") defaultAttributes)))  parseRules ("Lua","Comment") =   (((pDetect2Chars False '-' '-' >>= withAttribute AlertTok))    <|>-   ((pKeyword " \n\t():!+,-<=>%&*/;?[]^{|}~\\\"" list_attention >>= withAttribute AlertTok)))+   ((pKeyword " \n\t():!+,-<=>%&*/;?[]^{|}~\\\"" list_attention >>= withAttribute AlertTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Lua","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lua","Comment") defaultAttributes)))  parseRules ("Lua","Block Comment") =   (((pRegExprDynamic "\\]%1\\]" >>= withAttribute CommentTok) >>~ (popContext))    <|>    ((pDetect2Chars False '-' '-' >>= withAttribute AlertTok))    <|>-   ((pKeyword " \n\t():!+,-<=>%&*/;?[]^{|}~\\\"" list_attention >>= withAttribute AlertTok)))+   ((pKeyword " \n\t():!+,-<=>%&*/;?[]^{|}~\\\"" list_attention >>= withAttribute AlertTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Lua","Block Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lua","Block Comment") defaultAttributes)))  parseRules ("Lua","String_single") =   (((pRegExpr regex_'5c'5c'28a'7cb'7cf'7cn'7cr'7ct'7cv'7c'5c'5c'7c'22'7c'5c'27'7c'5b'7c'5d'29 >>= withAttribute OtherTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Lua","String_single")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lua","String_single") defaultAttributes)))  parseRules ("Lua","String_double") =   (((pRegExpr regex_'5c'5c'5babfnrtv'27'22'5c'5c'5c'5b'5c'5d'5d >>= withAttribute OtherTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Lua","String_double")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lua","String_double") defaultAttributes)))  parseRules ("Lua","String_block") =   (((pRegExpr regex_'5c'5c'28a'7cb'7cf'7cn'7cr'7ct'7cv'7c'5c'5c'7c'22'7c'5c'27'7c'5b'7c'5d'29 >>= withAttribute OtherTok))    <|>-   ((pRegExprDynamic "\\]%1\\]" >>= withAttribute StringTok) >>~ (popContext)))+   ((pRegExprDynamic "\\]%1\\]" >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Lua","String_block")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lua","String_block") defaultAttributes)))  parseRules ("Lua","Error") =-  pzero+  (currentContext >>= \x -> guard (x == ("Lua","Error")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Lua","Error") defaultAttributes)) +parseRules ("DoxygenLua", _) = Text.Highlighting.Kate.Syntax.Doxygenlua.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Lua","Base") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Makefile.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Makefile"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Makefile","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -100,12 +96,16 @@    <|>    ((pFirstNonSpace >> pAnyChar "@-" >>= withAttribute CharTok) >>~ pushContext ("Makefile","Commands"))    <|>-   ((pRegExpr regex_'23'2e'2a'24 >>= withAttribute CommentTok)))+   ((pRegExpr regex_'23'2e'2a'24 >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Makefile","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Makefile","Normal") defaultAttributes)))  parseRules ("Makefile","String") =   (((pLineContinue >>= withAttribute StringTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Makefile","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Makefile","String") defaultAttributes)))  parseRules ("Makefile","Value") =   (((pLineContinue >>= withAttribute CharTok))@@ -116,44 +116,60 @@    <|>    ((pRegExpr regex_'40'5b'2d'5f'5cd'5cw'5d'2a'40 >>= withAttribute FloatTok) >>~ (popContext))    <|>-   ((pDetectChar False ';' >>= withAttribute CharTok) >>~ (popContext)))+   ((pDetectChar False ';' >>= withAttribute CharTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Makefile","Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Makefile","Value") defaultAttributes)))  parseRules ("Makefile","VarFromValue(") =-  ((pDetectChar False ')' >>= withAttribute CharTok) >>~ (popContext))+  (((pDetectChar False ')' >>= withAttribute CharTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Makefile","VarFromValue(")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Makefile","VarFromValue(") defaultAttributes)))  parseRules ("Makefile","VarFromValue{") =-  ((pDetectChar False '}' >>= withAttribute CharTok) >>~ (popContext))+  (((pDetectChar False '}' >>= withAttribute CharTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Makefile","VarFromValue{")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Makefile","VarFromValue{") defaultAttributes)))  parseRules ("Makefile","VarFromNormal(") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_functions >>= withAttribute KeywordTok) >>~ pushContext ("Makefile","FunctionCall("))    <|>-   ((pDetectChar False ')' >>= withAttribute CharTok) >>~ (popContext)))+   ((pDetectChar False ')' >>= withAttribute CharTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Makefile","VarFromNormal(")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Makefile","VarFromNormal(") defaultAttributes)))  parseRules ("Makefile","VarFromNormal{") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_functions >>= withAttribute KeywordTok) >>~ pushContext ("Makefile","FunctionCall{"))    <|>-   ((pDetectChar False '}' >>= withAttribute CommentTok) >>~ (popContext)))+   ((pDetectChar False '}' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Makefile","VarFromNormal{")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Makefile","VarFromNormal{") defaultAttributes)))  parseRules ("Makefile","FunctionCall(") =   (((pDetect2Chars False '$' '{' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromNormal{"))    <|>    ((pDetect2Chars False '$' '(' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromNormal("))    <|>-   ((pDetectChar False ')' >>= withAttribute CharTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ')' >>= withAttribute CharTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Makefile","FunctionCall(")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Makefile","FunctionCall(") defaultAttributes)))  parseRules ("Makefile","FunctionCall{") =   (((pDetect2Chars False '$' '{' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromNormal{"))    <|>    ((pDetect2Chars False '$' '(' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromNormal("))    <|>-   ((pDetectChar False '}' >>= withAttribute CharTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '}' >>= withAttribute CharTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Makefile","FunctionCall{")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Makefile","FunctionCall{") defaultAttributes)))  parseRules ("Makefile","Commands") =   (((pDetect2Chars False '$' '{' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromNormal{"))    <|>    ((pDetect2Chars False '$' '(' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromNormal("))    <|>-   ((pRegExpr regex_'5b'5f'5cw'2d'5d'2a'5cb >>= withAttribute BaseNTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'5f'5cw'2d'5d'2a'5cb >>= withAttribute BaseNTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Makefile","Commands")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Makefile","Commands") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Makefile","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Mandoc.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Troff Mandoc"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Troff Mandoc","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -71,7 +67,9 @@    <|>    ((pColumn 0 >> pDetectChar False '.' >>= withAttribute FunctionTok) >>~ pushContext ("Troff Mandoc","DetectDirective"))    <|>-   ((parseRules ("Troff Mandoc","DetectOthers##Roff"))))+   ((parseRules ("Troff Mandoc","DetectOthers##Roff")))+   <|>+   (currentContext >>= \x -> guard (x == ("Troff Mandoc","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Troff Mandoc","Normal") defaultAttributes)))  parseRules ("Troff Mandoc","DetectDirective") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_headings >>= withAttribute KeywordTok) >>~ pushContext ("Troff Mandoc","Directive"))@@ -82,10 +80,14 @@    <|>    ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_others >>= withAttribute FunctionTok) >>~ pushContext ("Troff Mandoc","Directive"))    <|>-   ((parseRules ("Troff Mandoc","DetectDirective##Roff"))))+   ((parseRules ("Troff Mandoc","DetectDirective##Roff")))+   <|>+   (currentContext >>= \x -> guard (x == ("Troff Mandoc","DetectDirective")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Troff Mandoc","DetectDirective") defaultAttributes)))  parseRules ("Troff Mandoc","Directive") =-  ((parseRules ("Troff Mandoc","Directive##Roff")))+  (((parseRules ("Troff Mandoc","Directive##Roff")))+   <|>+   (currentContext >>= \x -> guard (x == ("Troff Mandoc","Directive")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Troff Mandoc","Directive") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Troff Mandoc","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Matlab.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Matlab"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Matlab","_normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -120,10 +116,14 @@    <|>    ((pString False ".'" >>= withAttribute NormalTok))    <|>-   ((pAnyChar "*+-/\\&|<>~^=,;:@" >>= withAttribute NormalTok)))+   ((pAnyChar "*+-/\\&|<>~^=,;:@" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Matlab","_normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Matlab","_normal") defaultAttributes)))  parseRules ("Matlab","_adjoint") =-  ((pRegExpr regex_'27'2b >>= withAttribute NormalTok) >>~ (popContext))+  (((pRegExpr regex_'27'2b >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Matlab","_adjoint")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Matlab","_adjoint") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Matlab","_normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Maxima.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Maxima"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Maxima","Normal Text")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -92,17 +88,23 @@    <|>    ((pRegExpr regex_'5b'2d'2b'5d'3f'5cd'2b >>= withAttribute DecValTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute NormalTok)))+   ((pDetectChar False '\'' >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Maxima","Normal Text")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Maxima","Normal Text") defaultAttributes)))  parseRules ("Maxima","String") =-  ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+  (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Maxima","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Maxima","String") defaultAttributes)))  parseRules ("Maxima","Comment") =   (((pKeyword " \n\t.():!+,-<=>&*/;?[]^{|}~\\@#" list_SpecialComment >>= withAttribute NormalTok))    <|>    ((pDetectSpaces >>= withAttribute NormalTok))    <|>-   ((pDetect2Chars False '*' '/' >>= withAttribute NormalTok) >>~ (popContext)))+   ((pDetect2Chars False '*' '/' >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Maxima","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Maxima","Comment") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Maxima","Normal Text") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Metafont.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Metapost/Metafont"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Metapost/Metafont","Normal Text")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -199,7 +195,9 @@    <|>    ((pRegExpr regex_'5cb'28for'7cforsuffixes'7cforever'29'5cb >>= withAttribute KeywordTok))    <|>-   ((pRegExpr regex_'5cbendfor'5cb >>= withAttribute KeywordTok)))+   ((pRegExpr regex_'5cbendfor'5cb >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Metapost/Metafont","Normal Text")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Metapost/Metafont","Normal Text") defaultAttributes)))  parseRules ("Metapost/Metafont","string") =   (((pDetectIdentifier >>= withAttribute StringTok))@@ -208,7 +206,9 @@    <|>    ((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Metapost/Metafont","string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Metapost/Metafont","string") defaultAttributes)))  parseRules ("Metapost/Metafont","TeXMode") =   (((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext ("Metapost/Metafont","ContrSeq"))@@ -217,7 +217,9 @@    <|>    ((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext ("Metapost/Metafont","MathMode"))    <|>-   ((pRegExpr regex_'5cbetex'5cb >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pRegExpr regex_'5cbetex'5cb >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Metapost/Metafont","TeXMode")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Metapost/Metafont","TeXMode") defaultAttributes)))  parseRules ("Metapost/Metafont","ContrSeq") =   (((pString False "verb*" >>= withAttribute NormalTok) >>~ pushContext ("Metapost/Metafont","Verb"))@@ -228,20 +230,26 @@    <|>    ((pRegExpr regex_'5ba'2dzA'2dZ'5d'2b'28'5c'2b'3f'7c'5c'2a'7b0'2c3'7d'29 >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Metapost/Metafont","ContrSeq")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Metapost/Metafont","ContrSeq") defaultAttributes)))  parseRules ("Metapost/Metafont","ToEndOfLine") =-  pzero+  (currentContext >>= \x -> guard (x == ("Metapost/Metafont","ToEndOfLine")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Metapost/Metafont","ToEndOfLine") defaultAttributes))  parseRules ("Metapost/Metafont","Verb") =-  ((pRegExprDynamic "(.)" >>= withAttribute NormalTok) >>~ pushContext ("Metapost/Metafont","VerbEnd"))+  (((pRegExprDynamic "(.)" >>= withAttribute NormalTok) >>~ pushContext ("Metapost/Metafont","VerbEnd"))+   <|>+   (currentContext >>= \x -> guard (x == ("Metapost/Metafont","Verb")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Metapost/Metafont","Verb") defaultAttributes)))  parseRules ("Metapost/Metafont","VerbEnd") =   (((pString True "%1" >>= withAttribute NormalTok) >>~ (popContext >> popContext >> popContext))    <|>    ((pDetectChar False '\215' >>= withAttribute NormalTok))    <|>-   ((pRegExprDynamic "[^%1\\xd7]*" >>= withAttribute NormalTok)))+   ((pRegExprDynamic "[^%1\\xd7]*" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Metapost/Metafont","VerbEnd")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Metapost/Metafont","VerbEnd") defaultAttributes)))  parseRules ("Metapost/Metafont","MathMode") =   (((pString False "$$" >>= withAttribute AlertTok))@@ -252,19 +260,25 @@    <|>    ((pDetect2Chars False '\\' ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((pDetect2Chars False '\\' ']' >>= withAttribute AlertTok)))+   ((pDetect2Chars False '\\' ']' >>= withAttribute AlertTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Metapost/Metafont","MathMode")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Metapost/Metafont","MathMode") defaultAttributes)))  parseRules ("Metapost/Metafont","MathContrSeq") =   (((pDetectChar False '\215' >>= withAttribute NormalTok))    <|>    ((pRegExpr regex_'5ba'2dzA'2dZ'5d'2b'5c'2a'3f >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Metapost/Metafont","MathContrSeq")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Metapost/Metafont","MathContrSeq") defaultAttributes)))  parseRules ("Metapost/Metafont","Comment") =   (((pRegExpr regex_'28FIXME'7cTODO'29'3a'3f >>= withAttribute AlertTok))    <|>-   ((pDetectChar False '\215' >>= withAttribute NormalTok)))+   ((pDetectChar False '\215' >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Metapost/Metafont","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Metapost/Metafont","Comment") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Metapost/Metafont","Normal Text") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Mips.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "MIPS Assembler"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("MIPS Assembler","normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -104,12 +100,16 @@    <|>    ((pHlCHex >>= withAttribute BaseNTok))    <|>-   ((pInt >>= withAttribute DecValTok)))+   ((pInt >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("MIPS Assembler","normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("MIPS Assembler","normal") defaultAttributes)))  parseRules ("MIPS Assembler","string") =   (((pRegExpr regex_'5c'5c'2e >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("MIPS Assembler","string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("MIPS Assembler","string") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("MIPS Assembler","normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Modula2.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Modula-2"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Modula-2","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -85,22 +81,32 @@    <|>    ((pString False "(*$" >>= withAttribute OtherTok) >>~ pushContext ("Modula-2","Prep1"))    <|>-   ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("Modula-2","Comment2")))+   ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("Modula-2","Comment2"))+   <|>+   (currentContext >>= \x -> guard (x == ("Modula-2","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Modula-2","Normal") defaultAttributes)))  parseRules ("Modula-2","String1") =-  ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+  (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Modula-2","String1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Modula-2","String1") defaultAttributes)))  parseRules ("Modula-2","String2") =-  ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+  (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Modula-2","String2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Modula-2","String2") defaultAttributes)))  parseRules ("Modula-2","Comment2") =-  ((pDetect2Chars False '*' ')' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' ')' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Modula-2","Comment2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Modula-2","Comment2") defaultAttributes)))  parseRules ("Modula-2","Comment3") =-  pzero+  (currentContext >>= \x -> guard (x == ("Modula-2","Comment3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Modula-2","Comment3") defaultAttributes))  parseRules ("Modula-2","Prep1") =-  ((pString False "$*)" >>= withAttribute OtherTok) >>~ pushContext ("Modula-2","Prep1"))+  (((pString False "$*)" >>= withAttribute OtherTok) >>~ pushContext ("Modula-2","Prep1"))+   <|>+   (currentContext >>= \x -> guard (x == ("Modula-2","Prep1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Modula-2","Prep1") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Modula-2","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Modula3.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Modula-3"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Modula-3","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -107,18 +103,26 @@    <|>    ((pDetect2Chars False '<' '*' >>= withAttribute OtherTok) >>~ pushContext ("Modula-3","Prep1"))    <|>-   ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("Modula-3","Comment2")))+   ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("Modula-3","Comment2"))+   <|>+   (currentContext >>= \x -> guard (x == ("Modula-3","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Modula-3","Normal") defaultAttributes)))  parseRules ("Modula-3","String1") =-  ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+  (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Modula-3","String1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Modula-3","String1") defaultAttributes)))  parseRules ("Modula-3","Comment2") =   (((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("Modula-3","Comment2"))    <|>-   ((pDetect2Chars False '*' ')' >>= withAttribute CommentTok) >>~ (popContext)))+   ((pDetect2Chars False '*' ')' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Modula-3","Comment2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Modula-3","Comment2") defaultAttributes)))  parseRules ("Modula-3","Prep1") =-  ((pDetect2Chars False '*' '>' >>= withAttribute OtherTok) >>~ (popContext))+  (((pDetect2Chars False '*' '>' >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Modula-3","Prep1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Modula-3","Prep1") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Modula-3","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Monobasic.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "MonoBasic"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("MonoBasic","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -194,17 +190,21 @@    <|>    ((pRegExpr regex_'23If'2e'2a'24 >>= withAttribute OtherTok))    <|>-   ((pRegExpr regex_'23End'2eIf'2e'2a'24 >>= withAttribute OtherTok)))+   ((pRegExpr regex_'23End'2eIf'2e'2a'24 >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("MonoBasic","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("MonoBasic","Normal") defaultAttributes)))  parseRules ("MonoBasic","String") =   (((pLineContinue >>= withAttribute StringTok) >>~ (popContext))    <|>    ((pHlCStringChar >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("MonoBasic","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("MonoBasic","String") defaultAttributes)))  parseRules ("MonoBasic","Comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("MonoBasic","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("MonoBasic","Comment") defaultAttributes))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("MonoBasic","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Nasm.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Intel x86 (NASM)"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Intel x86 (NASM)","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -107,16 +103,20 @@    <|>    ((pInt >>= withAttribute DecValTok))    <|>-   ((pHlCChar >>= withAttribute CharTok)))+   ((pHlCChar >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Intel x86 (NASM)","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Intel x86 (NASM)","Normal") defaultAttributes)))  parseRules ("Intel x86 (NASM)","Comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("Intel x86 (NASM)","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Intel x86 (NASM)","Comment") defaultAttributes))  parseRules ("Intel x86 (NASM)","Preprocessor") =-  pzero+  (currentContext >>= \x -> guard (x == ("Intel x86 (NASM)","Preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Intel x86 (NASM)","Preprocessor") defaultAttributes))  parseRules ("Intel x86 (NASM)","String") =-  ((pAnyChar "\"'" >>= withAttribute StringTok) >>~ (popContext))+  (((pAnyChar "\"'" >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Intel x86 (NASM)","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Intel x86 (NASM)","String") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Intel x86 (NASM)","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Noweb.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "noweb"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("noweb","RawDocumentation")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -77,7 +73,9 @@    <|>    ((pDetect2Chars False '[' '[' >>= withAttribute RegionMarkerTok) >>~ pushContext ("noweb","CodeQuote"))    <|>-   ((Text.Highlighting.Kate.Syntax.Html.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Html.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("noweb","RawDocumentation")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("noweb","RawDocumentation") defaultAttributes)))  parseRules ("noweb","CodeQuote") =   (((pDetect2Chars False '@' ']' >>= withAttribute NormalTok))@@ -86,7 +84,9 @@    <|>    ((parseRules ("noweb","SectionNames")))    <|>-   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("noweb","CodeQuote")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("noweb","CodeQuote") defaultAttributes)))  parseRules ("noweb","CodeSection") =   (((pColumn 0 >> pRegExpr regex_'40'24 >>= withAttribute RegionMarkerTok) >>~ pushContext ("noweb","RawDocumentation"))@@ -97,14 +97,18 @@    <|>    ((parseRules ("noweb","SectionNames")))    <|>-   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("noweb","CodeSection")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("noweb","CodeSection") defaultAttributes)))  parseRules ("noweb","SectionNames") =   (((pRegExpr regex_'40'3c'3c >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'3c'3c'2e'2a'5b'5e'40'5d'3e'3e'28'3f'21'3d'29 >>= withAttribute RegionMarkerTok)))+   ((pRegExpr regex_'3c'3c'2e'2a'5b'5e'40'5d'3e'3e'28'3f'21'3d'29 >>= withAttribute RegionMarkerTok))+   <|>+   (currentContext >>= \x -> guard (x == ("noweb","SectionNames")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("noweb","SectionNames") defaultAttributes)))  parseRules ("HTML", _) = Text.Highlighting.Kate.Syntax.Html.parseExpression parseRules ("C++", _) = Text.Highlighting.Kate.Syntax.Cpp.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("noweb","RawDocumentation") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Objectivec.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Objective-C"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Objective-C","Default")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -112,20 +108,26 @@    <|>    ((pColumn 0 >> pRegExpr regex_'23 >>= withAttribute OtherTok) >>~ pushContext ("Objective-C","Preprocessor"))    <|>-   ((pDetect2Chars False '@' '"' >>= withAttribute StringTok) >>~ pushContext ("Objective-C","String")))+   ((pDetect2Chars False '@' '"' >>= withAttribute StringTok) >>~ pushContext ("Objective-C","String"))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C","Default")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C","Default") defaultAttributes)))  parseRules ("Objective-C","String") =   (((pLineContinue >>= withAttribute StringTok))    <|>    ((pHlCStringChar >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C","String") defaultAttributes)))  parseRules ("Objective-C","SingleLineComment") =-  pzero+  (currentContext >>= \x -> guard (x == ("Objective-C","SingleLineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C","SingleLineComment") defaultAttributes))  parseRules ("Objective-C","MultiLineComment") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C","MultiLineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C","MultiLineComment") defaultAttributes)))  parseRules ("Objective-C","Preprocessor") =   (((pLineContinue >>= withAttribute OtherTok))@@ -138,11 +140,15 @@    <|>    ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C","SingleLineComment"))    <|>-   ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C","MultiLineCommentPrep")))+   ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C","MultiLineCommentPrep"))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C","Preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C","Preprocessor") defaultAttributes)))  parseRules ("Objective-C","MultiLineCommentPrep") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C","MultiLineCommentPrep")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C","MultiLineCommentPrep") defaultAttributes)))  parseRules ("Doxygen", _) = Text.Highlighting.Kate.Syntax.Doxygen.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Objective-C","Default") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Objectivecpp.hs view
@@ -33,11 +33,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Objective-C++"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Objective-C++","Default")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -151,20 +147,26 @@    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok))    <|>-   ((pAnyChar ":!%&()+,-/.*<=>?[]{|}~^;" >>= withAttribute NormalTok)))+   ((pAnyChar ":!%&()+,-/.*<=>?[]{|}~^;" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C++","Default")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C++","Default") defaultAttributes)))  parseRules ("Objective-C++","String") =   (((pLineContinue >>= withAttribute StringTok))    <|>    ((pHlCStringChar >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C++","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C++","String") defaultAttributes)))  parseRules ("Objective-C++","SingleLineComment") =-  pzero+  (currentContext >>= \x -> guard (x == ("Objective-C++","SingleLineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C++","SingleLineComment") defaultAttributes))  parseRules ("Objective-C++","MultiLineComment") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C++","MultiLineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C++","MultiLineComment") defaultAttributes)))  parseRules ("Objective-C++","Preprocessor") =   (((pLineContinue >>= withAttribute OtherTok))@@ -177,24 +179,30 @@    <|>    ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","SingleLineComment"))    <|>-   ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","MultiLineCommentPrep")))+   ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","MultiLineCommentPrep"))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C++","Preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C++","Preprocessor") defaultAttributes)))  parseRules ("Objective-C++","MultiLineCommentPrep") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C++","MultiLineCommentPrep")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C++","MultiLineCommentPrep") defaultAttributes)))  parseRules ("Objective-C++","Region Marker") =-  pzero+  (currentContext >>= \x -> guard (x == ("Objective-C++","Region Marker")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C++","Region Marker") defaultAttributes))  parseRules ("Objective-C++","Commentar 1") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C++","Commentar 1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C++","Commentar 1") defaultAttributes)))  parseRules ("Objective-C++","Commentar 2") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -203,7 +211,9 @@    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C++","Commentar 2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C++","Commentar 2") defaultAttributes)))  parseRules ("Objective-C++","Preprocessor") =   (((pLineContinue >>= withAttribute OtherTok))@@ -220,10 +230,14 @@    <|>    ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","Commentar 1"))    <|>-   ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","MultiLineCommentPrep")))+   ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","MultiLineCommentPrep"))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C++","Preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C++","Preprocessor") defaultAttributes)))  parseRules ("Objective-C++","Define") =-  ((pLineContinue >>= withAttribute OtherTok))+  (((pLineContinue >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C++","Define")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C++","Define") defaultAttributes)))  parseRules ("Objective-C++","Outscoped") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -242,7 +256,9 @@    <|>    ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","Outscoped intern"))    <|>-   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2a'28endif'7celse'7celif'29 >>= withAttribute OtherTok) >>~ (popContext)))+   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2a'28endif'7celse'7celif'29 >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C++","Outscoped")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C++","Outscoped") defaultAttributes)))  parseRules ("Objective-C++","Outscoped intern") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -261,9 +277,11 @@    <|>    ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","Outscoped intern"))    <|>-   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute CommentTok) >>~ (popContext)))+   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective-C++","Outscoped intern")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective-C++","Outscoped intern") defaultAttributes)))  parseRules ("Doxygen", _) = Text.Highlighting.Kate.Syntax.Doxygen.parseExpression parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Objective-C++","Default") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Ocaml.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Objective Caml"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Objective Caml","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -162,39 +158,53 @@    <|>    ((pRegExpr regex_'2d'3f'5b0'2d9'5d'5b0'2d9'5f'5d'2a'28'28'5c'2e'28'5b0'2d9'5d'5b0'2d9'5f'5d'2a'29'3f'28'5beE'5d'5b'2d'2b'5d'3f'5b0'2d9'5d'5b0'2d9'5f'5d'2a'29'3f'29'7c'28'5beE'5d'5b'2d'2b'5d'3f'5b0'2d9'5d'5b0'2d9'5f'5d'2a'29'29 >>= withAttribute FloatTok))    <|>-   ((pRegExpr regex_'2d'3f'5b0'2d9'5d'5b0'2d9'5f'5d'2a >>= withAttribute DecValTok)))+   ((pRegExpr regex_'2d'3f'5b0'2d9'5d'5b0'2d9'5f'5d'2a >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective Caml","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective Caml","Normal") defaultAttributes)))  parseRules ("Objective Caml","Multiline Comment") =   (((pDetect2Chars False '*' ')' >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective Caml","Multiline Comment")))+   ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective Caml","Multiline Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective Caml","Multiline Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective Caml","Multiline Comment") defaultAttributes)))  parseRules ("Objective Caml","String Constant") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>    ((pRegExpr regex_'28'5c'5c'5bntbr'27'22'5c'5c'5d'7c'5c'5c'5b0'2d9'5d'7b3'7d'7c'5c'5cx'5b0'2d9A'2dFa'2df'5d'7b2'7d'29 >>= withAttribute CharTok))    <|>-   ((pRegExpr regex_'5c'5c'24 >>= withAttribute CharTok)))+   ((pRegExpr regex_'5c'5c'24 >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective Caml","String Constant")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective Caml","String Constant") defaultAttributes)))  parseRules ("Objective Caml","Block") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("Objective Caml","Normal"))))+   ((parseRules ("Objective Caml","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective Caml","Block")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective Caml","Block") defaultAttributes)))  parseRules ("Objective Caml","Sig") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("Objective Caml","Normal"))))+   ((parseRules ("Objective Caml","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective Caml","Sig")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective Caml","Sig") defaultAttributes)))  parseRules ("Objective Caml","Struct") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("Objective Caml","Normal"))))+   ((parseRules ("Objective Caml","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective Caml","Struct")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective Caml","Struct") defaultAttributes)))  parseRules ("Objective Caml","Object") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("Objective Caml","Normal"))))+   ((parseRules ("Objective Caml","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective Caml","Object")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective Caml","Object") defaultAttributes)))  parseRules ("Objective Caml","ModuleEnv") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -210,7 +220,9 @@    <|>    ((pDetectSpaces >>= withAttribute NormalTok))    <|>-   ((pString False "." >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pString False "." >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective Caml","ModuleEnv2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective Caml","ModuleEnv2") defaultAttributes)))  parseRules ("Objective Caml","Camlp4 Quotation Constant") =   (((pDetect2Chars False '>' '>' >>= withAttribute StringTok) >>~ (popContext))@@ -221,7 +233,9 @@    <|>    ((pRegExpr regex_'5c'5c'28'5c'5c'7c'3e'3e'7c'3c'3c'29 >>= withAttribute CharTok))    <|>-   ((pRegExpr regex_'5c'5c'3c'3a'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c0377'5f'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a'3c >>= withAttribute CharTok)))+   ((pRegExpr regex_'5c'5c'3c'3a'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c0377'5f'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a'3c >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Objective Caml","Camlp4 Quotation Constant")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Objective Caml","Camlp4 Quotation Constant") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Objective Caml","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Octave.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Octave"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Octave","_normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -192,10 +188,14 @@    <|>    ((pString False ".'" >>= withAttribute NormalTok))    <|>-   ((pAnyChar "!\"%(*+,/;=>[]|~#&)-:<>\\^" >>= withAttribute NormalTok)))+   ((pAnyChar "!\"%(*+,/;=>[]|~#&)-:<>\\^" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Octave","_normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Octave","_normal") defaultAttributes)))  parseRules ("Octave","_adjoint") =-  ((pRegExpr regex_'27'2b >>= withAttribute NormalTok) >>~ (popContext))+  (((pRegExpr regex_'27'2b >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Octave","_adjoint")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Octave","_adjoint") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Octave","_normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Pascal.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Pascal"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Pascal","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -109,40 +105,60 @@    <|>    ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("Pascal","Comment2"))    <|>-   ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Pascal","Comment3")))+   ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Pascal","Comment3"))+   <|>+   (currentContext >>= \x -> guard (x == ("Pascal","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pascal","Normal") defaultAttributes)))  parseRules ("Pascal","CharNum") =   (((pDetectChar False '$' >>= withAttribute BaseNTok) >>~ pushContext ("Pascal","HexCharNum"))    <|>-   ((pRegExpr regex_'5b'5e0'2d9'5d >>= withAttribute StringTok) >>~ (popContext)))+   ((pRegExpr regex_'5b'5e0'2d9'5d >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Pascal","CharNum")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pascal","CharNum") defaultAttributes)))  parseRules ("Pascal","HexCharNum") =-  ((pRegExpr regex_'5b'5ea'2dfA'2dF0'2d9'5d >>= withAttribute BaseNTok) >>~ (popContext >> popContext))+  (((pRegExpr regex_'5b'5ea'2dfA'2dF0'2d9'5d >>= withAttribute BaseNTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Pascal","HexCharNum")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pascal","HexCharNum") defaultAttributes)))  parseRules ("Pascal","Hex") =-  ((pRegExpr regex_'5b'5ea'2dfA'2dF0'2d9'5d >>= withAttribute BaseNTok) >>~ (popContext))+  (((pRegExpr regex_'5b'5ea'2dfA'2dF0'2d9'5d >>= withAttribute BaseNTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Pascal","Hex")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pascal","Hex") defaultAttributes)))  parseRules ("Pascal","String") =-  ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+  (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Pascal","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pascal","String") defaultAttributes)))  parseRules ("Pascal","Prep1") =-  ((pDetect2Chars False '*' ')' >>= withAttribute OtherTok) >>~ (popContext))+  (((pDetect2Chars False '*' ')' >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Pascal","Prep1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pascal","Prep1") defaultAttributes)))  parseRules ("Pascal","Prep2") =-  ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext))+  (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Pascal","Prep2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pascal","Prep2") defaultAttributes)))  parseRules ("Pascal","Comment1") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_attention >>= withAttribute AlertTok))    <|>-   ((pDetectChar False '}' >>= withAttribute CommentTok) >>~ (popContext)))+   ((pDetectChar False '}' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Pascal","Comment1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pascal","Comment1") defaultAttributes)))  parseRules ("Pascal","Comment2") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_attention >>= withAttribute AlertTok))    <|>-   ((pDetect2Chars False '*' ')' >>= withAttribute CommentTok) >>~ (popContext)))+   ((pDetect2Chars False '*' ')' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Pascal","Comment2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pascal","Comment2") defaultAttributes)))  parseRules ("Pascal","Comment3") =-  ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_attention >>= withAttribute AlertTok))+  (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_attention >>= withAttribute AlertTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Pascal","Comment3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pascal","Comment3") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Pascal","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Perl.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Perl"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Perl","normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -279,7 +275,9 @@    <|>    ((pDetectChar False '{' >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '}' >>= withAttribute NormalTok)))+   ((pDetectChar False '}' >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","normal") defaultAttributes)))  parseRules ("Perl","find_quoted") =   (((pRegExpr regex_x'5cs'2a'28'27'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","string_6"))@@ -298,7 +296,9 @@    <|>    ((pRegExpr regex_'28'5b'5ea'2dzA'2dZ0'2d9'5f'5cs'5b'5c'5d'7b'7d'28'29'5d'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","string_6"))    <|>-   ((pRegExpr regex_'5cs'2b'23'2e'2a >>= withAttribute CommentTok)))+   ((pRegExpr regex_'5cs'2b'23'2e'2a >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","find_quoted")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","find_quoted") defaultAttributes)))  parseRules ("Perl","find_qqx") =   (((pDetectChar False '(' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","ip_string_2"))@@ -311,7 +311,9 @@    <|>    ((pRegExpr regex_'28'5b'5ea'2dzA'2dZ0'2d9'5f'5cs'5b'5c'5d'7b'7d'28'29'5d'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","ip_string_6"))    <|>-   ((pRegExpr regex_'5cs'2b'23'2e'2a >>= withAttribute CommentTok)))+   ((pRegExpr regex_'5cs'2b'23'2e'2a >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","find_qqx")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","find_qqx") defaultAttributes)))  parseRules ("Perl","find_qw") =   (((pDetectChar False '(' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","quote_word_paren"))@@ -322,7 +324,9 @@    <|>    ((pRegExpr regex_'28'5b'5ea'2dzA'2dZ0'2d9'5f'5cs'5b'5c'5d'7b'7d'28'29'5d'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","quote_word"))    <|>-   ((pRegExpr regex_'5cs'2b'23'2e'2a >>= withAttribute CommentTok)))+   ((pRegExpr regex_'5cs'2b'23'2e'2a >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","find_qw")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","find_qw") defaultAttributes)))  parseRules ("Perl","ipstring_internal") =   (((pDetectIdentifier >>= withAttribute StringTok))@@ -331,47 +335,61 @@    <|>    ((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok))    <|>-   ((lookAhead (pRegExpr regex_'28'3f'3a'5b'5c'24'40'5d'5cS'7c'25'5b'5cw'7b'5d'29) >> pushContext ("Perl","find_variable_unsafe") >> currentContext >>= parseRules)))+   ((lookAhead (pRegExpr regex_'28'3f'3a'5b'5c'24'40'5d'5cS'7c'25'5b'5cw'7b'5d'29) >> pushContext ("Perl","find_variable_unsafe") >> currentContext >>= parseRules))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","ipstring_internal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","ipstring_internal") defaultAttributes)))  parseRules ("Perl","ip_string") =   (((pDetectChar False '"' >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("Perl","ipstring_internal"))))+   ((parseRules ("Perl","ipstring_internal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","ip_string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","ip_string") defaultAttributes)))  parseRules ("Perl","ip_string_2") =   (((pRangeDetect '(' ')' >>= withAttribute StringTok))    <|>    ((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((parseRules ("Perl","ipstring_internal"))))+   ((parseRules ("Perl","ipstring_internal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","ip_string_2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","ip_string_2") defaultAttributes)))  parseRules ("Perl","ip_string_3") =   (((pRangeDetect '{' '}' >>= withAttribute StringTok))    <|>    ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((parseRules ("Perl","ipstring_internal"))))+   ((parseRules ("Perl","ipstring_internal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","ip_string_3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","ip_string_3") defaultAttributes)))  parseRules ("Perl","ip_string_4") =   (((pRangeDetect '[' ']' >>= withAttribute StringTok))    <|>    ((pDetectChar False ']' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((parseRules ("Perl","ipstring_internal"))))+   ((parseRules ("Perl","ipstring_internal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","ip_string_4")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","ip_string_4") defaultAttributes)))  parseRules ("Perl","ip_string_5") =   (((pRangeDetect '<' '>' >>= withAttribute StringTok))    <|>    ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((parseRules ("Perl","ipstring_internal"))))+   ((parseRules ("Perl","ipstring_internal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","ip_string_5")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","ip_string_5") defaultAttributes)))  parseRules ("Perl","ip_string_6") =   (((pRegExprDynamic "\\%1" >>= withAttribute StringTok))    <|>    ((pDetectChar True '1' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((parseRules ("Perl","ipstring_internal"))))+   ((parseRules ("Perl","ipstring_internal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","ip_string_6")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","ip_string_6") defaultAttributes)))  parseRules ("Perl","string") =   (((pDetectIdentifier >>= withAttribute StringTok))@@ -380,7 +398,9 @@    <|>    ((pDetect2Chars False '\\' '\\' >>= withAttribute CharTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","string") defaultAttributes)))  parseRules ("Perl","string_2") =   (((pDetectIdentifier >>= withAttribute StringTok))@@ -391,7 +411,9 @@    <|>    ((pRangeDetect '(' ')' >>= withAttribute StringTok))    <|>-   ((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","string_2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","string_2") defaultAttributes)))  parseRules ("Perl","string_3") =   (((pDetectIdentifier >>= withAttribute StringTok))@@ -402,7 +424,9 @@    <|>    ((pRangeDetect '{' '}' >>= withAttribute StringTok))    <|>-   ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","string_3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","string_3") defaultAttributes)))  parseRules ("Perl","string_4") =   (((pDetectIdentifier >>= withAttribute StringTok))@@ -413,7 +437,9 @@    <|>    ((pRangeDetect '[' ']' >>= withAttribute StringTok))    <|>-   ((pDetectChar False ']' >>= withAttribute KeywordTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ']' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","string_4")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","string_4") defaultAttributes)))  parseRules ("Perl","string_5") =   (((pDetectIdentifier >>= withAttribute StringTok))@@ -426,7 +452,9 @@    <|>    ((pRangeDetect '<' '>' >>= withAttribute StringTok))    <|>-   ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","string_5")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","string_5") defaultAttributes)))  parseRules ("Perl","string_6") =   (((pDetectIdentifier >>= withAttribute StringTok))@@ -435,7 +463,9 @@    <|>    ((pRegExprDynamic "\\%1" >>= withAttribute CharTok))    <|>-   ((pDetectChar True '1' >>= withAttribute KeywordTok) >>~ (popContext >> popContext)))+   ((pDetectChar True '1' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","string_6")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","string_6") defaultAttributes)))  parseRules ("Perl","find_subst") =   (((pRegExpr regex_'5cs'2b'23'2e'2a >>= withAttribute CommentTok))@@ -448,83 +478,109 @@    <|>    ((pDetectChar False '\'' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_sq_pattern"))    <|>-   ((pRegExpr regex_'28'5b'5e'5cw'5cs'5b'5c'5d'7b'7d'28'29'5d'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_slash_pattern")))+   ((pRegExpr regex_'28'5b'5e'5cw'5cs'5b'5c'5d'7b'7d'28'29'5d'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_slash_pattern"))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","find_subst")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","find_subst") defaultAttributes)))  parseRules ("Perl","subst_curlybrace_pattern") =   (((pRegExpr regex_'5cs'2b'23'2e'2a'24 >>= withAttribute CommentTok))    <|>    ((parseRules ("Perl","regex_pattern_internal_ip")))    <|>-   ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_curlybrace_middle")))+   ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_curlybrace_middle"))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","subst_curlybrace_pattern")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","subst_curlybrace_pattern") defaultAttributes)))  parseRules ("Perl","subst_curlybrace_middle") =   (((pRegExpr regex_'23'2e'2a'24 >>= withAttribute CommentTok))    <|>-   ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_curlybrace_replace")))+   ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_curlybrace_replace"))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","subst_curlybrace_middle")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","subst_curlybrace_middle") defaultAttributes)))  parseRules ("Perl","subst_curlybrace_replace") =   (((parseRules ("Perl","ipstring_internal")))    <|>    ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("Perl","subst_curlybrace_replace_recursive"))    <|>-   ((pRegExpr regex_'5c'7d'5bcegimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext >> popContext)))+   ((pRegExpr regex_'5c'7d'5bcegimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","subst_curlybrace_replace")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","subst_curlybrace_replace") defaultAttributes)))  parseRules ("Perl","subst_curlybrace_replace_recursive") =   (((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Perl","subst_curlybrace_replace_recursive"))    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("Perl","ipstring_internal"))))+   ((parseRules ("Perl","ipstring_internal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","subst_curlybrace_replace_recursive")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","subst_curlybrace_replace_recursive") defaultAttributes)))  parseRules ("Perl","subst_paren_pattern") =   (((pRegExpr regex_'5cs'2b'23'2e'2a'24 >>= withAttribute CommentTok))    <|>    ((parseRules ("Perl","regex_pattern_internal_ip")))    <|>-   ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_paren_replace")))+   ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_paren_replace"))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","subst_paren_pattern")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","subst_paren_pattern") defaultAttributes)))  parseRules ("Perl","subst_paren_replace") =   (((parseRules ("Perl","ipstring_internal")))    <|>    ((pDetectChar False '(' >>= withAttribute KeywordTok))    <|>-   ((pRegExpr regex_'5c'29'5bcegimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)))+   ((pRegExpr regex_'5c'29'5bcegimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","subst_paren_replace")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","subst_paren_replace") defaultAttributes)))  parseRules ("Perl","subst_bracket_pattern") =   (((pRegExpr regex_'5cs'2b'23'2e'2a'24 >>= withAttribute CommentTok))    <|>    ((parseRules ("Perl","regex_pattern_internal_ip")))    <|>-   ((pDetectChar False ']' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_bracket_replace")))+   ((pDetectChar False ']' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_bracket_replace"))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","subst_bracket_pattern")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","subst_bracket_pattern") defaultAttributes)))  parseRules ("Perl","subst_bracket_replace") =   (((parseRules ("Perl","ipstring_internal")))    <|>    ((pDetectChar False '[' >>= withAttribute KeywordTok))    <|>-   ((pRegExpr regex_'5c'5d'5bcegimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)))+   ((pRegExpr regex_'5c'5d'5bcegimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","subst_bracket_replace")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","subst_bracket_replace") defaultAttributes)))  parseRules ("Perl","subst_slash_pattern") =   (((pRegExprDynamic "\\$(?=%1)" >>= withAttribute CharTok))    <|>    ((pRegExprDynamic "(%1)" >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_slash_replace"))    <|>-   ((parseRules ("Perl","regex_pattern_internal_ip"))))+   ((parseRules ("Perl","regex_pattern_internal_ip")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","subst_slash_pattern")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","subst_slash_pattern") defaultAttributes)))  parseRules ("Perl","subst_slash_replace") =   (((pRegExprDynamic "%1[cegimosx]*" >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((parseRules ("Perl","ipstring_internal"))))+   ((parseRules ("Perl","ipstring_internal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","subst_slash_replace")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","subst_slash_replace") defaultAttributes)))  parseRules ("Perl","subst_sq_pattern") =   (((pRegExpr regex_'5cs'2b'23'2e'2a'24 >>= withAttribute CommentTok))    <|>    ((parseRules ("Perl","regex_pattern_internal")))    <|>-   ((pDetectChar False '\'' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_sq_replace")))+   ((pDetectChar False '\'' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_sq_replace"))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","subst_sq_pattern")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","subst_sq_pattern") defaultAttributes)))  parseRules ("Perl","subst_sq_replace") =-  ((pRegExpr regex_'27'5bcegimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))+  (((pRegExpr regex_'27'5bcegimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","subst_sq_replace")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","subst_sq_replace") defaultAttributes)))  parseRules ("Perl","tr") =   (((pRegExpr regex_'5c'28'5b'5e'29'5d'2a'5c'29'5cs'2a'5c'28'3f'3a'5b'5e'29'5d'2a'5c'29 >>= withAttribute OtherTok) >>~ (popContext))@@ -548,14 +604,18 @@    <|>    ((pDetectChar False '\'' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","pattern_sq"))    <|>-   ((pRegExpr regex_'28'5b'5e'5cw'5cs'5d'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","pattern")))+   ((pRegExpr regex_'28'5b'5e'5cw'5cs'5d'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","pattern"))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","find_pattern")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","find_pattern") defaultAttributes)))  parseRules ("Perl","pattern_slash") =   (((pRegExpr regex_'5c'24'28'3f'3d'2f'29 >>= withAttribute CharTok))    <|>    ((parseRules ("Perl","regex_pattern_internal_ip")))    <|>-   ((pRegExpr regex_'2f'5bcgimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pRegExpr regex_'2f'5bcgimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","pattern_slash")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","pattern_slash") defaultAttributes)))  parseRules ("Perl","pattern") =   (((pRegExprDynamic "\\$(?=%1)" >>= withAttribute CharTok))@@ -564,27 +624,37 @@    <|>    ((parseRules ("Perl","regex_pattern_internal_ip")))    <|>-   ((pRegExprDynamic "\\$(?=\\%1)" >>= withAttribute CharTok)))+   ((pRegExprDynamic "\\$(?=\\%1)" >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","pattern")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","pattern") defaultAttributes)))  parseRules ("Perl","pattern_brace") =   (((pRegExpr regex_'5c'7d'5bcgimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("Perl","regex_pattern_internal_ip"))))+   ((parseRules ("Perl","regex_pattern_internal_ip")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","pattern_brace")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","pattern_brace") defaultAttributes)))  parseRules ("Perl","pattern_bracket") =   (((pRegExpr regex_'5c'5d'5bcgimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("Perl","regex_pattern_internal_ip"))))+   ((parseRules ("Perl","regex_pattern_internal_ip")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","pattern_bracket")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","pattern_bracket") defaultAttributes)))  parseRules ("Perl","pattern_paren") =   (((pRegExpr regex_'5c'29'5bcgimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("Perl","regex_pattern_internal_ip"))))+   ((parseRules ("Perl","regex_pattern_internal_ip")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","pattern_paren")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","pattern_paren") defaultAttributes)))  parseRules ("Perl","pattern_sq") =   (((pRegExpr regex_'27'5bcgimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("Perl","regex_pattern_internal"))))+   ((parseRules ("Perl","regex_pattern_internal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","pattern_sq")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","pattern_sq") defaultAttributes)))  parseRules ("Perl","regex_pattern_internal_rules_1") =   (((pFirstNonSpace >> pRegExpr regex_'23'2e'2a'24 >>= withAttribute CommentTok))@@ -595,7 +665,9 @@    <|>    ((pRegExpr regex_'5c'5c'5b'5cd'5d'2b >>= withAttribute DataTypeTok))    <|>-   ((pRegExpr regex_'5c'5c'2e >>= withAttribute OtherTok)))+   ((pRegExpr regex_'5c'5c'2e >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","regex_pattern_internal_rules_1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","regex_pattern_internal_rules_1") defaultAttributes)))  parseRules ("Perl","regex_pattern_internal_rules_2") =   (((pDetect2Chars False '(' '?' >>= withAttribute CharTok) >>~ pushContext ("Perl","pat_ext"))@@ -608,26 +680,34 @@    <|>    ((pDetectChar False '$' >>= withAttribute CharTok))    <|>-   ((pRegExpr regex_'5cs'7b3'2c'7d'23'2e'2a'24 >>= withAttribute CommentTok)))+   ((pRegExpr regex_'5cs'7b3'2c'7d'23'2e'2a'24 >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","regex_pattern_internal_rules_2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","regex_pattern_internal_rules_2") defaultAttributes)))  parseRules ("Perl","regex_pattern_internal") =   (((parseRules ("Perl","regex_pattern_internal_rules_1")))    <|>-   ((parseRules ("Perl","regex_pattern_internal_rules_2"))))+   ((parseRules ("Perl","regex_pattern_internal_rules_2")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","regex_pattern_internal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","regex_pattern_internal") defaultAttributes)))  parseRules ("Perl","regex_pattern_internal_ip") =   (((parseRules ("Perl","regex_pattern_internal_rules_1")))    <|>    ((lookAhead (pRegExpr regex_'5b'24'40'5d'5b'5e'5c'5d'5cs'7b'7d'28'29'7c'3e'27'5d) >> pushContext ("Perl","find_variable_unsafe") >> currentContext >>= parseRules))    <|>-   ((parseRules ("Perl","regex_pattern_internal_rules_2"))))+   ((parseRules ("Perl","regex_pattern_internal_rules_2")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","regex_pattern_internal_ip")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","regex_pattern_internal_ip") defaultAttributes)))  parseRules ("Perl","pat_ext") =   (((pRegExpr regex_'5c'23'5b'5e'29'5d'2a >>= withAttribute CommentTok) >>~ (popContext))    <|>    ((pRegExpr regex_'5b'3a'3d'21'3e'3c'5d'2b >>= withAttribute CharTok) >>~ (popContext))    <|>-   ((pDetectChar False ')' >>= withAttribute CharTok) >>~ (popContext)))+   ((pDetectChar False ')' >>= withAttribute CharTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","pat_ext")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","pat_ext") defaultAttributes)))  parseRules ("Perl","pat_char_class") =   (((pDetectChar False '^' >>= withAttribute CharTok))@@ -638,7 +718,9 @@    <|>    ((pRegExpr regex_'5c'5b'3a'5c'5e'3f'5ba'2dz'5d'2b'3a'5c'5d >>= withAttribute BaseNTok))    <|>-   ((pDetectChar False ']' >>= withAttribute CharTok) >>~ (popContext)))+   ((pDetectChar False ']' >>= withAttribute CharTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","pat_char_class")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","pat_char_class") defaultAttributes)))  parseRules ("Perl","find_variable") =   (((pRegExpr regex_'5c'24'5b0'2d9'5d'2b >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect"))@@ -715,7 +797,9 @@    <|>    ((pDetect2Chars False '+' '+' >>= withAttribute NormalTok))    <|>-   ((pDetect2Chars False '-' '-' >>= withAttribute NormalTok)))+   ((pDetect2Chars False '-' '-' >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","var_detect_rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","var_detect_rules") defaultAttributes)))  parseRules ("Perl","quote_word") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -724,7 +808,9 @@    <|>    ((pRegExprDynamic "\\\\%1" >>= withAttribute NormalTok))    <|>-   ((pDetectChar True '1' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)))+   ((pDetectChar True '1' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","quote_word")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","quote_word") defaultAttributes)))  parseRules ("Perl","quote_word_paren") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -733,7 +819,9 @@    <|>    ((pDetect2Chars False '\\' ')' >>= withAttribute NormalTok))    <|>-   ((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)))+   ((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","quote_word_paren")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","quote_word_paren") defaultAttributes)))  parseRules ("Perl","quote_word_brace") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -742,7 +830,9 @@    <|>    ((pDetect2Chars False '\\' '}' >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)))+   ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","quote_word_brace")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","quote_word_brace") defaultAttributes)))  parseRules ("Perl","quote_word_bracket") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -751,7 +841,9 @@    <|>    ((pDetect2Chars False '\\' ']' >>= withAttribute NormalTok))    <|>-   ((pDetectChar False ']' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)))+   ((pDetectChar False ']' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","quote_word_bracket")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","quote_word_bracket") defaultAttributes)))  parseRules ("Perl","find_here_document") =   (((pRegExpr regex_'28'5cw'2b'29'5cs'2a'3b'3f >>= withAttribute KeywordTok) >>~ pushContext ("Perl","here_document"))@@ -760,7 +852,9 @@    <|>    ((pRegExpr regex_'5cs'2a'60'28'5b'5e'60'5d'2b'29'60'5cs'2a'3b'3f >>= withAttribute KeywordTok) >>~ pushContext ("Perl","here_document"))    <|>-   ((pRegExpr regex_'5cs'2a'27'28'5b'5e'27'5d'2b'29'27'5cs'2a'3b'3f >>= withAttribute KeywordTok) >>~ pushContext ("Perl","here_document_dumb")))+   ((pRegExpr regex_'5cs'2a'27'28'5b'5e'27'5d'2b'29'27'5cs'2a'3b'3f >>= withAttribute KeywordTok) >>~ pushContext ("Perl","here_document_dumb"))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","find_here_document")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","find_here_document") defaultAttributes)))  parseRules ("Perl","here_document") =   (((pDetectSpaces >>= withAttribute StringTok))@@ -769,29 +863,39 @@    <|>    ((pRegExpr regex_'5c'3d'5cs'2a'3c'3c'5cs'2a'5b'22'27'5d'3f'28'5bA'2dZ0'2d9'5f'5c'2d'5d'2b'29'5b'22'27'5d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Perl","here_document"))    <|>-   ((parseRules ("Perl","ipstring_internal"))))+   ((parseRules ("Perl","ipstring_internal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","here_document")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","here_document") defaultAttributes)))  parseRules ("Perl","here_document_dumb") =   (((pDetectSpaces >>= withAttribute NormalTok))    <|>    ((pColumn 0 >> pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((pDetectIdentifier >>= withAttribute NormalTok)))+   ((pDetectIdentifier >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","here_document_dumb")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","here_document_dumb") defaultAttributes)))  parseRules ("Perl","data_handle") =   (((pColumn 0 >> pRegExpr regex_'5c'3d'28'3f'3ahead'5b1'2d6'5d'7cover'7cback'7citem'7cfor'7cbegin'7cend'7cpod'29'5cs'2b'2e'2a >>= withAttribute CommentTok) >>~ pushContext ("Perl","pod"))    <|>-   ((pFirstNonSpace >> pString False "__END__" >>= withAttribute KeywordTok) >>~ pushContext ("Perl","normal")))+   ((pFirstNonSpace >> pString False "__END__" >>= withAttribute KeywordTok) >>~ pushContext ("Perl","normal"))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","data_handle")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","data_handle") defaultAttributes)))  parseRules ("Perl","end_handle") =   (((pColumn 0 >> pRegExpr regex_'5c'3d'28'3f'3ahead'5b1'2d6'5d'7cover'7cback'7citem'7cfor'7cbegin'7cend'7cpod'29'5cs'2a'2e'2a >>= withAttribute CommentTok) >>~ pushContext ("Perl","pod"))    <|>-   ((pFirstNonSpace >> pString False "__DATA__" >>= withAttribute KeywordTok) >>~ pushContext ("Perl","data_handle")))+   ((pFirstNonSpace >> pString False "__DATA__" >>= withAttribute KeywordTok) >>~ pushContext ("Perl","data_handle"))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","end_handle")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","end_handle") defaultAttributes)))  parseRules ("Perl","Backticked") =   (((parseRules ("Perl","ipstring_internal")))    <|>-   ((pDetectChar False '`' >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pDetectChar False '`' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","Backticked")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","Backticked") defaultAttributes)))  parseRules ("Perl","slash_safe_escape") =   (((pRegExpr regex_'5cs'2a'5c'7d'5cs'2a'2f'7b1'2c2'7d >>= withAttribute NormalTok) >>~ (popContext))@@ -803,7 +907,9 @@    ((popContext) >> currentContext >>= parseRules))  parseRules ("Perl","package_qualified_blank") =-  ((pRegExpr regex_'5b'5cw'5f'5d'2b >>= withAttribute NormalTok) >>~ (popContext))+  (((pRegExpr regex_'5b'5cw'5f'5d'2b >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","package_qualified_blank")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","package_qualified_blank") defaultAttributes)))  parseRules ("Perl","sub_name_def") =   (((pRegExpr regex_'5cw'2b >>= withAttribute FunctionTok))@@ -832,15 +938,19 @@    <|>    ((pColumn 0 >> pRegExpr regex_'5c'3d'28'3f'3ahead'5b1'2d6'5d'7cover'7cback'7citem'7cfor'7cbegin'7cend'7cpod'29'5cs'2a'2e'2a >>= withAttribute CommentTok))    <|>-   ((pColumn 0 >> pRegExpr regex_'5c'3dcut'2e'2a'24 >>= withAttribute CommentTok) >>~ (popContext)))+   ((pColumn 0 >> pRegExpr regex_'5c'3dcut'2e'2a'24 >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","pod")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","pod") defaultAttributes)))  parseRules ("Perl","comment") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Perl","comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Perl","comment") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Perl","normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Php.hs view
@@ -37,11 +37,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "PHP/PHP"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("PHP/PHP","start")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -110,7 +106,9 @@ parseRules ("PHP/PHP","start") =   (((pRegExpr regex_'3c'5c'3f'28'3f'3a'3d'7cphp'29'3f >>= withAttribute KeywordTok) >>~ pushContext ("PHP/PHP","phpsource"))    <|>-   ((pString False "?>" >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pString False "?>" >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","start")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","start") defaultAttributes)))  parseRules ("PHP/PHP","phpsource") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -191,27 +189,37 @@    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok))    <|>-   ((pAnyChar ";(),[]" >>= withAttribute OtherTok)))+   ((pAnyChar ";(),[]" >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","phpsource")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","phpsource") defaultAttributes)))  parseRules ("PHP/PHP","ternary") =   (((pDetect2Chars False ':' ':' >>= withAttribute NormalTok))    <|>    ((pDetectChar False ':' >>= withAttribute OtherTok) >>~ (popContext))    <|>-   ((parseRules ("PHP/PHP","phpsource"))))+   ((parseRules ("PHP/PHP","phpsource")))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","ternary")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","ternary") defaultAttributes)))  parseRules ("PHP/PHP","case") =-  ((parseRules ("PHP/PHP","ternary")))+  (((parseRules ("PHP/PHP","ternary")))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","case")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","case") defaultAttributes)))  parseRules ("PHP/PHP","onelinecomment") =   (((lookAhead (pString False "?>") >> (popContext) >> currentContext >>= parseRules))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","onelinecomment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","onelinecomment") defaultAttributes)))  parseRules ("PHP/PHP","twolinecomment") =   (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","twolinecomment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","twolinecomment") defaultAttributes)))  parseRules ("PHP/PHP","doublebackquotestringcommon") =   (((pDetect2Chars False '\\' '\\' >>= withAttribute KeywordTok))@@ -236,68 +244,88 @@    <|>    ((pRegExpr regex_'5c'24'5c'7b'5ba'2dzA'2dZ'5f'5cx7f'2d'5cxff'5d'5ba'2dzA'2dZ0'2d9'5f'5cx7f'2d'5cxff'5d'2a'28'5c'5b'5ba'2dzA'2dZ0'2d9'5f'5d'2a'5c'5d'29'2a'5c'7d >>= withAttribute KeywordTok))    <|>-   ((pRegExpr regex_'5c'7b'5c'24'5ba'2dzA'2dZ'5f'5cx7f'2d'5cxff'5d'5ba'2dzA'2dZ0'2d9'5f'5cx7f'2d'5cxff'5d'2a'28'5c'5b'28'5b0'2d9'5d'2a'7c'22'5b'5e'22'5d'2a'22'7c'5c'24'5ba'2dzA'2dZ'5d'2a'29'7c'27'5b'5e'27'5d'2a'27'7c'5c'5d'29'2a'28'2d'3e'5ba'2dzA'2dZ'5f'5cx7f'2d'5cxff'5d'5ba'2dzA'2dZ0'2d9'5f'5cx7f'2d'5cxff'5d'2a'28'5c'5b'5ba'2dzA'2dZ0'2d9'5f'5d'2a'5c'5d'29'2a'28'5c'5b'28'5b0'2d9'5d'2a'7c'22'5ba'2dzA'2dZ'5f'5d'2a'22'29'7c'27'5ba'2dzA'2dZ'5f'5d'2a'27'7c'5c'5d'29'2a'29'2a'5c'7d >>= withAttribute KeywordTok)))+   ((pRegExpr regex_'5c'7b'5c'24'5ba'2dzA'2dZ'5f'5cx7f'2d'5cxff'5d'5ba'2dzA'2dZ0'2d9'5f'5cx7f'2d'5cxff'5d'2a'28'5c'5b'28'5b0'2d9'5d'2a'7c'22'5b'5e'22'5d'2a'22'7c'5c'24'5ba'2dzA'2dZ'5d'2a'29'7c'27'5b'5e'27'5d'2a'27'7c'5c'5d'29'2a'28'2d'3e'5ba'2dzA'2dZ'5f'5cx7f'2d'5cxff'5d'5ba'2dzA'2dZ0'2d9'5f'5cx7f'2d'5cxff'5d'2a'28'5c'5b'5ba'2dzA'2dZ0'2d9'5f'5d'2a'5c'5d'29'2a'28'5c'5b'28'5b0'2d9'5d'2a'7c'22'5ba'2dzA'2dZ'5f'5d'2a'22'29'7c'27'5ba'2dzA'2dZ'5f'5d'2a'27'7c'5c'5d'29'2a'29'2a'5c'7d >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","doublebackquotestringcommon")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","doublebackquotestringcommon") defaultAttributes)))  parseRules ("PHP/PHP","backquotestring") =   (((parseRules ("PHP/PHP","doublebackquotestringcommon")))    <|>    ((pDetect2Chars False '\\' '`' >>= withAttribute KeywordTok))    <|>-   ((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","backquotestring")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","backquotestring") defaultAttributes)))  parseRules ("PHP/PHP","doublequotestring") =   (((parseRules ("PHP/PHP","doublebackquotestringcommon")))    <|>    ((pDetect2Chars False '\\' '"' >>= withAttribute KeywordTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","doublequotestring")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","doublequotestring") defaultAttributes)))  parseRules ("PHP/PHP","singlequotestring") =   (((pDetect2Chars False '\\' '\'' >>= withAttribute KeywordTok))    <|>    ((pDetect2Chars False '\\' '\\' >>= withAttribute KeywordTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","singlequotestring")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","singlequotestring") defaultAttributes)))  parseRules ("PHP/PHP","htmlheredoc") =   (((pColumn 0 >> pRegExprDynamic "%1;?$" >>= withAttribute KeywordTok) >>~ (popContext))    <|>    ((parseRules ("PHP/PHP","commonheredoc")))    <|>-   ((Text.Highlighting.Kate.Syntax.Html.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Html.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","htmlheredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","htmlheredoc") defaultAttributes)))  parseRules ("PHP/PHP","cssheredoc") =   (((pColumn 0 >> pRegExprDynamic "%1;?$" >>= withAttribute KeywordTok) >>~ (popContext))    <|>    ((parseRules ("PHP/PHP","commonheredoc")))    <|>-   ((Text.Highlighting.Kate.Syntax.Css.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Css.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","cssheredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","cssheredoc") defaultAttributes)))  parseRules ("PHP/PHP","mysqlheredoc") =   (((pColumn 0 >> pRegExprDynamic "%1;?$" >>= withAttribute KeywordTok) >>~ (popContext))    <|>    ((parseRules ("PHP/PHP","commonheredoc")))    <|>-   ((Text.Highlighting.Kate.Syntax.SqlMysql.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.SqlMysql.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","mysqlheredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","mysqlheredoc") defaultAttributes)))  parseRules ("PHP/PHP","javascriptheredoc") =   (((pColumn 0 >> pRegExprDynamic "%1;?$" >>= withAttribute KeywordTok) >>~ (popContext))    <|>    ((parseRules ("PHP/PHP","commonheredoc")))    <|>-   ((Text.Highlighting.Kate.Syntax.Javascript.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Javascript.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","javascriptheredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","javascriptheredoc") defaultAttributes)))  parseRules ("PHP/PHP","heredoc") =   (((pColumn 0 >> pRegExprDynamic "%1;?$" >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("PHP/PHP","commonheredoc"))))+   ((parseRules ("PHP/PHP","commonheredoc")))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","heredoc") defaultAttributes)))  parseRules ("PHP/PHP","commonheredoc") =   (((pRegExpr regex_'5c'24'5ba'2dzA'2dZ'5f'5cx7f'2d'5cxff'5d'5ba'2dzA'2dZ0'2d9'5f'5cx7f'2d'5cxff'5d'2a'28'5c'5b'5ba'2dzA'2dZ0'2d9'5f'5d'2a'5c'5d'29'2a >>= withAttribute KeywordTok))    <|>    ((pRegExpr regex_'5c'24'5c'7b'5ba'2dzA'2dZ'5f'5cx7f'2d'5cxff'5d'5ba'2dzA'2dZ0'2d9'5f'5cx7f'2d'5cxff'5d'2a'28'5c'5b'5ba'2dzA'2dZ0'2d9'5f'5d'2a'5c'5d'29'2a'5c'7d >>= withAttribute KeywordTok))    <|>-   ((pRegExpr regex_'5c'7b'5c'24'5ba'2dzA'2dZ'5f'5cx7f'2d'5cxff'5d'5ba'2dzA'2dZ0'2d9'5f'5cx7f'2d'5cxff'5d'2a'28'5c'5b'28'5b0'2d9'5d'2a'7c'22'5ba'2dzA'2dZ'5f'5d'2a'22'29'7c'27'5ba'2dzA'2dZ'5f'5d'2a'27'7c'5c'5d'29'2a'28'2d'3e'5ba'2dzA'2dZ'5f'5cx7f'2d'5cxff'5d'5ba'2dzA'2dZ0'2d9'5f'5cx7f'2d'5cxff'5d'2a'28'5c'5b'5ba'2dzA'2dZ0'2d9'5f'5d'2a'5c'5d'29'2a'28'5c'5b'28'5b0'2d9'5d'2a'7c'22'5ba'2dzA'2dZ'5f'5d'2a'22'29'7c'27'5ba'2dzA'2dZ'5f'5d'2a'27'7c'5c'5d'29'2a'29'2a'5c'7d >>= withAttribute KeywordTok)))+   ((pRegExpr regex_'5c'7b'5c'24'5ba'2dzA'2dZ'5f'5cx7f'2d'5cxff'5d'5ba'2dzA'2dZ0'2d9'5f'5cx7f'2d'5cxff'5d'2a'28'5c'5b'28'5b0'2d9'5d'2a'7c'22'5ba'2dzA'2dZ'5f'5d'2a'22'29'7c'27'5ba'2dzA'2dZ'5f'5d'2a'27'7c'5c'5d'29'2a'28'2d'3e'5ba'2dzA'2dZ'5f'5cx7f'2d'5cxff'5d'5ba'2dzA'2dZ0'2d9'5f'5cx7f'2d'5cxff'5d'2a'28'5c'5b'5ba'2dzA'2dZ0'2d9'5f'5d'2a'5c'5d'29'2a'28'5c'5b'28'5b0'2d9'5d'2a'7c'22'5ba'2dzA'2dZ'5f'5d'2a'22'29'7c'27'5ba'2dzA'2dZ'5f'5d'2a'27'7c'5c'5d'29'2a'29'2a'5c'7d >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("PHP/PHP","commonheredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PHP/PHP","commonheredoc") defaultAttributes)))  parseRules ("Doxygen", _) = Text.Highlighting.Kate.Syntax.Doxygen.parseExpression parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression@@ -306,4 +334,4 @@ parseRules ("SQL (MySQL)", _) = Text.Highlighting.Kate.Syntax.SqlMysql.parseExpression parseRules ("JavaScript", _) = Text.Highlighting.Kate.Syntax.Javascript.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("PHP/PHP","start") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Pike.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Pike"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Pike","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -112,7 +108,9 @@    <|>    ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'5cs'2b0 >>= withAttribute OtherTok) >>~ pushContext ("Pike","Outscoped"))    <|>-   ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute OtherTok) >>~ pushContext ("Pike","Preprocessor")))+   ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute OtherTok) >>~ pushContext ("Pike","Preprocessor"))+   <|>+   (currentContext >>= \x -> guard (x == ("Pike","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pike","Normal") defaultAttributes)))  parseRules ("Pike","String") =   (((pRegExpr regex_'5c'5cd'5b0'2d9'5d'2b >>= withAttribute CharTok))@@ -121,15 +119,21 @@    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((pLineContinue >>= withAttribute StringTok)))+   ((pLineContinue >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Pike","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pike","String") defaultAttributes)))  parseRules ("Pike","Line Comment") =-  ((pRegExpr regex_'28FIXME'7cTODO'7cNOT'28IC'29'3fE'29'3a'3f >>= withAttribute AlertTok))+  (((pRegExpr regex_'28FIXME'7cTODO'7cNOT'28IC'29'3fE'29'3a'3f >>= withAttribute AlertTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Pike","Line Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pike","Line Comment") defaultAttributes)))  parseRules ("Pike","Block Comment") =   (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'28FIXME'7cTODO'7cNOT'28IC'29'3fE'29'3a'3f >>= withAttribute AlertTok)))+   ((pRegExpr regex_'28FIXME'7cTODO'7cNOT'28IC'29'3fE'29'3a'3f >>= withAttribute AlertTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Pike","Block Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pike","Block Comment") defaultAttributes)))  parseRules ("Pike","Preprocessor") =   (((pRangeDetect '"' '"' >>= withAttribute StringTok))@@ -140,7 +144,9 @@    <|>    ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Pike","Block Comment"))    <|>-   ((pLineContinue >>= withAttribute OtherTok)))+   ((pLineContinue >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Pike","Preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pike","Preprocessor") defaultAttributes)))  parseRules ("Pike","Outscoped") =   (((pRegExpr regex_'28FIXME'7cTODO'7cNOT'28IC'29'3fE'29'3a'3f >>= withAttribute AlertTok))@@ -149,14 +155,18 @@    <|>    ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext ("Pike","Outscoped intern"))    <|>-   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2a'28endif'7celif'7celse'29 >>= withAttribute OtherTok) >>~ (popContext)))+   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2a'28endif'7celif'7celse'29 >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Pike","Outscoped")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pike","Outscoped") defaultAttributes)))  parseRules ("Pike","Outscoped intern") =   (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Pike","Block Comment"))    <|>    ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext ("Pike","Outscoped intern"))    <|>-   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute CommentTok) >>~ (popContext)))+   ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Pike","Outscoped intern")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Pike","Outscoped intern") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Pike","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Postscript.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "PostScript"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("PostScript","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -78,16 +74,20 @@    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("PostScript","String"))    <|>-   ((pRegExpr regex_'5c'2f'7b1'2c2'7d'5b'5e'5cs'5c'28'5c'29'5c'7b'5c'7d'5c'5b'5c'5d'25'2f'5d'2a >>= withAttribute DataTypeTok)))+   ((pRegExpr regex_'5c'2f'7b1'2c2'7d'5b'5e'5cs'5c'28'5c'29'5c'7b'5c'7d'5c'5b'5c'5d'25'2f'5d'2a >>= withAttribute DataTypeTok))+   <|>+   (currentContext >>= \x -> guard (x == ("PostScript","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PostScript","Normal") defaultAttributes)))  parseRules ("PostScript","Comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("PostScript","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PostScript","Comment") defaultAttributes))  parseRules ("PostScript","Header") =-  pzero+  (currentContext >>= \x -> guard (x == ("PostScript","Header")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PostScript","Header") defaultAttributes))  parseRules ("PostScript","String") =-  ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))+  (((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("PostScript","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("PostScript","String") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("PostScript","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Prolog.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Prolog"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Prolog","normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -100,23 +96,31 @@    <|>    ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Prolog","string2"))    <|>-   ((pAnyChar "~!^*()-+=[]|\\:;,./?&<>" >>= withAttribute NormalTok)))+   ((pAnyChar "~!^*()-+=[]|\\:;,./?&<>" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Prolog","normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Prolog","normal") defaultAttributes)))  parseRules ("Prolog","comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("Prolog","comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Prolog","comment") defaultAttributes))  parseRules ("Prolog","string") =   (((pHlCStringChar >>= withAttribute StringTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Prolog","string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Prolog","string") defaultAttributes)))  parseRules ("Prolog","string2") =   (((pHlCChar >>= withAttribute StringTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Prolog","string2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Prolog","string2") defaultAttributes)))  parseRules ("Prolog","comment region") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Prolog","comment region")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Prolog","comment region") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Prolog","normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Python.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Python"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Python","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -164,7 +160,9 @@    <|>    ((pAnyChar "+*/%\\|=;\\!<>!^&~-" >>= withAttribute NormalTok))    <|>-   ((pFirstNonSpace >> pRegExpr regex_'40'5b'5fa'2dzA'2dZ'5d'5b'5c'2e'5fa'2dzA'2dZ0'2d9'5d'2a >>= withAttribute OtherTok)))+   ((pFirstNonSpace >> pRegExpr regex_'40'5b'5fa'2dzA'2dZ'5d'5b'5c'2e'5fa'2dzA'2dZ0'2d9'5d'2a >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","Normal") defaultAttributes)))  parseRules ("Python","CheckForString") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -180,96 +178,126 @@    ((popContext) >> currentContext >>= parseRules))  parseRules ("Python","parenthesised") =-  ((parseRules ("Python","Normal")))+  (((parseRules ("Python","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","parenthesised")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","parenthesised") defaultAttributes)))  parseRules ("Python","Hash comment") =-  ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd)))+  (((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","Hash comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","Hash comment") defaultAttributes)))  parseRules ("Python","Tripple A-comment") =   (((pString False "'''" >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","Tripple A-comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","Tripple A-comment") defaultAttributes)))  parseRules ("Python","Tripple Q-comment") =   (((pHlCChar >>= withAttribute CommentTok))    <|>    ((pString False "\"\"\"" >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","Tripple Q-comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","Tripple Q-comment") defaultAttributes)))  parseRules ("Python","Single A-comment") =   (((pHlCStringChar >>= withAttribute CommentTok))    <|>    ((pDetectChar False '\'' >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","Single A-comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","Single A-comment") defaultAttributes)))  parseRules ("Python","Single Q-comment") =   (((pHlCStringChar >>= withAttribute CommentTok))    <|>    ((pDetectChar False '"' >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","Single Q-comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","Single Q-comment") defaultAttributes)))  parseRules ("Python","stringformat") =-  ((pRegExpr regex_'25'28'28'5c'28'5ba'2dzA'2dZ0'2d9'5f'5d'2b'5c'29'29'3f'5b'230'5c'2d_'2b'5d'3f'28'5b1'2d9'5d'5b0'2d9'5d'2a'7c'5c'2a'29'3f'28'5c'2e'28'5b1'2d9'5d'5b0'2d9'5d'2a'7c'5c'2a'29'29'3f'5bhlL'5d'3f'5bcrsdiouxXeEfFgG'25'5d'7cprog'7cdefault'29 >>= withAttribute OtherTok))+  (((pRegExpr regex_'25'28'28'5c'28'5ba'2dzA'2dZ0'2d9'5f'5d'2b'5c'29'29'3f'5b'230'5c'2d_'2b'5d'3f'28'5b1'2d9'5d'5b0'2d9'5d'2a'7c'5c'2a'29'3f'28'5c'2e'28'5b1'2d9'5d'5b0'2d9'5d'2a'7c'5c'2a'29'29'3f'5bhlL'5d'3f'5bcrsdiouxXeEfFgG'25'5d'7cprog'7cdefault'29 >>= withAttribute OtherTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","stringformat")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","stringformat") defaultAttributes)))  parseRules ("Python","Tripple A-string") =   (((pHlCStringChar >>= withAttribute CharTok))    <|>    ((parseRules ("Python","stringformat")))    <|>-   ((pString False "'''" >>= withAttribute StringTok) >>~ (popContext)))+   ((pString False "'''" >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","Tripple A-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","Tripple A-string") defaultAttributes)))  parseRules ("Python","Raw Tripple A-string") =   (((pHlCStringChar >>= withAttribute StringTok))    <|>    ((parseRules ("Python","stringformat")))    <|>-   ((pString False "'''" >>= withAttribute StringTok) >>~ (popContext)))+   ((pString False "'''" >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","Raw Tripple A-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","Raw Tripple A-string") defaultAttributes)))  parseRules ("Python","Tripple Q-string") =   (((pHlCStringChar >>= withAttribute CharTok))    <|>    ((parseRules ("Python","stringformat")))    <|>-   ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ (popContext)))+   ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","Tripple Q-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","Tripple Q-string") defaultAttributes)))  parseRules ("Python","Raw Tripple Q-string") =   (((pHlCStringChar >>= withAttribute StringTok))    <|>    ((parseRules ("Python","stringformat")))    <|>-   ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ (popContext)))+   ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","Raw Tripple Q-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","Raw Tripple Q-string") defaultAttributes)))  parseRules ("Python","Single A-string") =   (((pHlCStringChar >>= withAttribute CharTok))    <|>    ((parseRules ("Python","stringformat")))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","Single A-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","Single A-string") defaultAttributes)))  parseRules ("Python","Single Q-string") =   (((pHlCStringChar >>= withAttribute CharTok))    <|>    ((parseRules ("Python","stringformat")))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","Single Q-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","Single Q-string") defaultAttributes)))  parseRules ("Python","Raw A-string") =   (((pHlCStringChar >>= withAttribute StringTok))    <|>    ((parseRules ("Python","stringformat")))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","Raw A-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","Raw A-string") defaultAttributes)))  parseRules ("Python","Raw Q-string") =   (((pHlCStringChar >>= withAttribute StringTok))    <|>    ((parseRules ("Python","stringformat")))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Python","Raw Q-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Python","Raw Q-string") defaultAttributes)))  parseRules ("Alerts_indent", _) = Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Python","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/R.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "R Script"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("R Script","level0")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -86,14 +82,18 @@    <|>    ((pDetectChar False '}' >>= withAttribute ErrorTok))    <|>-   ((pDetectChar False ')' >>= withAttribute ErrorTok)))+   ((pDetectChar False ')' >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("R Script","level0")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("R Script","level0") defaultAttributes)))  parseRules ("R Script","ctx0") =   (((parseRules ("R Script","CommonRules")))    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((pDetectChar False ')' >>= withAttribute ErrorTok)))+   ((pDetectChar False ')' >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("R Script","ctx0")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("R Script","ctx0") defaultAttributes)))  parseRules ("R Script","parenthesis") =   (((pLineContinue >>= withAttribute NormalTok))@@ -104,22 +104,30 @@    <|>    ((parseRules ("R Script","CommonRules")))    <|>-   ((pDetectChar False '}' >>= withAttribute ErrorTok)))+   ((pDetectChar False '}' >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("R Script","parenthesis")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("R Script","parenthesis") defaultAttributes)))  parseRules ("R Script","string") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((pHlCStringChar >>= withAttribute CharTok)))+   ((pHlCStringChar >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("R Script","string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("R Script","string") defaultAttributes)))  parseRules ("R Script","string2") =   (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((pHlCStringChar >>= withAttribute CharTok)))+   ((pHlCStringChar >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("R Script","string2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("R Script","string2") defaultAttributes)))  parseRules ("R Script","backquotedsymbol") =   (((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((pHlCStringChar >>= withAttribute CharTok)))+   ((pHlCStringChar >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("R Script","backquotedsymbol")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("R Script","backquotedsymbol") defaultAttributes)))  parseRules ("R Script","operator_rhs") =   (((pString False "##" >>= withAttribute NormalTok) >>~ pushContext ("R Script","Headline"))@@ -133,10 +141,10 @@    ((popContext) >> currentContext >>= parseRules))  parseRules ("R Script","Headline") =-  pzero+  (currentContext >>= \x -> guard (x == ("R Script","Headline")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("R Script","Headline") defaultAttributes))  parseRules ("R Script","Comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("R Script","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("R Script","Comment") defaultAttributes))  parseRules ("R Script","CommonRules") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("R Script","string"))@@ -177,7 +185,9 @@    <|>    ((pDetectChar False '[' >>= withAttribute NormalTok))    <|>-   ((pDetectChar False ']' >>= withAttribute NormalTok)))+   ((pDetectChar False ']' >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("R Script","CommonRules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("R Script","CommonRules") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("R Script","level0") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Relaxngcompact.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "RelaxNG-Compact"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("RelaxNG-Compact","Normal Text")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -79,19 +75,27 @@    <|>    ((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\" list_Datatypes >>= withAttribute DataTypeTok))    <|>-   ((lookAhead (pRegExpr regex_'5b'5cw'5c'2e'2d'5d'2b'5b'5cs'5d'2b'3d) >> pushContext ("RelaxNG-Compact","Definitions") >> currentContext >>= parseRules)))+   ((lookAhead (pRegExpr regex_'5b'5cw'5c'2e'2d'5d'2b'5b'5cs'5d'2b'3d) >> pushContext ("RelaxNG-Compact","Definitions") >> currentContext >>= parseRules))+   <|>+   (currentContext >>= \x -> guard (x == ("RelaxNG-Compact","Normal Text")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("RelaxNG-Compact","Normal Text") defaultAttributes)))  parseRules ("RelaxNG-Compact","Comments") =-  pzero+  (currentContext >>= \x -> guard (x == ("RelaxNG-Compact","Comments")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("RelaxNG-Compact","Comments") defaultAttributes))  parseRules ("RelaxNG-Compact","String") =-  ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+  (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("RelaxNG-Compact","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("RelaxNG-Compact","String") defaultAttributes)))  parseRules ("RelaxNG-Compact","Node Names") =-  ((lookAhead (pDetectChar False '{') >> (popContext) >> currentContext >>= parseRules))+  (((lookAhead (pDetectChar False '{') >> (popContext) >> currentContext >>= parseRules))+   <|>+   (currentContext >>= \x -> guard (x == ("RelaxNG-Compact","Node Names")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("RelaxNG-Compact","Node Names") defaultAttributes)))  parseRules ("RelaxNG-Compact","Definitions") =-  ((lookAhead (pDetectChar False '=') >> (popContext >> popContext) >> currentContext >>= parseRules))+  (((lookAhead (pDetectChar False '=') >> (popContext >> popContext) >> currentContext >>= parseRules))+   <|>+   (currentContext >>= \x -> guard (x == ("RelaxNG-Compact","Definitions")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("RelaxNG-Compact","Definitions") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("RelaxNG-Compact","Normal Text") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Rhtml.hs view
@@ -34,11 +34,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Ruby/Rails/RHTML"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Ruby/Rails/RHTML","Start")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -287,7 +283,9 @@ defaultAttributes = [(("Ruby/Rails/RHTML","Start"),NormalTok),(("Ruby/Rails/RHTML","FindHTML"),NormalTok),(("Ruby/Rails/RHTML","FindEntityRefs"),NormalTok),(("Ruby/Rails/RHTML","FindPEntityRefs"),NormalTok),(("Ruby/Rails/RHTML","FindAttributes"),NormalTok),(("Ruby/Rails/RHTML","FindDTDRules"),NormalTok),(("Ruby/Rails/RHTML","Comment"),CommentTok),(("Ruby/Rails/RHTML","CDATA"),NormalTok),(("Ruby/Rails/RHTML","PI"),NormalTok),(("Ruby/Rails/RHTML","Doctype"),NormalTok),(("Ruby/Rails/RHTML","Doctype Internal Subset"),NormalTok),(("Ruby/Rails/RHTML","Doctype Markupdecl"),NormalTok),(("Ruby/Rails/RHTML","Doctype Markupdecl DQ"),StringTok),(("Ruby/Rails/RHTML","Doctype Markupdecl SQ"),StringTok),(("Ruby/Rails/RHTML","El Open"),NormalTok),(("Ruby/Rails/RHTML","El Close"),NormalTok),(("Ruby/Rails/RHTML","El Close 2"),NormalTok),(("Ruby/Rails/RHTML","El Close 3"),NormalTok),(("Ruby/Rails/RHTML","CSS"),NormalTok),(("Ruby/Rails/RHTML","CSS content"),NormalTok),(("Ruby/Rails/RHTML","JS"),NormalTok),(("Ruby/Rails/RHTML","JS content"),NormalTok),(("Ruby/Rails/RHTML","JS comment close"),CommentTok),(("Ruby/Rails/RHTML","Value"),NormalTok),(("Ruby/Rails/RHTML","Value NQ"),NormalTok),(("Ruby/Rails/RHTML","Value DQ"),StringTok),(("Ruby/Rails/RHTML","Value SQ"),StringTok),(("Ruby/Rails/RHTML","rubysourceline"),NormalTok),(("Ruby/Rails/RHTML","rubysource"),NormalTok),(("Ruby/Rails/RHTML","Line Continue"),NormalTok),(("Ruby/Rails/RHTML","Quoted String"),StringTok),(("Ruby/Rails/RHTML","Apostrophed String"),StringTok),(("Ruby/Rails/RHTML","Command String"),StringTok),(("Ruby/Rails/RHTML","Embedded documentation"),CommentTok),(("Ruby/Rails/RHTML","RegEx 1"),OtherTok),(("Ruby/Rails/RHTML","Subst"),NormalTok),(("Ruby/Rails/RHTML","Short Subst"),OtherTok),(("Ruby/Rails/RHTML","Member Access"),NormalTok),(("Ruby/Rails/RHTML","Comment Line"),CommentTok),(("Ruby/Rails/RHTML","General Comment"),CommentTok),(("Ruby/Rails/RHTML","RDoc Label"),OtherTok),(("Ruby/Rails/RHTML","find_heredoc"),NormalTok),(("Ruby/Rails/RHTML","find_indented_heredoc"),NormalTok),(("Ruby/Rails/RHTML","indented_heredoc"),NormalTok),(("Ruby/Rails/RHTML","apostrophed_indented_heredoc"),NormalTok),(("Ruby/Rails/RHTML","normal_heredoc"),NormalTok),(("Ruby/Rails/RHTML","apostrophed_normal_heredoc"),NormalTok),(("Ruby/Rails/RHTML","heredoc_rules"),NormalTok),(("Ruby/Rails/RHTML","find_gdl_input"),NormalTok),(("Ruby/Rails/RHTML","gdl_dq_string_1"),StringTok),(("Ruby/Rails/RHTML","gdl_dq_string_1_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_dq_string_2"),StringTok),(("Ruby/Rails/RHTML","gdl_dq_string_2_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_dq_string_3"),StringTok),(("Ruby/Rails/RHTML","gdl_dq_string_3_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_dq_string_4"),StringTok),(("Ruby/Rails/RHTML","gdl_dq_string_4_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_dq_string_5"),StringTok),(("Ruby/Rails/RHTML","dq_string_rules"),StringTok),(("Ruby/Rails/RHTML","gdl_token_array_1"),StringTok),(("Ruby/Rails/RHTML","gdl_token_array_1_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_token_array_2"),StringTok),(("Ruby/Rails/RHTML","gdl_token_array_2_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_token_array_3"),StringTok),(("Ruby/Rails/RHTML","gdl_token_array_3_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_token_array_4"),StringTok),(("Ruby/Rails/RHTML","gdl_token_array_4_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_token_array_5"),StringTok),(("Ruby/Rails/RHTML","token_array_rules"),StringTok),(("Ruby/Rails/RHTML","gdl_apostrophed_1"),StringTok),(("Ruby/Rails/RHTML","gdl_apostrophed_1_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_apostrophed_2"),StringTok),(("Ruby/Rails/RHTML","gdl_apostrophed_2_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_apostrophed_3"),StringTok),(("Ruby/Rails/RHTML","gdl_apostrophed_3_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_apostrophed_4"),StringTok),(("Ruby/Rails/RHTML","gdl_apostrophed_4_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_apostrophed_5"),StringTok),(("Ruby/Rails/RHTML","apostrophed_rules"),StringTok),(("Ruby/Rails/RHTML","gdl_shell_command_1"),StringTok),(("Ruby/Rails/RHTML","gdl_shell_command_1_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_shell_command_2"),StringTok),(("Ruby/Rails/RHTML","gdl_shell_command_2_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_shell_command_3"),StringTok),(("Ruby/Rails/RHTML","gdl_shell_command_3_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_shell_command_4"),StringTok),(("Ruby/Rails/RHTML","gdl_shell_command_4_nested"),StringTok),(("Ruby/Rails/RHTML","gdl_shell_command_5"),StringTok),(("Ruby/Rails/RHTML","shell_command_rules"),StringTok),(("Ruby/Rails/RHTML","gdl_regexpr_1"),OtherTok),(("Ruby/Rails/RHTML","gdl_regexpr_1_nested"),OtherTok),(("Ruby/Rails/RHTML","gdl_regexpr_2"),OtherTok),(("Ruby/Rails/RHTML","gdl_regexpr_2_nested"),OtherTok),(("Ruby/Rails/RHTML","gdl_regexpr_3"),OtherTok),(("Ruby/Rails/RHTML","gdl_regexpr_3_nested"),OtherTok),(("Ruby/Rails/RHTML","gdl_regexpr_4"),OtherTok),(("Ruby/Rails/RHTML","gdl_regexpr_4_nested"),OtherTok),(("Ruby/Rails/RHTML","gdl_regexpr_5"),OtherTok),(("Ruby/Rails/RHTML","regexpr_rules"),OtherTok),(("Ruby/Rails/RHTML","DATA"),NormalTok)]  parseRules ("Ruby/Rails/RHTML","Start") =-  ((parseRules ("Ruby/Rails/RHTML","FindHTML")))+  (((parseRules ("Ruby/Rails/RHTML","FindHTML")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Start")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Start") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","FindHTML") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -328,29 +326,39 @@    <|>    ((parseRules ("Ruby/Rails/RHTML","FindDTDRules")))    <|>-   ((parseRules ("Ruby/Rails/RHTML","FindEntityRefs"))))+   ((parseRules ("Ruby/Rails/RHTML","FindEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","FindHTML")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","FindHTML") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","FindEntityRefs") =   (((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok))    <|>-   ((pAnyChar "&<" >>= withAttribute ErrorTok)))+   ((pAnyChar "&<" >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","FindEntityRefs")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","FindEntityRefs") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","FindPEntityRefs") =   (((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok))    <|>    ((pRegExpr regex_'25'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'3b >>= withAttribute DecValTok))    <|>-   ((pAnyChar "&%" >>= withAttribute ErrorTok)))+   ((pAnyChar "&%" >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","FindPEntityRefs")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","FindPEntityRefs") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","FindAttributes") =   (((pColumn 0 >> pRegExpr regex_'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute OtherTok))    <|>    ((pRegExpr regex_'5cs'2b'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute OtherTok))    <|>-   ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Value")))+   ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Value"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","FindAttributes")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","FindAttributes") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","FindDTDRules") =-  ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby/Rails/RHTML","Doctype Markupdecl"))+  (((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby/Rails/RHTML","Doctype Markupdecl"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","FindDTDRules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","FindDTDRules") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Comment") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -361,7 +369,9 @@    <|>    ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'2d'28'2d'28'3f'21'2d'3e'29'29'2b >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'2d'28'2d'28'3f'21'2d'3e'29'29'2b >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Comment") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","CDATA") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -370,15 +380,21 @@    <|>    ((pString False "]]>" >>= withAttribute BaseNTok) >>~ (popContext))    <|>-   ((pString False "]]&gt;" >>= withAttribute DecValTok)))+   ((pString False "]]&gt;" >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","CDATA")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","CDATA") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","PI") =-  ((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext))+  (((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","PI")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","PI") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Doctype") =   (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext))    <|>-   ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby/Rails/RHTML","Doctype Internal Subset")))+   ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby/Rails/RHTML","Doctype Internal Subset"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Doctype")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Doctype") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Doctype Internal Subset") =   (((pDetectChar False ']' >>= withAttribute DataTypeTok) >>~ (popContext))@@ -389,28 +405,36 @@    <|>    ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","PI"))    <|>-   ((parseRules ("Ruby/Rails/RHTML","FindPEntityRefs"))))+   ((parseRules ("Ruby/Rails/RHTML","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Doctype Internal Subset")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Doctype Internal Subset") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Doctype Markupdecl") =   (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext))    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","Doctype Markupdecl DQ"))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","Doctype Markupdecl SQ")))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","Doctype Markupdecl SQ"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Doctype Markupdecl")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Doctype Markupdecl") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Doctype Markupdecl DQ") =   (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource"))    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("Ruby/Rails/RHTML","FindPEntityRefs"))))+   ((parseRules ("Ruby/Rails/RHTML","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Doctype Markupdecl DQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Doctype Markupdecl DQ") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Doctype Markupdecl SQ") =   (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource"))    <|>    ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("Ruby/Rails/RHTML","FindPEntityRefs"))))+   ((parseRules ("Ruby/Rails/RHTML","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Doctype Markupdecl SQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Doctype Markupdecl SQ") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","El Open") =   (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource"))@@ -421,28 +445,36 @@    <|>    ((parseRules ("Ruby/Rails/RHTML","FindAttributes")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","El Open")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","El Open") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","El Close") =   (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource"))    <|>    ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","El Close")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","El Close") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","El Close 2") =   (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource"))    <|>    ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","El Close 2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","El Close 2") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","El Close 3") =   (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource"))    <|>    ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext >> popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","El Close 3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","El Close 3") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","CSS") =   (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource"))@@ -453,14 +485,18 @@    <|>    ((parseRules ("Ruby/Rails/RHTML","FindAttributes")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","CSS")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","CSS") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","CSS content") =   (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource"))    <|>    ((pRegExpr regex_'3c'2fstyle'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","El Close 2"))    <|>-   ((Text.Highlighting.Kate.Syntax.Css.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Css.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","CSS content")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","CSS content") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","JS") =   (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource"))@@ -471,7 +507,9 @@    <|>    ((parseRules ("Ruby/Rails/RHTML","FindAttributes")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","JS")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","JS") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","JS content") =   (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource"))@@ -480,12 +518,16 @@    <|>    ((pRegExpr regex_'2f'2f'28'3f'3d'2e'2a'3c'2fscript'5cb'29 >>= withAttribute CommentTok) >>~ pushContext ("Ruby/Rails/RHTML","JS comment close"))    <|>-   ((Text.Highlighting.Kate.Syntax.Javascript.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Javascript.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","JS content")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","JS content") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","JS comment close") =   (((pRegExpr regex_'3c'2fscript'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","El Close 3"))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","JS comment close")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","JS comment close") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Value") =   (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource"))@@ -514,17 +556,23 @@    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("Ruby/Rails/RHTML","FindEntityRefs"))))+   ((parseRules ("Ruby/Rails/RHTML","FindEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Value DQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Value DQ") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Value SQ") =   (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource"))    <|>    ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("Ruby/Rails/RHTML","FindEntityRefs"))))+   ((parseRules ("Ruby/Rails/RHTML","FindEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Value SQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Value SQ") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","rubysourceline") =-  ((parseRules ("Ruby/Rails/RHTML","rubysource")))+  (((parseRules ("Ruby/Rails/RHTML","rubysource")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","rubysourceline")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","rubysourceline") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","rubysource") =   (((pLineContinue >>= withAttribute NormalTok) >>~ pushContext ("Ruby/Rails/RHTML","Line Continue"))@@ -663,14 +711,18 @@    <|>    ((pDetectChar False '/' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","RegEx 1"))    <|>-   ((pRegExpr regex_'5cs'2a'5b'25'5d'28'3f'3d'5bQqxw'5d'3f'5b'5e'5cs'3e'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","find_gdl_input")))+   ((pRegExpr regex_'5cs'2a'5b'25'5d'28'3f'3d'5bQqxw'5d'3f'5b'5e'5cs'3e'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","find_gdl_input"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","rubysource")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","rubysource") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Line Continue") =   (((pFirstNonSpace >> pRegExpr regex_'28while'7cuntil'29'5cb'28'3f'21'2e'2a'5cbdo'5cb'29 >>= withAttribute KeywordTok))    <|>    ((pFirstNonSpace >> pRegExpr regex_'28if'7cunless'29'5cb >>= withAttribute KeywordTok))    <|>-   ((parseRules ("Ruby/Rails/RHTML","rubysource"))))+   ((parseRules ("Ruby/Rails/RHTML","rubysource")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Line Continue")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Line Continue") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Quoted String") =   (((pString False "\\\\" >>= withAttribute StringTok))@@ -681,14 +733,18 @@    <|>    ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst"))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Quoted String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Quoted String") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Apostrophed String") =   (((pString False "\\\\" >>= withAttribute StringTok))    <|>    ((pRegExpr regex_'5c'5c'5c'27 >>= withAttribute StringTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Apostrophed String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Apostrophed String") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Command String") =   (((pString False "\\\\" >>= withAttribute StringTok))@@ -701,10 +757,14 @@    <|>    ((pHlCChar >>= withAttribute CharTok) >>~ (popContext))    <|>-   ((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Command String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Command String") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Embedded documentation") =-  ((pColumn 0 >> pString False "=end" >>= withAttribute CommentTok) >>~ (popContext))+  (((pColumn 0 >> pString False "=end" >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Embedded documentation")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Embedded documentation") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","RegEx 1") =   (((pRegExpr regex_'5c'5c'5c'2f >>= withAttribute OtherTok))@@ -715,17 +775,23 @@    <|>    ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst"))    <|>-   ((pRegExpr regex_'2f'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext)))+   ((pRegExpr regex_'2f'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","RegEx 1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","RegEx 1") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Subst") =   (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext))    <|>-   ((parseRules ("Ruby/Rails/RHTML","rubysource"))))+   ((parseRules ("Ruby/Rails/RHTML","rubysource")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Subst")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Subst") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Short Subst") =   (((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok))    <|>-   ((pRegExpr regex_'5cw'28'3f'21'5cw'29 >>= withAttribute OtherTok) >>~ (popContext)))+   ((pRegExpr regex_'5cw'28'3f'21'5cw'29 >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Short Subst")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Short Subst") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Member Access") =   (((pRegExpr regex_'5c'2e'3f'5b'5fa'2dz'5d'5cw'2a'28'5c'3f'7c'5c'21'29'3f'28'3f'3d'5b'5e'5cw'5cd'5c'2e'5c'3a'5d'29 >>= withAttribute NormalTok) >>~ (popContext))@@ -750,51 +816,71 @@    <|>    ((pAnyChar "()\\" >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5cW >>= withAttribute NormalTok) >>~ (popContext)))+   ((pRegExpr regex_'5cW >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Member Access")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Member Access") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","Comment Line") =   (((pRegExpr regex_'5cw'5c'3a'5c'3a'5cs >>= withAttribute CommentTok) >>~ pushContext ("Ruby/Rails/RHTML","RDoc Label"))    <|>    ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_attention >>= withAttribute AlertTok))    <|>-   ((pRegExpr regex_'2d'3f'25'3e >>= withAttribute KeywordTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'2d'3f'25'3e >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","Comment Line")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","Comment Line") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","General Comment") =-  ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_attention >>= withAttribute DecValTok))+  (((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_attention >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","General Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","General Comment") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","RDoc Label") =-  pzero+  (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","RDoc Label")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","RDoc Label") defaultAttributes))  parseRules ("Ruby/Rails/RHTML","find_heredoc") =   (((pRegExpr regex_'27'28'5cw'2b'29'27 >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","apostrophed_normal_heredoc"))    <|>-   ((pRegExpr regex_'22'3f'28'5cw'2b'29'22'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","normal_heredoc")))+   ((pRegExpr regex_'22'3f'28'5cw'2b'29'22'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","normal_heredoc"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","find_heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","find_heredoc") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","find_indented_heredoc") =   (((pRegExpr regex_'27'28'5cw'2b'29'27 >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","apostrophed_indented_heredoc"))    <|>-   ((pRegExpr regex_'22'3f'28'5cw'2b'29'22'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","indented_heredoc")))+   ((pRegExpr regex_'22'3f'28'5cw'2b'29'22'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","indented_heredoc"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","find_indented_heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","find_indented_heredoc") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","indented_heredoc") =   (((pFirstNonSpace >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("Ruby/Rails/RHTML","heredoc_rules"))))+   ((parseRules ("Ruby/Rails/RHTML","heredoc_rules")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","indented_heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","indented_heredoc") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","apostrophed_indented_heredoc") =-  ((pFirstNonSpace >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+  (((pFirstNonSpace >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","apostrophed_indented_heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","apostrophed_indented_heredoc") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","normal_heredoc") =   (((pColumn 0 >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("Ruby/Rails/RHTML","heredoc_rules"))))+   ((parseRules ("Ruby/Rails/RHTML","heredoc_rules")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","normal_heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","normal_heredoc") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","apostrophed_normal_heredoc") =-  ((pColumn 0 >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+  (((pColumn 0 >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","apostrophed_normal_heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","apostrophed_normal_heredoc") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","heredoc_rules") =   (((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Short Subst"))    <|>-   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst")))+   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","heredoc_rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","heredoc_rules") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","find_gdl_input") =   (((pRegExpr regex_w'5c'28 >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_1"))@@ -845,7 +931,9 @@    <|>    ((pRegExpr regex_Q'3f'3c >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_4"))    <|>-   ((pRegExpr regex_Q'3f'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_5")))+   ((pRegExpr regex_Q'3f'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_5"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","find_gdl_input")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","find_gdl_input") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_dq_string_1") =   (((parseRules ("Ruby/Rails/RHTML","dq_string_rules")))@@ -854,14 +942,18 @@    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_dq_string_1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_dq_string_1") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_dq_string_1_nested") =   (((parseRules ("Ruby/Rails/RHTML","dq_string_rules")))    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_dq_string_1_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_dq_string_1_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_dq_string_2") =   (((parseRules ("Ruby/Rails/RHTML","dq_string_rules")))@@ -870,14 +962,18 @@    <|>    ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext))    <|>-   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_2_nested")))+   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_2_nested"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_dq_string_2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_dq_string_2") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_dq_string_2_nested") =   (((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_2_nested"))    <|>    ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("Ruby/Rails/RHTML","dq_string_rules"))))+   ((parseRules ("Ruby/Rails/RHTML","dq_string_rules")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_dq_string_2_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_dq_string_2_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_dq_string_3") =   (((parseRules ("Ruby/Rails/RHTML","dq_string_rules")))@@ -886,14 +982,18 @@    <|>    ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_dq_string_3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_dq_string_3") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_dq_string_3_nested") =   (((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_3_nested"))    <|>    ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("Ruby/Rails/RHTML","dq_string_rules"))))+   ((parseRules ("Ruby/Rails/RHTML","dq_string_rules")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_dq_string_3_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_dq_string_3_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_dq_string_4") =   (((parseRules ("Ruby/Rails/RHTML","dq_string_rules")))@@ -902,28 +1002,36 @@    <|>    ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_dq_string_4")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_dq_string_4") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_dq_string_4_nested") =   (((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_4_nested"))    <|>    ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("Ruby/Rails/RHTML","dq_string_rules"))))+   ((parseRules ("Ruby/Rails/RHTML","dq_string_rules")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_dq_string_4_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_dq_string_4_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_dq_string_5") =   (((parseRules ("Ruby/Rails/RHTML","dq_string_rules")))    <|>    ((pRegExprDynamic "\\\\%1" >>= withAttribute StringTok))    <|>-   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_dq_string_5")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_dq_string_5") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","dq_string_rules") =   (((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok))    <|>    ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Short Subst"))    <|>-   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst")))+   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","dq_string_rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","dq_string_rules") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_token_array_1") =   (((parseRules ("Ruby/Rails/RHTML","token_array_rules")))@@ -932,14 +1040,18 @@    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_token_array_1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_token_array_1") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_token_array_1_nested") =   (((parseRules ("Ruby/Rails/RHTML","token_array_rules")))    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_token_array_1_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_token_array_1_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_token_array_2") =   (((parseRules ("Ruby/Rails/RHTML","token_array_rules")))@@ -948,14 +1060,18 @@    <|>    ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext))    <|>-   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_2_nested")))+   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_2_nested"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_token_array_2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_token_array_2") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_token_array_2_nested") =   (((parseRules ("Ruby/Rails/RHTML","token_array_rules")))    <|>    ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_2_nested"))    <|>-   ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_token_array_2_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_token_array_2_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_token_array_3") =   (((parseRules ("Ruby/Rails/RHTML","token_array_rules")))@@ -964,14 +1080,18 @@    <|>    ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_token_array_3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_token_array_3") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_token_array_3_nested") =   (((parseRules ("Ruby/Rails/RHTML","token_array_rules")))    <|>    ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_token_array_3_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_token_array_3_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_token_array_4") =   (((parseRules ("Ruby/Rails/RHTML","token_array_rules")))@@ -980,24 +1100,32 @@    <|>    ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_token_array_4")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_token_array_4") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_token_array_4_nested") =   (((parseRules ("Ruby/Rails/RHTML","token_array_rules")))    <|>    ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_token_array_4_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_token_array_4_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_token_array_5") =   (((parseRules ("Ruby/Rails/RHTML","token_array_rules")))    <|>    ((pRegExprDynamic "\\\\%1" >>= withAttribute StringTok))    <|>-   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_token_array_5")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_token_array_5") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","token_array_rules") =-  ((pString False "\\\\" >>= withAttribute StringTok))+  (((pString False "\\\\" >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","token_array_rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","token_array_rules") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_1") =   (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules")))@@ -1006,14 +1134,18 @@    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_apostrophed_1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_apostrophed_1") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_1_nested") =   (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules")))    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_apostrophed_1_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_apostrophed_1_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_2") =   (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules")))@@ -1022,14 +1154,18 @@    <|>    ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext))    <|>-   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_2_nested")))+   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_2_nested"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_apostrophed_2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_apostrophed_2") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_2_nested") =   (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules")))    <|>    ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_2_nested"))    <|>-   ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_apostrophed_2_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_apostrophed_2_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_3") =   (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules")))@@ -1038,14 +1174,18 @@    <|>    ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_apostrophed_3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_apostrophed_3") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_3_nested") =   (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules")))    <|>    ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_apostrophed_3_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_apostrophed_3_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_4") =   (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules")))@@ -1054,24 +1194,32 @@    <|>    ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_apostrophed_4")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_apostrophed_4") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_4_nested") =   (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules")))    <|>    ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_apostrophed_4_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_apostrophed_4_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_5") =   (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules")))    <|>    ((pRegExprDynamic "\\\\%1" >>= withAttribute StringTok))    <|>-   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_apostrophed_5")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_apostrophed_5") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","apostrophed_rules") =-  ((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok))+  (((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","apostrophed_rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","apostrophed_rules") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_shell_command_1") =   (((parseRules ("Ruby/Rails/RHTML","shell_command_rules")))@@ -1080,14 +1228,18 @@    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_shell_command_1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_shell_command_1") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_shell_command_1_nested") =   (((parseRules ("Ruby/Rails/RHTML","shell_command_rules")))    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_shell_command_1_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_shell_command_1_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_shell_command_2") =   (((parseRules ("Ruby/Rails/RHTML","shell_command_rules")))@@ -1096,14 +1248,18 @@    <|>    ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext))    <|>-   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_2_nested")))+   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_2_nested"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_shell_command_2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_shell_command_2") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_shell_command_2_nested") =   (((parseRules ("Ruby/Rails/RHTML","shell_command_rules")))    <|>    ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_2_nested"))    <|>-   ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_shell_command_2_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_shell_command_2_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_shell_command_3") =   (((parseRules ("Ruby/Rails/RHTML","shell_command_rules")))@@ -1112,14 +1268,18 @@    <|>    ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_shell_command_3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_shell_command_3") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_shell_command_3_nested") =   (((parseRules ("Ruby/Rails/RHTML","shell_command_rules")))    <|>    ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_shell_command_3_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_shell_command_3_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_shell_command_4") =   (((parseRules ("Ruby/Rails/RHTML","shell_command_rules")))@@ -1128,28 +1288,36 @@    <|>    ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_shell_command_4")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_shell_command_4") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_shell_command_4_nested") =   (((parseRules ("Ruby/Rails/RHTML","shell_command_rules")))    <|>    ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_shell_command_4_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_shell_command_4_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_shell_command_5") =   (((parseRules ("Ruby/Rails/RHTML","shell_command_rules")))    <|>    ((pRegExprDynamic "\\\\%1" >>= withAttribute StringTok))    <|>-   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_shell_command_5")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_shell_command_5") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","shell_command_rules") =   (((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok))    <|>    ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Short Subst"))    <|>-   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst")))+   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","shell_command_rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","shell_command_rules") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_regexpr_1") =   (((parseRules ("Ruby/Rails/RHTML","regexpr_rules")))@@ -1158,14 +1326,18 @@    <|>    ((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_1_nested"))    <|>-   ((pRegExpr regex_'5c'29'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'5c'29'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_regexpr_1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_regexpr_1") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_regexpr_1_nested") =   (((parseRules ("Ruby/Rails/RHTML","regexpr_rules")))    <|>    ((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext)))+   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_regexpr_1_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_regexpr_1_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_regexpr_2") =   (((parseRules ("Ruby/Rails/RHTML","regexpr_rules")))@@ -1174,14 +1346,18 @@    <|>    ((pRegExpr regex_'5c'7d'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext))    <|>-   ((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_2_nested")))+   ((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_2_nested"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_regexpr_2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_regexpr_2") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_regexpr_2_nested") =   (((parseRules ("Ruby/Rails/RHTML","regexpr_rules")))    <|>    ((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_2_nested"))    <|>-   ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext)))+   ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_regexpr_2_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_regexpr_2_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_regexpr_3") =   (((parseRules ("Ruby/Rails/RHTML","regexpr_rules")))@@ -1190,14 +1366,18 @@    <|>    ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_3_nested"))    <|>-   ((pRegExpr regex_'5c'5d'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'5c'5d'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_regexpr_3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_regexpr_3") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_regexpr_3_nested") =   (((parseRules ("Ruby/Rails/RHTML","regexpr_rules")))    <|>    ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext)))+   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_regexpr_3_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_regexpr_3_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_regexpr_4") =   (((parseRules ("Ruby/Rails/RHTML","regexpr_rules")))@@ -1206,34 +1386,42 @@    <|>    ((pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_4_nested"))    <|>-   ((pRegExpr regex_'3e'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'3e'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_regexpr_4")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_regexpr_4") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_regexpr_4_nested") =   (((parseRules ("Ruby/Rails/RHTML","regexpr_rules")))    <|>    ((pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext)))+   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_regexpr_4_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_regexpr_4_nested") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","gdl_regexpr_5") =   (((parseRules ("Ruby/Rails/RHTML","regexpr_rules")))    <|>    ((pRegExprDynamic "\\\\%1" >>= withAttribute OtherTok))    <|>-   ((pRegExprDynamic "\\s*%1[uiomxn]*" >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExprDynamic "\\s*%1[uiomxn]*" >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","gdl_regexpr_5")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","gdl_regexpr_5") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","regexpr_rules") =   (((pDetect2Chars False '\\' '\\' >>= withAttribute OtherTok))    <|>    ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Short Subst"))    <|>-   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst")))+   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","regexpr_rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","regexpr_rules") defaultAttributes)))  parseRules ("Ruby/Rails/RHTML","DATA") =-  pzero+  (currentContext >>= \x -> guard (x == ("Ruby/Rails/RHTML","DATA")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby/Rails/RHTML","DATA") defaultAttributes))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression parseRules ("CSS", _) = Text.Highlighting.Kate.Syntax.Css.parseExpression parseRules ("JavaScript", _) = Text.Highlighting.Kate.Syntax.Javascript.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Ruby/Rails/RHTML","Start") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Ruby.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Ruby"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Ruby","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -387,7 +383,9 @@    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ pushContext ("Ruby","check_div_1"))    <|>-   ((pDetectIdentifier >>= withAttribute NormalTok) >>~ pushContext ("Ruby","check_div_2")))+   ((pDetectIdentifier >>= withAttribute NormalTok) >>~ pushContext ("Ruby","check_div_2"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","Normal") defaultAttributes)))  parseRules ("Ruby","check_div_1") =   (((pRegExpr regex_'5cs'2a >>= withAttribute NormalTok))@@ -434,12 +432,16 @@    <|>    ((pFirstNonSpace >> pRegExpr regex_'28if'7cunless'29'5cb >>= withAttribute KeywordTok))    <|>-   ((parseRules ("Ruby","Normal"))))+   ((parseRules ("Ruby","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","Line Continue")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","Line Continue") defaultAttributes)))  parseRules ("Ruby","Find closing block brace") =   (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext ("Ruby","check_div_1_pop"))    <|>-   ((parseRules ("Ruby","Normal"))))+   ((parseRules ("Ruby","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","Find closing block brace")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","Find closing block brace") defaultAttributes)))  parseRules ("Ruby","Quoted String") =   (((pString False "\\\\" >>= withAttribute StringTok))@@ -450,14 +452,18 @@    <|>    ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst"))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Ruby","check_div_1_pop")))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Ruby","check_div_1_pop"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","Quoted String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","Quoted String") defaultAttributes)))  parseRules ("Ruby","Apostrophed String") =   (((pString False "\\\\" >>= withAttribute StringTok))    <|>    ((pRegExpr regex_'5c'5c'5c'27 >>= withAttribute StringTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Ruby","check_div_1_pop")))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Ruby","check_div_1_pop"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","Apostrophed String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","Apostrophed String") defaultAttributes)))  parseRules ("Ruby","Command String") =   (((pString False "\\\\" >>= withAttribute StringTok))@@ -468,12 +474,16 @@    <|>    ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst"))    <|>-   ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext ("Ruby","check_div_1_pop")))+   ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext ("Ruby","check_div_1_pop"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","Command String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","Command String") defaultAttributes)))  parseRules ("Ruby","Embedded documentation") =   (((pColumn 0 >> pRegExpr regex_'3dend'28'3f'3a'5cs'2e'2a'7c'24'29 >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","Embedded documentation")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","Embedded documentation") defaultAttributes)))  parseRules ("Ruby","RegEx 1") =   (((pRegExpr regex_'5c'5c'5c'2f >>= withAttribute OtherTok))@@ -482,17 +492,23 @@    <|>    ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst"))    <|>-   ((pRegExpr regex_'2f'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ pushContext ("Ruby","check_div_1_pop")))+   ((pRegExpr regex_'2f'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ pushContext ("Ruby","check_div_1_pop"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","RegEx 1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","RegEx 1") defaultAttributes)))  parseRules ("Ruby","Subst") =   (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext))    <|>-   ((parseRules ("Ruby","Normal"))))+   ((parseRules ("Ruby","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","Subst")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","Subst") defaultAttributes)))  parseRules ("Ruby","Short Subst") =   (((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok))    <|>-   ((pRegExpr regex_'5cw'28'3f'21'5cw'29 >>= withAttribute OtherTok) >>~ (popContext)))+   ((pRegExpr regex_'5cw'28'3f'21'5cw'29 >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","Short Subst")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","Short Subst") defaultAttributes)))  parseRules ("Ruby","Member Access") =   (((pRegExpr regex_'5c'2e'3f'5b'5fa'2dz'5d'5cw'2a'28'5c'3f'7c'5c'21'29'3f'28'3f'3d'5b'5e'5cw'5cd'5c'2e'5c'3a'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("Ruby","check_div_2_pop"))@@ -517,49 +533,69 @@    <|>    ((pAnyChar "()\\" >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5cW >>= withAttribute NormalTok) >>~ (popContext)))+   ((pRegExpr regex_'5cW >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","Member Access")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","Member Access") defaultAttributes)))  parseRules ("Ruby","Comment Line") =   (((pRegExpr regex_'5cw'5c'3a'5c'3a'5cs >>= withAttribute CommentTok) >>~ pushContext ("Ruby","RDoc Label"))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","Comment Line")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","Comment Line") defaultAttributes)))  parseRules ("Ruby","General Comment") =-  ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+  (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","General Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","General Comment") defaultAttributes)))  parseRules ("Ruby","RDoc Label") =-  pzero+  (currentContext >>= \x -> guard (x == ("Ruby","RDoc Label")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","RDoc Label") defaultAttributes))  parseRules ("Ruby","find_heredoc") =   (((pRegExpr regex_'27'28'5cw'2b'29'27 >>= withAttribute KeywordTok) >>~ pushContext ("Ruby","apostrophed_normal_heredoc"))    <|>-   ((pRegExpr regex_'22'3f'28'5cw'2b'29'22'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby","normal_heredoc")))+   ((pRegExpr regex_'22'3f'28'5cw'2b'29'22'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby","normal_heredoc"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","find_heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","find_heredoc") defaultAttributes)))  parseRules ("Ruby","find_indented_heredoc") =   (((pRegExpr regex_'27'28'5cw'2b'29'27 >>= withAttribute KeywordTok) >>~ pushContext ("Ruby","apostrophed_indented_heredoc"))    <|>-   ((pRegExpr regex_'22'3f'28'5cw'2b'29'22'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby","indented_heredoc")))+   ((pRegExpr regex_'22'3f'28'5cw'2b'29'22'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby","indented_heredoc"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","find_indented_heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","find_indented_heredoc") defaultAttributes)))  parseRules ("Ruby","indented_heredoc") =   (((pFirstNonSpace >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("Ruby","heredoc_rules"))))+   ((parseRules ("Ruby","heredoc_rules")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","indented_heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","indented_heredoc") defaultAttributes)))  parseRules ("Ruby","apostrophed_indented_heredoc") =-  ((pFirstNonSpace >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+  (((pFirstNonSpace >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","apostrophed_indented_heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","apostrophed_indented_heredoc") defaultAttributes)))  parseRules ("Ruby","normal_heredoc") =   (((pColumn 0 >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("Ruby","heredoc_rules"))))+   ((parseRules ("Ruby","heredoc_rules")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","normal_heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","normal_heredoc") defaultAttributes)))  parseRules ("Ruby","apostrophed_normal_heredoc") =-  ((pColumn 0 >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+  (((pColumn 0 >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","apostrophed_normal_heredoc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","apostrophed_normal_heredoc") defaultAttributes)))  parseRules ("Ruby","heredoc_rules") =   (((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Short Subst"))    <|>-   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst")))+   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","heredoc_rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","heredoc_rules") defaultAttributes)))  parseRules ("Ruby","find_gdl_input") =   (((pRegExpr regex_w'5c'28 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_token_array_1"))@@ -620,7 +656,9 @@    <|>    ((pRegExpr regex_Q'3f'3c >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_dq_string_4"))    <|>-   ((pRegExpr regex_Q'3f'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_dq_string_5")))+   ((pRegExpr regex_Q'3f'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_dq_string_5"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","find_gdl_input")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","find_gdl_input") defaultAttributes)))  parseRules ("Ruby","gdl_dq_string_1") =   (((parseRules ("Ruby","dq_string_rules")))@@ -629,14 +667,18 @@    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_dq_string_1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_dq_string_1") defaultAttributes)))  parseRules ("Ruby","gdl_dq_string_1_nested") =   (((parseRules ("Ruby","dq_string_rules")))    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_dq_string_1_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_dq_string_1_nested") defaultAttributes)))  parseRules ("Ruby","gdl_dq_string_2") =   (((parseRules ("Ruby","dq_string_rules")))@@ -645,14 +687,18 @@    <|>    ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext))    <|>-   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_2_nested")))+   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_2_nested"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_dq_string_2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_dq_string_2") defaultAttributes)))  parseRules ("Ruby","gdl_dq_string_2_nested") =   (((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_2_nested"))    <|>    ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("Ruby","dq_string_rules"))))+   ((parseRules ("Ruby","dq_string_rules")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_dq_string_2_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_dq_string_2_nested") defaultAttributes)))  parseRules ("Ruby","gdl_dq_string_3") =   (((parseRules ("Ruby","dq_string_rules")))@@ -661,14 +707,18 @@    <|>    ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_dq_string_3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_dq_string_3") defaultAttributes)))  parseRules ("Ruby","gdl_dq_string_3_nested") =   (((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_3_nested"))    <|>    ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("Ruby","dq_string_rules"))))+   ((parseRules ("Ruby","dq_string_rules")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_dq_string_3_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_dq_string_3_nested") defaultAttributes)))  parseRules ("Ruby","gdl_dq_string_4") =   (((parseRules ("Ruby","dq_string_rules")))@@ -677,28 +727,36 @@    <|>    ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_dq_string_4")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_dq_string_4") defaultAttributes)))  parseRules ("Ruby","gdl_dq_string_4_nested") =   (((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_4_nested"))    <|>    ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("Ruby","dq_string_rules"))))+   ((parseRules ("Ruby","dq_string_rules")))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_dq_string_4_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_dq_string_4_nested") defaultAttributes)))  parseRules ("Ruby","gdl_dq_string_5") =   (((parseRules ("Ruby","dq_string_rules")))    <|>    ((pRegExprDynamic "\\\\%1" >>= withAttribute StringTok))    <|>-   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_dq_string_5")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_dq_string_5") defaultAttributes)))  parseRules ("Ruby","dq_string_rules") =   (((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok))    <|>    ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Short Subst"))    <|>-   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst")))+   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","dq_string_rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","dq_string_rules") defaultAttributes)))  parseRules ("Ruby","gdl_token_array_1") =   (((parseRules ("Ruby","token_array_rules")))@@ -707,14 +765,18 @@    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_token_array_1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_token_array_1") defaultAttributes)))  parseRules ("Ruby","gdl_token_array_1_nested") =   (((parseRules ("Ruby","token_array_rules")))    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_token_array_1_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_token_array_1_nested") defaultAttributes)))  parseRules ("Ruby","gdl_token_array_2") =   (((parseRules ("Ruby","token_array_rules")))@@ -723,14 +785,18 @@    <|>    ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext))    <|>-   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_2_nested")))+   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_2_nested"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_token_array_2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_token_array_2") defaultAttributes)))  parseRules ("Ruby","gdl_token_array_2_nested") =   (((parseRules ("Ruby","token_array_rules")))    <|>    ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_2_nested"))    <|>-   ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_token_array_2_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_token_array_2_nested") defaultAttributes)))  parseRules ("Ruby","gdl_token_array_3") =   (((parseRules ("Ruby","token_array_rules")))@@ -739,14 +805,18 @@    <|>    ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_token_array_3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_token_array_3") defaultAttributes)))  parseRules ("Ruby","gdl_token_array_3_nested") =   (((parseRules ("Ruby","token_array_rules")))    <|>    ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_token_array_3_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_token_array_3_nested") defaultAttributes)))  parseRules ("Ruby","gdl_token_array_4") =   (((parseRules ("Ruby","token_array_rules")))@@ -755,24 +825,32 @@    <|>    ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_token_array_4")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_token_array_4") defaultAttributes)))  parseRules ("Ruby","gdl_token_array_4_nested") =   (((parseRules ("Ruby","token_array_rules")))    <|>    ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_token_array_4_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_token_array_4_nested") defaultAttributes)))  parseRules ("Ruby","gdl_token_array_5") =   (((parseRules ("Ruby","token_array_rules")))    <|>    ((pRegExprDynamic "\\\\%1" >>= withAttribute StringTok))    <|>-   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_token_array_5")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_token_array_5") defaultAttributes)))  parseRules ("Ruby","token_array_rules") =-  ((pString False "\\\\" >>= withAttribute StringTok))+  (((pString False "\\\\" >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","token_array_rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","token_array_rules") defaultAttributes)))  parseRules ("Ruby","gdl_apostrophed_1") =   (((parseRules ("Ruby","apostrophed_rules")))@@ -781,14 +859,18 @@    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_apostrophed_1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_apostrophed_1") defaultAttributes)))  parseRules ("Ruby","gdl_apostrophed_1_nested") =   (((parseRules ("Ruby","apostrophed_rules")))    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_apostrophed_1_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_apostrophed_1_nested") defaultAttributes)))  parseRules ("Ruby","gdl_apostrophed_2") =   (((parseRules ("Ruby","apostrophed_rules")))@@ -797,14 +879,18 @@    <|>    ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext))    <|>-   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_2_nested")))+   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_2_nested"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_apostrophed_2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_apostrophed_2") defaultAttributes)))  parseRules ("Ruby","gdl_apostrophed_2_nested") =   (((parseRules ("Ruby","apostrophed_rules")))    <|>    ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_2_nested"))    <|>-   ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_apostrophed_2_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_apostrophed_2_nested") defaultAttributes)))  parseRules ("Ruby","gdl_apostrophed_3") =   (((parseRules ("Ruby","apostrophed_rules")))@@ -813,14 +899,18 @@    <|>    ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_apostrophed_3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_apostrophed_3") defaultAttributes)))  parseRules ("Ruby","gdl_apostrophed_3_nested") =   (((parseRules ("Ruby","apostrophed_rules")))    <|>    ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_apostrophed_3_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_apostrophed_3_nested") defaultAttributes)))  parseRules ("Ruby","gdl_apostrophed_4") =   (((parseRules ("Ruby","apostrophed_rules")))@@ -829,24 +919,32 @@    <|>    ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_apostrophed_4")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_apostrophed_4") defaultAttributes)))  parseRules ("Ruby","gdl_apostrophed_4_nested") =   (((parseRules ("Ruby","apostrophed_rules")))    <|>    ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_apostrophed_4_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_apostrophed_4_nested") defaultAttributes)))  parseRules ("Ruby","gdl_apostrophed_5") =   (((parseRules ("Ruby","apostrophed_rules")))    <|>    ((pRegExprDynamic "\\\\%1" >>= withAttribute StringTok))    <|>-   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_apostrophed_5")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_apostrophed_5") defaultAttributes)))  parseRules ("Ruby","apostrophed_rules") =-  ((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok))+  (((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","apostrophed_rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","apostrophed_rules") defaultAttributes)))  parseRules ("Ruby","gdl_shell_command_1") =   (((parseRules ("Ruby","shell_command_rules")))@@ -855,14 +953,18 @@    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_shell_command_1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_shell_command_1") defaultAttributes)))  parseRules ("Ruby","gdl_shell_command_1_nested") =   (((parseRules ("Ruby","shell_command_rules")))    <|>    ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_shell_command_1_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_shell_command_1_nested") defaultAttributes)))  parseRules ("Ruby","gdl_shell_command_2") =   (((parseRules ("Ruby","shell_command_rules")))@@ -871,14 +973,18 @@    <|>    ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext))    <|>-   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_2_nested")))+   ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_2_nested"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_shell_command_2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_shell_command_2") defaultAttributes)))  parseRules ("Ruby","gdl_shell_command_2_nested") =   (((parseRules ("Ruby","shell_command_rules")))    <|>    ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_2_nested"))    <|>-   ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_shell_command_2_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_shell_command_2_nested") defaultAttributes)))  parseRules ("Ruby","gdl_shell_command_3") =   (((parseRules ("Ruby","shell_command_rules")))@@ -887,14 +993,18 @@    <|>    ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_shell_command_3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_shell_command_3") defaultAttributes)))  parseRules ("Ruby","gdl_shell_command_3_nested") =   (((parseRules ("Ruby","shell_command_rules")))    <|>    ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_shell_command_3_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_shell_command_3_nested") defaultAttributes)))  parseRules ("Ruby","gdl_shell_command_4") =   (((parseRules ("Ruby","shell_command_rules")))@@ -903,28 +1013,36 @@    <|>    ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_shell_command_4")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_shell_command_4") defaultAttributes)))  parseRules ("Ruby","gdl_shell_command_4_nested") =   (((parseRules ("Ruby","shell_command_rules")))    <|>    ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_shell_command_4_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_shell_command_4_nested") defaultAttributes)))  parseRules ("Ruby","gdl_shell_command_5") =   (((parseRules ("Ruby","shell_command_rules")))    <|>    ((pRegExprDynamic "\\\\%1" >>= withAttribute StringTok))    <|>-   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_shell_command_5")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_shell_command_5") defaultAttributes)))  parseRules ("Ruby","shell_command_rules") =   (((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok))    <|>    ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Short Subst"))    <|>-   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst")))+   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","shell_command_rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","shell_command_rules") defaultAttributes)))  parseRules ("Ruby","gdl_regexpr_1") =   (((parseRules ("Ruby","regexpr_rules")))@@ -933,14 +1051,18 @@    <|>    ((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_1_nested"))    <|>-   ((pRegExpr regex_'5c'29'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'5c'29'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_regexpr_1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_regexpr_1") defaultAttributes)))  parseRules ("Ruby","gdl_regexpr_1_nested") =   (((parseRules ("Ruby","regexpr_rules")))    <|>    ((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_1_nested"))    <|>-   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext)))+   ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_regexpr_1_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_regexpr_1_nested") defaultAttributes)))  parseRules ("Ruby","gdl_regexpr_2") =   (((parseRules ("Ruby","regexpr_rules")))@@ -949,14 +1071,18 @@    <|>    ((pRegExpr regex_'5c'7d'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext))    <|>-   ((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_2_nested")))+   ((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_2_nested"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_regexpr_2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_regexpr_2") defaultAttributes)))  parseRules ("Ruby","gdl_regexpr_2_nested") =   (((parseRules ("Ruby","regexpr_rules")))    <|>    ((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_2_nested"))    <|>-   ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext)))+   ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_regexpr_2_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_regexpr_2_nested") defaultAttributes)))  parseRules ("Ruby","gdl_regexpr_3") =   (((parseRules ("Ruby","regexpr_rules")))@@ -965,14 +1091,18 @@    <|>    ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_3_nested"))    <|>-   ((pRegExpr regex_'5c'5d'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'5c'5d'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_regexpr_3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_regexpr_3") defaultAttributes)))  parseRules ("Ruby","gdl_regexpr_3_nested") =   (((parseRules ("Ruby","regexpr_rules")))    <|>    ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_3_nested"))    <|>-   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext)))+   ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_regexpr_3_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_regexpr_3_nested") defaultAttributes)))  parseRules ("Ruby","gdl_regexpr_4") =   (((parseRules ("Ruby","regexpr_rules")))@@ -981,32 +1111,40 @@    <|>    ((pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_4_nested"))    <|>-   ((pRegExpr regex_'3e'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExpr regex_'3e'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_regexpr_4")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_regexpr_4") defaultAttributes)))  parseRules ("Ruby","gdl_regexpr_4_nested") =   (((parseRules ("Ruby","regexpr_rules")))    <|>    ((pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_4_nested"))    <|>-   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext)))+   ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_regexpr_4_nested")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_regexpr_4_nested") defaultAttributes)))  parseRules ("Ruby","gdl_regexpr_5") =   (((parseRules ("Ruby","regexpr_rules")))    <|>    ((pRegExprDynamic "\\\\%1" >>= withAttribute OtherTok))    <|>-   ((pRegExprDynamic "\\s*%1[uiomxn]*" >>= withAttribute OtherTok) >>~ (popContext >> popContext)))+   ((pRegExprDynamic "\\s*%1[uiomxn]*" >>= withAttribute OtherTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","gdl_regexpr_5")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","gdl_regexpr_5") defaultAttributes)))  parseRules ("Ruby","regexpr_rules") =   (((pDetect2Chars False '\\' '\\' >>= withAttribute OtherTok))    <|>    ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Short Subst"))    <|>-   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst")))+   ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst"))+   <|>+   (currentContext >>= \x -> guard (x == ("Ruby","regexpr_rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","regexpr_rules") defaultAttributes)))  parseRules ("Ruby","DATA") =-  pzero+  (currentContext >>= \x -> guard (x == ("Ruby","DATA")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Ruby","DATA") defaultAttributes))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Ruby","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Scala.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Scala"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Scala","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -135,19 +131,25 @@    <|>    ((pRegExpr regex_'5b'2e'5d'7b1'2c1'7d >>= withAttribute NormalTok) >>~ pushContext ("Scala","Member"))    <|>-   ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok)))+   ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Scala","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scala","Normal") defaultAttributes)))  parseRules ("Scala","String") =   (((pLineContinue >>= withAttribute StringTok))    <|>    ((pHlCStringChar >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Scala","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scala","String") defaultAttributes)))  parseRules ("Scala","Printf") =   (((pDetectChar False ';' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Scala","PrintfString")))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Scala","PrintfString"))+   <|>+   (currentContext >>= \x -> guard (x == ("Scala","Printf")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scala","Printf") defaultAttributes)))  parseRules ("Scala","PrintfString") =   (((pLineContinue >>= withAttribute StringTok))@@ -160,7 +162,9 @@    <|>    ((pRegExpr regex_'25'28'5cd'2b'5c'24'29'3f'28'2d'7c'23'7c'5c'2b'7c'5c_'7c0'7c'2c'7c'5c'28'29'2a'5cd'2a'28t'7cT'29'28a'7cA'7cb'7cB'7cc'7cC'7cd'7cD'7ce'7cF'7ch'7cH'7cI'7cj'7ck'7cl'7cL'7cm'7cM'7cN'7cp'7cP'7cQ'7cr'7cR'7cs'7cS'7cT'7cy'7cY'7cz'7cZ'29 >>= withAttribute CharTok))    <|>-   ((pRegExpr regex_'25'28'25'7cn'29 >>= withAttribute CharTok)))+   ((pRegExpr regex_'25'28'25'7cn'29 >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Scala","PrintfString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scala","PrintfString") defaultAttributes)))  parseRules ("Scala","Member") =   (((pRegExpr regex_'5cb'5b'5fa'2dzA'2dZ'5d'5cw'2a'28'3f'3d'5b'5cs'5d'2a'29 >>= withAttribute FunctionTok) >>~ (popContext))@@ -168,11 +172,13 @@    ((popContext) >> currentContext >>= parseRules))  parseRules ("Scala","Commentar 1") =-  pzero+  (currentContext >>= \x -> guard (x == ("Scala","Commentar 1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scala","Commentar 1") defaultAttributes))  parseRules ("Scala","Commentar 2") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Scala","Commentar 2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scala","Commentar 2") defaultAttributes)))  parseRules ("Javadoc", _) = Text.Highlighting.Kate.Syntax.Javadoc.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Scala","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Scheme.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Scheme"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Scheme","Level0")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -87,7 +83,9 @@ parseRules ("Scheme","Level0") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level1"))    <|>-   ((parseRules ("Scheme","Default"))))+   ((parseRules ("Scheme","Default")))+   <|>+   (currentContext >>= \x -> guard (x == ("Scheme","Level0")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scheme","Level0") defaultAttributes)))  parseRules ("Scheme","Default") =   (((pRegExpr regex_'3b'2b'5cs'2aBEGIN'2e'2a'24 >>= withAttribute RegionMarkerTok))@@ -118,10 +116,14 @@    <|>    ((pInt >>= withAttribute DecValTok))    <|>-   ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level1")))+   ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level1"))+   <|>+   (currentContext >>= \x -> guard (x == ("Scheme","Default")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scheme","Default") defaultAttributes)))  parseRules ("Scheme","MultiLineComment") =-  ((pColumn 0 >> pRegExpr regex_'21'23'5cs'2a'24 >>= withAttribute CommentTok) >>~ (popContext))+  (((pColumn 0 >> pRegExpr regex_'21'23'5cs'2a'24 >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Scheme","MultiLineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scheme","MultiLineComment") defaultAttributes)))  parseRules ("Scheme","SpecialNumber") =   (((pRegExpr regex_'5cd'2a'28'5c'2e'5cd'2b'29'3f >>= withAttribute DecValTok) >>~ (popContext))@@ -137,52 +139,68 @@    <|>    ((pDetect2Chars False '\\' '\\' >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Scheme","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scheme","String") defaultAttributes)))  parseRules ("Scheme","function_decl") =-  ((pRegExpr regex_'5cs'2a'5bA'2dZa'2dz0'2d9'2d'2b'5c'3c'5c'3e'2f'2f'5c'2a'5d'2a'5cs'2a >>= withAttribute FunctionTok) >>~ (popContext))+  (((pRegExpr regex_'5cs'2a'5bA'2dZa'2dz0'2d9'2d'2b'5c'3c'5c'3e'2f'2f'5c'2a'5d'2a'5cs'2a >>= withAttribute FunctionTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Scheme","function_decl")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scheme","function_decl") defaultAttributes)))  parseRules ("Scheme","Level1") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level2"))    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("Scheme","Default"))))+   ((parseRules ("Scheme","Default")))+   <|>+   (currentContext >>= \x -> guard (x == ("Scheme","Level1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scheme","Level1") defaultAttributes)))  parseRules ("Scheme","Level2") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level3"))    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("Scheme","Default"))))+   ((parseRules ("Scheme","Default")))+   <|>+   (currentContext >>= \x -> guard (x == ("Scheme","Level2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scheme","Level2") defaultAttributes)))  parseRules ("Scheme","Level3") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level4"))    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("Scheme","Default"))))+   ((parseRules ("Scheme","Default")))+   <|>+   (currentContext >>= \x -> guard (x == ("Scheme","Level3")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scheme","Level3") defaultAttributes)))  parseRules ("Scheme","Level4") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level5"))    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("Scheme","Default"))))+   ((parseRules ("Scheme","Default")))+   <|>+   (currentContext >>= \x -> guard (x == ("Scheme","Level4")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scheme","Level4") defaultAttributes)))  parseRules ("Scheme","Level5") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level6"))    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("Scheme","Default"))))+   ((parseRules ("Scheme","Default")))+   <|>+   (currentContext >>= \x -> guard (x == ("Scheme","Level5")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scheme","Level5") defaultAttributes)))  parseRules ("Scheme","Level6") =   (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level1"))    <|>    ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("Scheme","Default"))))+   ((parseRules ("Scheme","Default")))+   <|>+   (currentContext >>= \x -> guard (x == ("Scheme","Level6")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Scheme","Level6") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Scheme","Level0") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Sci.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "scilab"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("scilab","main")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -86,7 +82,9 @@    <|>    ((pRegExpr regex_'2f'2f'2e'2a'24 >>= withAttribute CommentTok))    <|>-   ((pRangeDetect '"' '"' >>= withAttribute StringTok)))+   ((pRangeDetect '"' '"' >>= withAttribute StringTok))+   <|>+   (currentContext >>= \x -> guard (x == ("scilab","main")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("scilab","main") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("scilab","main") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Sed.hs view
@@ -30,11 +30,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "sed"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("sed","BeginningOfLine")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -114,7 +110,9 @@    <|>    ((parseRules ("sed","Command")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error")))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","BeginningOfLine")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","BeginningOfLine") defaultAttributes)))  parseRules ("sed","FirstAddressRegex") =   (((pDetectSpaces >>= withAttribute StringTok))@@ -123,7 +121,9 @@    <|>    ((pRegExprDynamic "%1" >>= withAttribute StringTok) >>~ pushContext ("sed","AfterFirstAddress"))    <|>-   ((parseRules ("sed","Regex"))))+   ((parseRules ("sed","Regex")))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","FirstAddressRegex")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","FirstAddressRegex") defaultAttributes)))  parseRules ("sed","AfterFirstAddress") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -132,7 +132,9 @@    <|>    ((parseRules ("sed","AfterFirstAddress2")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error")))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","AfterFirstAddress")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","AfterFirstAddress") defaultAttributes)))  parseRules ("sed","AfterFirstAddress2") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -143,7 +145,9 @@    <|>    ((parseRules ("sed","Command")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error")))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","AfterFirstAddress2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","AfterFirstAddress2") defaultAttributes)))  parseRules ("sed","SecondAddress") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -156,7 +160,9 @@    <|>    ((pDetectChar False '$' >>= withAttribute OtherTok) >>~ pushContext ("sed","AfterSecondAddress"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error")))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","SecondAddress")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","SecondAddress") defaultAttributes)))  parseRules ("sed","SecondAddressRegex") =   (((pDetectSpaces >>= withAttribute StringTok))@@ -165,7 +171,9 @@    <|>    ((pRegExprDynamic "%1" >>= withAttribute StringTok) >>~ pushContext ("sed","AfterSecondAddress"))    <|>-   ((parseRules ("sed","Regex"))))+   ((parseRules ("sed","Regex")))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","SecondAddressRegex")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","SecondAddressRegex") defaultAttributes)))  parseRules ("sed","AfterSecondAddress") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -174,14 +182,18 @@    <|>    ((parseRules ("sed","Command")))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error")))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","AfterSecondAddress")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","AfterSecondAddress") defaultAttributes)))  parseRules ("sed","Step") =   (((pDetectSpaces >>= withAttribute NormalTok))    <|>    ((pInt >>= withAttribute DecValTok) >>~ pushContext ("sed","Command"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error")))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","Step")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","Step") defaultAttributes)))  parseRules ("sed","Command") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -204,12 +216,16 @@    <|>    ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("sed","BeginningOfLine"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error")))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","Command")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","Command") defaultAttributes)))  parseRules ("sed","SCommand") =   (((pDetectSpaces >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'28'5cS'29 >>= withAttribute StringTok) >>~ pushContext ("sed","SRegex")))+   ((pRegExpr regex_'28'5cS'29 >>= withAttribute StringTok) >>~ pushContext ("sed","SRegex"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","SCommand")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","SCommand") defaultAttributes)))  parseRules ("sed","SRegex") =   (((pDetectSpaces >>= withAttribute StringTok))@@ -218,7 +234,9 @@    <|>    ((pRegExprDynamic "(%1)" >>= withAttribute StringTok) >>~ pushContext ("sed","SReplacement"))    <|>-   ((parseRules ("sed","Regex"))))+   ((parseRules ("sed","Regex")))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","SRegex")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","SRegex") defaultAttributes)))  parseRules ("sed","SReplacement") =   (((pDetectSpaces >>= withAttribute StringTok))@@ -229,7 +247,9 @@    <|>    ((pRegExpr regex_'5c'5c'5b0'2d9LlUuE'5c'5c'26'5d >>= withAttribute CharTok))    <|>-   ((pDetectChar False '&' >>= withAttribute CharTok)))+   ((pDetectChar False '&' >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","SReplacement")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","SReplacement") defaultAttributes)))  parseRules ("sed","SFlags") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -240,17 +260,23 @@    <|>    ((pInt >>= withAttribute DecValTok))    <|>-   ((parseRules ("sed","AfterCommand"))))+   ((parseRules ("sed","AfterCommand")))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","SFlags")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","SFlags") defaultAttributes)))  parseRules ("sed","WFlag") =   (((pDetectSpaces >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'5cS'2b >>= withAttribute BaseNTok) >>~ pushContext ("sed","SFlags")))+   ((pRegExpr regex_'5cS'2b >>= withAttribute BaseNTok) >>~ pushContext ("sed","SFlags"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","WFlag")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","WFlag") defaultAttributes)))  parseRules ("sed","YCommand") =   (((pDetectSpaces >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'28'5cS'29 >>= withAttribute StringTok) >>~ pushContext ("sed","YSourceList")))+   ((pRegExpr regex_'28'5cS'29 >>= withAttribute StringTok) >>~ pushContext ("sed","YSourceList"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","YCommand")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","YCommand") defaultAttributes)))  parseRules ("sed","YSourceList") =   (((pDetectSpaces >>= withAttribute StringTok))@@ -261,7 +287,9 @@    <|>    ((pDetect2Chars False '\\' 'n' >>= withAttribute CharTok))    <|>-   ((pDetect2Chars False '\\' '\\' >>= withAttribute CharTok)))+   ((pDetect2Chars False '\\' '\\' >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","YSourceList")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","YSourceList") defaultAttributes)))  parseRules ("sed","YDestList") =   (((pDetectSpaces >>= withAttribute StringTok))@@ -272,54 +300,70 @@    <|>    ((pDetect2Chars False '\\' 'n' >>= withAttribute CharTok))    <|>-   ((pDetect2Chars False '\\' '\\' >>= withAttribute CharTok)))+   ((pDetect2Chars False '\\' '\\' >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","YDestList")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","YDestList") defaultAttributes)))  parseRules ("sed","AICCommand") =   (((pDetectSpaces >>= withAttribute NormalTok))    <|>    ((pLineContinue >>= withAttribute OtherTok) >>~ pushContext ("sed","LiteralText"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error")))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","AICCommand")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","AICCommand") defaultAttributes)))  parseRules ("sed","LiteralText") =   (((pDetect2Chars False '\\' '\\' >>= withAttribute OtherTok) >>~ pushContext ("sed","LiteralText"))    <|>    ((pLineContinue >>= withAttribute OtherTok) >>~ pushContext ("sed","LiteralText"))    <|>-   ((pDetectChar False '\\' >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error")))+   ((pDetectChar False '\\' >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","LiteralText")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","LiteralText") defaultAttributes)))  parseRules ("sed","BTCommand") =   (((pDetectSpaces >>= withAttribute NormalTok))    <|>    ((pRegExpr regex_'5cw'2b >>= withAttribute FunctionTok) >>~ pushContext ("sed","AfterCommand"))    <|>-   ((parseRules ("sed","AfterCommand"))))+   ((parseRules ("sed","AfterCommand")))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","BTCommand")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","BTCommand") defaultAttributes)))  parseRules ("sed","WRCommand") =   (((pDetectSpaces >>= withAttribute NormalTok))    <|>-   ((pRegExpr regex_'5cS'2b >>= withAttribute BaseNTok) >>~ pushContext ("sed","AfterCommand")))+   ((pRegExpr regex_'5cS'2b >>= withAttribute BaseNTok) >>~ pushContext ("sed","AfterCommand"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","WRCommand")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","WRCommand") defaultAttributes)))  parseRules ("sed","LCommand") =   (((pDetectSpaces >>= withAttribute NormalTok))    <|>    ((pInt >>= withAttribute DecValTok) >>~ pushContext ("sed","AfterCommand"))    <|>-   ((parseRules ("sed","AfterCommand"))))+   ((parseRules ("sed","AfterCommand")))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","LCommand")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","LCommand") defaultAttributes)))  parseRules ("sed","QCommand") =   (((pDetectSpaces >>= withAttribute NormalTok))    <|>    ((pInt >>= withAttribute DecValTok) >>~ pushContext ("sed","AfterCommand"))    <|>-   ((parseRules ("sed","AfterCommand"))))+   ((parseRules ("sed","AfterCommand")))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","QCommand")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","QCommand") defaultAttributes)))  parseRules ("sed","Label") =   (((pDetectSpaces >>= withAttribute NormalTok))    <|>    ((pRegExpr regex_'5cw'2b >>= withAttribute FunctionTok) >>~ pushContext ("sed","AfterCommand"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error")))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","Label")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","Label") defaultAttributes)))  parseRules ("sed","AfterCommand") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -330,7 +374,9 @@    <|>    ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("sed","Comment"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error")))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","AfterCommand")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","AfterCommand") defaultAttributes)))  parseRules ("sed","Regex") =   (((pDetect2Chars False '\\' '(' >>= withAttribute CharTok))@@ -395,13 +441,15 @@    <|>    ((pDetectChar False '[' >>= withAttribute CharTok))    <|>-   ((pDetectChar False ']' >>= withAttribute CharTok)))+   ((pDetectChar False ']' >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("sed","Regex")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","Regex") defaultAttributes)))  parseRules ("sed","Comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("sed","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","Comment") defaultAttributes))  parseRules ("sed","Error") =-  pzero+  (currentContext >>= \x -> guard (x == ("sed","Error")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("sed","Error") defaultAttributes))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("sed","BeginningOfLine") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Sgml.hs view
@@ -30,11 +30,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "SGML"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("SGML","Normal Text")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -68,27 +64,37 @@ parseRules ("SGML","Normal Text") =   (((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("SGML","Comment"))    <|>-   ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5ba'2dzA'2dZ'5f'3a'5d'5ba'2dzA'2dZ0'2d9'2e'5f'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("SGML","Attribute")))+   ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5ba'2dzA'2dZ'5f'3a'5d'5ba'2dzA'2dZ0'2d9'2e'5f'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("SGML","Attribute"))+   <|>+   (currentContext >>= \x -> guard (x == ("SGML","Normal Text")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SGML","Normal Text") defaultAttributes)))  parseRules ("SGML","Attribute") =   (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext))    <|>    ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("SGML","Value")))+   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("SGML","Value"))+   <|>+   (currentContext >>= \x -> guard (x == ("SGML","Attribute")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SGML","Attribute") defaultAttributes)))  parseRules ("SGML","Value") =   (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>    ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("SGML","Value 2")))+   ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("SGML","Value 2"))+   <|>+   (currentContext >>= \x -> guard (x == ("SGML","Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SGML","Value") defaultAttributes)))  parseRules ("SGML","Value 2") =-  ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+  (((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("SGML","Value 2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SGML","Value 2") defaultAttributes)))  parseRules ("SGML","Comment") =-  ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))+  (((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("SGML","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SGML","Comment") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("SGML","Normal Text") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Sql.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "SQL"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("SQL","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -111,7 +107,9 @@    <|>    ((pColumn 0 >> pRegExpr regex_'2f'24 >>= withAttribute CharTok))    <|>-   ((pColumn 0 >> pRegExpr regex_'40'40'3f'5b'5e'40_'5ct'5cr'5cn'5d >>= withAttribute OtherTok) >>~ pushContext ("SQL","SQL*Plus directive to include file")))+   ((pColumn 0 >> pRegExpr regex_'40'40'3f'5b'5e'40_'5ct'5cr'5cn'5d >>= withAttribute OtherTok) >>~ pushContext ("SQL","SQL*Plus directive to include file"))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL","Normal") defaultAttributes)))  parseRules ("SQL","String literal") =   (((pDetect2Chars False '\\' '\'' >>= withAttribute StringTok) >>~ (popContext))@@ -122,22 +120,28 @@    <|>    ((pDetect2Chars False '\'' '\'' >>= withAttribute CharTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL","String literal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL","String literal") defaultAttributes)))  parseRules ("SQL","Singleline PL/SQL-style comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("SQL","Singleline PL/SQL-style comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL","Singleline PL/SQL-style comment") defaultAttributes))  parseRules ("SQL","Multiline C-style comment") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL","Multiline C-style comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL","Multiline C-style comment") defaultAttributes)))  parseRules ("SQL","SQL*Plus remark directive") =-  pzero+  (currentContext >>= \x -> guard (x == ("SQL","SQL*Plus remark directive")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL","SQL*Plus remark directive") defaultAttributes))  parseRules ("SQL","User-defined identifier") =-  ((pDetectChar False '"' >>= withAttribute OtherTok) >>~ (popContext))+  (((pDetectChar False '"' >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL","User-defined identifier")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL","User-defined identifier") defaultAttributes)))  parseRules ("SQL","SQL*Plus directive to include file") =-  pzero+  (currentContext >>= \x -> guard (x == ("SQL","SQL*Plus directive to include file")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL","SQL*Plus directive to include file") defaultAttributes))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("SQL","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/SqlMysql.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "SQL (MySQL)"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("SQL (MySQL)","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -121,7 +117,9 @@    <|>    ((pColumn 0 >> pRegExpr regex_'40'40'3f'5b'5e'40_'5ct'5cr'5cn'5d >>= withAttribute OtherTok) >>~ pushContext ("SQL (MySQL)","Preprocessor"))    <|>-   ((pDetectChar False '.' >>= withAttribute CharTok)))+   ((pDetectChar False '.' >>= withAttribute CharTok))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL (MySQL)","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (MySQL)","Normal") defaultAttributes)))  parseRules ("SQL (MySQL)","String") =   (((pLineContinue >>= withAttribute StringTok) >>~ (popContext))@@ -130,7 +128,9 @@    <|>    ((pDetectChar False '&' >>= withAttribute CharTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL (MySQL)","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (MySQL)","String") defaultAttributes)))  parseRules ("SQL (MySQL)","String2") =   (((pLineContinue >>= withAttribute StringTok) >>~ (popContext))@@ -139,25 +139,31 @@    <|>    ((pDetectChar False '&' >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL (MySQL)","String2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (MySQL)","String2") defaultAttributes)))  parseRules ("SQL (MySQL)","Name") =   (((pLineContinue >>= withAttribute StringTok) >>~ (popContext))    <|>    ((pHlCStringChar >>= withAttribute CharTok))    <|>-   ((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL (MySQL)","Name")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (MySQL)","Name") defaultAttributes)))  parseRules ("SQL (MySQL)","SingleLineComment") =-  pzero+  (currentContext >>= \x -> guard (x == ("SQL (MySQL)","SingleLineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (MySQL)","SingleLineComment") defaultAttributes))  parseRules ("SQL (MySQL)","MultiLineComment") =   (((pLineContinue >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)))+   ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL (MySQL)","MultiLineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (MySQL)","MultiLineComment") defaultAttributes)))  parseRules ("SQL (MySQL)","Preprocessor") =-  pzero+  (currentContext >>= \x -> guard (x == ("SQL (MySQL)","Preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (MySQL)","Preprocessor") defaultAttributes))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("SQL (MySQL)","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/SqlPostgresql.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "SQL (PostgreSQL)"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("SQL (PostgreSQL)","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -132,20 +128,28 @@    <|>    ((pColumn 0 >> pRegExpr regex_'40'40'3f'5b'5e'40_'5ct'5cr'5cn'5d >>= withAttribute OtherTok) >>~ pushContext ("SQL (PostgreSQL)","Preprocessor"))    <|>-   ((pRegExprDynamic "\\$([^\\$\\n\\r]*)\\$" >>= withAttribute NormalTok) >>~ pushContext ("SQL (PostgreSQL)","MultiLineString")))+   ((pRegExprDynamic "\\$([^\\$\\n\\r]*)\\$" >>= withAttribute NormalTok) >>~ pushContext ("SQL (PostgreSQL)","MultiLineString"))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL (PostgreSQL)","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (PostgreSQL)","Normal") defaultAttributes)))  parseRules ("SQL (PostgreSQL)","CreateFunction") =   (((pRegExprDynamic "\\$([^\\$\\n\\r]*)\\$" >>= withAttribute FunctionTok) >>~ pushContext ("SQL (PostgreSQL)","FunctionBody"))    <|>-   ((parseRules ("SQL (PostgreSQL)","Normal"))))+   ((parseRules ("SQL (PostgreSQL)","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL (PostgreSQL)","CreateFunction")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (PostgreSQL)","CreateFunction") defaultAttributes)))  parseRules ("SQL (PostgreSQL)","FunctionBody") =   (((pRegExprDynamic "\\$%1\\$" >>= withAttribute FunctionTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("SQL (PostgreSQL)","Normal"))))+   ((parseRules ("SQL (PostgreSQL)","Normal")))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL (PostgreSQL)","FunctionBody")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (PostgreSQL)","FunctionBody") defaultAttributes)))  parseRules ("SQL (PostgreSQL)","MultiLineString") =-  ((pRegExprDynamic "\\$%1\\$" >>= withAttribute NormalTok) >>~ (popContext))+  (((pRegExprDynamic "\\$%1\\$" >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL (PostgreSQL)","MultiLineString")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (PostgreSQL)","MultiLineString") defaultAttributes)))  parseRules ("SQL (PostgreSQL)","String") =   (((pLineContinue >>= withAttribute StringTok) >>~ (popContext))@@ -154,21 +158,27 @@    <|>    ((pDetectChar False '&' >>= withAttribute CharTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL (PostgreSQL)","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (PostgreSQL)","String") defaultAttributes)))  parseRules ("SQL (PostgreSQL)","SingleLineComment") =-  pzero+  (currentContext >>= \x -> guard (x == ("SQL (PostgreSQL)","SingleLineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (PostgreSQL)","SingleLineComment") defaultAttributes))  parseRules ("SQL (PostgreSQL)","MultiLineComment") =   (((pLineContinue >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)))+   ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL (PostgreSQL)","MultiLineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (PostgreSQL)","MultiLineComment") defaultAttributes)))  parseRules ("SQL (PostgreSQL)","Identifier") =-  ((pDetectChar False '"' >>= withAttribute OtherTok) >>~ (popContext))+  (((pDetectChar False '"' >>= withAttribute OtherTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("SQL (PostgreSQL)","Identifier")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (PostgreSQL)","Identifier") defaultAttributes)))  parseRules ("SQL (PostgreSQL)","Preprocessor") =-  pzero+  (currentContext >>= \x -> guard (x == ("SQL (PostgreSQL)","Preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("SQL (PostgreSQL)","Preprocessor") defaultAttributes))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("SQL (PostgreSQL)","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Tcl.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Tcl/Tk"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Tcl/Tk","Base")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -110,22 +106,28 @@    <|>    ((pDetectChar False '[' >>= withAttribute KeywordTok))    <|>-   ((pDetectChar False ']' >>= withAttribute KeywordTok)))+   ((pDetectChar False ']' >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Tcl/Tk","Base")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Tcl/Tk","Base") defaultAttributes)))  parseRules ("Tcl/Tk","String") =   (((pRegExpr regex_'5c'5c'2e >>= withAttribute CharTok))    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((pDetectChar False '$' >>= withAttribute DataTypeTok)))+   ((pDetectChar False '$' >>= withAttribute DataTypeTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Tcl/Tk","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Tcl/Tk","String") defaultAttributes)))  parseRules ("Tcl/Tk","Comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("Tcl/Tk","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Tcl/Tk","Comment") defaultAttributes))  parseRules ("Tcl/Tk","New command line") =   (((pRegExpr regex_'5cs'2a'23 >>= withAttribute CommentTok) >>~ pushContext ("Tcl/Tk","Comment"))    <|>-   ((lookAhead (pRegExpr regex_'2e) >> (popContext) >> currentContext >>= parseRules)))+   ((lookAhead (pRegExpr regex_'2e) >> (popContext) >> currentContext >>= parseRules))+   <|>+   (currentContext >>= \x -> guard (x == ("Tcl/Tk","New command line")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Tcl/Tk","New command line") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Tcl/Tk","Base") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Texinfo.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Texinfo"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Texinfo","Normal Text")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -79,26 +75,36 @@    <|>    ((pRegExpr regex_'40'28menu'7csmallexample'7ctable'7cmultitable'29'5cb >>= withAttribute FunctionTok) >>~ pushContext ("Texinfo","folding"))    <|>-   ((pRegExpr regex_'40'5b'5cw'5d'2b'28'5c'7b'28'5b'5cw'5d'2b'5b'5cs'5d'2a'29'2b'5c'7d'29'3f >>= withAttribute FunctionTok)))+   ((pRegExpr regex_'40'5b'5cw'5d'2b'28'5c'7b'28'5b'5cw'5d'2b'5b'5cs'5d'2a'29'2b'5c'7d'29'3f >>= withAttribute FunctionTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Texinfo","Normal Text")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Texinfo","Normal Text") defaultAttributes)))  parseRules ("Texinfo","singleLineComment") =-  ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+  (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Texinfo","singleLineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Texinfo","singleLineComment") defaultAttributes)))  parseRules ("Texinfo","multiLineComment") =   (((pString False "@end ignore" >>= withAttribute CommentTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))))+   ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Texinfo","multiLineComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Texinfo","multiLineComment") defaultAttributes)))  parseRules ("Texinfo","nodeFolding") =   (((lookAhead (pRegExpr regex_'40node'5cb) >> (popContext) >> currentContext >>= parseRules))    <|>-   ((parseRules ("Texinfo","Normal Text"))))+   ((parseRules ("Texinfo","Normal Text")))+   <|>+   (currentContext >>= \x -> guard (x == ("Texinfo","nodeFolding")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Texinfo","nodeFolding") defaultAttributes)))  parseRules ("Texinfo","folding") =   (((pRegExpr regex_'40end_'28menu'7csmallexample'7ctable'7cmultitable'29'5cb >>= withAttribute FunctionTok) >>~ (popContext))    <|>-   ((parseRules ("Texinfo","Normal Text"))))+   ((parseRules ("Texinfo","Normal Text")))+   <|>+   (currentContext >>= \x -> guard (x == ("Texinfo","folding")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Texinfo","folding") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Texinfo","Normal Text") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Verilog.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Verilog"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Verilog","Normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -133,22 +129,30 @@    <|>    ((pRegExpr regex_'5c'24'5ba'2dzA'2dZ'5f'5d'2b'5cw'2a >>= withAttribute DataTypeTok))    <|>-   ((pRegExpr regex_'23'5b'5cd'5f'5d'2b >>= withAttribute BaseNTok)))+   ((pRegExpr regex_'23'5b'5cd'5f'5d'2b >>= withAttribute BaseNTok))+   <|>+   (currentContext >>= \x -> guard (x == ("Verilog","Normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Verilog","Normal") defaultAttributes)))  parseRules ("Verilog","String") =   (((pLineContinue >>= withAttribute StringTok) >>~ pushContext ("Verilog","Some Context"))    <|>    ((pHlCStringChar >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Verilog","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Verilog","String") defaultAttributes)))  parseRules ("Verilog","Commentar 1") =-  ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+  (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))+   <|>+   (currentContext >>= \x -> guard (x == ("Verilog","Commentar 1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Verilog","Commentar 1") defaultAttributes)))  parseRules ("Verilog","Commentar 2") =   (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)))+   ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Verilog","Commentar 2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Verilog","Commentar 2") defaultAttributes)))  parseRules ("Verilog","Preprocessor") =   (((pLineContinue >>= withAttribute OtherTok) >>~ pushContext ("Verilog","Some Context"))@@ -159,25 +163,35 @@    <|>    ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Verilog","Commentar 1"))    <|>-   ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Verilog","Commentar/Preprocessor")))+   ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Verilog","Commentar/Preprocessor"))+   <|>+   (currentContext >>= \x -> guard (x == ("Verilog","Preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Verilog","Preprocessor") defaultAttributes)))  parseRules ("Verilog","Commentar/Preprocessor") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Verilog","Commentar/Preprocessor")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Verilog","Commentar/Preprocessor") defaultAttributes)))  parseRules ("Verilog","Some Context") =-  pzero+  (currentContext >>= \x -> guard (x == ("Verilog","Some Context")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Verilog","Some Context") defaultAttributes))  parseRules ("Verilog","Some Context2") =   (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pFirstNonSpace >> pString False "#endif" >>= withAttribute CommentTok) >>~ (popContext)))+   ((pFirstNonSpace >> pString False "#endif" >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Verilog","Some Context2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Verilog","Some Context2") defaultAttributes)))  parseRules ("Verilog","Block name") =-  ((pDetectIdentifier >>= withAttribute DataTypeTok) >>~ (popContext))+  (((pDetectIdentifier >>= withAttribute DataTypeTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Verilog","Block name")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Verilog","Block name") defaultAttributes)))  parseRules ("Verilog","Port") =-  ((pDetectIdentifier >>= withAttribute NormalTok) >>~ (popContext))+  (((pDetectIdentifier >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Verilog","Port")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Verilog","Port") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Verilog","Normal") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Vhdl.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "VHDL"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("VHDL","start")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -120,7 +116,9 @@    <|>    ((lookAhead (pRegExpr regex_'28'5cb'29'28package'5cs'2bbody'5cs'2b'28'5cb'28'3f'21'28'3f'3aprocess'7cconstant'7csignal'7cvariable'29'29'28'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'29'5cb'29'5cs'2bis'29'5cb) >> pushContext ("VHDL","packagebody") >> currentContext >>= parseRules))    <|>-   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywordsToplevel >>= withAttribute KeywordTok)))+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywordsToplevel >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","start")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","start") defaultAttributes)))  parseRules ("VHDL","package") =   (((pString True "%2" >>= withAttribute KeywordTok))@@ -131,7 +129,9 @@    <|>    ((pRegExprDynamic "(\\b)end(\\s+package)?(\\s+%3)?\\s*;" >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("VHDL","generalDetection"))))+   ((parseRules ("VHDL","generalDetection")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","package")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","package") defaultAttributes)))  parseRules ("VHDL","packagebody") =   (((pString True "%2" >>= withAttribute KeywordTok))@@ -142,7 +142,9 @@    <|>    ((pRegExprDynamic "(\\b)end(\\s+package)?(\\s+%3)?\\s*;" >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("VHDL","generalDetection"))))+   ((parseRules ("VHDL","generalDetection")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","packagebody")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","packagebody") defaultAttributes)))  parseRules ("VHDL","architecture_main") =   (((parseRules ("VHDL","preDetection")))@@ -153,7 +155,9 @@    <|>    ((pRegExprDynamic "(\\b)end(\\s+architecture)?(\\s+\\b(?!(?:process|constant|signal|variable))([A-Za-z_][A-Za-z0-9_]*)\\b)\\s*;" >>= withAttribute ErrorTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("VHDL","detect_arch_parts"))))+   ((parseRules ("VHDL","detect_arch_parts")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","architecture_main")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","architecture_main") defaultAttributes)))  parseRules ("VHDL","arch_decl") =   (((parseRules ("VHDL","preDetection")))@@ -164,7 +168,9 @@    <|>    ((pString False "begin" >>= withAttribute KeywordTok) >>~ (popContext))    <|>-   ((parseRules ("VHDL","generalDetection"))))+   ((parseRules ("VHDL","generalDetection")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","arch_decl")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","arch_decl") defaultAttributes)))  parseRules ("VHDL","detect_arch_parts") =   (((lookAhead (pRegExprDynamic "(\\b)((\\b(?!(?:process|constant|signal|variable))([A-Za-z_][A-Za-z0-9_]*)\\b)\\s*:\\s*)(if|for).*\\s+generate\\b") >> pushContext ("VHDL","generate1") >> currentContext >>= parseRules))@@ -173,7 +179,9 @@    <|>    ((lookAhead (pRegExprDynamic "\\b(\\b(?!(?:process|constant|signal|variable))([A-Za-z_][A-Za-z0-9_]*)\\b)\\s*:\\s*(\\b(?!(?:process|constant|signal|variable))([A-Za-z_][A-Za-z0-9_]*)\\b)") >> pushContext ("VHDL","instance") >> currentContext >>= parseRules))    <|>-   ((parseRules ("VHDL","generalDetection"))))+   ((parseRules ("VHDL","generalDetection")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","detect_arch_parts")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","detect_arch_parts") defaultAttributes)))  parseRules ("VHDL","generate1") =   (((parseRules ("VHDL","preDetection")))@@ -186,7 +194,9 @@    <|>    ((pString False "if" >>= withAttribute KeywordTok))    <|>-   ((parseRules ("VHDL","generalDetection"))))+   ((parseRules ("VHDL","generalDetection")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","generate1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","generate1") defaultAttributes)))  parseRules ("VHDL","generate2") =   (((parseRules ("VHDL","preDetection")))@@ -195,7 +205,9 @@    <|>    ((pRegExpr regex_'28'5cb'29end'5cs'2bgenerate'28'5cs'2b'5cb'28'3f'21'28'3f'3aprocess'7cconstant'7csignal'7cvariable'29'29'28'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'29'5cb'29'3f'5cs'2a'3b >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("VHDL","detect_arch_parts"))))+   ((parseRules ("VHDL","detect_arch_parts")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","generate2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","generate2") defaultAttributes)))  parseRules ("VHDL","process1") =   (((parseRules ("VHDL","preDetection")))@@ -208,7 +220,9 @@    <|>    ((pString False "begin" >>= withAttribute KeywordTok))    <|>-   ((parseRules ("VHDL","proc_rules"))))+   ((parseRules ("VHDL","proc_rules")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","process1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","process1") defaultAttributes)))  parseRules ("VHDL","proc_rules") =   (((pRegExpr regex_'28'5cb'29'5cb'28'3f'21'28'3f'3aprocess'7cconstant'7csignal'7cvariable'29'29'28'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'29'5cb'28'3f'3d'5cs'2a'3a'28'3f'21'3d'29'29 >>= withAttribute KeywordTok))@@ -219,7 +233,9 @@    <|>    ((pRegExpr regex_'28'5cb'29'28'28'5cb'28'3f'21'28'3f'3aprocess'7cconstant'7csignal'7cvariable'29'29'28'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'29'5cb'29'5cs'2a'3a'5cs'2a'29'3f'28'28for'7cwhile'29'5cs'2b'2e'2b'5cs'2b'29'3floop'5cb >>= withAttribute KeywordTok) >>~ pushContext ("VHDL","forOrWhile"))    <|>-   ((parseRules ("VHDL","generalDetection"))))+   ((parseRules ("VHDL","generalDetection")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","proc_rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","proc_rules") defaultAttributes)))  parseRules ("VHDL","instance") =   (((parseRules ("VHDL","preDetection")))@@ -230,21 +246,27 @@    <|>    ((pDetect2Chars False ')' ';' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("VHDL","generalDetection"))))+   ((parseRules ("VHDL","generalDetection")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","instance")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","instance") defaultAttributes)))  parseRules ("VHDL","forOrWhile") =   (((pRegExpr regex_'28'5cb'29end'5cs'2bloop'28'5cs'2b'5cb'28'3f'21'28'3f'3aprocess'7cconstant'7csignal'7cvariable'29'29'28'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'29'5cb'29'3f'5cs'2a'3b >>= withAttribute KeywordTok) >>~ (popContext))    <|>    ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_forOrWhile >>= withAttribute KeywordTok))    <|>-   ((parseRules ("VHDL","proc_rules"))))+   ((parseRules ("VHDL","proc_rules")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","forOrWhile")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","forOrWhile") defaultAttributes)))  parseRules ("VHDL","if_start") =   (((parseRules ("VHDL","preDetection")))    <|>    ((pString False "then" >>= withAttribute KeywordTok) >>~ pushContext ("VHDL","if"))    <|>-   ((parseRules ("VHDL","generalDetection"))))+   ((parseRules ("VHDL","generalDetection")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","if_start")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","if_start") defaultAttributes)))  parseRules ("VHDL","if") =   (((parseRules ("VHDL","preDetection")))@@ -253,14 +275,18 @@    <|>    ((parseRules ("VHDL","proc_rules")))    <|>-   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_if >>= withAttribute KeywordTok)))+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_if >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","if")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","if") defaultAttributes)))  parseRules ("VHDL","case1") =   (((parseRules ("VHDL","preDetection")))    <|>    ((pString False "is" >>= withAttribute KeywordTok) >>~ pushContext ("VHDL","case2"))    <|>-   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_case >>= withAttribute KeywordTok)))+   ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_case >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","case1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","case1") defaultAttributes)))  parseRules ("VHDL","case2") =   (((parseRules ("VHDL","preDetection")))@@ -269,7 +295,9 @@    <|>    ((pString False "when" >>= withAttribute KeywordTok) >>~ pushContext ("VHDL","caseWhen"))    <|>-   ((parseRules ("VHDL","proc_rules"))))+   ((parseRules ("VHDL","proc_rules")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","case2")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","case2") defaultAttributes)))  parseRules ("VHDL","caseWhen") =   (((parseRules ("VHDL","preDetection")))@@ -278,14 +306,18 @@    <|>    ((lookAhead (pRegExpr regex_'28'5cb'29end'5cs'2bcase'28'5cs'2b'5cb'28'3f'21'28'3f'3aprocess'7cconstant'7csignal'7cvariable'29'29'28'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'29'5cb'29'3f'5cs'2a'3b) >> (popContext) >> currentContext >>= parseRules))    <|>-   ((parseRules ("VHDL","proc_rules"))))+   ((parseRules ("VHDL","proc_rules")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","caseWhen")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","caseWhen") defaultAttributes)))  parseRules ("VHDL","entity") =   (((parseRules ("VHDL","preDetection")))    <|>    ((pRegExpr regex_'28'5cb'28'3f'21'28'3f'3aprocess'7cconstant'7csignal'7cvariable'29'29'28'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'29'5cb'29 >>= withAttribute KeywordTok) >>~ pushContext ("VHDL","entity_main"))    <|>-   ((parseRules ("VHDL","generalDetection"))))+   ((parseRules ("VHDL","generalDetection")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","entity")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","entity") defaultAttributes)))  parseRules ("VHDL","entity_main") =   (((parseRules ("VHDL","preDetection")))@@ -298,7 +330,9 @@    <|>    ((pRegExpr regex_port >>= withAttribute KeywordTok))    <|>-   ((parseRules ("VHDL","generalDetection"))))+   ((parseRules ("VHDL","generalDetection")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","entity_main")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","entity_main") defaultAttributes)))  parseRules ("VHDL","preDetection") =   (((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("VHDL","comment"))@@ -307,7 +341,9 @@    <|>    ((pAnyChar "[&><=:+\\-*\\/|].," >>= withAttribute OtherTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute BaseNTok) >>~ pushContext ("VHDL","attribute")))+   ((pDetectChar False '\'' >>= withAttribute BaseNTok) >>~ pushContext ("VHDL","attribute"))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","preDetection")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","preDetection") defaultAttributes)))  parseRules ("VHDL","generalDetection") =   (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_types >>= withAttribute DataTypeTok))@@ -322,13 +358,17 @@    <|>    ((pHlCChar >>= withAttribute CharTok))    <|>-   ((pDetectSpaces >>= withAttribute NormalTok)))+   ((pDetectSpaces >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","generalDetection")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","generalDetection") defaultAttributes)))  parseRules ("VHDL","comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("VHDL","comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","comment") defaultAttributes))  parseRules ("VHDL","string") =-  ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+  (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","string") defaultAttributes)))  parseRules ("VHDL","attribute") =   (((pDetectChar False '"' >>= withAttribute BaseNTok) >>~ pushContext ("VHDL","quot in att"))@@ -337,17 +377,23 @@    <|>    ((pDetectChar False '\'' >>= withAttribute BaseNTok) >>~ (popContext))    <|>-   ((pAnyChar "()=<>" >>= withAttribute BaseNTok) >>~ (popContext)))+   ((pAnyChar "()=<>" >>= withAttribute BaseNTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","attribute")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","attribute") defaultAttributes)))  parseRules ("VHDL","quot in att") =-  ((pDetectChar False '"' >>= withAttribute BaseNTok) >>~ (popContext))+  (((pDetectChar False '"' >>= withAttribute BaseNTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","quot in att")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","quot in att") defaultAttributes)))  parseRules ("VHDL","signal") =   (((parseRules ("VHDL","preDetection")))    <|>    ((pDetectChar False ';' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("VHDL","generalDetection"))))+   ((parseRules ("VHDL","generalDetection")))+   <|>+   (currentContext >>= \x -> guard (x == ("VHDL","signal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("VHDL","signal") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("VHDL","start") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Xml.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "XML"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("XML","Start")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -90,7 +86,9 @@ defaultAttributes = [(("XML","Start"),NormalTok),(("XML","FindXML"),NormalTok),(("XML","FindEntityRefs"),NormalTok),(("XML","FindPEntityRefs"),NormalTok),(("XML","Comment"),CommentTok),(("XML","CDATA"),NormalTok),(("XML","PI"),NormalTok),(("XML","Doctype"),NormalTok),(("XML","Doctype Internal Subset"),NormalTok),(("XML","Doctype Markupdecl"),NormalTok),(("XML","Doctype Markupdecl DQ"),StringTok),(("XML","Doctype Markupdecl SQ"),StringTok),(("XML","Element"),NormalTok),(("XML","El Content"),NormalTok),(("XML","El End"),NormalTok),(("XML","Attribute"),NormalTok),(("XML","Value"),NormalTok),(("XML","Value DQ"),StringTok),(("XML","Value SQ"),StringTok)]  parseRules ("XML","Start") =-  ((parseRules ("XML","FindXML")))+  (((parseRules ("XML","FindXML")))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","Start")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","Start") defaultAttributes)))  parseRules ("XML","FindXML") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -107,19 +105,25 @@    <|>    ((parseRules ("XML","FindEntityRefs")))    <|>-   ((pDetectIdentifier >>= withAttribute NormalTok)))+   ((pDetectIdentifier >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","FindXML")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","FindXML") defaultAttributes)))  parseRules ("XML","FindEntityRefs") =   (((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'28'3f'21'5b0'2d9'5d'29'5b'5cw'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok))    <|>-   ((pAnyChar "&<" >>= withAttribute ErrorTok)))+   ((pAnyChar "&<" >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","FindEntityRefs")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","FindEntityRefs") defaultAttributes)))  parseRules ("XML","FindPEntityRefs") =   (((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'28'3f'21'5b0'2d9'5d'29'5b'5cw'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok))    <|>    ((pRegExpr regex_'25'28'3f'21'5b0'2d9'5d'29'5b'5cw'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'3b >>= withAttribute DecValTok))    <|>-   ((pAnyChar "&%" >>= withAttribute ErrorTok)))+   ((pAnyChar "&%" >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","FindPEntityRefs")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","FindPEntityRefs") defaultAttributes)))  parseRules ("XML","Comment") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -130,7 +134,9 @@    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","Comment") defaultAttributes)))  parseRules ("XML","CDATA") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -139,15 +145,21 @@    <|>    ((pString False "]]>" >>= withAttribute BaseNTok) >>~ (popContext))    <|>-   ((pString False "]]&gt;" >>= withAttribute DecValTok)))+   ((pString False "]]&gt;" >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","CDATA")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","CDATA") defaultAttributes)))  parseRules ("XML","PI") =-  ((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext))+  (((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","PI")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","PI") defaultAttributes)))  parseRules ("XML","Doctype") =   (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext))    <|>-   ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("XML","Doctype Internal Subset")))+   ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("XML","Doctype Internal Subset"))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","Doctype")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","Doctype") defaultAttributes)))  parseRules ("XML","Doctype Internal Subset") =   (((pDetectChar False ']' >>= withAttribute DataTypeTok) >>~ (popContext))@@ -158,24 +170,32 @@    <|>    ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("XML","PI"))    <|>-   ((parseRules ("XML","FindPEntityRefs"))))+   ((parseRules ("XML","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","Doctype Internal Subset")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","Doctype Internal Subset") defaultAttributes)))  parseRules ("XML","Doctype Markupdecl") =   (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext))    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("XML","Doctype Markupdecl DQ"))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("XML","Doctype Markupdecl SQ")))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("XML","Doctype Markupdecl SQ"))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","Doctype Markupdecl")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","Doctype Markupdecl") defaultAttributes)))  parseRules ("XML","Doctype Markupdecl DQ") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("XML","FindPEntityRefs"))))+   ((parseRules ("XML","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","Doctype Markupdecl DQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","Doctype Markupdecl DQ") defaultAttributes)))  parseRules ("XML","Doctype Markupdecl SQ") =   (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("XML","FindPEntityRefs"))))+   ((parseRules ("XML","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","Doctype Markupdecl SQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","Doctype Markupdecl SQ") defaultAttributes)))  parseRules ("XML","Element") =   (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext))@@ -186,40 +206,54 @@    <|>    ((pRegExpr regex_'5cs'2b'28'3f'21'5b0'2d9'5d'29'5b'5cw'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute OtherTok) >>~ pushContext ("XML","Attribute"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","Element")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","Element") defaultAttributes)))  parseRules ("XML","El Content") =   (((pRegExpr regex_'3c'2f'28'3f'21'5b0'2d9'5d'29'5b'5cw'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("XML","El End"))    <|>-   ((parseRules ("XML","FindXML"))))+   ((parseRules ("XML","FindXML")))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","El Content")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","El Content") defaultAttributes)))  parseRules ("XML","El End") =   (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","El End")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","El End") defaultAttributes)))  parseRules ("XML","Attribute") =   (((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("XML","Value"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","Attribute")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","Attribute") defaultAttributes)))  parseRules ("XML","Value") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("XML","Value DQ"))    <|>    ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("XML","Value SQ"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","Value") defaultAttributes)))  parseRules ("XML","Value DQ") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((parseRules ("XML","FindEntityRefs"))))+   ((parseRules ("XML","FindEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","Value DQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","Value DQ") defaultAttributes)))  parseRules ("XML","Value SQ") =   (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((parseRules ("XML","FindEntityRefs"))))+   ((parseRules ("XML","FindEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("XML","Value SQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XML","Value SQ") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("XML","Start") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Xorg.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "x.org Configuration"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("x.org Configuration","xorg")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -69,7 +65,9 @@ parseRules ("x.org Configuration","xorg") =   (((pString False "Section" >>= withAttribute FunctionTok) >>~ pushContext ("x.org Configuration","Section"))    <|>-   ((pDetectChar False '#' >>= withAttribute NormalTok) >>~ pushContext ("x.org Configuration","Comment")))+   ((pDetectChar False '#' >>= withAttribute NormalTok) >>~ pushContext ("x.org Configuration","Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("x.org Configuration","xorg")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("x.org Configuration","xorg") defaultAttributes)))  parseRules ("x.org Configuration","Section") =   (((pRangeDetect '"' '"' >>= withAttribute StringTok) >>~ pushContext ("x.org Configuration","Section Content"))@@ -78,7 +76,9 @@    <|>    ((pDetectIdentifier >>= withAttribute ErrorTok))    <|>-   ((pDetectChar False '#' >>= withAttribute NormalTok) >>~ pushContext ("x.org Configuration","Comment")))+   ((pDetectChar False '#' >>= withAttribute NormalTok) >>~ pushContext ("x.org Configuration","Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("x.org Configuration","Section")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("x.org Configuration","Section") defaultAttributes)))  parseRules ("x.org Configuration","Section Content") =   (((pString False "EndSection" >>= withAttribute FunctionTok) >>~ (popContext >> popContext))@@ -89,7 +89,9 @@    <|>    ((pRegExpr regex_'5cb'5cw'2b'5cb >>= withAttribute NormalTok) >>~ pushContext ("x.org Configuration","Keyword"))    <|>-   ((pDetectChar False '#' >>= withAttribute NormalTok) >>~ pushContext ("x.org Configuration","Comment")))+   ((pDetectChar False '#' >>= withAttribute NormalTok) >>~ pushContext ("x.org Configuration","Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("x.org Configuration","Section Content")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("x.org Configuration","Section Content") defaultAttributes)))  parseRules ("x.org Configuration","Keyword") =   (((pRangeDetect '"' '"' >>= withAttribute DataTypeTok))@@ -102,15 +104,19 @@    <|>    ((pRegExpr regex_'5b'5cw'5cd'5d'2b >>= withAttribute OtherTok))    <|>-   ((pDetectChar False '#' >>= withAttribute KeywordTok) >>~ pushContext ("x.org Configuration","Comment")))+   ((pDetectChar False '#' >>= withAttribute KeywordTok) >>~ pushContext ("x.org Configuration","Comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("x.org Configuration","Keyword")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("x.org Configuration","Keyword") defaultAttributes)))  parseRules ("x.org Configuration","Comment") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("x.org Configuration","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("x.org Configuration","Comment") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("x.org Configuration","xorg") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Xslt.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "xslt"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("xslt","normalText")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -112,7 +108,9 @@    <|>    ((pDetectChar False '<' >>= withAttribute KeywordTok) >>~ pushContext ("xslt","tagname"))    <|>-   ((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok)))+   ((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","normalText")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","normalText") defaultAttributes)))  parseRules ("xslt","CDATA") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -121,15 +119,21 @@    <|>    ((pString False "]]>" >>= withAttribute BaseNTok) >>~ (popContext))    <|>-   ((pString False "]]&gt;" >>= withAttribute DecValTok)))+   ((pString False "]]&gt;" >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","CDATA")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","CDATA") defaultAttributes)))  parseRules ("xslt","PI") =-  ((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext))+  (((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","PI")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","PI") defaultAttributes)))  parseRules ("xslt","Doctype") =   (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext))    <|>-   ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("xslt","Doctype Internal Subset")))+   ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("xslt","Doctype Internal Subset"))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","Doctype")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","Doctype") defaultAttributes)))  parseRules ("xslt","Doctype Internal Subset") =   (((pDetectChar False ']' >>= withAttribute DataTypeTok) >>~ (popContext))@@ -140,34 +144,46 @@    <|>    ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("xslt","PI"))    <|>-   ((parseRules ("xslt","FindPEntityRefs"))))+   ((parseRules ("xslt","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","Doctype Internal Subset")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","Doctype Internal Subset") defaultAttributes)))  parseRules ("xslt","Doctype Markupdecl") =   (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext))    <|>    ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("xslt","Doctype Markupdecl DQ"))    <|>-   ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext ("xslt","Doctype Markupdecl SQ")))+   ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext ("xslt","Doctype Markupdecl SQ"))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","Doctype Markupdecl")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","Doctype Markupdecl") defaultAttributes)))  parseRules ("xslt","Doctype Markupdecl DQ") =   (((pDetectChar False '"' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("xslt","FindPEntityRefs"))))+   ((parseRules ("xslt","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","Doctype Markupdecl DQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","Doctype Markupdecl DQ") defaultAttributes)))  parseRules ("xslt","Doctype Markupdecl SQ") =   (((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((parseRules ("xslt","FindPEntityRefs"))))+   ((parseRules ("xslt","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","Doctype Markupdecl SQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","Doctype Markupdecl SQ") defaultAttributes)))  parseRules ("xslt","detectEntRef") =-  ((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok))+  (((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","detectEntRef")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","detectEntRef") defaultAttributes)))  parseRules ("xslt","FindPEntityRefs") =   (((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok))    <|>    ((pRegExpr regex_'25'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'3b >>= withAttribute DecValTok))    <|>-   ((pAnyChar "&%" >>= withAttribute NormalTok)))+   ((pAnyChar "&%" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","FindPEntityRefs")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","FindPEntityRefs") defaultAttributes)))  parseRules ("xslt","tagname") =   (((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\\"{}" list_keytags >>= withAttribute KeywordTok) >>~ pushContext ("xslt","xattributes"))@@ -176,14 +192,18 @@    <|>    ((pRegExpr regex_'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("xslt","attributes"))    <|>-   ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","tagname")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","tagname") defaultAttributes)))  parseRules ("xslt","attributes") =   (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>    ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("xslt","attrValue")))+   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("xslt","attrValue"))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","attributes")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","attributes") defaultAttributes)))  parseRules ("xslt","attrValue") =   (((pDetect2Chars False '/' '>' >>= withAttribute ErrorTok) >>~ (popContext >> popContext >> popContext))@@ -192,7 +212,9 @@    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("xslt","string"))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("xslt","sqstring")))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("xslt","sqstring"))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","attrValue")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","attrValue") defaultAttributes)))  parseRules ("xslt","xattributes") =   (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))@@ -205,7 +227,9 @@    <|>    ((pRegExpr regex_match'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("xslt","xattrValue"))    <|>-   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("xslt","attrValue")))+   ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("xslt","attrValue"))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","xattributes")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","xattributes") defaultAttributes)))  parseRules ("xslt","xattrValue") =   (((pDetect2Chars False '/' '>' >>= withAttribute ErrorTok) >>~ (popContext >> popContext >> popContext))@@ -214,28 +238,36 @@    <|>    ((pDetectChar False '"' >>= withAttribute OtherTok) >>~ pushContext ("xslt","xpath"))    <|>-   ((pDetectChar False '\'' >>= withAttribute OtherTok) >>~ pushContext ("xslt","sqxpath")))+   ((pDetectChar False '\'' >>= withAttribute OtherTok) >>~ pushContext ("xslt","sqxpath"))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","xattrValue")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","xattrValue") defaultAttributes)))  parseRules ("xslt","string") =   (((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext ("xslt","xpath"))    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("xslt","detectEntRef"))))+   ((parseRules ("xslt","detectEntRef")))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","string") defaultAttributes)))  parseRules ("xslt","sqstring") =   (((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext ("xslt","sqxpath"))    <|>    ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext >> popContext))    <|>-   ((parseRules ("xslt","detectEntRef"))))+   ((parseRules ("xslt","detectEntRef")))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","sqstring")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","sqstring") defaultAttributes)))  parseRules ("xslt","comment") =   (((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))    <|>    ((pRegExpr regex_'2d'28'2d'28'3f'21'2d'3e'29'29'2b >>= withAttribute ErrorTok))    <|>-   ((pRegExpr regex_'28FIXME'7cTODO'7cHACK'29 >>= withAttribute AlertTok)))+   ((pRegExpr regex_'28FIXME'7cTODO'7cHACK'29 >>= withAttribute AlertTok))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","comment") defaultAttributes)))  parseRules ("xslt","xpath") =   (((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\\"{}" list_functions >>= withAttribute KeywordTok))@@ -258,7 +290,9 @@    <|>    ((pDetectChar False '$' >>= withAttribute ErrorTok))    <|>-   ((parseRules ("xslt","detectEntRef"))))+   ((parseRules ("xslt","detectEntRef")))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","xpath")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","xpath") defaultAttributes)))  parseRules ("xslt","sqxpath") =   (((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\\"{}" list_functions >>= withAttribute KeywordTok))@@ -281,17 +315,23 @@    <|>    ((pDetectChar False '$' >>= withAttribute ErrorTok))    <|>-   ((parseRules ("xslt","detectEntRef"))))+   ((parseRules ("xslt","detectEntRef")))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","sqxpath")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","sqxpath") defaultAttributes)))  parseRules ("xslt","sqxpathstring") =   (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("xslt","detectEntRef"))))+   ((parseRules ("xslt","detectEntRef")))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","sqxpathstring")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","sqxpathstring") defaultAttributes)))  parseRules ("xslt","xpathstring") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("xslt","detectEntRef"))))+   ((parseRules ("xslt","detectEntRef")))+   <|>+   (currentContext >>= \x -> guard (x == ("xslt","xpathstring")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("xslt","xpathstring") defaultAttributes)))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("xslt","normalText") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Xul.hs view
@@ -32,11 +32,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "XUL"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("XUL","Start")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -118,7 +114,9 @@ defaultAttributes = [(("XUL","Start"),NormalTok),(("XUL","FindXML"),NormalTok),(("XUL","FindEntityRefs"),NormalTok),(("XUL","FindPEntityRefs"),NormalTok),(("XUL","Comment"),CommentTok),(("XUL","PI"),NormalTok),(("XUL","Doctype"),NormalTok),(("XUL","Doctype Internal Subset"),NormalTok),(("XUL","Doctype Markupdecl"),NormalTok),(("XUL","Doctype Markupdecl DQ"),StringTok),(("XUL","Doctype Markupdecl SQ"),StringTok),(("XUL","Element"),NormalTok),(("XUL","El Content"),NormalTok),(("XUL","El End"),NormalTok),(("XUL","Attribute"),NormalTok),(("XUL","Value"),NormalTok),(("XUL","Value DQ"),StringTok),(("XUL","Value SQ"),StringTok),(("XUL","CDATA"),NormalTok),(("XUL","String"),StringTok),(("XUL","String 1"),CharTok),(("XUL","JSComment"),CommentTok),(("XUL","Multi/inline Comment"),CommentTok),(("XUL","Regular Expression"),OtherTok),(("XUL","(Internal regex catch)"),NormalTok),(("XUL","Regular Expression Character Class"),BaseNTok),(("XUL","(regex caret first check)"),FloatTok),(("XUL","(charclass caret first check)"),FloatTok),(("XUL","region_marker"),RegionMarkerTok)]  parseRules ("XUL","Start") =-  ((parseRules ("XUL","FindXML")))+  (((parseRules ("XUL","FindXML")))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Start")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Start") defaultAttributes)))  parseRules ("XUL","FindXML") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -135,19 +133,25 @@    <|>    ((parseRules ("XUL","FindEntityRefs")))    <|>-   ((pDetectIdentifier >>= withAttribute NormalTok)))+   ((pDetectIdentifier >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","FindXML")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","FindXML") defaultAttributes)))  parseRules ("XUL","FindEntityRefs") =   (((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok))    <|>-   ((pAnyChar "&<" >>= withAttribute ErrorTok)))+   ((pAnyChar "&<" >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","FindEntityRefs")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","FindEntityRefs") defaultAttributes)))  parseRules ("XUL","FindPEntityRefs") =   (((pRegExpr regex_'26'28'23'5b0'2d9'5d'2b'7c'23'5bxX'5d'5b0'2d9A'2dFa'2df'5d'2b'7c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29'3b >>= withAttribute DecValTok))    <|>    ((pRegExpr regex_'25'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'3b >>= withAttribute DecValTok))    <|>-   ((pAnyChar "&%" >>= withAttribute ErrorTok)))+   ((pAnyChar "&%" >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","FindPEntityRefs")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","FindPEntityRefs") defaultAttributes)))  parseRules ("XUL","Comment") =   (((pDetectSpaces >>= withAttribute CommentTok))@@ -158,15 +162,21 @@    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Comment") defaultAttributes)))  parseRules ("XUL","PI") =-  ((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext))+  (((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","PI")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","PI") defaultAttributes)))  parseRules ("XUL","Doctype") =   (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext))    <|>-   ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("XUL","Doctype Internal Subset")))+   ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("XUL","Doctype Internal Subset"))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Doctype")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Doctype") defaultAttributes)))  parseRules ("XUL","Doctype Internal Subset") =   (((pDetectChar False ']' >>= withAttribute DataTypeTok) >>~ (popContext))@@ -177,24 +187,32 @@    <|>    ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("XUL","PI"))    <|>-   ((parseRules ("XUL","FindPEntityRefs"))))+   ((parseRules ("XUL","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Doctype Internal Subset")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Doctype Internal Subset") defaultAttributes)))  parseRules ("XUL","Doctype Markupdecl") =   (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext))    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("XUL","Doctype Markupdecl DQ"))    <|>-   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("XUL","Doctype Markupdecl SQ")))+   ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("XUL","Doctype Markupdecl SQ"))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Doctype Markupdecl")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Doctype Markupdecl") defaultAttributes)))  parseRules ("XUL","Doctype Markupdecl DQ") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("XUL","FindPEntityRefs"))))+   ((parseRules ("XUL","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Doctype Markupdecl DQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Doctype Markupdecl DQ") defaultAttributes)))  parseRules ("XUL","Doctype Markupdecl SQ") =   (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))    <|>-   ((parseRules ("XUL","FindPEntityRefs"))))+   ((parseRules ("XUL","FindPEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Doctype Markupdecl SQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Doctype Markupdecl SQ") defaultAttributes)))  parseRules ("XUL","Element") =   (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext))@@ -205,39 +223,53 @@    <|>    ((pRegExpr regex_'5cs'2b'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute OtherTok) >>~ pushContext ("XUL","Attribute"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Element")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Element") defaultAttributes)))  parseRules ("XUL","El Content") =   (((pRegExpr regex_'3c'2f'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("XUL","El End"))    <|>-   ((parseRules ("XUL","FindXML"))))+   ((parseRules ("XUL","FindXML")))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","El Content")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","El Content") defaultAttributes)))  parseRules ("XUL","El End") =   (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","El End")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","El End") defaultAttributes)))  parseRules ("XUL","Attribute") =   (((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("XUL","Value"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Attribute")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Attribute") defaultAttributes)))  parseRules ("XUL","Value") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("XUL","Value DQ"))    <|>    ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("XUL","Value SQ"))    <|>-   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok)))+   ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Value")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Value") defaultAttributes)))  parseRules ("XUL","Value DQ") =   (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((parseRules ("XUL","FindEntityRefs"))))+   ((parseRules ("XUL","FindEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Value DQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Value DQ") defaultAttributes)))  parseRules ("XUL","Value SQ") =   (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext >> popContext >> popContext))    <|>-   ((parseRules ("XUL","FindEntityRefs"))))+   ((parseRules ("XUL","FindEntityRefs")))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Value SQ")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Value SQ") defaultAttributes)))  parseRules ("XUL","CDATA") =   (((pString False "]]>" >>= withAttribute BaseNTok) >>~ (popContext))@@ -284,33 +316,43 @@    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok))    <|>-   ((pAnyChar ":!%&+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok)))+   ((pAnyChar ":!%&+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","CDATA")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","CDATA") defaultAttributes)))  parseRules ("XUL","String") =   (((pDetectIdentifier >>= withAttribute StringTok))    <|>    ((pHlCStringChar >>= withAttribute CharTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","String") defaultAttributes)))  parseRules ("XUL","String 1") =   (((pDetectIdentifier >>= withAttribute CharTok))    <|>    ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("XUL","String"))    <|>-   ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","String 1")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","String 1") defaultAttributes)))  parseRules ("XUL","JSComment") =   (((pDetectSpaces >>= withAttribute CommentTok))    <|>    ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetectIdentifier >>= withAttribute CommentTok)))+   ((pDetectIdentifier >>= withAttribute CommentTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","JSComment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","JSComment") defaultAttributes)))  parseRules ("XUL","Multi/inline Comment") =   (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))    <|>-   ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)))+   ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Multi/inline Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Multi/inline Comment") defaultAttributes)))  parseRules ("XUL","Regular Expression") =   (((pRegExpr regex_'2f'5big'5d'7b0'2c2'7d >>= withAttribute OtherTok) >>~ (popContext >> popContext >> popContext))@@ -327,7 +369,9 @@    <|>    ((pRegExpr regex_'5c'24'28'3f'3d'2f'29 >>= withAttribute FloatTok))    <|>-   ((pAnyChar "?+*()|" >>= withAttribute FloatTok)))+   ((pAnyChar "?+*()|" >>= withAttribute FloatTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Regular Expression")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Regular Expression") defaultAttributes)))  parseRules ("XUL","(Internal regex catch)") =   (((pRegExpr regex_'5cs'2a >>= withAttribute NormalTok))@@ -345,7 +389,9 @@ parseRules ("XUL","Regular Expression Character Class") =   (((pRegExpr regex_'5c'5c'5b'5c'5b'5c'5d'5d >>= withAttribute BaseNTok))    <|>-   ((pDetectChar False ']' >>= withAttribute BaseNTok) >>~ (popContext >> popContext)))+   ((pDetectChar False ']' >>= withAttribute BaseNTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","Regular Expression Character Class")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","Regular Expression Character Class") defaultAttributes)))  parseRules ("XUL","(regex caret first check)") =   (((pDetectChar False '^' >>= withAttribute FloatTok) >>~ pushContext ("XUL","Regular Expression"))@@ -360,8 +406,10 @@ parseRules ("XUL","region_marker") =   (((pDetectIdentifier >>= withAttribute RegionMarkerTok))    <|>-   ((pDetectSpaces >>= withAttribute RegionMarkerTok)))+   ((pDetectSpaces >>= withAttribute RegionMarkerTok))+   <|>+   (currentContext >>= \x -> guard (x == ("XUL","region_marker")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("XUL","region_marker") defaultAttributes)))  parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("XUL","Start") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Yacc.hs view
@@ -31,11 +31,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "Yacc/Bison"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("Yacc/Bison","Pre Start")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -93,14 +89,18 @@    <|>    ((pColumn 0 >> pDetect2Chars False '%' '{' >>= withAttribute BaseNTok) >>~ pushContext ("Yacc/Bison","C Declarations"))    <|>-   ((lookAhead (pRegExpr regex_'2e) >> pushContext ("Yacc/Bison","Declarations") >> currentContext >>= parseRules)))+   ((lookAhead (pRegExpr regex_'2e) >> pushContext ("Yacc/Bison","Declarations") >> currentContext >>= parseRules))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","Pre Start")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","Pre Start") defaultAttributes)))  parseRules ("Yacc/Bison","C Declarations") =   (((parseRules ("Yacc/Bison","Comment")))    <|>    ((pColumn 0 >> pDetect2Chars False '%' '}' >>= withAttribute BaseNTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","C Declarations")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","C Declarations") defaultAttributes)))  parseRules ("Yacc/Bison","Declarations") =   (((parseRules ("Yacc/Bison","Comment")))@@ -111,7 +111,9 @@    <|>    ((pColumn 0 >> pDetect2Chars False '%' '{' >>= withAttribute BaseNTok) >>~ pushContext ("Yacc/Bison","C Declarations"))    <|>-   ((pDetectChar False '%' >>= withAttribute KeywordTok) >>~ pushContext ("Yacc/Bison","Percent Command")))+   ((pDetectChar False '%' >>= withAttribute KeywordTok) >>~ pushContext ("Yacc/Bison","Percent Command"))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","Declarations")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","Declarations") defaultAttributes)))  parseRules ("Yacc/Bison","Union Start") =   (((parseRules ("Yacc/Bison","Comment")))@@ -120,28 +122,36 @@    <|>    ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("Yacc/Bison","Union In"))    <|>-   ((pRegExpr regex_'2e >>= withAttribute AlertTok) >>~ (popContext)))+   ((pRegExpr regex_'2e >>= withAttribute AlertTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","Union Start")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","Union Start") defaultAttributes)))  parseRules ("Yacc/Bison","Union In") =   (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("Yacc/Bison","Union InIn"))    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext >> popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","Union In")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","Union In") defaultAttributes)))  parseRules ("Yacc/Bison","Union InIn") =   (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("Yacc/Bison","Union InIn"))    <|>    ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext))    <|>-   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression)))+   ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","Union InIn")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","Union InIn") defaultAttributes)))  parseRules ("Yacc/Bison","Rules") =   (((parseRules ("Yacc/Bison","Comment")))    <|>    ((pDetect2Chars False '%' '%' >>= withAttribute BaseNTok) >>~ pushContext ("Yacc/Bison","User Code"))    <|>-   ((pDetectChar False ':' >>= withAttribute NormalTok) >>~ pushContext ("Yacc/Bison","Rule In")))+   ((pDetectChar False ':' >>= withAttribute NormalTok) >>~ pushContext ("Yacc/Bison","Rule In"))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","Rules")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","Rules") defaultAttributes)))  parseRules ("Yacc/Bison","Rule In") =   (((parseRules ("Yacc/Bison","Comment")))@@ -152,49 +162,71 @@    <|>    ((pDetectChar False '|' >>= withAttribute NormalTok))    <|>-   ((parseRules ("Yacc/Bison","StringOrChar"))))+   ((parseRules ("Yacc/Bison","StringOrChar")))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","Rule In")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","Rule In") defaultAttributes)))  parseRules ("Yacc/Bison","User Code") =-  ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+  (((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","User Code")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","User Code") defaultAttributes)))  parseRules ("Yacc/Bison","Percent Command") =   (((parseRules ("Yacc/Bison","Comment")))    <|>-   ((lookAhead (pRegExpr regex_'5cW) >> pushContext ("Yacc/Bison","Percent Command In") >> currentContext >>= parseRules)))+   ((lookAhead (pRegExpr regex_'5cW) >> pushContext ("Yacc/Bison","Percent Command In") >> currentContext >>= parseRules))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","Percent Command")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","Percent Command") defaultAttributes)))  parseRules ("Yacc/Bison","Percent Command In") =   (((parseRules ("Yacc/Bison","StringOrChar")))    <|>-   ((pDetectChar False '<' >>= withAttribute DataTypeTok) >>~ pushContext ("Yacc/Bison","PC type")))+   ((pDetectChar False '<' >>= withAttribute DataTypeTok) >>~ pushContext ("Yacc/Bison","PC type"))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","Percent Command In")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","Percent Command In") defaultAttributes)))  parseRules ("Yacc/Bison","PC type") =-  ((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext))+  (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","PC type")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","PC type") defaultAttributes)))  parseRules ("Yacc/Bison","Comment") =   (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Yacc/Bison","CommentStar"))    <|>-   ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Yacc/Bison","CommentSlash")))+   ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Yacc/Bison","CommentSlash"))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","Comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","Comment") defaultAttributes)))  parseRules ("Yacc/Bison","CommentStar") =-  ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+  (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","CommentStar")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","CommentStar") defaultAttributes)))  parseRules ("Yacc/Bison","CommentSlash") =-  ((pRegExpr regex_'5b'5e'5c'5c'5d'24 >>= withAttribute CommentTok) >>~ (popContext))+  (((pRegExpr regex_'5b'5e'5c'5c'5d'24 >>= withAttribute CommentTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","CommentSlash")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","CommentSlash") defaultAttributes)))  parseRules ("Yacc/Bison","StringOrChar") =   (((pDetectChar False '\'' >>= withAttribute CharTok) >>~ pushContext ("Yacc/Bison","Char"))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Yacc/Bison","String")))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Yacc/Bison","String"))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","StringOrChar")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","StringOrChar") defaultAttributes)))  parseRules ("Yacc/Bison","String") =   (((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok))    <|>-   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","String")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","String") defaultAttributes)))  parseRules ("Yacc/Bison","Char") =   (((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","Char")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","Char") defaultAttributes)))  parseRules ("Yacc/Bison","Normal C Bloc") =   (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("Yacc/Bison","Normal C Bloc"))@@ -203,7 +235,9 @@    <|>    ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))    <|>-   ((pDetectChar False '$' >>= withAttribute KeywordTok) >>~ pushContext ("Yacc/Bison","Dol")))+   ((pDetectChar False '$' >>= withAttribute KeywordTok) >>~ pushContext ("Yacc/Bison","Dol"))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","Normal C Bloc")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","Normal C Bloc") defaultAttributes)))  parseRules ("Yacc/Bison","Dol") =   (((pRegExpr regex_'3c'5b'5e'3e'5d'2b'3e >>= withAttribute DataTypeTok) >>~ pushContext ("Yacc/Bison","DolEnd"))@@ -213,8 +247,10 @@ parseRules ("Yacc/Bison","DolEnd") =   (((pRegExpr regex_'5cd'2b >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>-   ((pDetectChar False '$' >>= withAttribute KeywordTok) >>~ (popContext >> popContext)))+   ((pDetectChar False '$' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("Yacc/Bison","DolEnd")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("Yacc/Bison","DolEnd") defaultAttributes)))  parseRules ("C++", _) = Text.Highlighting.Kate.Syntax.Cpp.parseExpression -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("Yacc/Bison","Pre Start") <|> fail ("Unknown context" ++ show x)
Text/Highlighting/Kate/Syntax/Yaml.hs view
@@ -30,11 +30,7 @@ parseExpression :: KateParser Token parseExpression = do   (lang,cont) <- currentContext-  let defAttr = fromMaybe NormalTok $ lookup (lang,cont) defaultAttributes-  result <- if lang == "YAML"-               then parseRules (lang,cont) <|>-                      (pDefault >>= withAttribute defAttr)-               else parseRules ("YAML","normal")+  result <- parseRules (lang,cont)   optional $ do eof                 updateState $ \st -> st{ synStPrevChar = '\n' }                 pEndLine@@ -122,7 +118,9 @@    <|>    ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext ("YAML","string"))    <|>-   ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("YAML","stringx")))+   ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("YAML","stringx"))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","normal")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","normal") defaultAttributes)))  parseRules ("YAML","dash") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -137,26 +135,34 @@    <|>    ((pRegExpr regex_'5c'2a'5cS'2b >>= withAttribute DataTypeTok))    <|>-   ((lookAhead (pRegExpr regex_'2e) >> (popContext) >> currentContext >>= parseRules)))+   ((lookAhead (pRegExpr regex_'2e) >> (popContext) >> currentContext >>= parseRules))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","dash")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","dash") defaultAttributes)))  parseRules ("YAML","header") =-  ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment"))+  (((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","header")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","header") defaultAttributes)))  parseRules ("YAML","EOD") =-  pzero+  (currentContext >>= \x -> guard (x == ("YAML","EOD")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","EOD") defaultAttributes))  parseRules ("YAML","directive") =-  pzero+  (currentContext >>= \x -> guard (x == ("YAML","directive")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","directive") defaultAttributes))  parseRules ("YAML","attribute") =-  ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment"))+  (((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","attribute")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","attribute") defaultAttributes)))  parseRules ("YAML","attribute-inline") =   (((pDetectChar False ',' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))    <|>    ((lookAhead (pDetectChar False '}') >> (popContext >> popContext) >> currentContext >>= parseRules))    <|>-   ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment")))+   ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment"))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","attribute-inline")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","attribute-inline") defaultAttributes)))  parseRules ("YAML","attribute-pre") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -179,7 +185,9 @@    <|>    ((pRegExpr regex_'5c'2a'5cS'2b >>= withAttribute DataTypeTok) >>~ pushContext ("YAML","attribute"))    <|>-   ((pRegExpr regex_'2e >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute")))+   ((pRegExpr regex_'2e >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute"))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","attribute-pre")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","attribute-pre") defaultAttributes)))  parseRules ("YAML","attribute-pre-inline") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -206,7 +214,9 @@    <|>    ((lookAhead (pDetectChar False '}') >> (popContext) >> currentContext >>= parseRules))    <|>-   ((pRegExpr regex_'2e >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-inline")))+   ((pRegExpr regex_'2e >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-inline"))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","attribute-pre-inline")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","attribute-pre-inline") defaultAttributes)))  parseRules ("YAML","list") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -237,7 +247,9 @@    <|>    ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("YAML","stringx"))    <|>-   ((pDetectChar False ',' >>= withAttribute KeywordTok)))+   ((pDetectChar False ',' >>= withAttribute KeywordTok))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","list")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","list") defaultAttributes)))  parseRules ("YAML","hash") =   (((pDetectSpaces >>= withAttribute NormalTok))@@ -250,50 +262,66 @@    <|>    ((pRegExpr regex_'5c'3f'3f'5cs'2a'27'5b'5e'27'23'5d'2b'27'5cs'2a'3a >>= withAttribute FunctionTok) >>~ pushContext ("YAML","attribute-pre-inline"))    <|>-   ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext)))+   ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","hash")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","hash") defaultAttributes)))  parseRules ("YAML","attribute-string") =   (((pDetectIdentifier >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-end")))+   ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-end"))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","attribute-string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","attribute-string") defaultAttributes)))  parseRules ("YAML","attribute-stringx") =   (((pDetectIdentifier >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-end")))+   ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-end"))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","attribute-stringx")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","attribute-stringx") defaultAttributes)))  parseRules ("YAML","attribute-string-inline") =   (((pDetectIdentifier >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-end-inline")))+   ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-end-inline"))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","attribute-string-inline")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","attribute-string-inline") defaultAttributes)))  parseRules ("YAML","attribute-stringx-inline") =   (((pDetectIdentifier >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-end-inline")))+   ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-end-inline"))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","attribute-stringx-inline")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","attribute-stringx-inline") defaultAttributes)))  parseRules ("YAML","attribute-end") =-  pzero+  (currentContext >>= \x -> guard (x == ("YAML","attribute-end")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","attribute-end") defaultAttributes))  parseRules ("YAML","attribute-end-inline") =   (((pRegExpr regex_'5cs'2a >>= withAttribute NormalTok))    <|>    ((lookAhead (pDetectChar False '}') >> (popContext >> popContext >> popContext) >> currentContext >>= parseRules))    <|>-   ((pRegExpr regex_'2c'5cs >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)))+   ((pRegExpr regex_'2c'5cs >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","attribute-end-inline")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","attribute-end-inline") defaultAttributes)))  parseRules ("YAML","string") =   (((pDetectIdentifier >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ (popContext)))+   ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","string")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","string") defaultAttributes)))  parseRules ("YAML","stringx") =   (((pDetectIdentifier >>= withAttribute NormalTok))    <|>-   ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ (popContext)))+   ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ (popContext))+   <|>+   (currentContext >>= \x -> guard (x == ("YAML","stringx")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","stringx") defaultAttributes)))  parseRules ("YAML","comment") =-  pzero+  (currentContext >>= \x -> guard (x == ("YAML","comment")) >> pDefault >>= withAttribute (fromMaybe NormalTok $ lookup ("YAML","comment") defaultAttributes))  -parseRules x = fail $ "Unknown context" ++ show x+parseRules x = parseRules ("YAML","normal") <|> fail ("Unknown context" ++ show x)
changelog view
@@ -1,3 +1,12 @@+highlighting-kate 0.5.3.1 (07 Sep 2012)++  * More changes to properly handle includes.  This+    closes issue #22 with doxygen comments.  pDefault+    has been incorporated into the ends of the context+    parsers, instead of being put in parseExpression.++  * Re-added doxygenlua, which now works.+ highlighting-kate 0.5.3 (07 Sep 2012)    * Improved handling of include directives.  This fixes
highlighting-kate.cabal view
@@ -1,5 +1,5 @@ Name:                highlighting-kate-Version:             0.5.3+Version:             0.5.3.1 Cabal-Version:       >= 1.6 Build-Type:          Simple Category:            Text@@ -52,6 +52,7 @@                      xml/diff.xml                      xml/djangotemplate.xml                      xml/doxygen.xml+                     xml/doxygenlua.xml                      xml/dtd.xml                      xml/eiffel.xml                      xml/email.xml@@ -178,6 +179,7 @@                      Text.Highlighting.Kate.Syntax.Diff                      Text.Highlighting.Kate.Syntax.Djangotemplate                      Text.Highlighting.Kate.Syntax.Doxygen+                     Text.Highlighting.Kate.Syntax.Doxygenlua                      Text.Highlighting.Kate.Syntax.Dtd                      Text.Highlighting.Kate.Syntax.Eiffel                      Text.Highlighting.Kate.Syntax.Email
+ xml/doxygenlua.xml view
@@ -0,0 +1,481 @@+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE language SYSTEM "language.dtd"+[+        <!ENTITY wordsep "([][,?;()]|\.$|\.?\s)">     <!-- things that end a TagWord -->+]>+<!--+  Version 1.01 by Bruno Massa++  Based on the original Doxygen Highlighter version 1.0 from+  Copyright 2004 Dominik Haumann (dhdev@gmx.de)+  Copyright 2007 Matthew Woehlke (mw_triad@users.sourceforge.net)++ **********************************************************************+ * This library is free software; you can redistribute it and/or      *+ * modify it under the terms of the GNU Lesser General Public         *+ * License as published by the Free Software Foundation; either       *+ * version 2 of the License, or (at your option) any later version.   *+ *                                                                    *+ * This library is distributed in the hope that it will be useful,    *+ * but WITHOUT ANY WARRANTY; without even the implied warranty of     *+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  *+ * Lesser General Public License for more details.                    *+ *                                                                    *+ * You should have received a copy of the GNU Lesser General Public   *+ * License along with this library; if not, write to the              *+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,   *+ * Boston, MA  02110-1301, USA.                                       *+ **********************************************************************+ -->+<language name="DoxygenLua" version="1.01" kateversion="2.4" section="Markup" extensions="*.dox;*.doxygen" mimetype="text/x-doxygen" author="Bruno Massa (brmassa@gmail.com)" license="LGPL">+  <highlighting>+    <!-- note: all tags may begin with a \ or @ char+         so if you add/change tags you have to do it twice -->+    <list name="TagOnly">+      <item> \arg </item>+      <item> \attention </item>+      <item> \author </item>+      <item> \callgraph </item>+      <item> \code </item>+      <item> \dot </item>+      <item> \else </item>+      <item> \endcode </item>+      <item> \endcond </item>+      <item> \enddot </item>+      <item> \endhtmlonly </item>+      <item> \endif </item>+      <item> \endlatexonly </item>+      <item> \endlink </item>+      <item> \endmanonly </item>+      <item> \endverbatim </item>+      <item> \endxmlonly </item>+      <item> \f[ </item>+      <item> \f] </item>+      <item> \f$ </item>+      <item> \hideinitializer </item>+      <item> \htmlonly </item>+      <item> \interface </item>+      <item> \internal </item>+      <item> \invariant </item>+      <item> \~ </item>+      <item> \@ </item>+      <item> \$ </item>+      <item> \\ </item>+      <item> \# </item>+      <item> \latexonly </item>+      <item> \li </item>+      <item> \manonly </item>+      <item> \n </item>+      <item> \nosubgrouping </item>+      <item> \note </item>+      <item> \only </item>+      <item> \post </item>+      <item> \pre </item>+      <item> \remarks </item>+      <item> \return </item>+      <item> \returns </item>+      <item> \sa </item>+      <item> \see </item>+      <item> \showinitializer </item>+      <item> \since </item>+      <item> \test </item>+      <item> \todo </item>+      <item> \verbatim </item>+      <item> \warning </item>+      <item> \xmlonly </item>++      <item> @arg </item>+      <item> @attention </item>+      <item> @author </item>+      <item> @callgraph </item>+      <item> @code </item>+      <item> @dot </item>+      <item> @else </item>+      <item> @endcode </item>+      <item> @endcond </item>+      <item> @enddot </item>+      <item> @endhtmlonly </item>+      <item> @endif </item>+      <item> @endlatexonly </item>+      <item> @endlink </item>+      <item> @endmanonly </item>+      <item> @endverbatim </item>+      <item> @endxmlonly </item>+      <item> @f[ </item>+      <item> @f] </item>+      <item> @f$ </item>+      <item> @hideinitializer </item>+      <item> @htmlonly </item>+      <item> @interface </item>+      <item> @internal </item>+      <item> @invariant </item>+      <item> @~ </item>+      <item> @@ </item>+      <item> @$ </item>+      <item> @\ </item>+      <item> @# </item>+      <item> @latexonly </item>+      <item> @li </item>+      <item> @manonly </item>+      <item> @n </item>+      <item> @nosubgrouping </item>+      <item> @note </item>+      <item> @only </item>+      <item> @post </item>+      <item> @pre </item>+      <item> @remarks </item>+      <item> @return </item>+      <item> @returns </item>+      <item> @sa </item>+      <item> @see </item>+      <item> @showinitializer </item>+      <item> @since </item>+      <item> @test </item>+      <item> @todo </item>+      <item> @verbatim </item>+      <item> @warning </item>+      <item> @xmlonly </item>+    </list>++    <list name="TagWord">+      <item> \addtogroup </item>+      <item> \a </item>+      <item> \anchor </item>+      <item> \b </item>+      <item> \c </item>+      <item> \class </item>+      <item> \cond </item>+      <item> \copydoc </item>+      <item> \def </item>+      <item> \dontinclude </item>+      <item> \dotfile </item>+      <item> \e </item>+      <item> \elseif </item>+      <item> \em </item>+      <item> \enum </item>+      <item> \example </item>+      <item> \exception </item>+      <item> \exceptions </item>+      <item> \file </item>+      <item> \htmlinclude </item>+      <item> \if </item>+      <item> \ifnot </item>+      <item> \include </item>+      <item> \link </item>+      <item> \namespace </item>+      <item> \p </item>+      <item> \package </item>+      <item> \ref </item>+      <item> \relatesalso </item>+      <item> \relates </item>+      <item> \retval </item>+      <item> \throw </item>+      <item> \throws </item>+      <item> \verbinclude </item>+      <item> \version </item>+      <item> \xrefitem </item>++      <item> @addtogroup </item>+      <item> @a </item>+      <item> @anchor </item>+      <item> @b </item>+      <item> @c </item>+      <item> @class </item>+      <item> @cond </item>+      <item> @copydoc </item>+      <item> @def </item>+      <item> @dontinclude </item>+      <item> @dotfile </item>+      <item> @e </item>+      <item> @elseif </item>+      <item> @em </item>+      <item> @enum </item>+      <item> @example </item>+      <item> @exception </item>+      <item> @exceptions </item>+      <item> @file </item>+      <item> @htmlinclude </item>+      <item> @if </item>+      <item> @ifnot </item>+      <item> @include </item>+      <item> @link </item>+      <item> @namespace </item>+      <item> @p </item>+      <item> @package </item>+      <item> @ref </item>+      <item> @relatesalso </item>+      <item> @relates </item>+      <item> @retval </item>+      <item> @throw </item>+      <item> @throws </item>+      <item> @verbinclude </item>+      <item> @version </item>+      <item> @xrefitem </item>+    </list>+    <list name="TagParam">+      <item> \param </item>++      <item> @param </item>+    </list>+    <list name="TagWordWord">+      <item> \image </item>++      <item> @image </item>+    </list>+    <list name="TagWordString">+      <item> \defgroup </item>+      <item> \page </item>+      <item> \paragraph </item>+      <item> \section </item>+      <item> \struct </item>+      <item> \subsection </item>+      <item> \subsubsection </item>+      <item> \union </item>+      <item> \weakgroup </item>++      <item> @defgroup </item>+      <item> @page </item>+      <item> @paragraph </item>+      <item> @section </item>+      <item> @struct </item>+      <item> @subsection </item>+      <item> @subsubsection </item>+      <item> @union </item>+      <item> @weakgroup </item>+    </list>+    <list name="TagString">+      <item> \addindex </item>+      <item> \brief </item>+      <item> \bug </item>+      <item> \date </item>+      <item> \deprecated </item>+      <item> \fn </item>+      <item> \ingroup </item>+      <item> \line </item>+      <item> \mainpage </item>+      <item> \name </item>+      <item> \overload </item>+      <item> \par </item>+      <item> \short </item>+      <item> \skip </item>+      <item> \skipline </item>+      <item> \typedef </item>+      <item> \until </item>+      <item> \var </item>++      <item> @addindex </item>+      <item> @brief </item>+      <item> @bug </item>+      <item> @date </item>+      <item> @deprecated </item>+      <item> @fn </item>+      <item> @ingroup </item>+      <item> @line </item>+      <item> @mainpage </item>+      <item> @name </item>+      <item> @overload </item>+      <item> @par </item>+      <item> @short </item>+      <item> @skip </item>+      <item> @skipline </item>+      <item> @typedef </item>+      <item> @until </item>+      <item> @var </item>+    </list>+    <contexts>+    <!-- different formats:+      @tag                     : TagOnly+      @tag rest_of_line        : TagString+      @tag <word>              : TagWord+      @tag <word> <word>       : TagWordWord+      @tag <word> rest_of_line : TagWordString+    -->+      <context attribute="Normal Text" lineEndContext="#stay" name="Normal">+        <RegExpr      attribute="Comment" context="BlockComment" beginRegion="BlockComment"  String="--\[(=*)\[" dynamic="true" />+        <StringDetect attribute="Comment" context="LineComment" String="--"/>+      </context>+      <context attribute="Comment" lineEndContext="#pop" name="LineComment">+        <DetectSpaces />+        <IncludeRules context="##Alerts" />+        <keyword attribute="Tags" context="#stay" String="TagOnly" />+        <keyword attribute="Tags" context="SL_TagWord" String="TagWord" />+        <keyword attribute="Tags" context="SL_TagParam" String="TagParam" />+        <keyword attribute="Tags" context="SL_TagWordWord" String="TagWordWord" />+        <keyword attribute="Tags" context="SL_TagString" String="TagString" />+        <keyword attribute="Tags" context="SL_TagWordString" String="TagWordString" />+        <DetectIdentifier />+        <StringDetect attribute="HTML Comment" context="SL_htmlcomment" String="&lt;!--" />+        <Detect2Chars attribute="Comment" context="#stay" char="&lt;" char1="&lt;" />+        <RegExpr attribute="HTML Tag" context="SL_htmltag" String="&lt;\s*\/?\s*[a-zA-Z_:][a-zA-Z0-9._:-]*" />+      </context>+      <context attribute="Comment" lineEndContext="#stay" name="BlockComment" dynamic="true" >+        <DetectSpaces />+        <RegExpr      attribute="Comment" context="#pop" endRegion="BlockComment" String="\]%1\]" dynamic="true" />+        <IncludeRules context="##Alerts" />+        <Detect2Chars attribute="Region" context="#stay" char="@" char1="{" />+        <Detect2Chars attribute="Region" context="#stay" char="@" char1="}" />+        <keyword attribute="Tags" context="#stay" String="TagOnly" />+        <keyword attribute="Tags" context="ML_TagWord" String="TagWord" />+        <keyword attribute="Tags" context="ML_TagParam" String="TagParam" />+        <keyword attribute="Tags" context="ML_TagWordWord" String="TagWordWord" />+        <keyword attribute="Tags" context="ML_TagString" String="TagString" />+        <keyword attribute="Tags" context="ML_TagWordString" String="TagWordString" />+        <DetectIdentifier />+        <RegExpr attribute="Tags" context="#stay" String="\\(&lt;|&gt;)" />+        <Detect2Chars attribute="Comment" context="#stay" char="&lt;" char1="&lt;" />+        <RegExpr attribute="HTML Tag" context="ML_htmltag" String="&lt;\s*\/?\s*[a-zA-Z_:][a-zA-Z0-9._:-]*" />+        <StringDetect attribute="HTML Comment" context="ML_htmlcomment" String="&lt;!--" />+      </context>++<!-- NOTE: all contexts beginning with ML_ are for multiline comments+     The following contexts contain a Detect2Chars that looks for a */ sequence to end multiline comments. Singleline comments do not have this limitation - that's why all contexts are copy&pasted and the line <Detect2Chars ... */> is removed. <IncludeRules context="acontext"> could be used instead but it would make context switching much more complex and very hard to understand! (But use IncludeRules where the rules don't refer to another SL_*/ML_* context, to help maintainability.)+-->+      <!-- tag contexts -->+      <context attribute="Comment" lineEndContext="#pop" name="ML_TagWord">+        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" lookAhead="true"/>+        <IncludeRules context="SL_TagWord" />+      </context>+      <context attribute="Comment" lineEndContext="#pop" name="ML_TagParam">+        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" lookAhead="true"/>+        <DetectSpaces />+        <StringDetect attribute="Tags" context="ML_Tag2ndWord" String="[in]" />+        <StringDetect attribute="Tags" context="ML_Tag2ndWord" String="[out]" />+        <StringDetect attribute="Tags" context="ML_Tag2ndWord" String="[in,out]" />+        <RegExpr attribute="Word" context="#pop" String="\S(?=&wordsep;)" />+        <RegExpr attribute="Word" context="#stay" String="\S" />+      </context>+      <context attribute="Comment" lineEndContext="#pop" name="ML_TagWordWord">+        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" lookAhead="true"/>+        <DetectSpaces />+        <RegExpr attribute="Word" context="ML_Tag2ndWord" String="\S(?=&wordsep;)" />+        <RegExpr attribute="Word" context="#stay" String="\S" />+      </context>+      <!-- TODO for kate 2.x, convert references to "#pop!ML_TagWord" -->+      <context attribute="Comment" lineEndContext="#pop#pop" name="ML_Tag2ndWord">+        <Detect2Chars attribute="Comment" context="#pop#pop" char="*" char1="/" lookAhead="true"/>+        <IncludeRules context="SL_Tag2ndWord" />+      </context>+      <context attribute="Comment" lineEndContext="#pop" name="ML_TagString">+        <DetectSpaces />+        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" lookAhead="true"/>+        <StringDetect attribute="HTML Comment" context="ML_htmlcomment" String="&lt;!--" />+        <Detect2Chars attribute="Comment" context="#stay" char="&lt;" char1="&lt;" />+        <RegExpr attribute="HTML Tag" context="ML_htmltag" String="&lt;\s*\/?\s*[a-zA-Z_:][a-zA-Z0-9._:-]*" />+        <RegExpr attribute="Description" context="#stay" String="." />+      </context>+      <context attribute="Comment" lineEndContext="#pop" name="ML_TagWordString">+        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" lookAhead="true"/>+        <IncludeRules context="SL_TagWordString" />+      </context>++      <!-- html contexts -->+      <context name="ML_htmltag" attribute="Identifier" lineEndContext="#stay">+        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" lookAhead="true"/>+        <Detect2Chars attribute="HTML Tag" context="#pop" char="/" char1="&gt;" />+        <DetectChar attribute="HTML Tag" context="#pop" char="&gt;"/>+        <RegExpr attribute="Identifier" context="ML_identifiers" String="\s*=\s*"/>+      </context>+      <context name="ML_htmlcomment" attribute="HTML Comment" lineEndContext="#stay">+        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" lookAhead="true"/>+        <IncludeRules context="##Alerts" />+        <StringDetect attribute="HTML Comment" context="#pop" String="--&gt;" />+      </context>+      <context name="ML_identifiers" attribute="Identifier" lineEndContext="#stay">+        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" lookAhead="true"/>+        <RegExpr attribute="String" context="#pop" String="\s*#?[a-zA-Z0-9]*" />+        <DetectChar attribute="Types" context="ML_types1" char="'" />+        <DetectChar attribute="Types" context="ML_types2" char="&quot;" />+      </context>+      <context name="ML_types1" attribute="Types" lineEndContext="#stay">+        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" lookAhead="true"/>+        <DetectChar attribute="Types" context="#pop#pop" char="'" />+      </context>+      <context name="ML_types2" attribute="Types" lineEndContext="#stay">+        <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" lookAhead="true"/>+        <DetectChar attribute="Types" context="#pop#pop" char="&quot;" />+      </context>++<!-- NOTE: all contexts beginning with SL_ are for singleline comments -->+      <!-- tag contexts -->+      <context attribute="Comment" lineEndContext="#pop" name="SL_TagWord">+        <DetectSpaces />+        <keyword attribute="Tags" context="#pop" String="TagWord" lookAhead="true"/>+        <RegExpr attribute="Word" context="#pop" String="\S(?=&wordsep;)" />+        <RegExpr attribute="Word" context="#stay" String="\S" />+      </context>+      <context attribute="Comment" lineEndContext="#pop" name="SL_TagParam">+        <DetectSpaces />+        <StringDetect attribute="Tags" context="SL_Tag2ndWord" String="[in]" />+        <StringDetect attribute="Tags" context="SL_Tag2ndWord" String="[out]" />+        <StringDetect attribute="Tags" context="SL_Tag2ndWord" String="[in,out]" />+        <RegExpr attribute="Word" context="#pop" String="\S(?=&wordsep;)" />+        <RegExpr attribute="Word" context="#stay" String="\S" />+      </context>+      <context attribute="Comment" lineEndContext="#pop" name="SL_TagWordWord">+        <DetectSpaces />+        <RegExpr attribute="Word" context="SL_Tag2ndWord" String="\S(?=&wordsep;)" />+        <RegExpr attribute="Word" context="#stay" String="\S" />+      </context>+      <!-- TODO for kate 2.x, convert references to "#pop!SL_TagWord" -->+      <context attribute="Comment" lineEndContext="#pop#pop" name="SL_Tag2ndWord">+        <DetectSpaces />+        <RegExpr attribute="Word" context="#pop#pop" String="\S(?=&wordsep;)" />+        <RegExpr attribute="Word" context="#stay" String="\S" />+      </context>+      <context attribute="Comment" lineEndContext="#pop" name="SL_TagString">+        <DetectSpaces />+        <StringDetect attribute="HTML Comment" context="SL_htmlcomment" String="&lt;!--" />+        <Detect2Chars attribute="Comment" context="#stay" char="&lt;" char1="&lt;" />+        <RegExpr attribute="HTML Tag" context="SL_htmltag" String="&lt;\s*\/?\s*[a-zA-Z_:][a-zA-Z0-9._:-]*" />+        <RegExpr attribute="Description" context="#stay" String="." />+      </context>+      <context attribute="Comment" lineEndContext="#pop" name="SL_TagWordString">+        <DetectSpaces />+        <RegExpr attribute="Word" context="#pop" String="\S(?=&wordsep;)" />+        <RegExpr attribute="Word" context="#stay" String="\S" />+      </context>++      <!-- html contexts -->+      <context name="SL_htmltag" attribute="Identifier" lineEndContext="#pop">+        <Detect2Chars attribute="HTML Tag" context="#pop" char="/" char1="&gt;" />+        <DetectChar attribute="HTML Tag" context="#pop" char="&gt;"/>+        <RegExpr attribute="Identifier" context="SL_identifiers" String="\s*=\s*"/>+      </context>+      <context name="SL_htmlcomment" attribute="HTML Comment" lineEndContext="#pop">+        <IncludeRules context="##Alerts" />+        <StringDetect attribute="HTML Comment" context="#pop" String="--&gt;" />+      </context>+      <context name="SL_identifiers" attribute="Identifier" lineEndContext="#pop">+        <RegExpr attribute="String" context="#pop" String="\s*#?[a-zA-Z0-9]*" />+        <DetectChar attribute="Types" context="SL_types1" char="'" />+        <DetectChar attribute="Types" context="SL_types2" char="&quot;" />+      </context>+      <context name="SL_types1" attribute="Types" lineEndContext="#pop">+        <DetectChar attribute="Types" context="#pop#pop" char="'" />+      </context>+      <context name="SL_types2" attribute="Types" lineEndContext="#pop">+        <DetectChar attribute="Types" context="#pop#pop" char="&quot;" />+      </context>++    </contexts>+    <itemDatas>+      <itemData name="Normal Text" defStyleNum="dsNormal" />+      <itemData name="Tags"        defStyleNum="dsKeyword" color="#ca60ca" selColor="#ffffff" bold="1" italic="0" />+      <itemData name="Word"        defStyleNum="dsKeyword" color="#0095ff" selColor="#ffffff" bold="1" italic="0" />+      <itemData name="HTML Tag"    defStyleNum="dsKeyword"/>+      <itemData name="Description" defStyleNum="dsString" />+      <itemData name="Comment"     defStyleNum="dsComment"/>+      <itemData name="Region"      defStyleNum="dsRegionMarker" />+      <itemData name="Identifier"  defStyleNum="dsOthers" />+      <itemData name="HTML Comment" defStyleNum="dsComment" />+      <itemData name="Types"       defStyleNum="dsDataType" />+    </itemDatas>+  </highlighting>+  <general>+    <comments>+      <comment name="singleLine" start="--" />+      <comment name="multiLine" start="--[[" end="]]" />+    </comments>+    <keywords casesensitive="0" weakDeliminator="\$~" />+  </general>+</language>
xml/lua.xml view
@@ -217,7 +217,7 @@         <RegExpr attribute="Comment" context="Normal" String="#!.*$" column="0" />       </context>       <context name="Normal"        attribute="Normal Text" lineEndContext="#stay">-        <!--        <IncludeRules context="##DoxygenLua" /> -->+        <IncludeRules context="##DoxygenLua" />         <keyword      attribute="Error"  context="#stay" String="deprecated" />         <DetectSpaces />         <RegExpr      attribute="Comment"  context="Block Comment" beginRegion="block comment"  String="--\[(=*)\[" dynamic="true" />