highlighting-kate 0.5.2 → 0.5.3
raw patch · 95 files changed
+5898/−6197 lines, 95 files
Files
- ParseSyntaxFiles.hs +34/−32
- Text/Highlighting/Kate/Common.hs +14/−28
- Text/Highlighting/Kate/Syntax/Actionscript.hs +34/−37
- Text/Highlighting/Kate/Syntax/Ada.hs +25/−29
- Text/Highlighting/Kate/Syntax/Alert.hs +15/−19
- Text/Highlighting/Kate/Syntax/Alert_indent.hs +15/−19
- Text/Highlighting/Kate/Syntax/Apache.hs +47/−50
- Text/Highlighting/Kate/Syntax/Asn1.hs +18/−22
- Text/Highlighting/Kate/Syntax/Asp.hs +64/−68
- Text/Highlighting/Kate/Syntax/Awk.hs +22/−25
- Text/Highlighting/Kate/Syntax/Bash.hs +240/−243
- Text/Highlighting/Kate/Syntax/Bibtex.hs +37/−41
- Text/Highlighting/Kate/Syntax/Boo.hs +60/−64
- Text/Highlighting/Kate/Syntax/C.hs +59/−61
- Text/Highlighting/Kate/Syntax/Changelog.hs +21/−25
- Text/Highlighting/Kate/Syntax/Clojure.hs +60/−64
- Text/Highlighting/Kate/Syntax/Cmake.hs +34/−37
- Text/Highlighting/Kate/Syntax/Coffee.hs +49/−51
- Text/Highlighting/Kate/Syntax/Coldfusion.hs +80/−84
- Text/Highlighting/Kate/Syntax/Commonlisp.hs +27/−31
- Text/Highlighting/Kate/Syntax/Cpp.hs +58/−60
- Text/Highlighting/Kate/Syntax/Cs.hs +28/−31
- Text/Highlighting/Kate/Syntax/Css.hs +85/−88
- Text/Highlighting/Kate/Syntax/D.hs +156/−158
- Text/Highlighting/Kate/Syntax/Diff.hs +69/−73
- Text/Highlighting/Kate/Syntax/Djangotemplate.hs +164/−165
- Text/Highlighting/Kate/Syntax/Doxygen.hs +127/−130
- Text/Highlighting/Kate/Syntax/Dtd.hs +35/−38
- Text/Highlighting/Kate/Syntax/Eiffel.hs +21/−25
- Text/Highlighting/Kate/Syntax/Email.hs +15/−19
- Text/Highlighting/Kate/Syntax/Erlang.hs +28/−31
- Text/Highlighting/Kate/Syntax/Fortran.hs +90/−94
- Text/Highlighting/Kate/Syntax/Fsharp.hs +54/−58
- Text/Highlighting/Kate/Syntax/Gnuassembler.hs +36/−39
- Text/Highlighting/Kate/Syntax/Go.hs +28/−31
- Text/Highlighting/Kate/Syntax/Haskell.hs +30/−34
- Text/Highlighting/Kate/Syntax/Haxe.hs +32/−36
- Text/Highlighting/Kate/Syntax/Html.hs +119/−120
- Text/Highlighting/Kate/Syntax/Ini.hs +23/−26
- Text/Highlighting/Kate/Syntax/Java.hs +48/−51
- Text/Highlighting/Kate/Syntax/Javadoc.hs +64/−67
- Text/Highlighting/Kate/Syntax/Javascript.hs +56/−59
- Text/Highlighting/Kate/Syntax/Json.hs +35/−39
- Text/Highlighting/Kate/Syntax/Jsp.hs +139/−143
- Text/Highlighting/Kate/Syntax/Latex.hs +234/−238
- Text/Highlighting/Kate/Syntax/Lex.hs +82/−85
- Text/Highlighting/Kate/Syntax/LiterateHaskell.hs +33/−36
- Text/Highlighting/Kate/Syntax/Lua.hs +36/−40
- Text/Highlighting/Kate/Syntax/Makefile.hs +48/−52
- Text/Highlighting/Kate/Syntax/Mandoc.hs +28/−32
- Text/Highlighting/Kate/Syntax/Matlab.hs +21/−25
- Text/Highlighting/Kate/Syntax/Maxima.hs +21/−25
- Text/Highlighting/Kate/Syntax/Metafont.hs +43/−47
- Text/Highlighting/Kate/Syntax/Mips.hs +18/−22
- Text/Highlighting/Kate/Syntax/Modula2.hs +30/−34
- Text/Highlighting/Kate/Syntax/Modula3.hs +25/−29
- Text/Highlighting/Kate/Syntax/Monobasic.hs +21/−25
- Text/Highlighting/Kate/Syntax/Nasm.hs +24/−28
- Text/Highlighting/Kate/Syntax/Noweb.hs +30/−32
- Text/Highlighting/Kate/Syntax/Objectivec.hs +33/−36
- Text/Highlighting/Kate/Syntax/Objectivecpp.hs +65/−67
- Text/Highlighting/Kate/Syntax/Ocaml.hs +51/−55
- Text/Highlighting/Kate/Syntax/Octave.hs +21/−25
- Text/Highlighting/Kate/Syntax/Pascal.hs +42/−46
- Text/Highlighting/Kate/Syntax/Perl.hs +264/−267
- Text/Highlighting/Kate/Syntax/Php.hs +74/−72
- Text/Highlighting/Kate/Syntax/Pike.hs +39/−43
- Text/Highlighting/Kate/Syntax/Postscript.hs +24/−28
- Text/Highlighting/Kate/Syntax/Prolog.hs +27/−31
- Text/Highlighting/Kate/Syntax/Python.hs +78/−81
- Text/Highlighting/Kate/Syntax/R.hs +50/−54
- Text/Highlighting/Kate/Syntax/Relaxngcompact.hs +27/−31
- Text/Highlighting/Kate/Syntax/Rhtml.hs +422/−423
- Text/Highlighting/Kate/Syntax/Ruby.hs +360/−363
- Text/Highlighting/Kate/Syntax/Scala.hs +34/−37
- Text/Highlighting/Kate/Syntax/Scheme.hs +56/−60
- Text/Highlighting/Kate/Syntax/Sci.hs +15/−19
- Text/Highlighting/Kate/Syntax/Sed.hs +138/−142
- Text/Highlighting/Kate/Syntax/Sgml.hs +27/−31
- Text/Highlighting/Kate/Syntax/Sql.hs +33/−37
- Text/Highlighting/Kate/Syntax/SqlMysql.hs +35/−39
- Text/Highlighting/Kate/Syntax/SqlPostgresql.hs +43/−47
- Text/Highlighting/Kate/Syntax/Tcl.hs +25/−29
- Text/Highlighting/Kate/Syntax/Texinfo.hs +30/−33
- Text/Highlighting/Kate/Syntax/Verilog.hs +44/−47
- Text/Highlighting/Kate/Syntax/Vhdl.hs +123/−127
- Text/Highlighting/Kate/Syntax/Xml.hs +78/−81
- Text/Highlighting/Kate/Syntax/Xorg.hs +33/−36
- Text/Highlighting/Kate/Syntax/Xslt.hs +93/−97
- Text/Highlighting/Kate/Syntax/Xul.hs +115/−118
- Text/Highlighting/Kate/Syntax/Yacc.hs +87/−90
- Text/Highlighting/Kate/Syntax/Yaml.hs +101/−105
- Text/Highlighting/Kate/Types.hs +5/−4
- changelog +16/−0
- highlighting-kate.cabal +1/−1
ParseSyntaxFiles.hs view
@@ -24,7 +24,6 @@ import Control.Monad import Data.List import Data.Char (toUpper, toLower, isAlphaNum)-import qualified Data.Map as Map import System.Directory import System.Environment import System.FilePath@@ -168,7 +167,6 @@ \import Text.Highlighting.Kate.Common\n" ++ unlines includeImports ++ "import Text.ParserCombinators.Parsec hiding (State)\n\- \import Data.Map (fromList)\n\ \import Control.Monad.State\n\ \import Data.Char (isSpace)\n\ \import Data.Maybe (fromMaybe)\n" ++@@ -208,32 +206,36 @@ text "updateState $ \\st -> st { synStPrevChar = last txt" $$ text " , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) }" $$ text "return (attr, txt)")- parseExpressionInternal = text "parseExpressionInternal = do" $$ (nest 2 $- text "context <- currentContext" $$- text "parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))")+ lang = synLanguage syntax parseExpression = text "-- | Parse an expression using appropriate local context." $$ text "parseExpression :: KateParser Token" $$ text "parseExpression = do" $$ (nest 2 $- text "st <- getState" $$- text "let oldLang = synStLanguage st" $$- text ("setState $ st { synStLanguage = " ++ show (synLanguage syntax) ++ " }") $$- text ("context <- currentContext <|> (pushContext " ++ show (contName $ head $ synContexts syntax) ++- " >> currentContext)") $$- text "result <- parseRules context" $$- text "optional $ eof >> pEndLine" $$- text "updateState $ \\st -> st { synStLanguage = oldLang }" $$+ 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 "optional $ do eof" $$+ text " updateState $ \\st -> st{ synStPrevChar = '\\n' }" $$+ text " pEndLine" $$ text "return result")- defaultAttributes = text $ "defaultAttributes = " ++ (show $ map (\cont -> (contName cont, labelFor syntax $ contAttribute cont)) $ synContexts syntax)+ defaultAttributes = text $ "defaultAttributes = " ++ (show $ map (\cont -> ((synLanguage syntax, contName cont), labelFor syntax $ contAttribute cont)) $ synContexts syntax) -- Note: lineBeginContexts seems not to be used in any of the xml files -- lineBeginContexts = -- text $ "lineBeginContexts = " ++ (show $ map (\cont -> (contName cont, contLineBeginContext cont)) $ synContexts syntax) startingContext = head (synContexts syntax)- contextNull = text $ "parseRules \"\" = parseRules " ++ show (contName startingContext)- contextCatchAll = text $ "parseRules x = fail $ \"Unknown context\" ++ x"+ -- contextNull = text $ "parseRules \"\" = parseRules " ++ show (synLanguage syntax, contName startingContext)+ isIncludeRules p = parserType p == "IncludeRules" && "##" `isPrefixOf`+ parserContext p+ includeLangs = nub $ map (drop 2 . parserContext) $+ 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" contexts = map (mkRules syntax) $ synContexts syntax- initialContextStack = Map.fromList [(synLanguage syntax, [contName startingContext])]+ initialContextStack = [(synLanguage syntax, contName startingContext)] startingState = SyntaxState { synStContexts = initialContextStack- , synStLanguage = synLanguage syntax , synStLineNumber = 0 , synStPrevNonspace = False , synStPrevChar = '\n'@@ -245,18 +247,18 @@ \highlight :: String -> [SourceLine]\n\ \highlight input = evalState (mapM parseSourceLine $ lines input) startingState" lineParser = text $ "parseSourceLine :: String -> State SyntaxState SourceLine\n\- \parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine"+ \parseSourceLine = mkParseSourceLine parseExpression" endLineParser = text "pEndLine = do" $$ (nest 2 $ text "updateState $ \\st -> st{ synStPrevNonspace = False }" $$ text "context <- currentContext" $$ text "case context of" $$- (nest 2 $ (vcat $ map (\cont -> text (show $ contName cont) <> text " -> " <>- switchContext (contLineEndContext cont) (<> text " >> ") <>+ (nest 2 $ (vcat $ map (\cont -> text (show (synLanguage syntax, contName cont)) <> text " -> " <>+ switchContext (synLanguage syntax, contLineEndContext cont) (<> text " >> ") <> if "#pop" `isPrefixOf` (contLineEndContext cont) then text "pEndLine" else text "return ()") $ synContexts syntax) $$ (text $ "_ -> return ()")))- {- text "pushContext (fromMaybe \"#stay\" $ lookup context lineBeginContexts)" $$ -}+ {- text "pushContext (synLanguage syntax, fromMaybe \"#stay\" $ lookup context lineBeginContexts)" $$ -} -- we use 'words "blah blah2 blah3"' to keep ghc from inlining the list, which makes compiling take a long time listDef (n, list) = text $ listName n ++ " = Set.fromList $ words $ " ++ show (if keywordCaseSensitive (synKeywordAttr syntax)@@ -267,8 +269,8 @@ regexes = vcat $ map regexDef $ nub $ [parserString x | x <- concatMap contParsers (synContexts syntax), parserType x == "RegExpr", parserDynamic x == False] in vcat $ intersperse (text "") $ [name, exts, mainFunction, lineParser, parseExpression, initState,- endLineParser, withAttr, parseExpressionInternal, lists, regexes,- defaultAttributes {- , lineBeginContexts -}] ++ contexts ++ [contextNull, contextCatchAll]+ endLineParser, withAttr, lists, regexes,+ defaultAttributes {- , lineBeginContexts -}] ++ contexts ++ [foreignContexts, contextCatchAll] mkAlternatives :: [Doc] -> Doc mkAlternatives docs =@@ -280,10 +282,10 @@ mkRules :: SyntaxDefinition -> SyntaxContext -> Doc mkRules syntax context = let fallthroughParser = if contFallthrough context- then [parens (switchContext (contFallthroughContext context) (<> text " >> ") <>+ then [parens (switchContext (synLanguage syntax, contFallthroughContext context) (<> text " >> ") <> text "currentContext >>= parseRules")] else []- in text ("parseRules " ++ show (contName context) ++ " =") $$+ in text ("parseRules " ++ show (synLanguage syntax, contName context) ++ " =") $$ if null (contParsers context) && null fallthroughParser then nest 2 (text "pzero") else nest 2 $ mkAlternatives $ (map (mkSyntaxParser syntax context) $ contParsers context) ++ fallthroughParser@@ -320,7 +322,7 @@ if parserIncludeAttrib parser || attr' == NormalTok then "" else " >>= ((withAttribute " ++ show attr' ++ ") . snd)"- xs -> "parseRules " ++ show xs+ xs -> "parseRules " ++ show (synLanguage syntax, xs) "DetectSpaces" -> "pDetectSpaces" "DetectIdentifier" -> "pDetectIdentifier" _ -> "pUnimplemented"@@ -335,10 +337,10 @@ then mainParser <> char ')' else if parserLookAhead parser then text "lookAhead (" <> mainParser <> char ')'- <> switchContext (parserContext parser) (text " >> " <>)+ <> switchContext (synLanguage syntax, parserContext parser) (text " >> " <>) <> text " >> currentContext >>= parseRules)" else mainParser <> text " >>= withAttribute " <> text (show attr') <> char ')'- <> switchContext (parserContext parser) (text " >>~ " <>)+ <> switchContext (synLanguage syntax, parserContext parser) (text " >>~ " <>) childParsers = parserChildren parser in char '(' <> (if null childParsers@@ -346,15 +348,15 @@ else text "withChildren " <> parserDoc <> char ' ' <> (mkAlternatives $ map (mkSyntaxParser syntax context) childParsers)) <> char ')' -switchContext :: String -> (Doc -> Doc) -> Doc-switchContext next finalizer =+switchContext :: Context -> (Doc -> Doc) -> Doc+switchContext (lang,next) finalizer = case next of x | "#pop" `isPrefixOf` x -> finalizer $ char '(' <> text (concat $ intersperse " >> " $ replicate (length (filter (=='#') x)) "popContext") <> char ')' "#stay" -> empty "" -> empty- x -> finalizer $ text ("pushContext " ++ show x)+ x -> finalizer $ text ("pushContext " ++ show (lang,x)) langNameToModule :: String -> String langNameToModule str = "Text.Highlighting.Kate.Syntax." ++
Text/Highlighting/Kate/Common.hs view
@@ -23,7 +23,6 @@ import Data.Char (isDigit, toLower, isSpace) import Data.List (tails) import Control.Monad.State-import qualified Data.Map as Map import qualified Data.Set as Set -- | Match filename against a list of globs contained in a semicolon-separated@@ -62,36 +61,26 @@ | a == b = normalizeHighlighting ((a, x++y):xs) normalizeHighlighting (x:xs) = x : normalizeHighlighting xs -pushContext :: [Char] -> KateParser ()-pushContext context = if context == "#stay"+pushContext :: Context -> KateParser ()+pushContext (lang,context) =+ if context == "#stay" then return () else do st <- getState let contexts = synStContexts st- let lang = synStLanguage st- let addContext c x = case x of- Nothing -> Just [c]- Just cs -> Just (c:cs)- let newContexts = Map.alter (addContext context) lang contexts- updateState $ \st -> st { synStContexts = newContexts }+ updateState $ \st -> st{ synStContexts =+ (lang,context) : contexts } popContext :: KateParser () popContext = do st <- getState- let contexts = synStContexts st- let lang = synStLanguage st- case Map.lookup lang contexts of- Just (_:_) -> updateState $ \st ->- st{ synStContexts = Map.adjust tail lang contexts }- Just [] -> fail $ "Stack empty for language " ++ lang- Nothing -> fail $ "No context stack for language " ++ lang+ case synStContexts st of+ (_:xs) -> updateState $ \st -> st{ synStContexts = xs }+ [] -> fail "Stack empty" -currentContext :: KateParser String+currentContext :: KateParser Context currentContext = do st <- getState- let contexts = synStContexts st- let lang = synStLanguage st- case Map.lookup lang contexts of- Just [] -> return ""- Just (c:_) -> return c- Nothing -> fail $ "No context stack for language " ++ lang+ case synStContexts st of+ (x:_) -> return x+ [] -> fail "Stack empty" withChildren :: KateParser Token -> KateParser Token@@ -298,16 +287,13 @@ fromState f = f `fmap` getState mkParseSourceLine :: KateParser Token -- ^ parseExpressionInternal- -> KateParser () -- ^ pEndline -> String -> State SyntaxState SourceLine-mkParseSourceLine parseExpressionInternal pEndLine ln = do+mkParseSourceLine parseExpression ln = do modify $ \st -> st{ synStLineNumber = synStLineNumber st + 1 } st <- get let lineName = "line " ++ show (synStLineNumber st)- let pline = do ts <- many parseExpressionInternal- updateState $ \st -> st{ synStPrevChar = '\n' }- pEndLine+ let pline = do ts <- many parseExpression s <- getState return (s, ts) let (newst, result) = case runParser pline st lineName ln of
Text/Highlighting/Kate/Syntax/Actionscript.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Javadoc import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,33 +26,35 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "ActionScript 2.0" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("ActionScript 2.0",["Normal"])], synStLanguage = "ActionScript 2.0", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("ActionScript 2.0","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "String" -> (popContext) >> pEndLine- "Member" -> (popContext) >> pEndLine- "StaticImports" -> (popContext) >> pEndLine- "Imports" -> (popContext) >> pEndLine- "Commentar 1" -> (popContext) >> pEndLine- "Commentar 2" -> return ()+ ("ActionScript 2.0","Normal") -> return ()+ ("ActionScript 2.0","String") -> (popContext) >> pEndLine+ ("ActionScript 2.0","Member") -> (popContext) >> pEndLine+ ("ActionScript 2.0","StaticImports") -> (popContext) >> pEndLine+ ("ActionScript 2.0","Imports") -> (popContext) >> pEndLine+ ("ActionScript 2.0","Commentar 1") -> (popContext) >> pEndLine+ ("ActionScript 2.0","Commentar 2") -> return () _ -> return () withAttribute attr txt = do@@ -62,10 +63,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_properties = Set.fromList $ words $ "_accProps _focusrect _global _highquality _level _parent _quality _root _soundbuftime maxscroll scroll this" list_global'5ffunctions = Set.fromList $ words $ "asfunction call chr clearInterval duplicateMovieClip escape eval fscommand getProperty getTimer getURL getVersion gotoAndPlay gotoAndStop ifFrameLoaded int isFinite isNaN length loadMovie loadMovieNum loadVariables loadVariablesNum mbchr mblength mbord mbsubstring nextFrame nextScene on onClipEvent ord parseFloat parseInt play prevFrame prevScene print printAsBitmap printAsBitmapNum printNum random removeMovieClip setInterval setProperty showRedrawRegions startDrag stop stopAllSounds stopDrag substring targetPath tellTarget toggleHighQuality trace typeof unescape unloadMovie unloadMovieNum updateAfterEvent" list_classes = Set.fromList $ words $ "Accessibility Accordion Alert Binding Button Camera CellRenderer CheckBox Collection Color ComboBox ComponentMixins ContextMenu ContextMenuItem CustomActions CustomFormatter CustomValidator DataGrid DataHolder DataProvider DataSet DataType Date DateChooser DateField Delta DeltaItem DeltaPacket DepthManager EndPoint Error FaultEvent FocusManager Form Function Iterator Key Label List LoadVars Loader LocalConnection Log Math Media Menu MenuBar Microphone Mouse MovieClip MovieClipLoader NetConnection NetStream Number NumericStepper PendingCall PopUpManager PrintJob ProgressBar RDBMSResolver RadioButton RelayResponder SOAPCall Screen ScrollPane Selection SharedObject Slide Sound Stage StyleManager System TextArea TextField TextFormat TextInput TextSnapshot TransferObject Tree TreeDataProvider TypedValue UIComponent UIEventDispatcher UIObject Video WebService WebServiceConnector Window XML XMLConnector XUpdateResolver"@@ -83,9 +80,9 @@ regex_'5cb'5b'5fa'2dzA'2dZ'5d'5cw'2a'28'3f'3d'5b'5cs'5d'2a'29 = compileRegex "\\b[_a-zA-Z]\\w*(?=[\\s]*)" regex_'5cs'2a'2e'2a'24 = compileRegex "\\s*.*$" -defaultAttributes = [("Normal",NormalTok),("String",StringTok),("Member",NormalTok),("StaticImports",NormalTok),("Imports",NormalTok),("Commentar 1",CommentTok),("Commentar 2",CommentTok)]+defaultAttributes = [(("ActionScript 2.0","Normal"),NormalTok),(("ActionScript 2.0","String"),StringTok),(("ActionScript 2.0","Member"),NormalTok),(("ActionScript 2.0","StaticImports"),NormalTok),(("ActionScript 2.0","Imports"),NormalTok),(("ActionScript 2.0","Commentar 1"),CommentTok),(("ActionScript 2.0","Commentar 2"),CommentTok)] -parseRules "Normal" =+parseRules ("ActionScript 2.0","Normal") = (((Text.Highlighting.Kate.Syntax.Javadoc.parseExpression)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_properties >>= withAttribute NormalTok))@@ -128,11 +125,11 @@ <|> ((pRegExpr regex_'2f'2f'5cs'2aEND'2e'2a'24 >>= withAttribute DecValTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("ActionScript 2.0","String")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("ActionScript 2.0","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("ActionScript 2.0","Commentar 2")) <|> ((pDetectChar False '{' >>= withAttribute NormalTok)) <|>@@ -140,40 +137,40 @@ <|> ((pRegExpr regex_'5c'2e'7b3'2c3'7d'5cs'2b >>= withAttribute KeywordTok)) <|>- ((pRegExpr regex_'5cb'28import'5cs'2bstatic'29'5cb >>= withAttribute KeywordTok) >>~ pushContext "StaticImports")+ ((pRegExpr regex_'5cb'28import'5cs'2bstatic'29'5cb >>= withAttribute KeywordTok) >>~ pushContext ("ActionScript 2.0","StaticImports")) <|>- ((pRegExpr regex_'5cb'28package'7cimport'29'5cb >>= withAttribute KeywordTok) >>~ pushContext "Imports")+ ((pRegExpr regex_'5cb'28package'7cimport'29'5cb >>= withAttribute KeywordTok) >>~ pushContext ("ActionScript 2.0","Imports")) <|> ((pRegExpr regex_'5cb'5b'5f'5cw'5d'5b'5f'5cw'5cd'5d'2a'28'3f'3d'5b'5cs'5d'2a'28'2f'5c'2a'5cs'2a'5cd'2b'5cs'2a'5c'2a'2f'5cs'2a'29'3f'5b'28'5d'29 >>= withAttribute FunctionTok)) <|>- ((pRegExpr regex_'5b'2e'5d'7b1'2c1'7d >>= withAttribute NormalTok) >>~ pushContext "Member")+ ((pRegExpr regex_'5b'2e'5d'7b1'2c1'7d >>= withAttribute NormalTok) >>~ pushContext ("ActionScript 2.0","Member")) <|> ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))) -parseRules "String" =+parseRules ("ActionScript 2.0","String") = (((pLineContinue >>= withAttribute StringTok)) <|> ((pHlCStringChar >>= withAttribute CharTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Member" =+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)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "StaticImports" =+parseRules ("ActionScript 2.0","StaticImports") = ((pRegExpr regex_'5cs'2a'2e'2a'24 >>= withAttribute KeywordTok) >>~ (popContext)) -parseRules "Imports" =+parseRules ("ActionScript 2.0","Imports") = ((pRegExpr regex_'5cs'2a'2e'2a'24 >>= withAttribute KeywordTok) >>~ (popContext)) -parseRules "Commentar 1" =+parseRules ("ActionScript 2.0","Commentar 1") = pzero -parseRules "Commentar 2" =+parseRules ("ActionScript 2.0","Commentar 2") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "" = parseRules "Normal"+parseRules ("Javadoc", _) = Text.Highlighting.Kate.Syntax.Javadoc.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Ada.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,30 +25,32 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Ada" }- context <- currentContext <|> (pushContext "Default" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Ada",["Default"])], synStLanguage = "Ada", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Ada","Default")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Default" -> return ()- "Region Marker" -> (popContext) >> pEndLine- "String" -> (popContext) >> pEndLine- "Comment" -> (popContext) >> pEndLine+ ("Ada","Default") -> return ()+ ("Ada","Region Marker") -> (popContext) >> pEndLine+ ("Ada","String") -> (popContext) >> pEndLine+ ("Ada","Comment") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -58,10 +59,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "abort abs abstract accept access aliased all and array at begin body constant declare delay delta digits do else elsif end entry exception exit for function generic goto in interface is limited mod new not null of or others out overriding package pragma private procedure protected raise range rem record renames requeue return reverse separate subtype tagged task terminate then type until use when while with xor" list_pragmas = Set.fromList $ words $ "all_calls_remote assert assertion_policy asynchronous atomic atomic_components attach_handler controlled convention detect_blocking discard_names elaborate elaborate_all elaborate_body export import inline inspection_point interrupt_handler interrupt_priority linker_options list locking_policy no_return normalize_scalars optimize pack page partition_elaboration_policy preelaborable_initialization preelaborate priority priority_specific_dispatching profile pure queuing_policy relative_deadline remote_call_interface remote_types restrictions reviewable shared_passive storage_size suppress task_dispatching_policy unchecked_union unsuppress volatile volatile_components" list_types = Set.fromList $ words $ "boolean char float integer long_float long_integer long_long_float long_long_integer short_float short_integer string wide_string wide_char wide_wide_char wide_wide_string"@@ -80,9 +77,9 @@ regex_'5cbend'5cb = compileRegex "\\bend\\b" regex_'27'2e'27 = compileRegex "'.'" -defaultAttributes = [("Default",NormalTok),("Region Marker",RegionMarkerTok),("String",StringTok),("Comment",CommentTok)]+defaultAttributes = [(("Ada","Default"),NormalTok),(("Ada","Region Marker"),RegionMarkerTok),(("Ada","String"),StringTok),(("Ada","Comment"),CommentTok)] -parseRules "Default" =+parseRules ("Ada","Default") = (((pRegExpr regex_'5cbrecord'5cb >>= withAttribute KeywordTok)) <|> ((pRegExpr regex_'5cbend'5cs'2brecord'5cb >>= withAttribute KeywordTok))@@ -107,9 +104,9 @@ <|> ((pRegExpr regex_'5cbend'5cb >>= withAttribute KeywordTok)) <|>- ((pFirstNonSpace >> pString False "-- BEGIN" >>= withAttribute RegionMarkerTok) >>~ pushContext "Region Marker")+ ((pFirstNonSpace >> pString False "-- BEGIN" >>= withAttribute RegionMarkerTok) >>~ pushContext ("Ada","Region Marker")) <|>- ((pFirstNonSpace >> pString False "-- END" >>= withAttribute RegionMarkerTok) >>~ pushContext "Region Marker")+ ((pFirstNonSpace >> pString False "-- END" >>= withAttribute RegionMarkerTok) >>~ pushContext ("Ada","Region Marker")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|>@@ -123,21 +120,20 @@ <|> ((pRegExpr regex_'27'2e'27 >>= withAttribute CharTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Ada","String")) <|>- ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("Ada","Comment")) <|> ((pAnyChar ":!%&()+,-/.*<=>|" >>= withAttribute NormalTok))) -parseRules "Region Marker" =+parseRules ("Ada","Region Marker") = pzero -parseRules "String" =+parseRules ("Ada","String") = ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) -parseRules "Comment" =+parseRules ("Ada","Comment") = pzero -parseRules "" = parseRules "Default" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Alert.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,27 +25,29 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Alerts" }- context <- currentContext <|> (pushContext "Normal Text" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Alerts",["Normal Text"])], synStLanguage = "Alerts", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Alerts","Normal Text")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal Text" -> (popContext) >> pEndLine+ ("Alerts","Normal Text") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -55,18 +56,13 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_alerts = Set.fromList $ words $ "### ALERT BUG DANGER DEPRECATED FIXME HACK NOTE NOTICE SECURITY TASK TEST TESTING TODO WARNING" -defaultAttributes = [("Normal Text",NormalTok)]+defaultAttributes = [(("Alerts","Normal Text"),NormalTok)] -parseRules "Normal Text" =+parseRules ("Alerts","Normal Text") = ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_alerts >>= withAttribute AlertTok)) -parseRules "" = parseRules "Normal Text" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Alert_indent.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,27 +25,29 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Alerts_indent" }- context <- currentContext <|> (pushContext "Normal Text" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Alerts_indent",["Normal Text"])], synStLanguage = "Alerts_indent", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Alerts_indent","Normal Text")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal Text" -> (popContext) >> pEndLine+ ("Alerts_indent","Normal Text") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -55,18 +56,13 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_alerts = Set.fromList $ words $ "### ALERT BUG DANGER DEPRECATED FIXME HACK NOTE NOTICE SECURITY TASK TEST TESTING TODO WARNING" -defaultAttributes = [("Normal Text",NormalTok)]+defaultAttributes = [(("Alerts_indent","Normal Text"),NormalTok)] -parseRules "Normal Text" =+parseRules ("Alerts_indent","Normal Text") = ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_alerts >>= withAttribute AlertTok)) -parseRules "" = parseRules "Normal Text" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Apache.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,35 +26,37 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Apache Configuration" }- context <- currentContext <|> (pushContext "apache" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Apache Configuration",["apache"])], synStLanguage = "Apache Configuration", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Apache Configuration","apache")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "apache" -> return ()- "String Directives" -> (popContext) >> pEndLine- "Integer Directives" -> (popContext) >> pEndLine- "Alternative Directives" -> (popContext) >> pEndLine- "Comment" -> (popContext) >> pEndLine- "Container Open" -> (popContext) >> pEndLine- "Container Close" -> (popContext) >> pEndLine- "Comment Alert" -> (popContext) >> pEndLine- "Alert" -> (popContext) >> pEndLine+ ("Apache Configuration","apache") -> return ()+ ("Apache Configuration","String Directives") -> (popContext) >> pEndLine+ ("Apache Configuration","Integer Directives") -> (popContext) >> pEndLine+ ("Apache Configuration","Alternative Directives") -> (popContext) >> pEndLine+ ("Apache Configuration","Comment") -> (popContext) >> pEndLine+ ("Apache Configuration","Container Open") -> (popContext) >> pEndLine+ ("Apache Configuration","Container Close") -> (popContext) >> pEndLine+ ("Apache Configuration","Comment Alert") -> (popContext) >> pEndLine+ ("Apache Configuration","Alert") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -64,10 +65,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_String_Directives = Set.fromList $ words $ "acceptfilter accessfilename action addalt addaltbyencoding addaltbytype addcharset adddefaultcharset adddescription addencoding addhandler addicon addiconbyencoding addiconbytype addinputfilter addlanguage addmoduleinfo addoutputfilter addoutputfilterbytype addtype alias aliasmatch allow anonymous authbasicprovider authdbmgroupfile authdbmuserfile authdigestdomain authdigestfile authdigestgroupfile authdigestnonceformat authdigestprovider authgroupfile authldapbinddn authldapbindpassword authldapcharsetconfig authldapgroupattribute authldapurl authname authuserfile browsermatch browsermatchnocase bs2000account cachedisable cacheenable cachefile cachegcclean cachegcunused cacheroot cgimapextension charsetdefault charsetoptions charsetsourceenc cookiedomain cookielog cookiename coredumpdirectory customlog dav davgenericlockdb davlockdb dbdparams dbdpreparesql dbdriver defaulticon defaultlanguage defaulttype deflatefilternote deny directoryindex documentroot errordocument errorlog example expiresbytype expiresdefault extfilterdefine extfilteroptions filterchain filterdeclare filterprotocol filterprovider filtertrace forcetype forensiclog group header headername imapbase include indexignore indexoptions indexstylesheet isapicachefile languagepriority ldapsharedcachefile ldaptrustedca ldaptrustedcatype ldaptrustedclientcert ldaptrustedglobalcert listen loadfile loadmodule lockfile logformat metadir metasuffix mimemagicfile mmapfile namevirtualhost noproxy nwssltrustedcerts nwsslupgradeable passenv pidfile proxyblock proxydomain proxypass proxypassreverse proxypassreversecookiedomain proxypassreversecookiepath proxyremote proxyremotematch readmename redirect redirectmatch redirectpermanent redirecttemp removecharset removeencoding removehandler removeinputfilter removelanguage removeoutputfilter removetype requestheader require rewritebase rewritecond rewritelock rewritelog rewritemap rewriterule scoreboardfile script scriptalias scriptaliasmatch scriptlog scriptsock securelisten serveradmin serveralias servername serverpath serverroot setenv setenvif setenvifnocase sethandler setinputfilter setoutputfilter ssiendtag ssierrormsg ssistarttag ssitimeformat ssiundefinedecho sslcacertificatefile sslcacertificatepath sslcadnrequestfile sslcadnrequestpath sslcarevocationfile sslcarevocationpath sslcertificatechainfile sslcertificatefile sslcertificatekeyfile sslciphersuite sslcryptodevice sslhonorciperorder sslpassphrasedialog sslproxycacertificatefile sslproxycacertificatepath sslproxycarevocationfile sslproxycarevocationpath sslproxyciphersuite sslproxymachinecertificatefile sslproxymachinecertificatepath sslproxyprotocol sslrandomseed sslrequire sslrequiressl sslusername suexecusergroup transferlog typesconfig unsetenv user userdir virtualdocumentroot virtualdocumentrootip virtualscriptalias virtualscriptaliasip win32disableacceptex" list_Integer_Directives = Set.fromList $ words $ "allowconnect assignuserid authdigestnoncelifetime authdigestshmemsize cachedefaultexpire cachedirlength cachedirlevels cacheforcecompletion cachegcdaily cachegcinterval cachegcmemusage cachelastmodifiedfactor cachemaxexpire cachemaxfilesize cacheminfilesize cachesize cachetimemargin childperuserid cookieexpires davmintimeout dbdexptime dbdkeep dbdmax dbdmin dbdpersist deflatebuffersize deflatecompressionlevel deflatememlevel deflatewindowsize identitychecktimeout isapireadaheadbuffer keepalivetimeout ldapcacheentries ldapcachettl ldapconnectiontimeout ldapopcacheentries ldapopcachettl ldapsharedcachesize limitinternalrecursion limitrequestbody limitrequestfields limitrequestfieldsize limitrequestline limitxmlrequestbody listenbacklog maxclients maxkeepaliverequests maxmemfree maxrequestsperchild maxrequestsperthread maxspareservers maxsparethreads maxthreads maxthreadsperchild mcachemaxobjectcount mcachemaxobjectsize mcachemaxstreamingbuffer mcacheminobjectsize mcachesize minspareservers minsparethreads numservers proxyiobuffersize proxymaxforwards proxyreceivebuffersize proxytimeout rewriteloglevel rlimitcpu rlimitmem rlimitnproc scriptlogbuffer scriptloglength sendbuffersize serverlimit sslproxyverifydepth sslsessioncachetimeout sslverifydepth startservers startthreads threadlimit threadsperchild threadstacksize timeout" list_Alternative_Directives = Set.fromList $ words $ "acceptmutex acceptpathinfo allowencodedslashes allowoverride anonymous_authoritative anonymous_logemail anonymous_mustgiveemail anonymous_nouserid anonymous_verifyemail authauthoritative authbasicauthoritative authbasicprovider authdbmauthoritative authdbmtype authdefaultauthoritative authdigestalgorithm authdigestnccheck authdigestqop authldapauthoritative authldapcomparednonserver authldapdereferencealiases authldapenabled authldapfrontpagehack authldapgroupattributeisdn authldapremoteuserisdn authtype authzdbmauthoritative authzdbmtype authzdefaultauthoritative authzgroupfileauthoritative authzldapauthoritative authzownerauthoritative authzuserauthoritative bufferedlogs cacheexpirycheck cacheignorecachecontrol cacheignoreheaders cacheignorenolastmod cachenegotiateddocs cachestorenostore cachestoreprivate checkspelling contentdigest cookiestyle cookietracking coredumpdirectory customlog davdepthinfinity directoryslash dumpioinput dumpiooutput enableexceptionhook enablemmap enablesendfile expiresactive extendedstatus fileetag forcelanguagepriority hostnamelookups identitycheck imapdefault imapmenu indexorderdefault isapiappendlogtoerrors isapiappendlogtoquery isapifakeasync isapilognotsupported keepalive ldaptrustedmode ldapverifyservercert loglevel mcacheremovalalgorithm metafiles modmimeusepathinfo multiviewsmatch options order protocolecho proxybadheader proxyerroroverride proxypreservehost proxyrequests proxyvia rewriteengine rewriteoptions satisfy scriptinterpretersource serversignature servertokens sslengine sslmutex ssloptions sslprotocol sslproxyengine sslproxyverify sslsessioncache sslverifyclient usecanonicalname xbithack"@@ -78,65 +75,65 @@ regex_'5b'5e'23'5d'2a = compileRegex "[^#]*" regex_'5b'5e'23'3e'5d'2a = compileRegex "[^#>]*" -defaultAttributes = [("apache",NormalTok),("String Directives",OtherTok),("Integer Directives",CharTok),("Alternative Directives",CharTok),("Comment",CommentTok),("Container Open",FunctionTok),("Container Close",FunctionTok),("Comment Alert",NormalTok),("Alert",ErrorTok)]+defaultAttributes = [(("Apache Configuration","apache"),NormalTok),(("Apache Configuration","String Directives"),OtherTok),(("Apache Configuration","Integer Directives"),CharTok),(("Apache Configuration","Alternative Directives"),CharTok),(("Apache Configuration","Comment"),CommentTok),(("Apache Configuration","Container Open"),FunctionTok),(("Apache Configuration","Container Close"),FunctionTok),(("Apache Configuration","Comment Alert"),NormalTok),(("Apache Configuration","Alert"),ErrorTok)] -parseRules "apache" =- (((pKeyword " \n\t.():!+-<=>%&*/;?[]^{|}~\\" list_String_Directives >>= withAttribute NormalTok) >>~ pushContext "String Directives")+parseRules ("Apache Configuration","apache") =+ (((pKeyword " \n\t.():!+-<=>%&*/;?[]^{|}~\\" list_String_Directives >>= withAttribute NormalTok) >>~ pushContext ("Apache Configuration","String Directives")) <|>- ((pKeyword " \n\t.():!+-<=>%&*/;?[]^{|}~\\" list_Integer_Directives >>= withAttribute OtherTok) >>~ pushContext "Integer Directives")+ ((pKeyword " \n\t.():!+-<=>%&*/;?[]^{|}~\\" list_Integer_Directives >>= withAttribute OtherTok) >>~ pushContext ("Apache Configuration","Integer Directives")) <|>- ((pKeyword " \n\t.():!+-<=>%&*/;?[]^{|}~\\" list_Alternative_Directives >>= withAttribute OtherTok) >>~ pushContext "Alternative Directives")+ ((pKeyword " \n\t.():!+-<=>%&*/;?[]^{|}~\\" list_Alternative_Directives >>= withAttribute OtherTok) >>~ pushContext ("Apache Configuration","Alternative Directives")) <|>- ((pRegExpr regex_'3c'5cw'2b >>= withAttribute FunctionTok) >>~ pushContext "Container Open")+ ((pRegExpr regex_'3c'5cw'2b >>= withAttribute FunctionTok) >>~ pushContext ("Apache Configuration","Container Open")) <|>- ((pRegExpr regex_'3c'2f'5cw'2b >>= withAttribute FunctionTok) >>~ pushContext "Container Close")+ ((pRegExpr regex_'3c'2f'5cw'2b >>= withAttribute FunctionTok) >>~ pushContext ("Apache Configuration","Container Close")) <|>- ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "Comment"))+ ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("Apache Configuration","Comment"))) -parseRules "String Directives" =+parseRules ("Apache Configuration","String Directives") = (((pRegExpr regex_'5b'5e'23'5d'2a >>= withAttribute StringTok)) <|>- ((parseRules "Comment Alert")))+ ((parseRules ("Apache Configuration","Comment Alert")))) -parseRules "Integer Directives" =- (((pFloat >>= withAttribute FloatTok) >>~ pushContext "Integer Directives")+parseRules ("Apache Configuration","Integer Directives") =+ (((pFloat >>= withAttribute FloatTok) >>~ pushContext ("Apache Configuration","Integer Directives")) <|>- ((pInt >>= withAttribute FloatTok) >>~ pushContext "Integer Directives")+ ((pInt >>= withAttribute FloatTok) >>~ pushContext ("Apache Configuration","Integer Directives")) <|>- ((parseRules "Comment Alert")))+ ((parseRules ("Apache Configuration","Comment Alert")))) -parseRules "Alternative Directives" =+parseRules ("Apache Configuration","Alternative Directives") = (((pKeyword " \n\t.():!+-<=>%&*/;?[]^{|}~\\" list_Alternates >>= withAttribute KeywordTok)) <|> ((pDetectChar False '-' >>= withAttribute KeywordTok)) <|> ((pDetectChar False '+' >>= withAttribute KeywordTok)) <|>- ((parseRules "Comment Alert")))+ ((parseRules ("Apache Configuration","Comment Alert")))) -parseRules "Comment" =+parseRules ("Apache Configuration","Comment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "Container Open" =- (((pDetectChar False '>' >>= withAttribute FunctionTok) >>~ pushContext "Alert")+parseRules ("Apache Configuration","Container Open") =+ (((pDetectChar False '>' >>= withAttribute FunctionTok) >>~ pushContext ("Apache Configuration","Alert")) <|> ((pRegExpr regex_'5b'5e'23'3e'5d'2a >>= withAttribute OtherTok)) <|>- ((parseRules "Comment Alert")))+ ((parseRules ("Apache Configuration","Comment Alert")))) -parseRules "Container Close" =- ((pDetectChar False '>' >>= withAttribute FunctionTok) >>~ pushContext "Alert")+parseRules ("Apache Configuration","Container Close") =+ ((pDetectChar False '>' >>= withAttribute FunctionTok) >>~ pushContext ("Apache Configuration","Alert")) -parseRules "Comment Alert" =- ((pDetectChar False '#' >>= withAttribute ErrorTok) >>~ pushContext "Alert")+parseRules ("Apache Configuration","Comment Alert") =+ ((pDetectChar False '#' >>= withAttribute ErrorTok) >>~ pushContext ("Apache Configuration","Alert")) -parseRules "Alert" =+parseRules ("Apache Configuration","Alert") = pzero -parseRules "" = parseRules "apache"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Asn1.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,28 +25,30 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "ASN.1" }- context <- currentContext <|> (pushContext "Normal Text" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("ASN.1",["Normal Text"])], synStLanguage = "ASN.1", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("ASN.1","Normal Text")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal Text" -> return ()- "Comment" -> (popContext) >> pEndLine+ ("ASN.1","Normal Text") -> return ()+ ("ASN.1","Comment") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -56,26 +57,21 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "DEFINITIONS BEGIN END EXPORTS IMPORTS FROM APPLICATION PRIVATE UNIVERSAL DEFAULT OPTIONAL FALSE TRUE" list_types = Set.fromList $ words $ "BOOLEAN INTEGER OCTET STRING NULL REAL ENUMERATED SEQUENCE SET CHOICE OF VisibleString StringStore" -defaultAttributes = [("Normal Text",NormalTok),("Comment",CommentTok)]+defaultAttributes = [(("ASN.1","Normal Text"),NormalTok),(("ASN.1","Comment"),CommentTok)] -parseRules "Normal Text" =+parseRules ("ASN.1","Normal Text") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_types >>= withAttribute DataTypeTok)) <|>- ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext "Comment"))+ ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("ASN.1","Comment"))) -parseRules "Comment" =+parseRules ("ASN.1","Comment") = pzero -parseRules "" = parseRules "Normal Text" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Asp.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,39 +25,41 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "ASP" }- context <- currentContext <|> (pushContext "nosource" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("ASP",["nosource"])], synStLanguage = "ASP", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("ASP","nosource")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "nosource" -> return ()- "aspsource" -> return ()- "asp_onelinecomment" -> (popContext) >> pEndLine- "doublequotestring" -> return ()- "singlequotestring" -> return ()- "htmltag" -> return ()- "htmlcomment" -> return ()- "identifiers" -> return ()- "types1" -> return ()- "types2" -> return ()- "scripts" -> return ()- "scripts_onelinecomment" -> (popContext) >> pEndLine- "twolinecomment" -> return ()+ ("ASP","nosource") -> return ()+ ("ASP","aspsource") -> return ()+ ("ASP","asp_onelinecomment") -> (popContext) >> pEndLine+ ("ASP","doublequotestring") -> return ()+ ("ASP","singlequotestring") -> return ()+ ("ASP","htmltag") -> return ()+ ("ASP","htmlcomment") -> return ()+ ("ASP","identifiers") -> return ()+ ("ASP","types1") -> return ()+ ("ASP","types2") -> return ()+ ("ASP","scripts") -> return ()+ ("ASP","scripts_onelinecomment") -> (popContext) >> pEndLine+ ("ASP","twolinecomment") -> return () _ -> return () withAttribute attr txt = do@@ -67,10 +68,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_control_structures = Set.fromList $ words $ "select case end select if then else elseif end if while do until loop wend for each to in next exit continue" list_keywords = Set.fromList $ words $ "dim redim preserve const erase nothing set new me function sub call class private public with randomize open close movenext execute eof not true false or and xor" list_functions = Set.fromList $ words $ "response write redirect end request form querystring servervariables cookies session server createobject abs array asc atn cbool cbyte ccur cdate cdbl chr cint clng cos csng cstr date dateadd datediff datepart dateserial datevalue date day exp filter fix formatcurrency formatdatetime formatnumber formatpercent getobject hex hour inputbox instr instrrev int isarray isdate isempty isnull isnumeric isobject join lbound lcase left len loadpicture log ltrim mid minute month monthname msgbox now oct replace rgb right rnd round rtrim scriptengine scriptenginebuildversion scriptenginemajorversion scriptengineminorversion second sgn sin space split sqr strcomp strreverse string tan time timer timeserial timevalue trim typename ubound ucase vartype weekday weekdayname year add addfolders buildpath clear close copy copyfile copyfolder createfolder createtextfile delete deletefile deletefolder driveexists exists fileexists folderexists getabsolutepathname getbasename getdrive getdrivename getextensionname getfile getfilename getfolder getparentfoldername getspecialfolder gettempname items item keys move movefile movefolder openastextstream opentextfile raise read readall readline remove removeall skip skipline write writeblanklines writeline"@@ -109,29 +106,29 @@ 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 = [("nosource",NormalTok),("aspsource",NormalTok),("asp_onelinecomment",CommentTok),("doublequotestring",StringTok),("singlequotestring",StringTok),("htmltag",OtherTok),("htmlcomment",CommentTok),("identifiers",OtherTok),("types1",DataTypeTok),("types2",DataTypeTok),("scripts",NormalTok),("scripts_onelinecomment",CommentTok),("twolinecomment",CommentTok)]+defaultAttributes = [(("ASP","nosource"),NormalTok),(("ASP","aspsource"),NormalTok),(("ASP","asp_onelinecomment"),CommentTok),(("ASP","doublequotestring"),StringTok),(("ASP","singlequotestring"),StringTok),(("ASP","htmltag"),OtherTok),(("ASP","htmlcomment"),CommentTok),(("ASP","identifiers"),OtherTok),(("ASP","types1"),DataTypeTok),(("ASP","types2"),DataTypeTok),(("ASP","scripts"),NormalTok),(("ASP","scripts_onelinecomment"),CommentTok),(("ASP","twolinecomment"),CommentTok)] -parseRules "nosource" =- (((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext "aspsource")+parseRules ("ASP","nosource") =+ (((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource")) <|>- ((pRegExpr regex_'3c'5cs'2ascript'5cs'2alanguage'3d'22VBScript'22'5b'5e'3e'5d'2a'3e >>= withAttribute KeywordTok) >>~ pushContext "aspsource")+ ((pRegExpr regex_'3c'5cs'2ascript'5cs'2alanguage'3d'22VBScript'22'5b'5e'3e'5d'2a'3e >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource")) <|>- ((pRegExpr regex_'3c'5cs'2ascript'28'5cs'7c'3e'29 >>= withAttribute KeywordTok) >>~ pushContext "scripts")+ ((pRegExpr regex_'3c'5cs'2ascript'28'5cs'7c'3e'29 >>= withAttribute KeywordTok) >>~ pushContext ("ASP","scripts")) <|>- ((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 "htmltag")+ ((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 "htmlcomment"))+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("ASP","htmlcomment"))) -parseRules "aspsource" =+parseRules ("ASP","aspsource") = (((pString False "%>" >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pRegExpr regex_'3c'5cs'2a'5c'2f'5cs'2ascript'5cs'2a'3e >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pDetectChar False '\'' >>= withAttribute CommentTok) >>~ pushContext "asp_onelinecomment")+ ((pDetectChar False '\'' >>= withAttribute CommentTok) >>~ pushContext ("ASP","asp_onelinecomment")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "doublequotestring")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("ASP","doublequotestring")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "singlequotestring")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("ASP","singlequotestring")) <|> ((pDetectChar False '&' >>= withAttribute KeywordTok)) <|>@@ -203,10 +200,10 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_functions >>= withAttribute KeywordTok))) -parseRules "asp_onelinecomment" =+parseRules ("ASP","asp_onelinecomment") = ((pString False "%>" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) -parseRules "doublequotestring" =+parseRules ("ASP","doublequotestring") = (((pDetect2Chars False '"' '"' >>= withAttribute KeywordTok)) <|> ((pRegExpr regex_'5c'5c'5b0'2d7'5d'7b1'2c3'7d >>= withAttribute KeywordTok))@@ -215,56 +212,56 @@ <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "singlequotestring" =+parseRules ("ASP","singlequotestring") = (((pDetect2Chars False '\'' '\'' >>= withAttribute KeywordTok)) <|> ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "htmltag" =+parseRules ("ASP","htmltag") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext "aspsource")+ ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource")) <|>- ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext "aspsource")+ ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource")) <|>- ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext "identifiers"))+ ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("ASP","identifiers"))) -parseRules "htmlcomment" =- (((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext "aspsource")+parseRules ("ASP","htmlcomment") =+ (((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource")) <|>- ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext "aspsource")+ ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource")) <|> ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext)) <|>- ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext "identifiers"))+ ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("ASP","identifiers"))) -parseRules "identifiers" =+parseRules ("ASP","identifiers") = (((pRegExpr regex_'5cs'2a'23'3f'5ba'2dzA'2dZ0'2d9'5d'2a >>= withAttribute StringTok) >>~ (popContext)) <|>- ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ pushContext "types1")+ ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ pushContext ("ASP","types1")) <|>- ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext "types2"))+ ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("ASP","types2"))) -parseRules "types1" =- (((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext "aspsource")+parseRules ("ASP","types1") =+ (((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource")) <|>- ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext "aspsource")+ ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource")) <|> ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))) -parseRules "types2" =- (((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext "aspsource")+parseRules ("ASP","types2") =+ (((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource")) <|>- ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext "aspsource")+ ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource")) <|> ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))) -parseRules "scripts" =- (((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "scripts_onelinecomment")+parseRules ("ASP","scripts") =+ (((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("ASP","scripts_onelinecomment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "twolinecomment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("ASP","twolinecomment")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_control_structures >>= withAttribute KeywordTok)) <|>@@ -272,13 +269,13 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_functions >>= withAttribute KeywordTok)) <|>- ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext "aspsource")+ ((pString False "<%" >>= withAttribute KeywordTok) >>~ pushContext ("ASP","aspsource")) <|> ((pRegExpr regex_'3c'5cs'2a'5c'2f'5cs'2ascript'5cs'2a'3e >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "doublequotestring")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("ASP","doublequotestring")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "singlequotestring")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("ASP","singlequotestring")) <|> ((pHlCOct >>= withAttribute BaseNTok)) <|>@@ -296,12 +293,11 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" Set.empty >>= withAttribute OtherTok))) -parseRules "scripts_onelinecomment" =+parseRules ("ASP","scripts_onelinecomment") = ((pRegExpr regex_'3c'5cs'2a'5c'2f'5cs'2ascript'5cs'2a'3e >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) -parseRules "twolinecomment" =+parseRules ("ASP","twolinecomment") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "" = parseRules "nosource" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Awk.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,29 +26,31 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "AWK" }- context <- currentContext <|> (pushContext "Base" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("AWK",["Base"])], synStLanguage = "AWK", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("AWK","Base")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Base" -> return ()- "String" -> return ()- "Comment" -> (popContext) >> pEndLine+ ("AWK","Base") -> return ()+ ("AWK","String") -> return ()+ ("AWK","Comment") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -58,10 +59,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "if else while do for in continue break print printf getline function return next exit" list_builtins = Set.fromList $ words $ "ARGC ARGV CONVFMT ENVIRON FILENAME FNR FS NF NR OFMT OFS ORS RS RSTART RLENGTH SUBSEP" list_functions = Set.fromList $ words $ "gsub gensub index length match split sprintf sub substr tolower toupper atan2 cos exp int log rand sin sqrt srand close fflush system"@@ -69,18 +66,18 @@ regex_'5cb'28BEGIN'7cEND'29'5cb = compileRegex "\\b(BEGIN|END)\\b" regex_'5c'24'5bA'2dZa'2dz0'2d9'5f'5d'2b = compileRegex "\\$[A-Za-z0-9_]+" -defaultAttributes = [("Base",NormalTok),("String",StringTok),("Comment",CommentTok)]+defaultAttributes = [(("AWK","Base"),NormalTok),(("AWK","String"),StringTok),(("AWK","Comment"),CommentTok)] -parseRules "Base" =+parseRules ("AWK","Base") = (((pRegExpr regex_'5cb'28BEGIN'7cEND'29'5cb >>= withAttribute StringTok)) <|> ((pDetectChar False '{' >>= withAttribute KeywordTok)) <|> ((pDetectChar False '}' >>= withAttribute KeywordTok)) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("AWK","Comment")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("AWK","String")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|>@@ -94,14 +91,14 @@ <|> ((pRegExpr regex_'5c'24'5bA'2dZa'2dz0'2d9'5f'5d'2b >>= withAttribute OtherTok))) -parseRules "String" =+parseRules ("AWK","String") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) <|> ((pHlCStringChar >>= withAttribute StringTok))) -parseRules "Comment" =+parseRules ("AWK","Comment") = ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) -parseRules "" = parseRules "Base"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Bash.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,75 +26,77 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Bash" }- context <- currentContext <|> (pushContext "Start" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Bash",["Start"])], synStLanguage = "Bash", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Bash","Start")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Start" -> return ()- "FindAll" -> return ()- "FindMost" -> return ()- "FindComments" -> (popContext) >> pEndLine- "Comment" -> (popContext) >> pEndLine- "FindCommentsParen" -> (popContext) >> pEndLine- "CommentParen" -> (popContext) >> pEndLine- "FindCommentsBackq" -> (popContext) >> pEndLine- "CommentBackq" -> (popContext) >> pEndLine- "FindCommands" -> return ()- "FindOthers" -> return ()- "FindStrings" -> return ()- "FindSubstitutions" -> return ()- "FindTests" -> return ()- "ExprDblParen" -> return ()- "ExprDblParenSubst" -> return ()- "ExprSubParen" -> return ()- "ExprBracket" -> return ()- "ExprDblBracket" -> return ()- "Group" -> return ()- "SubShell" -> return ()- "Assign" -> (popContext) >> pEndLine- "AssignArray" -> (popContext) >> pEndLine- "AssignSubscr" -> (popContext) >> pEndLine- "Subscript" -> return ()- "FunctionDef" -> (popContext) >> pEndLine- "VarName" -> (popContext) >> pEndLine- "ProcessSubst" -> return ()- "StringSQ" -> return ()- "StringDQ" -> return ()- "StringEsc" -> return ()- "VarBrace" -> return ()- "VarAlt" -> return ()- "VarSubst" -> return ()- "VarSubst2" -> return ()- "VarSub" -> return ()- "VarSub2" -> return ()- "SubstFile" -> return ()- "SubstCommand" -> return ()- "SubstBackq" -> return ()- "Case" -> return ()- "CaseIn" -> return ()- "CaseExpr" -> return ()- "HereDoc" -> return ()- "HereDocRemainder" -> (popContext) >> pEndLine- "HereDocQ" -> return ()- "HereDocNQ" -> return ()- "HereDocIQ" -> return ()- "HereDocINQ" -> return ()+ ("Bash","Start") -> return ()+ ("Bash","FindAll") -> return ()+ ("Bash","FindMost") -> return ()+ ("Bash","FindComments") -> (popContext) >> pEndLine+ ("Bash","Comment") -> (popContext) >> pEndLine+ ("Bash","FindCommentsParen") -> (popContext) >> pEndLine+ ("Bash","CommentParen") -> (popContext) >> pEndLine+ ("Bash","FindCommentsBackq") -> (popContext) >> pEndLine+ ("Bash","CommentBackq") -> (popContext) >> pEndLine+ ("Bash","FindCommands") -> return ()+ ("Bash","FindOthers") -> return ()+ ("Bash","FindStrings") -> return ()+ ("Bash","FindSubstitutions") -> return ()+ ("Bash","FindTests") -> return ()+ ("Bash","ExprDblParen") -> return ()+ ("Bash","ExprDblParenSubst") -> return ()+ ("Bash","ExprSubParen") -> return ()+ ("Bash","ExprBracket") -> return ()+ ("Bash","ExprDblBracket") -> return ()+ ("Bash","Group") -> return ()+ ("Bash","SubShell") -> return ()+ ("Bash","Assign") -> (popContext) >> pEndLine+ ("Bash","AssignArray") -> (popContext) >> pEndLine+ ("Bash","AssignSubscr") -> (popContext) >> pEndLine+ ("Bash","Subscript") -> return ()+ ("Bash","FunctionDef") -> (popContext) >> pEndLine+ ("Bash","VarName") -> (popContext) >> pEndLine+ ("Bash","ProcessSubst") -> return ()+ ("Bash","StringSQ") -> return ()+ ("Bash","StringDQ") -> return ()+ ("Bash","StringEsc") -> return ()+ ("Bash","VarBrace") -> return ()+ ("Bash","VarAlt") -> return ()+ ("Bash","VarSubst") -> return ()+ ("Bash","VarSubst2") -> return ()+ ("Bash","VarSub") -> return ()+ ("Bash","VarSub2") -> return ()+ ("Bash","SubstFile") -> return ()+ ("Bash","SubstCommand") -> return ()+ ("Bash","SubstBackq") -> return ()+ ("Bash","Case") -> return ()+ ("Bash","CaseIn") -> return ()+ ("Bash","CaseExpr") -> return ()+ ("Bash","HereDoc") -> return ()+ ("Bash","HereDocRemainder") -> (popContext) >> pEndLine+ ("Bash","HereDocQ") -> return ()+ ("Bash","HereDocNQ") -> return ()+ ("Bash","HereDocIQ") -> return ()+ ("Bash","HereDocINQ") -> return () _ -> return () withAttribute attr txt = do@@ -104,10 +105,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "else for function in select until while elif then set" list_builtins = Set.fromList $ words $ ": source alias bg bind break builtin cd caller command compgen complete continue dirs disown echo enable eval exec exit fc fg getopts hash help history jobs kill let logout popd printf pushd pwd return set shift shopt suspend test time times trap type ulimit umask unalias wait" list_builtins'5fvar = Set.fromList $ words $ "export unset declare typeset local read readonly"@@ -185,73 +182,73 @@ regex_'28'3c'3c'5cs'2a'5c'5c'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'29 = compileRegex "(<<\\s*\\\\([^|&;()<>\\s]+))" regex_'28'3c'3c'5cs'2a'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'29 = compileRegex "(<<\\s*([^|&;()<>\\s]+))" -defaultAttributes = [("Start",NormalTok),("FindAll",NormalTok),("FindMost",NormalTok),("FindComments",NormalTok),("Comment",CommentTok),("FindCommentsParen",NormalTok),("CommentParen",CommentTok),("FindCommentsBackq",NormalTok),("CommentBackq",CommentTok),("FindCommands",NormalTok),("FindOthers",NormalTok),("FindStrings",NormalTok),("FindSubstitutions",NormalTok),("FindTests",NormalTok),("ExprDblParen",NormalTok),("ExprDblParenSubst",NormalTok),("ExprSubParen",NormalTok),("ExprBracket",NormalTok),("ExprDblBracket",NormalTok),("Group",NormalTok),("SubShell",NormalTok),("Assign",NormalTok),("AssignArray",NormalTok),("AssignSubscr",NormalTok),("Subscript",OtherTok),("FunctionDef",FunctionTok),("VarName",NormalTok),("ProcessSubst",NormalTok),("StringSQ",StringTok),("StringDQ",StringTok),("StringEsc",StringTok),("VarBrace",ErrorTok),("VarAlt",NormalTok),("VarSubst",NormalTok),("VarSubst2",NormalTok),("VarSub",ErrorTok),("VarSub2",ErrorTok),("SubstFile",NormalTok),("SubstCommand",NormalTok),("SubstBackq",NormalTok),("Case",NormalTok),("CaseIn",NormalTok),("CaseExpr",NormalTok),("HereDoc",NormalTok),("HereDocRemainder",NormalTok),("HereDocQ",NormalTok),("HereDocNQ",NormalTok),("HereDocIQ",NormalTok),("HereDocINQ",NormalTok)]+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 "Start" =- ((parseRules "FindAll"))+parseRules ("Bash","Start") =+ ((parseRules ("Bash","FindAll"))) -parseRules "FindAll" =- (((parseRules "FindComments"))+parseRules ("Bash","FindAll") =+ (((parseRules ("Bash","FindComments"))) <|>- ((parseRules "FindCommands"))+ ((parseRules ("Bash","FindCommands"))) <|>- ((parseRules "FindStrings"))+ ((parseRules ("Bash","FindStrings"))) <|>- ((parseRules "FindSubstitutions"))+ ((parseRules ("Bash","FindSubstitutions"))) <|>- ((parseRules "FindOthers")))+ ((parseRules ("Bash","FindOthers")))) -parseRules "FindMost" =- (((parseRules "FindComments"))+parseRules ("Bash","FindMost") =+ (((parseRules ("Bash","FindComments"))) <|>- ((parseRules "FindStrings"))+ ((parseRules ("Bash","FindStrings"))) <|>- ((parseRules "FindSubstitutions"))+ ((parseRules ("Bash","FindSubstitutions"))) <|>- ((parseRules "FindOthers")))+ ((parseRules ("Bash","FindOthers")))) -parseRules "FindComments" =- (((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "Comment")+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 "Comment"))+ ((pRegExpr regex_'5b'5cs'3b'5d'28'3f'3d'23'29 >>= withAttribute NormalTok) >>~ pushContext ("Bash","Comment"))) -parseRules "Comment" =+parseRules ("Bash","Comment") = ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) -parseRules "FindCommentsParen" =- (((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "CommentParen")+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 "CommentParen"))+ ((pRegExpr regex_'5b'5cs'3b'5d'28'3f'3d'23'29 >>= withAttribute NormalTok) >>~ pushContext ("Bash","CommentParen"))) -parseRules "CommentParen" =+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)))) -parseRules "FindCommentsBackq" =- (((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "CommentBackq")+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 "CommentBackq"))+ ((pRegExpr regex_'5b'5cs'3b'5d'28'3f'3d'23'29 >>= withAttribute NormalTok) >>~ pushContext ("Bash","CommentBackq"))) -parseRules "CommentBackq" =+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)))) -parseRules "FindCommands" =- (((pDetect2Chars False '(' '(' >>= withAttribute KeywordTok) >>~ pushContext "ExprDblParen")+parseRules ("Bash","FindCommands") =+ (((pDetect2Chars False '(' '(' >>= withAttribute KeywordTok) >>~ pushContext ("Bash","ExprDblParen")) <|>- ((pColumn 0 >> pRegExpr regex_'5c'5b'5c'5b'28'3f'3d'28'24'7c'5cs'29'29 >>= withAttribute KeywordTok) >>~ pushContext "ExprDblBracket")+ ((pColumn 0 >> pRegExpr regex_'5c'5b'5c'5b'28'3f'3d'28'24'7c'5cs'29'29 >>= withAttribute KeywordTok) >>~ pushContext ("Bash","ExprDblBracket")) <|>- ((pRegExpr regex_'5cs'5c'5b'5c'5b'28'3f'3d'28'24'7c'5cs'29'29 >>= withAttribute KeywordTok) >>~ pushContext "ExprDblBracket")+ ((pRegExpr regex_'5cs'5c'5b'5c'5b'28'3f'3d'28'24'7c'5cs'29'29 >>= withAttribute KeywordTok) >>~ pushContext ("Bash","ExprDblBracket")) <|>- ((pColumn 0 >> pRegExpr regex_'5c'5b'28'3f'3d'28'24'7c'5cs'29'29 >>= withAttribute KeywordTok) >>~ pushContext "ExprBracket")+ ((pColumn 0 >> pRegExpr regex_'5c'5b'28'3f'3d'28'24'7c'5cs'29'29 >>= withAttribute KeywordTok) >>~ pushContext ("Bash","ExprBracket")) <|>- ((pRegExpr regex_'5cs'5c'5b'28'3f'3d'28'24'7c'5cs'29'29 >>= withAttribute KeywordTok) >>~ pushContext "ExprBracket")+ ((pRegExpr regex_'5cs'5c'5b'28'3f'3d'28'24'7c'5cs'29'29 >>= withAttribute KeywordTok) >>~ pushContext ("Bash","ExprBracket")) <|>- ((pRegExpr regex_'5c'7b'28'3f'3d'28'24'7c'5cs'29'29 >>= withAttribute KeywordTok) >>~ pushContext "Group")+ ((pRegExpr regex_'5c'7b'28'3f'3d'28'24'7c'5cs'29'29 >>= withAttribute KeywordTok) >>~ pushContext ("Bash","Group")) <|>- ((pDetectChar False '(' >>= withAttribute KeywordTok) >>~ pushContext "SubShell")+ ((pDetectChar False '(' >>= withAttribute KeywordTok) >>~ pushContext ("Bash","SubShell")) <|> ((pRegExpr regex_'5cbdo'28'3f'21'5b'5cw'24'2b'2d'5d'29 >>= withAttribute KeywordTok)) <|>@@ -261,19 +258,19 @@ <|> ((pRegExpr regex_'5cbfi'28'3f'21'5b'5cw'24'2b'2d'5d'29 >>= withAttribute KeywordTok)) <|>- ((pRegExpr regex_'5cbcase'28'3f'21'5b'5cw'24'2b'2d'5d'29 >>= withAttribute KeywordTok) >>~ pushContext "Case")+ ((pRegExpr regex_'5cbcase'28'3f'21'5b'5cw'24'2b'2d'5d'29 >>= withAttribute KeywordTok) >>~ pushContext ("Bash","Case")) <|> ((pRegExpr regex_'2d'5bA'2dZa'2dz0'2d9'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'2d'2d'5ba'2dz'5d'5bA'2dZa'2dz0'2d9'5f'2d'5d'2a >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'5cb'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'5c'2b'3f'3d >>= withAttribute OtherTok) >>~ pushContext "Assign")+ ((pRegExpr regex_'5cb'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'5c'2b'3f'3d >>= withAttribute OtherTok) >>~ pushContext ("Bash","Assign")) <|>- ((pRegExpr regex_'5cb'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'28'3f'3d'5c'5b'2e'2b'5c'5d'5c'2b'3f'3d'29 >>= withAttribute OtherTok) >>~ pushContext "AssignSubscr")+ ((pRegExpr regex_'5cb'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'28'3f'3d'5c'5b'2e'2b'5c'5d'5c'2b'3f'3d'29 >>= withAttribute OtherTok) >>~ pushContext ("Bash","AssignSubscr")) <|> ((pString False ":()" >>= withAttribute FunctionTok)) <|>- ((pRegExpr regex_'5cbfunction'5cb >>= withAttribute KeywordTok) >>~ pushContext "FunctionDef")+ ((pRegExpr regex_'5cbfunction'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Bash","FunctionDef")) <|> ((pKeyword " \n\t()!+,<=>&*;?|~\\`" list_keywords >>= withAttribute KeywordTok)) <|>@@ -283,13 +280,13 @@ <|> ((pKeyword " \n\t()!+,<=>&*;?|~\\`" list_unixcommands >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t()!+,<=>&*;?|~\\`" list_builtins'5fvar >>= withAttribute KeywordTok) >>~ pushContext "VarName")+ ((pKeyword " \n\t()!+,<=>&*;?|~\\`" list_builtins'5fvar >>= withAttribute KeywordTok) >>~ pushContext ("Bash","VarName")) <|> ((pRegExpr regex_'5cd'2a'3c'3c'3c >>= withAttribute KeywordTok)) <|>- ((lookAhead (pString False "<<") >> pushContext "HereDoc" >> currentContext >>= parseRules))+ ((lookAhead (pString False "<<") >> pushContext ("Bash","HereDoc") >> currentContext >>= parseRules)) <|>- ((pRegExpr regex_'5b'3c'3e'5d'5c'28 >>= withAttribute KeywordTok) >>~ pushContext "ProcessSubst")+ ((pRegExpr regex_'5b'3c'3e'5d'5c'28 >>= withAttribute KeywordTok) >>~ pushContext ("Bash","ProcessSubst")) <|> ((pRegExpr regex_'28'5b0'2d9'5d'2a'28'3e'7b1'2c2'7d'7c'3c'29'28'26'5b0'2d9'5d'2b'2d'3f'29'3f'7c'26'3e'7c'3e'26'7c'5b0'2d9'5d'2a'3c'3e'29 >>= withAttribute KeywordTok)) <|>@@ -297,7 +294,7 @@ <|> ((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))) -parseRules "FindOthers" =+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)) <|> ((pRegExpr regex_'5c'5c'24 >>= withAttribute KeywordTok))@@ -310,21 +307,21 @@ <|> ((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))) -parseRules "FindStrings" =+parseRules ("Bash","FindStrings") = (((pDetect2Chars False '*' '\'' >>= withAttribute DataTypeTok)) <|> ((pDetect2Chars False '*' '"' >>= withAttribute DataTypeTok)) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "StringSQ")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Bash","StringSQ")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "StringDQ")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Bash","StringDQ")) <|>- ((pDetect2Chars False '$' '\'' >>= withAttribute StringTok) >>~ pushContext "StringEsc")+ ((pDetect2Chars False '$' '\'' >>= withAttribute StringTok) >>~ pushContext ("Bash","StringEsc")) <|>- ((pDetect2Chars False '$' '"' >>= withAttribute StringTok) >>~ pushContext "StringDQ"))+ ((pDetect2Chars False '$' '"' >>= withAttribute StringTok) >>~ pushContext ("Bash","StringDQ"))) -parseRules "FindSubstitutions" =- (((pRegExpr regex_'5c'24'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'5c'5b >>= withAttribute OtherTok) >>~ pushContext "Subscript")+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")) <|> ((pRegExpr regex_'5c'24'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a >>= withAttribute OtherTok)) <|>@@ -336,21 +333,21 @@ <|> ((pRegExpr regex_'5c'24'5c'7b'21'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'28'5c'5b'5b'2a'40'5d'5c'5d'7c'5b'2a'40'5d'29'3f'5c'7d >>= withAttribute OtherTok)) <|>- ((pRegExpr regex_'5c'24'5c'7b'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a >>= withAttribute OtherTok) >>~ pushContext "VarBrace")+ ((pRegExpr regex_'5c'24'5c'7b'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a >>= withAttribute OtherTok) >>~ pushContext ("Bash","VarBrace")) <|>- ((pRegExpr regex_'5c'24'5c'7b'5b'2a'40'23'3f'24'21'5f0'2d9'2d'5d'28'3f'3d'5b'3a'23'25'2f'3d'3f'2b'2d'5d'29 >>= withAttribute OtherTok) >>~ pushContext "VarBrace")+ ((pRegExpr regex_'5c'24'5c'7b'5b'2a'40'23'3f'24'21'5f0'2d9'2d'5d'28'3f'3d'5b'3a'23'25'2f'3d'3f'2b'2d'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Bash","VarBrace")) <|>- ((pString False "$((" >>= withAttribute OtherTok) >>~ pushContext "ExprDblParenSubst")+ ((pString False "$((" >>= withAttribute OtherTok) >>~ pushContext ("Bash","ExprDblParenSubst")) <|>- ((pString False "$(<" >>= withAttribute KeywordTok) >>~ pushContext "SubstFile")+ ((pString False "$(<" >>= withAttribute KeywordTok) >>~ pushContext ("Bash","SubstFile")) <|>- ((pString False "$(" >>= withAttribute OtherTok) >>~ pushContext "SubstCommand")+ ((pString False "$(" >>= withAttribute OtherTok) >>~ pushContext ("Bash","SubstCommand")) <|>- ((pDetectChar False '`' >>= withAttribute KeywordTok) >>~ pushContext "SubstBackq")+ ((pDetectChar False '`' >>= withAttribute KeywordTok) >>~ pushContext ("Bash","SubstBackq")) <|> ((pRegExpr regex_'5c'5c'5b'60'24'5c'5c'5d >>= withAttribute DataTypeTok))) -parseRules "FindTests" =+parseRules ("Bash","FindTests") = (((pRegExpr regex_'2d'5babcdefghkprstuwxOGLSNozn'5d'28'3f'3d'5cs'29 >>= withAttribute OtherTok)) <|> ((pRegExpr regex_'2d'28'5bno'5dt'7cef'29'28'3f'3d'5cs'29 >>= withAttribute OtherTok))@@ -359,193 +356,193 @@ <|> ((pRegExpr regex_'2d'28eq'7cne'7c'5bgl'5d'5bte'5d'29'28'3f'3d'5cs'29 >>= withAttribute OtherTok))) -parseRules "ExprDblParen" =+parseRules ("Bash","ExprDblParen") = (((pDetect2Chars False ')' ')' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "ExprSubParen")+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Bash","ExprSubParen")) <|>- ((parseRules "FindMost")))+ ((parseRules ("Bash","FindMost")))) -parseRules "ExprDblParenSubst" =+parseRules ("Bash","ExprDblParenSubst") = (((pDetect2Chars False ')' ')' >>= withAttribute OtherTok) >>~ (popContext)) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "ExprSubParen")+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Bash","ExprSubParen")) <|>- ((parseRules "FindMost")))+ ((parseRules ("Bash","FindMost")))) -parseRules "ExprSubParen" =+parseRules ("Bash","ExprSubParen") = (((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "ExprSubParen")+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Bash","ExprSubParen")) <|>- ((parseRules "FindMost")))+ ((parseRules ("Bash","FindMost")))) -parseRules "ExprBracket" =+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)) <|> ((pColumn 0 >> pRegExpr regex_'5c'5d'28'3f'3d'28'24'7c'5b'5cs'3b'7c'26'5d'29'29 >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "ExprSubParen")+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Bash","ExprSubParen")) <|>- ((parseRules "FindTests"))+ ((parseRules ("Bash","FindTests"))) <|>- ((parseRules "FindMost")))+ ((parseRules ("Bash","FindMost")))) -parseRules "ExprDblBracket" =+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)) <|> ((pColumn 0 >> pRegExpr regex_'5c'5d'5c'5d'28'3f'3d'28'24'7c'5b'5cs'3b'7c'26'5d'29'29 >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "ExprSubParen")+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Bash","ExprSubParen")) <|>- ((parseRules "FindTests"))+ ((parseRules ("Bash","FindTests"))) <|>- ((parseRules "FindMost")))+ ((parseRules ("Bash","FindMost")))) -parseRules "Group" =+parseRules ("Bash","Group") = (((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "FindAll")))+ ((parseRules ("Bash","FindAll")))) -parseRules "SubShell" =+parseRules ("Bash","SubShell") = (((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "FindAll")))+ ((parseRules ("Bash","FindAll")))) -parseRules "Assign" =- (((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext "AssignArray")+parseRules ("Bash","Assign") =+ (((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext ("Bash","AssignArray")) <|>- ((parseRules "FindStrings"))+ ((parseRules ("Bash","FindStrings"))) <|>- ((parseRules "FindSubstitutions"))+ ((parseRules ("Bash","FindSubstitutions"))) <|>- ((parseRules "FindOthers"))+ ((parseRules ("Bash","FindOthers"))) <|> ((pRegExpr regex_'5b'5cw'3a'2c'2b'5f'2e'2f'2d'5d >>= withAttribute NormalTok)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "AssignArray" =+parseRules ("Bash","AssignArray") = (((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext)) <|>- ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext "Subscript")+ ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext ("Bash","Subscript")) <|>- ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext "Assign")+ ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("Bash","Assign")) <|>- ((parseRules "FindMost")))+ ((parseRules ("Bash","FindMost")))) -parseRules "AssignSubscr" =- (((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext "Subscript")+parseRules ("Bash","AssignSubscr") =+ (((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext ("Bash","Subscript")) <|>- ((pDetect2Chars False '+' '=' >>= withAttribute OtherTok) >>~ pushContext "Assign")+ ((pDetect2Chars False '+' '=' >>= withAttribute OtherTok) >>~ pushContext ("Bash","Assign")) <|>- ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext "Assign")+ ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("Bash","Assign")) <|>- ((parseRules "FindStrings"))+ ((parseRules ("Bash","FindStrings"))) <|>- ((parseRules "FindSubstitutions"))+ ((parseRules ("Bash","FindSubstitutions"))) <|>- ((parseRules "FindOthers"))+ ((parseRules ("Bash","FindOthers"))) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "Subscript" =+parseRules ("Bash","Subscript") = (((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext)) <|>- ((parseRules "FindStrings"))+ ((parseRules ("Bash","FindStrings"))) <|>- ((parseRules "FindSubstitutions"))+ ((parseRules ("Bash","FindSubstitutions"))) <|>- ((parseRules "FindOthers")))+ ((parseRules ("Bash","FindOthers")))) -parseRules "FunctionDef" =+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)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "VarName" =+parseRules ("Bash","VarName") = (((pRegExpr regex_'2d'5bA'2dZa'2dz0'2d9'5d'2b >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'2d'2d'5ba'2dz'5d'5bA'2dZa'2dz0'2d9'5f'2d'5d'2a >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5cb'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a >>= withAttribute OtherTok)) <|>- ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext "Subscript")+ ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext ("Bash","Subscript")) <|>- ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext "Assign")+ ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("Bash","Assign")) <|>- ((parseRules "FindMost"))+ ((parseRules ("Bash","FindMost"))) <|> ((pRegExpr regex_'5b'5e'5d'7d'29'7c'3b'60'26'3e'3c'5d >>= withAttribute NormalTok)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "ProcessSubst" =+parseRules ("Bash","ProcessSubst") = (((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "FindCommentsParen"))+ ((parseRules ("Bash","FindCommentsParen"))) <|>- ((parseRules "FindCommands"))+ ((parseRules ("Bash","FindCommands"))) <|>- ((parseRules "FindStrings"))+ ((parseRules ("Bash","FindStrings"))) <|>- ((parseRules "FindSubstitutions"))+ ((parseRules ("Bash","FindSubstitutions"))) <|>- ((parseRules "FindOthers")))+ ((parseRules ("Bash","FindOthers")))) -parseRules "StringSQ" =+parseRules ("Bash","StringSQ") = ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)) -parseRules "StringDQ" =+parseRules ("Bash","StringDQ") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) <|> ((pRegExpr regex_'5c'5c'5b'60'22'5c'5c'24'5cn'5d >>= withAttribute DataTypeTok)) <|>- ((parseRules "FindSubstitutions")))+ ((parseRules ("Bash","FindSubstitutions")))) -parseRules "StringEsc" =+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))) -parseRules "VarBrace" =+parseRules ("Bash","VarBrace") = (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext)) <|>- ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext "Subscript")+ ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext ("Bash","Subscript")) <|>- ((pRegExpr regex_'28'3a'3f'5b'2d'3d'3f'2b'5d'7c'23'23'3f'7c'25'25'3f'29 >>= withAttribute OtherTok) >>~ pushContext "VarAlt")+ ((pRegExpr regex_'28'3a'3f'5b'2d'3d'3f'2b'5d'7c'23'23'3f'7c'25'25'3f'29 >>= withAttribute OtherTok) >>~ pushContext ("Bash","VarAlt")) <|>- ((pRegExpr regex_'2f'2f'3f >>= withAttribute OtherTok) >>~ pushContext "VarSubst")+ ((pRegExpr regex_'2f'2f'3f >>= withAttribute OtherTok) >>~ pushContext ("Bash","VarSubst")) <|>- ((pDetectChar False ':' >>= withAttribute OtherTok) >>~ pushContext "VarSub"))+ ((pDetectChar False ':' >>= withAttribute OtherTok) >>~ pushContext ("Bash","VarSub"))) -parseRules "VarAlt" =+parseRules ("Bash","VarAlt") = (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>- ((parseRules "FindStrings"))+ ((parseRules ("Bash","FindStrings"))) <|>- ((parseRules "FindSubstitutions")))+ ((parseRules ("Bash","FindSubstitutions")))) -parseRules "VarSubst" =+parseRules ("Bash","VarSubst") = (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '/' >>= withAttribute OtherTok) >>~ pushContext "VarSubst2")+ ((pDetectChar False '/' >>= withAttribute OtherTok) >>~ pushContext ("Bash","VarSubst2")) <|>- ((parseRules "FindStrings"))+ ((parseRules ("Bash","FindStrings"))) <|>- ((parseRules "FindSubstitutions")))+ ((parseRules ("Bash","FindSubstitutions")))) -parseRules "VarSubst2" =+parseRules ("Bash","VarSubst2") = (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext >> popContext)) <|>- ((parseRules "FindStrings"))+ ((parseRules ("Bash","FindStrings"))) <|>- ((parseRules "FindSubstitutions")))+ ((parseRules ("Bash","FindSubstitutions")))) -parseRules "VarSub" =- (((pDetectChar False ':' >>= withAttribute OtherTok) >>~ pushContext "VarSub2")+parseRules ("Bash","VarSub") =+ (((pDetectChar False ':' >>= withAttribute OtherTok) >>~ pushContext ("Bash","VarSub2")) <|> ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>@@ -553,121 +550,121 @@ <|> ((pRegExpr regex_'5b0'2d9'5d'2b'28'3f'3d'5b'3a'7d'5d'29 >>= withAttribute OtherTok)) <|>- ((parseRules "FindSubstitutions")))+ ((parseRules ("Bash","FindSubstitutions")))) -parseRules "VarSub2" =+parseRules ("Bash","VarSub2") = (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext >> popContext)) <|> ((pRegExpr regex_'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a >>= withAttribute OtherTok)) <|> ((pRegExpr regex_'5b0'2d9'5d'28'3f'3d'5b'3a'7d'5d'29 >>= withAttribute OtherTok)) <|>- ((parseRules "FindSubstitutions")))+ ((parseRules ("Bash","FindSubstitutions")))) -parseRules "SubstFile" =+parseRules ("Bash","SubstFile") = (((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "FindCommentsParen"))+ ((parseRules ("Bash","FindCommentsParen"))) <|>- ((parseRules "FindStrings"))+ ((parseRules ("Bash","FindStrings"))) <|>- ((parseRules "FindSubstitutions"))+ ((parseRules ("Bash","FindSubstitutions"))) <|>- ((parseRules "FindOthers")))+ ((parseRules ("Bash","FindOthers")))) -parseRules "SubstCommand" =+parseRules ("Bash","SubstCommand") = (((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext)) <|>- ((parseRules "FindCommentsParen"))+ ((parseRules ("Bash","FindCommentsParen"))) <|>- ((parseRules "FindCommands"))+ ((parseRules ("Bash","FindCommands"))) <|>- ((parseRules "FindStrings"))+ ((parseRules ("Bash","FindStrings"))) <|>- ((parseRules "FindSubstitutions"))+ ((parseRules ("Bash","FindSubstitutions"))) <|>- ((parseRules "FindOthers")))+ ((parseRules ("Bash","FindOthers")))) -parseRules "SubstBackq" =+parseRules ("Bash","SubstBackq") = (((pDetectChar False '`' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "FindCommentsBackq"))+ ((parseRules ("Bash","FindCommentsBackq"))) <|>- ((parseRules "FindCommands"))+ ((parseRules ("Bash","FindCommands"))) <|>- ((parseRules "FindStrings"))+ ((parseRules ("Bash","FindStrings"))) <|>- ((parseRules "FindSubstitutions"))+ ((parseRules ("Bash","FindSubstitutions"))) <|>- ((parseRules "FindOthers")))+ ((parseRules ("Bash","FindOthers")))) -parseRules "Case" =- (((pRegExpr regex_'5csin'5cb >>= withAttribute KeywordTok) >>~ pushContext "CaseIn")+parseRules ("Bash","Case") =+ (((pRegExpr regex_'5csin'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Bash","CaseIn")) <|>- ((parseRules "FindMost")))+ ((parseRules ("Bash","FindMost")))) -parseRules "CaseIn" =+parseRules ("Bash","CaseIn") = (((pRegExpr regex_'5cbesac'28'3f'3d'24'7c'5b'5cs'3b'29'5d'29 >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ pushContext "CaseExpr")+ ((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ pushContext ("Bash","CaseExpr")) <|> ((pAnyChar "(|" >>= withAttribute KeywordTok)) <|>- ((parseRules "FindMost")))+ ((parseRules ("Bash","FindMost")))) -parseRules "CaseExpr" =+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 "FindAll")))+ ((parseRules ("Bash","FindAll")))) -parseRules "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 "HereDocIQ" >> currentContext >>= parseRules))+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)) <|>- ((lookAhead (pRegExpr regex_'28'3c'3c'2d'5cs'2a'27'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'27'29) >> pushContext "HereDocIQ" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'28'3c'3c'2d'5cs'2a'27'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'27'29) >> pushContext ("Bash","HereDocIQ") >> currentContext >>= parseRules)) <|>- ((lookAhead (pRegExpr regex_'28'3c'3c'2d'5cs'2a'5c'5c'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'29) >> pushContext "HereDocIQ" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'28'3c'3c'2d'5cs'2a'5c'5c'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'29) >> pushContext ("Bash","HereDocIQ") >> currentContext >>= parseRules)) <|>- ((lookAhead (pRegExpr regex_'28'3c'3c'2d'5cs'2a'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'29) >> pushContext "HereDocINQ" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'28'3c'3c'2d'5cs'2a'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'29) >> pushContext ("Bash","HereDocINQ") >> currentContext >>= parseRules)) <|>- ((lookAhead (pRegExpr regex_'28'3c'3c'5cs'2a'22'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'22'29) >> pushContext "HereDocQ" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'28'3c'3c'5cs'2a'22'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'22'29) >> pushContext ("Bash","HereDocQ") >> currentContext >>= parseRules)) <|>- ((lookAhead (pRegExpr regex_'28'3c'3c'5cs'2a'27'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'27'29) >> pushContext "HereDocQ" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'28'3c'3c'5cs'2a'27'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'27'29) >> pushContext ("Bash","HereDocQ") >> currentContext >>= parseRules)) <|>- ((lookAhead (pRegExpr regex_'28'3c'3c'5cs'2a'5c'5c'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'29) >> pushContext "HereDocQ" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'28'3c'3c'5cs'2a'5c'5c'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'29) >> pushContext ("Bash","HereDocQ") >> currentContext >>= parseRules)) <|>- ((lookAhead (pRegExpr regex_'28'3c'3c'5cs'2a'28'5b'5e'7c'26'3b'28'29'3c'3e'5cs'5d'2b'29'29) >> pushContext "HereDocNQ" >> currentContext >>= parseRules))+ ((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))) -parseRules "HereDocRemainder" =- ((parseRules "FindAll"))+parseRules ("Bash","HereDocRemainder") =+ ((parseRules ("Bash","FindAll"))) -parseRules "HereDocQ" =- (((pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ pushContext "HereDocRemainder")+parseRules ("Bash","HereDocQ") =+ (((pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ pushContext ("Bash","HereDocRemainder")) <|> ((pColumn 0 >> pRegExprDynamic "%2\\b" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))) -parseRules "HereDocNQ" =- (((pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ pushContext "HereDocRemainder")+parseRules ("Bash","HereDocNQ") =+ (((pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ pushContext ("Bash","HereDocRemainder")) <|> ((pColumn 0 >> pRegExprDynamic "%2\\b" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((parseRules "FindSubstitutions")))+ ((parseRules ("Bash","FindSubstitutions")))) -parseRules "HereDocIQ" =- (((pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ pushContext "HereDocRemainder")+parseRules ("Bash","HereDocIQ") =+ (((pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ pushContext ("Bash","HereDocRemainder")) <|> ((pColumn 0 >> pRegExprDynamic "\\t*%2\\b" >>= withAttribute KeywordTok) >>~ (popContext >> popContext))) -parseRules "HereDocINQ" =- (((pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ pushContext "HereDocRemainder")+parseRules ("Bash","HereDocINQ") =+ (((pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ pushContext ("Bash","HereDocRemainder")) <|> ((pColumn 0 >> pRegExprDynamic "\\t*%2\\b" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((parseRules "FindSubstitutions")))+ ((parseRules ("Bash","FindSubstitutions")))) -parseRules "" = parseRules "Start"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Bibtex.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,33 +25,35 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "BibTeX" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("BibTeX",["Normal"])], synStLanguage = "BibTeX", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("BibTeX","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "PreambleCommand" -> return ()- "StringCommand" -> return ()- "Entry" -> return ()- "Field" -> return ()- "CurlyBracket" -> return ()- "QuotedText" -> return ()+ ("BibTeX","Normal") -> return ()+ ("BibTeX","PreambleCommand") -> return ()+ ("BibTeX","StringCommand") -> return ()+ ("BibTeX","Entry") -> return ()+ ("BibTeX","Field") -> return ()+ ("BibTeX","CurlyBracket") -> return ()+ ("BibTeX","QuotedText") -> return () _ -> return () withAttribute attr txt = do@@ -61,10 +62,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_kw'5fentry = Set.fromList $ words $ "@article @book @booklet @conference @collection @electronic @inbook @incollection @inproceedings @manual @mastersthesis @misc @online @patent @periodical @proceedings @report @phdthesis @set @thesis @techreport @unpublished @www @person @company @place" regex_'5ba'2dzA'2dZ0'2d9'5c'2d'5d'2b = compileRegex "[a-zA-Z0-9\\-]+"@@ -75,39 +72,39 @@ regex_'5c'5c'28'5ba'2dzA'2dZ'40'5d'2b'7c'5b'5e_'5d'29 = compileRegex "\\\\([a-zA-Z@]+|[^ ])" regex_'7d'24 = compileRegex "}$" -defaultAttributes = [("Normal",CommentTok),("PreambleCommand",NormalTok),("StringCommand",NormalTok),("Entry",NormalTok),("Field",NormalTok),("CurlyBracket",NormalTok),("QuotedText",StringTok)]+defaultAttributes = [(("BibTeX","Normal"),CommentTok),(("BibTeX","PreambleCommand"),NormalTok),(("BibTeX","StringCommand"),NormalTok),(("BibTeX","Entry"),NormalTok),(("BibTeX","Field"),NormalTok),(("BibTeX","CurlyBracket"),NormalTok),(("BibTeX","QuotedText"),StringTok)] -parseRules "Normal" =- (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~" list_kw'5fentry >>= withAttribute KeywordTok) >>~ pushContext "Entry")+parseRules ("BibTeX","Normal") =+ (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~" list_kw'5fentry >>= withAttribute KeywordTok) >>~ pushContext ("BibTeX","Entry")) <|>- ((pString False "@string" >>= withAttribute FunctionTok) >>~ pushContext "StringCommand")+ ((pString False "@string" >>= withAttribute FunctionTok) >>~ pushContext ("BibTeX","StringCommand")) <|>- ((pString False "@preamble" >>= withAttribute FunctionTok) >>~ pushContext "PreambleCommand")+ ((pString False "@preamble" >>= withAttribute FunctionTok) >>~ pushContext ("BibTeX","PreambleCommand")) <|> ((pString False "@comment" >>= withAttribute CommentTok))) -parseRules "PreambleCommand" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "CurlyBracket")+parseRules ("BibTeX","PreambleCommand") =+ (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("BibTeX","CurlyBracket")) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "StringCommand" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "CurlyBracket")+parseRules ("BibTeX","StringCommand") =+ (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("BibTeX","CurlyBracket")) <|>- ((pRegExpr regex_'5ba'2dzA'2dZ0'2d9'5c'2d'5d'2b >>= withAttribute StringTok) >>~ pushContext "CurlyBracket")+ ((pRegExpr regex_'5ba'2dzA'2dZ0'2d9'5c'2d'5d'2b >>= withAttribute StringTok) >>~ pushContext ("BibTeX","CurlyBracket")) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "Entry" =+parseRules ("BibTeX","Entry") = (((pDetectChar False '{' >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5ba'2dzA'2dZ0'2d9'5f'40'5c'5c'2d'5c'5c'3a'5d'2b >>= withAttribute OtherTok)) <|>- ((pDetectChar False ',' >>= withAttribute NormalTok) >>~ pushContext "Field")+ ((pDetectChar False ',' >>= withAttribute NormalTok) >>~ pushContext ("BibTeX","Field")) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "Field" =+parseRules ("BibTeX","Field") = (((pFirstNonSpace >> pRegExpr regex_'5ba'2dzA'2dZ0'2d9'5c'2d'5f'5c'2e'5d'2b >>= withAttribute DataTypeTok)) <|> ((pDetectSpaces >>= withAttribute NormalTok))@@ -116,11 +113,11 @@ <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "CurlyBracket")+ ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("BibTeX","CurlyBracket")) <|> ((lookAhead (pDetectChar False '}') >> (popContext) >> currentContext >>= parseRules)) <|>- ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext "QuotedText")+ ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("BibTeX","QuotedText")) <|> ((pDetectChar False ',' >>= withAttribute NormalTok)) <|>@@ -134,8 +131,8 @@ <|> ((pRegExpr regex_'2e >>= withAttribute AlertTok))) -parseRules "CurlyBracket" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "CurlyBracket")+parseRules ("BibTeX","CurlyBracket") =+ (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("BibTeX","CurlyBracket")) <|> ((pRegExpr regex_'5c'5c'28'5ba'2dzA'2dZ'40'5d'2b'7c'5b'5e_'5d'29 >>= withAttribute CharTok)) <|>@@ -143,11 +140,10 @@ <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "QuotedText" =+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))) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Boo.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,42 +25,44 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Boo" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Boo",["Normal"])], synStLanguage = "Boo", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Boo","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "parenthesised" -> return ()- "Quasi-Quotation" -> return ()- "Tripple A-comment" -> return ()- "Tripple Q-comment" -> return ()- "Tripple A-string" -> return ()- "Raw Tripple A-string" -> return ()- "Tripple Q-string" -> return ()- "Raw Tripple Q-string" -> return ()- "Comment SlashSlash" -> (popContext) >> pEndLine- "Single A-comment" -> return ()- "Single Q-comment" -> return ()- "Single A-string" -> return ()- "Single Q-string" -> return ()- "Raw A-string" -> return ()- "Raw Q-string" -> return ()+ ("Boo","Normal") -> return ()+ ("Boo","parenthesised") -> return ()+ ("Boo","Quasi-Quotation") -> return ()+ ("Boo","Tripple A-comment") -> return ()+ ("Boo","Tripple Q-comment") -> return ()+ ("Boo","Tripple A-string") -> return ()+ ("Boo","Raw Tripple A-string") -> return ()+ ("Boo","Tripple Q-string") -> return ()+ ("Boo","Raw Tripple Q-string") -> return ()+ ("Boo","Comment SlashSlash") -> (popContext) >> pEndLine+ ("Boo","Single A-comment") -> return ()+ ("Boo","Single Q-comment") -> return ()+ ("Boo","Single A-string") -> return ()+ ("Boo","Single Q-string") -> return ()+ ("Boo","Raw A-string") -> return ()+ ("Boo","Raw Q-string") -> return () _ -> return () withAttribute attr txt = do@@ -70,10 +71,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_namespace = Set.fromList $ words $ "import from as namespace" list_operators = Set.fromList $ words $ "and assert in is not or" list_primitive = Set.fromList $ words $ "bool byte sbyte double decimal single short ushort int char uint long ulong object duck string regex date timespan"@@ -103,9 +100,9 @@ regex_'25'5c'28'5ba'2dzA'2dZ0'2d9'5f'5d'2b'5c'29'5ba'2dzA'2dZ'5d = compileRegex "%\\([a-zA-Z0-9_]+\\)[a-zA-Z]" regex_'27'27'27 = compileRegex "'''" -defaultAttributes = [("Normal",NormalTok),("parenthesised",NormalTok),("Quasi-Quotation",NormalTok),("Tripple A-comment",CommentTok),("Tripple Q-comment",CommentTok),("Tripple A-string",StringTok),("Raw Tripple A-string",StringTok),("Tripple Q-string",StringTok),("Raw Tripple Q-string",StringTok),("Comment SlashSlash",CommentTok),("Single A-comment",CommentTok),("Single Q-comment",CommentTok),("Single A-string",StringTok),("Single Q-string",StringTok),("Raw A-string",StringTok),("Raw Q-string",StringTok)]+defaultAttributes = [(("Boo","Normal"),NormalTok),(("Boo","parenthesised"),NormalTok),(("Boo","Quasi-Quotation"),NormalTok),(("Boo","Tripple A-comment"),CommentTok),(("Boo","Tripple Q-comment"),CommentTok),(("Boo","Tripple A-string"),StringTok),(("Boo","Raw Tripple A-string"),StringTok),(("Boo","Tripple Q-string"),StringTok),(("Boo","Raw Tripple Q-string"),StringTok),(("Boo","Comment SlashSlash"),CommentTok),(("Boo","Single A-comment"),CommentTok),(("Boo","Single Q-comment"),CommentTok),(("Boo","Single A-string"),StringTok),(("Boo","Single Q-string"),StringTok),(("Boo","Raw A-string"),StringTok),(("Boo","Raw Q-string"),StringTok)] -parseRules "Normal" =+parseRules ("Boo","Normal") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_namespace >>= withAttribute CharTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_definition >>= withAttribute KeywordTok))@@ -136,35 +133,35 @@ <|> ((pRegExpr regex_0'5b1'2d9'5d'5b0'2d9'5d'2a >>= withAttribute OtherTok)) <|>- ((pRegExpr regex_'5brR'5d'27'27'27 >>= withAttribute StringTok) >>~ pushContext "Raw Tripple A-string")+ ((pRegExpr regex_'5brR'5d'27'27'27 >>= withAttribute StringTok) >>~ pushContext ("Boo","Raw Tripple A-string")) <|>- ((pRegExpr regex_'5brR'5d'22'22'22 >>= withAttribute StringTok) >>~ pushContext "Raw Tripple Q-string")+ ((pRegExpr regex_'5brR'5d'22'22'22 >>= withAttribute StringTok) >>~ pushContext ("Boo","Raw Tripple Q-string")) <|>- ((pRegExpr regex_'5brR'5d'27 >>= withAttribute StringTok) >>~ pushContext "Raw A-string")+ ((pRegExpr regex_'5brR'5d'27 >>= withAttribute StringTok) >>~ pushContext ("Boo","Raw A-string")) <|>- ((pRegExpr regex_'5brR'5d'22 >>= withAttribute StringTok) >>~ pushContext "Raw Q-string")+ ((pRegExpr regex_'5brR'5d'22 >>= withAttribute StringTok) >>~ pushContext ("Boo","Raw Q-string")) <|> ((pRegExpr regex_'23'2e'2a'24 >>= withAttribute CommentTok)) <|>- ((pColumn 0 >> pRegExpr regex_'5cs'2au'3f'27'27'27 >>= withAttribute CommentTok) >>~ pushContext "Tripple A-comment")+ ((pColumn 0 >> pRegExpr regex_'5cs'2au'3f'27'27'27 >>= withAttribute CommentTok) >>~ pushContext ("Boo","Tripple A-comment")) <|>- ((pColumn 0 >> pRegExpr regex_'5cs'2au'3f'22'22'22 >>= withAttribute CommentTok) >>~ pushContext "Tripple Q-comment")+ ((pColumn 0 >> pRegExpr regex_'5cs'2au'3f'22'22'22 >>= withAttribute CommentTok) >>~ pushContext ("Boo","Tripple Q-comment")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Comment SlashSlash")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Boo","Comment SlashSlash")) <|>- ((pString False "'''" >>= withAttribute StringTok) >>~ pushContext "Tripple A-string")+ ((pString False "'''" >>= withAttribute StringTok) >>~ pushContext ("Boo","Tripple A-string")) <|>- ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ pushContext "Tripple Q-string")+ ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ pushContext ("Boo","Tripple Q-string")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Single A-string")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Boo","Single A-string")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Single Q-string")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Boo","Single Q-string")) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "parenthesised")+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Boo","parenthesised")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pString False "[|" >>= withAttribute NormalTok) >>~ pushContext "Quasi-Quotation")+ ((pString False "[|" >>= withAttribute NormalTok) >>~ pushContext ("Boo","Quasi-Quotation")) <|> ((pString False "|]" >>= withAttribute NormalTok) >>~ (popContext)) <|>@@ -172,21 +169,21 @@ <|> ((pRegExpr regex_'25'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))) -parseRules "parenthesised" =- ((parseRules "Normal"))+parseRules ("Boo","parenthesised") =+ ((parseRules ("Boo","Normal"))) -parseRules "Quasi-Quotation" =- ((parseRules "Normal"))+parseRules ("Boo","Quasi-Quotation") =+ ((parseRules ("Boo","Normal"))) -parseRules "Tripple A-comment" =+parseRules ("Boo","Tripple A-comment") = ((pString False "'''" >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "Tripple Q-comment" =+parseRules ("Boo","Tripple Q-comment") = (((pHlCChar >>= withAttribute CommentTok)) <|> ((pRegExpr regex_'22'22'22 >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Tripple A-string" =+parseRules ("Boo","Tripple A-string") = (((pHlCStringChar >>= withAttribute CharTok)) <|> ((pRegExpr regex_'25'5c'28'5ba'2dzA'2dZ0'2d9'5f'5d'2b'5c'29'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))@@ -195,7 +192,7 @@ <|> ((pRegExpr regex_'27'27'27 >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Raw Tripple A-string" =+parseRules ("Boo","Raw Tripple A-string") = (((pHlCStringChar >>= withAttribute StringTok)) <|> ((pRegExpr regex_'25'5c'28'5ba'2dzA'2dZ0'2d9'5f'5d'2b'5c'29'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))@@ -204,7 +201,7 @@ <|> ((pRegExpr regex_'27'27'27 >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Tripple Q-string" =+parseRules ("Boo","Tripple Q-string") = (((pHlCStringChar >>= withAttribute CharTok)) <|> ((pRegExpr regex_'25'5c'28'5ba'2dzA'2dZ0'2d9'5f'5d'2b'5c'29'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))@@ -213,7 +210,7 @@ <|> ((pRegExpr regex_'22'22'22 >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Raw Tripple Q-string" =+parseRules ("Boo","Raw Tripple Q-string") = (((pHlCStringChar >>= withAttribute StringTok)) <|> ((pRegExpr regex_'25'5c'28'5ba'2dzA'2dZ0'2d9'5f'5d'2b'5c'29'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))@@ -222,20 +219,20 @@ <|> ((pRegExpr regex_'22'22'22 >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Comment SlashSlash" =+parseRules ("Boo","Comment SlashSlash") = ((pLineContinue >>= withAttribute CommentTok)) -parseRules "Single A-comment" =+parseRules ("Boo","Single A-comment") = (((pHlCStringChar >>= withAttribute CommentTok)) <|> ((pDetectChar False '\'' >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Single Q-comment" =+parseRules ("Boo","Single Q-comment") = (((pHlCStringChar >>= withAttribute CommentTok)) <|> ((pDetectChar False '"' >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Single A-string" =+parseRules ("Boo","Single A-string") = (((pHlCStringChar >>= withAttribute CharTok)) <|> ((pRegExpr regex_'25'5c'28'5ba'2dzA'2dZ0'2d9'5f'5d'2b'5c'29'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))@@ -244,7 +241,7 @@ <|> ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Single Q-string" =+parseRules ("Boo","Single Q-string") = (((pHlCStringChar >>= withAttribute CharTok)) <|> ((pRegExpr regex_'25'5c'28'5ba'2dzA'2dZ0'2d9'5f'5d'2b'5c'29'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))@@ -253,7 +250,7 @@ <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Raw A-string" =+parseRules ("Boo","Raw A-string") = (((pHlCStringChar >>= withAttribute StringTok)) <|> ((pRegExpr regex_'25'5c'28'5ba'2dzA'2dZ0'2d9'5f'5d'2b'5c'29'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))@@ -262,7 +259,7 @@ <|> ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Raw Q-string" =+parseRules ("Boo","Raw Q-string") = (((pHlCStringChar >>= withAttribute StringTok)) <|> ((pRegExpr regex_'25'5c'28'5ba'2dzA'2dZ0'2d9'5f'5d'2b'5c'29'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok))@@ -271,6 +268,5 @@ <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/C.hs view
@@ -9,7 +9,6 @@ import qualified Text.Highlighting.Kate.Syntax.Doxygen import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -28,37 +27,39 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "C" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("C",["Normal"])], synStLanguage = "C", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("C","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "String" -> (popContext) >> pEndLine- "Region Marker" -> (popContext) >> pEndLine- "Commentar 1" -> (popContext) >> pEndLine- "Commentar 2" -> return ()- "AfterHash" -> (popContext) >> pEndLine- "Preprocessor" -> (popContext) >> pEndLine- "Define" -> (popContext) >> pEndLine- "Commentar/Preprocessor" -> return ()- "Outscoped" -> return ()- "Outscoped intern" -> return ()+ ("C","Normal") -> return ()+ ("C","String") -> (popContext) >> pEndLine+ ("C","Region Marker") -> (popContext) >> pEndLine+ ("C","Commentar 1") -> (popContext) >> pEndLine+ ("C","Commentar 2") -> return ()+ ("C","AfterHash") -> (popContext) >> pEndLine+ ("C","Preprocessor") -> (popContext) >> pEndLine+ ("C","Define") -> (popContext) >> pEndLine+ ("C","Commentar/Preprocessor") -> return ()+ ("C","Outscoped") -> return ()+ ("C","Outscoped intern") -> return () _ -> return () withAttribute attr txt = do@@ -67,10 +68,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "break case continue default do else enum extern for goto if inline return sizeof struct switch typedef union while" list_types = Set.fromList $ words $ "auto char const double float int long register restrict short signed static unsigned void volatile int8_t int16_t int32_t int64_t uint8_t uint16_t uint32_t uint64_t wchar_t _Imaginary _Complex _Bool" @@ -83,18 +80,18 @@ regex_'23'5cs'2aif = compileRegex "#\\s*if" regex_'23'5cs'2ael'28'3f'3ase'7cif'29 = compileRegex "#\\s*el(?:se|if)" -defaultAttributes = [("Normal",NormalTok),("String",StringTok),("Region Marker",RegionMarkerTok),("Commentar 1",CommentTok),("Commentar 2",CommentTok),("AfterHash",ErrorTok),("Preprocessor",OtherTok),("Define",OtherTok),("Commentar/Preprocessor",CommentTok),("Outscoped",CommentTok),("Outscoped intern",CommentTok)]+defaultAttributes = [(("C","Normal"),NormalTok),(("C","String"),StringTok),(("C","Region Marker"),RegionMarkerTok),(("C","Commentar 1"),CommentTok),(("C","Commentar 2"),CommentTok),(("C","AfterHash"),ErrorTok),(("C","Preprocessor"),OtherTok),(("C","Define"),OtherTok),(("C","Commentar/Preprocessor"),CommentTok),(("C","Outscoped"),CommentTok),(("C","Outscoped intern"),CommentTok)] -parseRules "Normal" =+parseRules ("C","Normal") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'5cs'2b0'5cs'2a'24 >>= withAttribute OtherTok) >>~ pushContext "Outscoped")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'5cs'2b0'5cs'2a'24 >>= withAttribute OtherTok) >>~ pushContext ("C","Outscoped")) <|>- ((pFirstNonSpace >> lookAhead (pDetectChar False '#') >> pushContext "AfterHash" >> currentContext >>= parseRules))+ ((pFirstNonSpace >> lookAhead (pDetectChar False '#') >> pushContext ("C","AfterHash") >> currentContext >>= parseRules)) <|>- ((pFirstNonSpace >> pString False "//BEGIN" >>= withAttribute RegionMarkerTok) >>~ pushContext "Region Marker")+ ((pFirstNonSpace >> pString False "//BEGIN" >>= withAttribute RegionMarkerTok) >>~ pushContext ("C","Region Marker")) <|>- ((pFirstNonSpace >> pString False "//END" >>= withAttribute RegionMarkerTok) >>~ pushContext "Region Marker")+ ((pFirstNonSpace >> pString False "//END" >>= withAttribute RegionMarkerTok) >>~ pushContext ("C","Region Marker")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\'\"" list_keywords >>= withAttribute KeywordTok)) <|>@@ -130,48 +127,48 @@ <|> ((pHlCChar >>= withAttribute CharTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("C","String")) <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression)) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("C","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("C","Commentar 2")) <|> ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))) -parseRules "String" =+parseRules ("C","String") = (((pLineContinue >>= withAttribute StringTok)) <|> ((pHlCStringChar >>= withAttribute CharTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Region Marker" =+parseRules ("C","Region Marker") = pzero -parseRules "Commentar 1" =+parseRules ("C","Commentar 1") = (((pLineContinue >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "Commentar 2" =+parseRules ("C","Commentar 2") = (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "AfterHash" =- (((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'28'3f'3adef'7cndef'29'3f'28'3f'3d'5cs'2b'5cS'29 >>= withAttribute OtherTok) >>~ pushContext "Preprocessor")+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")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute OtherTok) >>~ pushContext "Preprocessor")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute OtherTok) >>~ pushContext ("C","Preprocessor")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2adefine'2e'2a'28'28'3f'3d'5c'5c'29'29 >>= withAttribute OtherTok) >>~ pushContext "Define")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2adefine'2e'2a'28'28'3f'3d'5c'5c'29'29 >>= withAttribute OtherTok) >>~ pushContext ("C","Define")) <|>- ((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 "Preprocessor")+ ((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 "Preprocessor"))+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2b'5b0'2d9'5d'2b >>= withAttribute OtherTok) >>~ pushContext ("C","Preprocessor"))) -parseRules "Preprocessor" =+parseRules ("C","Preprocessor") = (((pLineContinue >>= withAttribute OtherTok)) <|> ((pRangeDetect '"' '"' >>= withAttribute OtherTok))@@ -180,56 +177,57 @@ <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression >>= ((withAttribute OtherTok) . snd))) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar/Preprocessor")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("C","Commentar/Preprocessor")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1"))+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("C","Commentar 1"))) -parseRules "Define" =+parseRules ("C","Define") = ((pLineContinue >>= withAttribute OtherTok)) -parseRules "Commentar/Preprocessor" =+parseRules ("C","Commentar/Preprocessor") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "Outscoped" =+parseRules ("C","Outscoped") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetectIdentifier >>= withAttribute CommentTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("C","String")) <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression >>= ((withAttribute CommentTok) . snd))) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("C","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("C","Commentar 2")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext "Outscoped intern")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext ("C","Outscoped intern")) <|> ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2ael'28'3f'3ase'7cif'29 >>= withAttribute OtherTok) >>~ (popContext)) <|> ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute OtherTok) >>~ (popContext))) -parseRules "Outscoped intern" =+parseRules ("C","Outscoped intern") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetectIdentifier >>= withAttribute CommentTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("C","String")) <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression >>= ((withAttribute CommentTok) . snd))) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("C","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("C","Commentar 2")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext "Outscoped intern")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext ("C","Outscoped intern")) <|> ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "" = parseRules "Normal"+parseRules ("Doxygen", _) = Text.Highlighting.Kate.Syntax.Doxygen.parseExpression+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Changelog.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -25,29 +24,31 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "ChangeLog" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("ChangeLog",["Normal"])], synStLanguage = "ChangeLog", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("ChangeLog","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "line" -> (popContext) >> pEndLine- "entry" -> (popContext) >> pEndLine+ ("ChangeLog","Normal") -> return ()+ ("ChangeLog","line") -> (popContext) >> pEndLine+ ("ChangeLog","entry") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -56,31 +57,26 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'5cd'5cd'5cd'5cd'5cs'2a'2d'5cs'2a'5cd'5cd'5cs'2a'2d'5cs'2a'5cd'5cd'5cs'2a = compileRegex "\\d\\d\\d\\d\\s*-\\s*\\d\\d\\s*-\\s*\\d\\d\\s*" regex_'28'5cw'5cs'2a'29'2b = compileRegex "(\\w\\s*)+" regex_'3c'2e'2a'3e'5cs'2a'24 = compileRegex "<.*>\\s*$" regex_'2e'2a'3a = compileRegex ".*:" -defaultAttributes = [("Normal",NormalTok),("line",NormalTok),("entry",NormalTok)]+defaultAttributes = [(("ChangeLog","Normal"),NormalTok),(("ChangeLog","line"),NormalTok),(("ChangeLog","entry"),NormalTok)] -parseRules "Normal" =- (((pFirstNonSpace >> pDetectChar False '*' >>= withAttribute DecValTok) >>~ pushContext "entry")+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 "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"))) -parseRules "line" =+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))) -parseRules "entry" =+parseRules ("ChangeLog","entry") = ((pRegExpr regex_'2e'2a'3a >>= withAttribute DecValTok) >>~ (popContext)) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Clojure.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,37 +25,39 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Clojure" }- context <- currentContext <|> (pushContext "Level0" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Clojure",["Level0"])], synStLanguage = "Clojure", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Clojure","Level0")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Level0" -> return ()- "Default" -> return ()- "function_decl" -> return ()- "SpecialNumber" -> (popContext) >> pEndLine- "String" -> return ()- "Level1" -> return ()- "Level2" -> return ()- "Level3" -> return ()- "Level4" -> return ()- "Level5" -> return ()- "Level6" -> return ()+ ("Clojure","Level0") -> return ()+ ("Clojure","Default") -> return ()+ ("Clojure","function_decl") -> return ()+ ("Clojure","SpecialNumber") -> (popContext) >> pEndLine+ ("Clojure","String") -> return ()+ ("Clojure","Level1") -> return ()+ ("Clojure","Level2") -> return ()+ ("Clojure","Level3") -> return ()+ ("Clojure","Level4") -> return ()+ ("Clojure","Level5") -> return ()+ ("Clojure","Level6") -> return () _ -> return () withAttribute attr txt = do@@ -65,10 +66,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_definitions = Set.fromList $ words $ "def def- defalias defhinted definline defmacro defmacro- defmethod defmulti defn defn- defnk defn-memo defonce defonce- defprotocol defrecord defstruct defstruct- deftest deftest- deftype defunbound defunbound- defvar defvar-" list_keywords = Set.fromList $ words $ "< <= = == > >= - -> ->> / . .. * + accessor aclone add-classpath add-watcher agent agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and append-child apply apply-template are areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assert-any assert-expr assert-predicate assoc assoc! associative? assoc-in atom atom? attrs await await1 await-for bases bean bigdec bigint binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* branch? butlast byte byte-array bytes case cast catch char char? char-array char-escape-string char-name-string chars children chunk chunk-append chunk-buffer chunk-cons chunked-seq? chunk-first chunk-next chunk-rest class class? clear-agent-errors clojure-version coll? collection-tag comment commute comp comparator compare compare-and-set! compile complement compose-fixtures concat cond condp conj conj! cons constantly construct-proxy contains? content content-handler count counted? create-ns create-struct cycle dec decimal? declare delay delay? deliver deref derive descendants destructure difference disj disj! dissoc dissoc! distinct distinct? do doall doc dorun doseq dosync do-template dotimes doto double double-array doubles down drop drop-last drop-while e edit element emit emit-element empty empty? end? ensure enumeration-seq eval even? every? extend extenders extend-protocol extends? extend-type false? ffirst file-position file-seq filter finally find find-doc find-ns find-var first float float? float-array floats flush fn fn? fnext for force format function? future future? future-call future-cancel future-cancelled? future-done? gen-and-load-class gen-and-save-class gen-class gen-interface gensym get get-child get-child-count get-in get-method get-possibly-unbound-var get-proxy-class get-thread-bindings get-validator handle handler-case hash hash-map hash-set identical? identity if if-let ifn? if-not import inc inc-report-counter index init-proxy in-ns insert-child insert-left insert-right inspect inspect-table inspect-tree instance? int int-array integer? interleave intern interpose intersection into into-array ints io! is isa? is-leaf iterate iterator-seq join join-fixtures juxt key keys keyword keyword? keywordize-keys last lazy-cat lazy-seq left leftmost lefts let letfn line-seq list list* list? list-model list-provider load loaded-libs load-file load-reader load-script load-string locking long long-array longs loop macroexpand macroexpand-1 macroexpand-all main make-array make-hierarchy make-node map map? mapcat map-invert max max-key memfn memoize merge merge-with meta methods method-sig min min-key mod name namespace neg? newline next nfirst nil? nnext node not not= not-any? not-empty not-every? ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? or parents partial partition path pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? postwalk postwalk-demo postwalk-replace pr prefer-method prefers prev prewalk prewalk-demo prewalk-replace primitives-classnames print print-cause-trace print-ctor print-doc print-dup printf println println-str print-method print-namespace-doc print-simple print-special-doc print-stack-trace print-str print-throwable print-trace-element prn prn-str project promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super pr-str push-thread-bindings pvalues quot rand rand-int range ratio? rational? rationalize read read-line read-string recur reduce ref refer refer-clojure ref-history-count re-find ref-max-history ref-min-history ref-set re-groups reify release-pending-sends rem re-matcher re-matches remove remove-method remove-ns remove-watcher rename rename-keys re-pattern repeat repeatedly repl replace repl-caught repl-exception replicate repl-prompt repl-read report require re-seq reset! reset-meta! resolve rest resultset-seq reverse reversible? right rightmost rights root rseq rsubseq run-all-tests run-tests satisfies? second select select-keys send send-off seq seq? seque sequence sequential? seq-zip set set? set-test set-validator! short short-array shorts shutdown-agents skip-if-eol skip-whitespace slurp some sort sort-by sorted? sorted-map sorted-map-by sorted-set sorted-set-by special-form-anchor special-symbol? split-at split-with str stream? string? stringify-keys struct struct-map subs subseq subvec successful? supers swap! symbol symbol? sync syntax-symbol-anchor take take-last take-nth take-while test test-all-vars testing testing-contexts-str testing-vars-str test-ns test-var the-ns throw time to-array to-array-2d trampoline transient tree-seq true? try try-expr type unchecked-add unchecked-dec unchecked-divide unchecked-inc unchecked-multiply unchecked-negate unchecked-remainder unchecked-subtract underive unimport union unquote unquote-splicing up update-in update-proxy use use-fixtures val vals var? var-get var-set vary-meta vec vector vector? walk when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision with-test with-test-out xml-seq zero?" list_variables = Set.fromList $ words $ "*1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* *compile-path* *current* *e *err* *file* *flush-on-newline* *in* *initial-report-counters* *load-tests* *macro-meta* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *report-counters* *sb* *source-path* *stack* *stack-trace-depth* *state* *testing-contexts* *testing-vars* *test-out* *use-context-classloader* *warn-on-reflection*"@@ -80,16 +77,16 @@ regex_'5cs'2a'5bA'2dZa'2dz0'2d9'2d'2b'5c'3c'5c'3e'2f'2f'5c'2a'5d'2a'5cs'2a = compileRegex "\\s*[A-Za-z0-9-+\\<\\>//\\*]*\\s*" regex_'23'5c'5c'2e = compileRegex "#\\\\." -defaultAttributes = [("Level0",NormalTok),("Default",NormalTok),("function_decl",FunctionTok),("SpecialNumber",NormalTok),("String",StringTok),("Level1",NormalTok),("Level2",NormalTok),("Level3",NormalTok),("Level4",NormalTok),("Level5",NormalTok),("Level6",NormalTok)]+defaultAttributes = [(("Clojure","Level0"),NormalTok),(("Clojure","Default"),NormalTok),(("Clojure","function_decl"),FunctionTok),(("Clojure","SpecialNumber"),NormalTok),(("Clojure","String"),StringTok),(("Clojure","Level1"),NormalTok),(("Clojure","Level2"),NormalTok),(("Clojure","Level3"),NormalTok),(("Clojure","Level4"),NormalTok),(("Clojure","Level5"),NormalTok),(("Clojure","Level6"),NormalTok)] -parseRules "Level0" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level1")+parseRules ("Clojure","Level0") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level1")) <|>- ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext "Level1")+ ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level1")) <|>- ((parseRules "Default")))+ ((parseRules ("Clojure","Default")))) -parseRules "Default" =+parseRules ("Clojure","Default") = (((pRegExpr regex_'3b'2e'2a'24 >>= withAttribute CommentTok)) <|> ((pDetect2Chars False '#' '_' >>= withAttribute CommentTok))@@ -116,24 +113,24 @@ <|> ((pKeyword " \n\t.(),%&;[]^{|}~" list_variables >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t.(),%&;[]^{|}~" list_definitions >>= withAttribute KeywordTok) >>~ pushContext "function_decl")+ ((pKeyword " \n\t.(),%&;[]^{|}~" list_definitions >>= withAttribute KeywordTok) >>~ pushContext ("Clojure","function_decl")) <|> ((pRegExpr regex_'5c'5c'2e >>= withAttribute CharTok)) <|>- ((pDetect2Chars False '#' '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetect2Chars False '#' '"' >>= withAttribute StringTok) >>~ pushContext ("Clojure","String")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Clojure","String")) <|> ((pFloat >>= withAttribute FloatTok)) <|> ((pInt >>= withAttribute DecValTok)) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level1"))+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level1"))) -parseRules "function_decl" =+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)) -parseRules "SpecialNumber" =+parseRules ("Clojure","SpecialNumber") = (((pFloat >>= withAttribute FloatTok) >>~ (popContext)) <|> ((pInt >>= withAttribute DecValTok) >>~ (popContext))@@ -142,67 +139,66 @@ <|> ((pHlCHex >>= withAttribute FloatTok) >>~ (popContext))) -parseRules "String" =+parseRules ("Clojure","String") = (((pRegExpr regex_'23'5c'5c'2e >>= withAttribute CharTok)) <|> ((pHlCStringChar >>= withAttribute NormalTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Level1" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level2")+parseRules ("Clojure","Level1") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level2")) <|>- ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext "Level2")+ ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level2")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "Default")))+ ((parseRules ("Clojure","Default")))) -parseRules "Level2" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level3")+parseRules ("Clojure","Level2") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level3")) <|>- ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext "Level3")+ ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level3")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "Default")))+ ((parseRules ("Clojure","Default")))) -parseRules "Level3" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level4")+parseRules ("Clojure","Level3") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level4")) <|>- ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext "Level4")+ ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level4")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "Default")))+ ((parseRules ("Clojure","Default")))) -parseRules "Level4" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level5")+parseRules ("Clojure","Level4") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level5")) <|>- ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext "Level5")+ ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level5")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "Default")))+ ((parseRules ("Clojure","Default")))) -parseRules "Level5" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level6")+parseRules ("Clojure","Level5") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level6")) <|>- ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext "Level6")+ ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level6")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "Default")))+ ((parseRules ("Clojure","Default")))) -parseRules "Level6" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level1")+parseRules ("Clojure","Level6") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level1")) <|>- ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext "Level1")+ ((pDetect2Chars False '#' '(' >>= withAttribute NormalTok) >>~ pushContext ("Clojure","Level1")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "Default")))+ ((parseRules ("Clojure","Default")))) -parseRules "" = parseRules "Level0" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Cmake.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,32 +26,34 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "CMake" }- context <- currentContext <|> (pushContext "Normal Text" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("CMake",["Normal Text"])], synStLanguage = "CMake", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("CMake","Normal Text")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal Text" -> return ()- "Detect Variables" -> return ()- "Command Args" -> return ()- "Macro Args" -> return ()- "Comment" -> (popContext) >> pEndLine- "String" -> return ()+ ("CMake","Normal Text") -> return ()+ ("CMake","Detect Variables") -> return ()+ ("CMake","Command Args") -> return ()+ ("CMake","Macro Args") -> return ()+ ("CMake","Comment") -> (popContext) >> pEndLine+ ("CMake","String") -> return () _ -> return () withAttribute attr txt = do@@ -61,10 +62,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_commands = Set.fromList $ words $ "add_custom_command add_custom_target add_definitions add_dependencies add_executable add_library add_subdirectory add_test aux_source_directory break build_command build_name cmake_minimum_required cmake_policy configure_file create_test_sourcelist define_property else elseif enable_language enable_testing endforeach endfunction endif endmacro endwhile exec_program execute_process export export_library_dependencies file find_file find_library find_package find_path find_program fltk_wrap_ui foreach function get_cmake_property get_directory_property get_filename_component get_property get_source_file_property get_target_property get_test_property if include include_directories include_external_msproject include_regular_expression install install_files install_programs install_targets link_directories link_libraries list load_cache load_command macro make_directory mark_as_advanced math message option output_required_files project qt_wrap_cpp qt_wrap_ui remove remove_definitions return separate_arguments set set_directory_properties set_property set_source_files_properties set_target_properties set_tests_properties site_name source_group string subdir_depends subdirs target_link_libraries try_compile try_run unset use_mangled_mesa utility_source variable_requires variable_watch while write_file" list_itkvtk'5fcommands = Set.fromList $ words $ "itk_wrap_tcl vtk_make_instantiator vtk_wrap_java vtk_wrap_python vtk_wrap_tcl" list_special'5fargs = Set.fromList $ words $ "A ABSOLUTE AFTER ALL ALPHABET AND APPEND ARCHIVE ARGS ASCII AUTHOR_WARNING B BEFORE BRIEF_DOCS BUNDLE CACHE CLEAR CMAKE_FIND_ROOT_PATH_BOTH CMAKE_FLAGS CODE COMMAND COMMAND_NAME COMMENT COMPARE COMPILE_DEFINITIONS COMPILE_OUTPUT_VARIABLE COMPILE_RESULT_VAR COMPONENT COMPONENTS CONFIGS CONFIGURATION CONFIGURATIONS CONFIGURE COPYONLY COPY_FILE DEFINED DEFINITION DEPENDS DESTINATION DIRECTORY DIRECTORY_PERMISSIONS DOC DOWNLOAD ENV EQUAL ERROR_FILE ERROR_QUIET ERROR_STRIP_TRAILING_WHITESPACE ERROR_VARIABLE ESCAPE_QUOTES EXACT EXCLUDE EXCLUDE_FROM_ALL EXISTS EXPORT EXPR EXT EXTRA_INCLUDE FATAL_ERROR FILE FILES FILES_MATCHING FILE_PERMISSIONS FIND FOLLOW_SYMLINKS FORCE FRAMEWORK FULL_DOCS FUNCTION GET GLOB GLOB_RECURSE GREATER GROUP_EXECUTE GROUP_READ HEX HINTS IMPLICIT_DEPENDS IMPORTED IN INCLUDE_INTERNALS INHERITED INPUT_FILE INSERT IS_ABSOLUTE IS_DIRECTORY IS_NEWER_THAN IS_SYMLINK ITEMS LENGTH LENGTH_MAXIMUM LENGTH_MINIMUM LESS LIBRARY LIMIT LIMIT_COUNT LIMIT_INPUT LIMIT_OUTPUT LINK_INTERFACE_LIBRARIES LISTS LOG MACOSX_BUNDLE MAIN_DEPENDENCY MAKE_DIRECTORY MATCH MATCHALL MATCHES MODULE NAME NAMELINK_ONLY NAMELINK_SKIP NAMES NAMESPACE NAME_WE NEW NEWLINE_CONSUME NOT NOTEQUAL NO_CMAKE_BUILDS_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_HEX_CONVERSION NO_MODULE NO_POLICY_SCOPE NO_SOURCE_PERMISSIONS NO_SYSTEM_ENVIRONMENT_PATH OFFSET OLD ONLY_CMAKE_FIND_ROOT_PATH OPTIONAL OR OUTPUT OUTPUT_DIRECTORY OUTPUT_FILE OUTPUT_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE OWNER_EXECUTE OWNER_READ OWNER_WRITE PACKAGE PARENT_SCOPE PATH PATHS PATH_SUFFIXES PATH_TO_MESA PATTERN PERMISSIONS POLICY POP POST_BUILD PREORDER PRE_BUILD PRE_LINK PRIVATE_HEADER PROGRAM PROGRAMS PROGRAM_ARGS PROJECT_NAME PROPERTIES PROPERTY PUBLIC_HEADER PUSH QUIET RANDOM RANDOM_SEED RANGE READ READ_WITH_PREFIX REALPATH REGEX REGULAR_EXPRESSION RELATIVE RELATIVE_PATH REMOVE REMOVE_AT REMOVE_DUPLICATES REMOVE_ITEM REMOVE_RECURSE RENAME REPLACE REQUIRED REQUIRED_VARIABLE1 REQUIRED_VARIABLE2 RESOURCE RESULT_VAR RESULT_VARIABLE RETURN_VALUE REVERSE RUNTIME RUNTIME_DIRECTORY RUN_OUTPUT_VARIABLE RUN_RESULT_VAR SCRIPT SEND_ERROR SET SHARED SORT SOURCE SOURCES STATIC STATUS STREQUAL STRGREATER STRINGS STRIP STRLESS SUBSTRING SYSTEM TARGET TARGETS TEST TEST_VARIABLE TIMEOUT TOLOWER TOUPPER TO_CMAKE_PATH TO_NATIVE_PATH USE_SOURCE_PERMISSIONS VALUE VAR VAR2 VARIABLE VERBATIM VERSION VERSION_EQUAL VERSION_GREATER VERSION_LESS WARNING WIN32 WORKING_DIRECTORY WRITE"@@ -81,12 +78,12 @@ regex_'22'28'3f'3d'5b_'29'3b'5d'7c'24'29 = compileRegex "\"(?=[ );]|$)" regex_'5c'5c'5b'22'24n'5c'5c'5d = compileRegex "\\\\[\"$n\\\\]" -defaultAttributes = [("Normal Text",NormalTok),("Detect Variables",NormalTok),("Command Args",NormalTok),("Macro Args",NormalTok),("Comment",CommentTok),("String",StringTok)]+defaultAttributes = [(("CMake","Normal Text"),NormalTok),(("CMake","Detect Variables"),NormalTok),(("CMake","Command Args"),NormalTok),(("CMake","Macro Args"),NormalTok),(("CMake","Comment"),CommentTok),(("CMake","String"),StringTok)] -parseRules "Normal Text" =+parseRules ("CMake","Normal Text") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_commands >>= withAttribute KeywordTok) >>~ pushContext "Command Args")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_commands >>= withAttribute KeywordTok) >>~ pushContext ("CMake","Command Args")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_itkvtk'5fcommands >>= withAttribute FunctionTok)) <|>@@ -94,18 +91,18 @@ <|> ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aEND'2e'2a'24 >>= withAttribute RegionMarkerTok)) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("CMake","Comment")) <|>- ((parseRules "Detect Variables"))+ ((parseRules ("CMake","Detect Variables"))) <|>- ((pRegExpr regex_'5cw'2b'5cs'2a'28'3f'3d'5c'28'29 >>= withAttribute FunctionTok) >>~ pushContext "Macro Args"))+ ((pRegExpr regex_'5cw'2b'5cs'2a'28'3f'3d'5c'28'29 >>= withAttribute FunctionTok) >>~ pushContext ("CMake","Macro Args"))) -parseRules "Detect Variables" =+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))) -parseRules "Command Args" =+parseRules ("CMake","Command Args") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_special'5fargs >>= withAttribute OtherTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_extra'5fspecial'5fargs >>= withAttribute OtherTok))@@ -114,29 +111,29 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_extra'5fproperties >>= withAttribute OtherTok)) <|>- ((parseRules "Macro Args")))+ ((parseRules ("CMake","Macro Args")))) -parseRules "Macro Args" =+parseRules ("CMake","Macro Args") = (((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pString False "\\\"" >>= withAttribute CharTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("CMake","String")) <|> ((pRegExpr regex_'23'2e'2a'24 >>= withAttribute CommentTok)) <|>- ((parseRules "Detect Variables")))+ ((parseRules ("CMake","Detect Variables")))) -parseRules "Comment" =+parseRules ("CMake","Comment") = ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) -parseRules "String" =+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 "Detect Variables")))+ ((parseRules ("CMake","Detect Variables")))) -parseRules "" = parseRules "Normal Text"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Coffee.hs view
@@ -9,7 +9,6 @@ import qualified Text.Highlighting.Kate.Syntax.Alert_indent import qualified Text.Highlighting.Kate.Syntax.Javascript import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -28,37 +27,39 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "CoffeeScript" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("CoffeeScript",["Normal"])], synStLanguage = "CoffeeScript", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("CoffeeScript","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "Multiline Regex" -> return ()- "Class" -> return ()- "Comment" -> (popContext) >> pEndLine- "Multiline Comment" -> return ()- "String" -> return ()- "Rich String" -> return ()- "Heredoc" -> return ()- "Rich Heredoc" -> return ()- "Embedding" -> return ()- "Javascript" -> return ()+ ("CoffeeScript","Normal") -> return ()+ ("CoffeeScript","Multiline Regex") -> return ()+ ("CoffeeScript","Class") -> return ()+ ("CoffeeScript","Comment") -> (popContext) >> pEndLine+ ("CoffeeScript","Multiline Comment") -> return ()+ ("CoffeeScript","String") -> return ()+ ("CoffeeScript","Rich String") -> return ()+ ("CoffeeScript","Heredoc") -> return ()+ ("CoffeeScript","Rich Heredoc") -> return ()+ ("CoffeeScript","Embedding") -> return ()+ ("CoffeeScript","Javascript") -> return () _ -> return () withAttribute attr txt = do@@ -67,10 +68,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_value'5fkeywords = Set.fromList $ words $ "false true yes no on off undefined null NaN Infinity" list_keywords = Set.fromList $ words $ "return break continue throw for while until loop if else unless switch when then and or in of by is isnt not typeof delete where super try catch finally try catch finally constructor" list_class'5fkeywords = Set.fromList $ words $ "class extends new instanceof"@@ -87,9 +84,9 @@ regex_'2f'2f'2f'5bmig'5d'7b0'2c3'7d = compileRegex "///[mig]{0,3}" regex_'5b'40'24'3a'2e'5cw'5c'5b'5c'5d'5d'2b = compileRegex "[@$:.\\w\\[\\]]+" -defaultAttributes = [("Normal",NormalTok),("Multiline Regex",StringTok),("Class",NormalTok),("Comment",CommentTok),("Multiline Comment",CommentTok),("String",StringTok),("Rich String",StringTok),("Heredoc",StringTok),("Rich Heredoc",StringTok),("Embedding",NormalTok),("Javascript",AlertTok)]+defaultAttributes = [(("CoffeeScript","Normal"),NormalTok),(("CoffeeScript","Multiline Regex"),StringTok),(("CoffeeScript","Class"),NormalTok),(("CoffeeScript","Comment"),CommentTok),(("CoffeeScript","Multiline Comment"),CommentTok),(("CoffeeScript","String"),StringTok),(("CoffeeScript","Rich String"),StringTok),(("CoffeeScript","Heredoc"),StringTok),(("CoffeeScript","Rich Heredoc"),StringTok),(("CoffeeScript","Embedding"),NormalTok),(("CoffeeScript","Javascript"),AlertTok)] -parseRules "Normal" =+parseRules ("CoffeeScript","Normal") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pFloat >>= withAttribute FloatTok))@@ -102,7 +99,7 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\#'" list_keywords >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\#'" list_class'5fkeywords >>= withAttribute KeywordTok) >>~ pushContext "Class")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\#'" list_class'5fkeywords >>= withAttribute KeywordTok) >>~ pushContext ("CoffeeScript","Class")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\#'" list_value'5fkeywords >>= withAttribute OtherTok)) <|>@@ -120,78 +117,79 @@ <|> ((pRegExpr regex_'5b'5f'24a'2dz'5d'5b'24'5cw'5d'2a'5cb >>= withAttribute NormalTok)) <|>- ((pString False "'''" >>= withAttribute StringTok) >>~ pushContext "Heredoc")+ ((pString False "'''" >>= withAttribute StringTok) >>~ pushContext ("CoffeeScript","Heredoc")) <|>- ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ pushContext "Rich Heredoc")+ ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ pushContext ("CoffeeScript","Rich Heredoc")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("CoffeeScript","String")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Rich String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("CoffeeScript","Rich String")) <|>- ((pDetectChar False '`' >>= withAttribute AlertTok) >>~ pushContext "Javascript")+ ((pDetectChar False '`' >>= withAttribute AlertTok) >>~ pushContext ("CoffeeScript","Javascript")) <|>- ((pString False "###" >>= withAttribute CommentTok) >>~ pushContext "Multiline Comment")+ ((pString False "###" >>= withAttribute CommentTok) >>~ pushContext ("CoffeeScript","Multiline Comment")) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("CoffeeScript","Comment")) <|>- ((pRegExpr regex_'2f'2f'2f >>= withAttribute StringTok) >>~ pushContext "Multiline Regex")+ ((pRegExpr regex_'2f'2f'2f >>= withAttribute StringTok) >>~ pushContext ("CoffeeScript","Multiline Regex")) <|> ((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))) -parseRules "Multiline Regex" =+parseRules ("CoffeeScript","Multiline Regex") = (((pHlCStringChar >>= withAttribute StringTok)) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("CoffeeScript","Comment")) <|> ((pRegExpr regex_'2f'2f'2f'5bmig'5d'7b0'2c3'7d >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Class" =+parseRules ("CoffeeScript","Class") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5b'40'24'3a'2e'5cw'5c'5b'5c'5d'5d'2b >>= withAttribute DataTypeTok) >>~ (popContext))) -parseRules "Comment" =+parseRules ("CoffeeScript","Comment") = ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd))) -parseRules "Multiline Comment" =+parseRules ("CoffeeScript","Multiline Comment") = (((pString False "###" >>= withAttribute CommentTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "String" =+parseRules ("CoffeeScript","String") = (((pHlCStringChar >>= withAttribute StringTok)) <|> ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Rich String" =+parseRules ("CoffeeScript","Rich String") = (((pHlCStringChar >>= withAttribute StringTok)) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute CharTok) >>~ pushContext "Embedding")+ ((pDetect2Chars False '#' '{' >>= withAttribute CharTok) >>~ pushContext ("CoffeeScript","Embedding")) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Heredoc" =+parseRules ("CoffeeScript","Heredoc") = (((pHlCStringChar >>= withAttribute StringTok)) <|> ((pString False "'''" >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Rich Heredoc" =+parseRules ("CoffeeScript","Rich Heredoc") = (((pHlCStringChar >>= withAttribute StringTok)) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute CharTok) >>~ pushContext "Embedding")+ ((pDetect2Chars False '#' '{' >>= withAttribute CharTok) >>~ pushContext ("CoffeeScript","Embedding")) <|> ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Embedding" =+parseRules ("CoffeeScript","Embedding") = ((pDetectChar False '}' >>= withAttribute CharTok) >>~ (popContext)) -parseRules "Javascript" =+parseRules ("CoffeeScript","Javascript") = (((pDetectChar False '`' >>= withAttribute AlertTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Javascript.parseExpression))) -parseRules "" = parseRules "Normal"+parseRules ("Alerts_indent", _) = Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression+parseRules ("JavaScript", _) = Text.Highlighting.Kate.Syntax.Javascript.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Coldfusion.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,47 +25,49 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "ColdFusion" }- context <- currentContext <|> (pushContext "Normal Text" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("ColdFusion",["Normal Text"])], synStLanguage = "ColdFusion", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("ColdFusion","Normal Text")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal Text" -> return ()- "ctxCFSCRIPT Tag" -> return ()- "ctxSCRIPT Tag" -> return ()- "ctxSTYLE Tag" -> return ()- "ctxTag" -> return ()- "ctxTable Tag" -> return ()- "ctxAnchor Tag" -> return ()- "ctxImage Tag" -> return ()- "ctxCF Tag" -> return ()- "ctxCustom Tag" -> return ()- "ctxCFX Tag" -> return ()- "ctxHTML Comment" -> return ()- "ctxCF Comment" -> return ()- "ctxC Style Comment" -> return ()- "ctxOne Line Comment" -> (popContext) >> pEndLine- "ctxHTML Entities" -> (popContext) >> pEndLine- "ctxCFSCRIPT Block" -> return ()- "ctxSCRIPT Block" -> return ()- "ctxSTYLE Block" -> return ()- "ctxStyle Properties" -> return ()- "ctxStyle Values" -> (popContext) >> pEndLine+ ("ColdFusion","Normal Text") -> return ()+ ("ColdFusion","ctxCFSCRIPT Tag") -> return ()+ ("ColdFusion","ctxSCRIPT Tag") -> return ()+ ("ColdFusion","ctxSTYLE Tag") -> return ()+ ("ColdFusion","ctxTag") -> return ()+ ("ColdFusion","ctxTable Tag") -> return ()+ ("ColdFusion","ctxAnchor Tag") -> return ()+ ("ColdFusion","ctxImage Tag") -> return ()+ ("ColdFusion","ctxCF Tag") -> return ()+ ("ColdFusion","ctxCustom Tag") -> return ()+ ("ColdFusion","ctxCFX Tag") -> return ()+ ("ColdFusion","ctxHTML Comment") -> return ()+ ("ColdFusion","ctxCF Comment") -> return ()+ ("ColdFusion","ctxC Style Comment") -> return ()+ ("ColdFusion","ctxOne Line Comment") -> (popContext) >> pEndLine+ ("ColdFusion","ctxHTML Entities") -> (popContext) >> pEndLine+ ("ColdFusion","ctxCFSCRIPT Block") -> return ()+ ("ColdFusion","ctxSCRIPT Block") -> return ()+ ("ColdFusion","ctxSTYLE Block") -> return ()+ ("ColdFusion","ctxStyle Properties") -> return ()+ ("ColdFusion","ctxStyle Values") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -75,10 +76,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_Script_Keywords = Set.fromList $ words $ "if else for in while do continue break with try catch switch case new var function return this delete true false void throw typeof const default" list_Script_Objects = Set.fromList $ words $ "anchor applet area array boolean button checkbox date document event fileupload form frame function hidden history image layer linke location math navigator number object option password radio regexp reset screen select string submit text textarea window" list_Script_Methods = Set.fromList $ words $ "abs acos alert anchor apply asin atan atan2 back blur call captureevents ceil charat charcodeat clearinterval cleartimeout click close compile concat confirm cos disableexternalcapture enableexternalcapture eval exec exp find floor focus forward fromcharcode getdate getday getfullyear gethours getmilliseconds getminutes getmonth getseconds getselection gettime gettimezoneoffset getutcdate getutcday getutcfullyear getutchours getutcmilliseconds getutcminutes getutcmonth getutcseconds go handleevent home indexof javaenabled join lastindexof link load log match max min moveabove movebelow moveby moveto movetoabsolute open parse plugins.refresh pop pow preference print prompt push random releaseevents reload replace reset resizeby resizeto reverse round routeevent scrollby scrollto search select setdate setfullyear sethours setinterval setmilliseconds setminutes setmonth setseconds settime settimeout setutcdate setutcfullyear setutchours setutcmilliseconds setutcminutes setutcmonth setutcseconds shift sin slice sort splice split sqrt stop string formatting submit substr substring taintenabled tan test tolocalestring tolowercase tosource tostring touppercase toutcstring unshift unwatch utc valueof watch write writeln"@@ -102,37 +99,37 @@ regex_'3c'2f'5bsS'5d'5btT'5d'5byY'5d'5blL'5d'5beE'5d'3e = compileRegex "</[sS][tT][yY][lL][eE]>" regex_'23'28'5b0'2d9a'2dfA'2dF'5d'7b3'7d'29'7c'28'5b0'2d9a'2dfA'2dF'5d'7b6'7d'29 = compileRegex "#([0-9a-fA-F]{3})|([0-9a-fA-F]{6})" -defaultAttributes = [("Normal Text",NormalTok),("ctxCFSCRIPT Tag",NormalTok),("ctxSCRIPT Tag",NormalTok),("ctxSTYLE Tag",NormalTok),("ctxTag",NormalTok),("ctxTable Tag",NormalTok),("ctxAnchor Tag",NormalTok),("ctxImage Tag",NormalTok),("ctxCF Tag",NormalTok),("ctxCustom Tag",NormalTok),("ctxCFX Tag",NormalTok),("ctxHTML Comment",CommentTok),("ctxCF Comment",CommentTok),("ctxC Style Comment",CommentTok),("ctxOne Line Comment",CommentTok),("ctxHTML Entities",NormalTok),("ctxCFSCRIPT Block",NormalTok),("ctxSCRIPT Block",NormalTok),("ctxSTYLE Block",NormalTok),("ctxStyle Properties",NormalTok),("ctxStyle Values",NormalTok)]+defaultAttributes = [(("ColdFusion","Normal Text"),NormalTok),(("ColdFusion","ctxCFSCRIPT Tag"),NormalTok),(("ColdFusion","ctxSCRIPT Tag"),NormalTok),(("ColdFusion","ctxSTYLE Tag"),NormalTok),(("ColdFusion","ctxTag"),NormalTok),(("ColdFusion","ctxTable Tag"),NormalTok),(("ColdFusion","ctxAnchor Tag"),NormalTok),(("ColdFusion","ctxImage Tag"),NormalTok),(("ColdFusion","ctxCF Tag"),NormalTok),(("ColdFusion","ctxCustom Tag"),NormalTok),(("ColdFusion","ctxCFX Tag"),NormalTok),(("ColdFusion","ctxHTML Comment"),CommentTok),(("ColdFusion","ctxCF Comment"),CommentTok),(("ColdFusion","ctxC Style Comment"),CommentTok),(("ColdFusion","ctxOne Line Comment"),CommentTok),(("ColdFusion","ctxHTML Entities"),NormalTok),(("ColdFusion","ctxCFSCRIPT Block"),NormalTok),(("ColdFusion","ctxSCRIPT Block"),NormalTok),(("ColdFusion","ctxSTYLE Block"),NormalTok),(("ColdFusion","ctxStyle Properties"),NormalTok),(("ColdFusion","ctxStyle Values"),NormalTok)] -parseRules "Normal Text" =- (((pString False "<!---" >>= withAttribute CommentTok) >>~ pushContext "ctxCF Comment")+parseRules ("ColdFusion","Normal Text") =+ (((pString False "<!---" >>= withAttribute CommentTok) >>~ pushContext ("ColdFusion","ctxCF Comment")) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "ctxHTML Comment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("ColdFusion","ctxHTML Comment")) <|>- ((pRegExpr regex_'3c'5bcC'5d'5bfF'5d'5bsS'5d'5bcC'5d'5brR'5d'5biI'5d'5bpP'5d'5btT'5d >>= withAttribute NormalTok) >>~ pushContext "ctxCFSCRIPT Tag")+ ((pRegExpr regex_'3c'5bcC'5d'5bfF'5d'5bsS'5d'5bcC'5d'5brR'5d'5biI'5d'5bpP'5d'5btT'5d >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxCFSCRIPT Tag")) <|>- ((pRegExpr regex_'3c'5bsS'5d'5bcC'5d'5brR'5d'5biI'5d'5bpP'5d'5btT'5d >>= withAttribute NormalTok) >>~ pushContext "ctxSCRIPT Tag")+ ((pRegExpr regex_'3c'5bsS'5d'5bcC'5d'5brR'5d'5biI'5d'5bpP'5d'5btT'5d >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxSCRIPT Tag")) <|>- ((pRegExpr regex_'3c'5bsS'5d'5btT'5d'5byY'5d'5blL'5d'5beE'5d >>= withAttribute NormalTok) >>~ pushContext "ctxSTYLE Tag")+ ((pRegExpr regex_'3c'5bsS'5d'5btT'5d'5byY'5d'5blL'5d'5beE'5d >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxSTYLE Tag")) <|>- ((pDetectChar False '&' >>= withAttribute NormalTok) >>~ pushContext "ctxHTML Entities")+ ((pDetectChar False '&' >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxHTML Entities")) <|>- ((pRegExpr regex_'3c'5c'2f'3f'5bcC'5d'5bfF'5d'5f >>= withAttribute NormalTok) >>~ pushContext "ctxCustom Tag")+ ((pRegExpr regex_'3c'5c'2f'3f'5bcC'5d'5bfF'5d'5f >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxCustom Tag")) <|>- ((pRegExpr regex_'3c'5c'2f'3f'5bcC'5d'5bfF'5d'5bxX'5d'5f >>= withAttribute NormalTok) >>~ pushContext "ctxCFX Tag")+ ((pRegExpr regex_'3c'5c'2f'3f'5bcC'5d'5bfF'5d'5bxX'5d'5f >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxCFX Tag")) <|>- ((pRegExpr regex_'3c'5c'2f'3f'5bcC'5d'5bfF'5d >>= withAttribute NormalTok) >>~ pushContext "ctxCF Tag")+ ((pRegExpr regex_'3c'5c'2f'3f'5bcC'5d'5bfF'5d >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxCF Tag")) <|>- ((pRegExpr regex_'3c'5c'2f'3f'28'5btT'5d'5baAhHbBfFrRdD'5d'29'7c'28'5bcC'5d'5baA'5d'5bpP'5d'5btT'5d'29 >>= withAttribute NormalTok) >>~ pushContext "ctxTable Tag")+ ((pRegExpr regex_'3c'5c'2f'3f'28'5btT'5d'5baAhHbBfFrRdD'5d'29'7c'28'5bcC'5d'5baA'5d'5bpP'5d'5btT'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxTable Tag")) <|>- ((pRegExpr regex_'3c'5c'2f'3f'5baA'5d_ >>= withAttribute NormalTok) >>~ pushContext "ctxAnchor Tag")+ ((pRegExpr regex_'3c'5c'2f'3f'5baA'5d_ >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxAnchor Tag")) <|>- ((pRegExpr regex_'3c'5c'2f'3f'5biI'5d'5bmM'5d'5bgG'5d_ >>= withAttribute NormalTok) >>~ pushContext "ctxImage Tag")+ ((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 "ctxTag"))+ ((pRegExpr regex_'3c'21'3f'5c'2f'3f'5ba'2dzA'2dZ0'2d9'5f'5d'2b >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxTag"))) -parseRules "ctxCFSCRIPT Tag" =- (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ pushContext "ctxCFSCRIPT Block")+parseRules ("ColdFusion","ctxCFSCRIPT Tag") =+ (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxCFSCRIPT Block")) <|> ((pDetectChar False '=' >>= withAttribute NormalTok)) <|>@@ -140,8 +137,8 @@ <|> ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))) -parseRules "ctxSCRIPT Tag" =- (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ pushContext "ctxSCRIPT Block")+parseRules ("ColdFusion","ctxSCRIPT Tag") =+ (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxSCRIPT Block")) <|> ((pDetectChar False '=' >>= withAttribute NormalTok)) <|>@@ -149,8 +146,8 @@ <|> ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))) -parseRules "ctxSTYLE Tag" =- (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ pushContext "ctxSTYLE Block")+parseRules ("ColdFusion","ctxSTYLE Tag") =+ (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxSTYLE Block")) <|> ((pDetectChar False '=' >>= withAttribute NormalTok)) <|>@@ -158,7 +155,7 @@ <|> ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))) -parseRules "ctxTag" =+parseRules ("ColdFusion","ctxTag") = (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pDetectChar False '=' >>= withAttribute NormalTok))@@ -167,7 +164,7 @@ <|> ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))) -parseRules "ctxTable Tag" =+parseRules ("ColdFusion","ctxTable Tag") = (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pDetectChar False '=' >>= withAttribute NormalTok))@@ -176,7 +173,7 @@ <|> ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))) -parseRules "ctxAnchor Tag" =+parseRules ("ColdFusion","ctxAnchor Tag") = (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pDetectChar False '=' >>= withAttribute NormalTok))@@ -185,7 +182,7 @@ <|> ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))) -parseRules "ctxImage Tag" =+parseRules ("ColdFusion","ctxImage Tag") = (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pDetectChar False '=' >>= withAttribute NormalTok))@@ -194,7 +191,7 @@ <|> ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))) -parseRules "ctxCF Tag" =+parseRules ("ColdFusion","ctxCF Tag") = (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pDetectChar False '=' >>= withAttribute NormalTok))@@ -203,7 +200,7 @@ <|> ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))) -parseRules "ctxCustom Tag" =+parseRules ("ColdFusion","ctxCustom Tag") = (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pDetectChar False '=' >>= withAttribute NormalTok))@@ -212,7 +209,7 @@ <|> ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))) -parseRules "ctxCFX Tag" =+parseRules ("ColdFusion","ctxCFX Tag") = (((pDetectChar False '>' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pDetectChar False '=' >>= withAttribute NormalTok))@@ -221,27 +218,27 @@ <|> ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))) -parseRules "ctxHTML Comment" =- (((pString False "<!---" >>= withAttribute CommentTok) >>~ pushContext "ctxCF Comment")+parseRules ("ColdFusion","ctxHTML Comment") =+ (((pString False "<!---" >>= withAttribute CommentTok) >>~ pushContext ("ColdFusion","ctxCF Comment")) <|> ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "ctxCF Comment" =+parseRules ("ColdFusion","ctxCF Comment") = ((pString False "--->" >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "ctxC Style Comment" =+parseRules ("ColdFusion","ctxC Style Comment") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "ctxOne Line Comment" =+parseRules ("ColdFusion","ctxOne Line Comment") = pzero -parseRules "ctxHTML Entities" =+parseRules ("ColdFusion","ctxHTML Entities") = ((pDetectChar False ';' >>= withAttribute NormalTok) >>~ (popContext)) -parseRules "ctxCFSCRIPT Block" =- (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "ctxC Style Comment")+parseRules ("ColdFusion","ctxCFSCRIPT Block") =+ (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("ColdFusion","ctxC Style Comment")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "ctxOne Line Comment")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("ColdFusion","ctxOne Line Comment")) <|> ((pRegExpr regex_'22'5b'5e'22'5d'2a'22 >>= withAttribute NormalTok)) <|>@@ -261,10 +258,10 @@ <|> ((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))) -parseRules "ctxSCRIPT Block" =- (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "ctxC Style Comment")+parseRules ("ColdFusion","ctxSCRIPT Block") =+ (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("ColdFusion","ctxC Style Comment")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "ctxOne Line Comment")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("ColdFusion","ctxOne Line Comment")) <|> ((pRegExpr regex_'22'5b'5e'22'5d'2a'22 >>= withAttribute NormalTok)) <|>@@ -286,21 +283,21 @@ <|> ((pRegExpr regex_'3c'2f'5bsS'5d'5bcC'5d'5brR'5d'5biI'5d'5bpP'5d'5btT'5d'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext))) -parseRules "ctxSTYLE Block" =- (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "ctxC Style Comment")+parseRules ("ColdFusion","ctxSTYLE Block") =+ (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("ColdFusion","ctxC Style Comment")) <|>- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "ctxStyle Properties")+ ((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))) -parseRules "ctxStyle Properties" =+parseRules ("ColdFusion","ctxStyle Properties") = (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "ctxC Style Comment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("ColdFusion","ctxC Style Comment")) <|>- ((pDetectChar False ':' >>= withAttribute NormalTok) >>~ pushContext "ctxStyle Values"))+ ((pDetectChar False ':' >>= withAttribute NormalTok) >>~ pushContext ("ColdFusion","ctxStyle Values"))) -parseRules "ctxStyle Values" =+parseRules ("ColdFusion","ctxStyle Values") = (((pDetectChar False ';' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pDetectChar False ',' >>= withAttribute NormalTok))@@ -315,6 +312,5 @@ <|> ((pRegExpr regex_'27'5b'5e'27'5d'2a'27 >>= withAttribute NormalTok))) -parseRules "" = parseRules "Normal Text" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Commonlisp.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,31 +25,33 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Common Lisp" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Common Lisp",["Normal"])], synStLanguage = "Common Lisp", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Common Lisp","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "MultiLineComment" -> return ()- "function_decl" -> return ()- "SpecialNumber" -> (popContext) >> pEndLine- "String" -> return ()+ ("Common Lisp","Normal") -> return ()+ ("Common Lisp","MultiLineComment") -> return ()+ ("Common Lisp","function_decl") -> return ()+ ("Common Lisp","SpecialNumber") -> (popContext) >> pEndLine+ ("Common Lisp","String") -> return () _ -> return () withAttribute attr txt = do@@ -59,10 +60,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_symbols = Set.fromList $ words $ "< <= = > >= => - / /= // /// * ** *** + ++ +++ 1- 1+" list_definitions = Set.fromList $ words $ "defclass defconstant defgeneric define-compiler-macro define-condition define-method-combination define-modify-macro define-setf-expander define-setf-method define-symbol-macro defmacro defmethod defpackage defparameter defsetf deftype defvar defun defstruct" list_keywords = Set.fromList $ words $ "abort abs access acons acos acosh add-method adjoin adjustable-array-p adjust-array allocate-instance alpha-char-p alphanumericp and append apply applyhook apropos apropos-list aref arithmetic-error arithmetic-error-operands arithmetic-error-operation array array-dimension array-dimension-limit array-dimensions array-displacement array-element-type array-has-fill-pointer-p array-in-bounds-p arrayp array-rank array-rank-limit array-row-major-index array-total-size array-total-size-limit ash asin asinh assert assoc assoc-if assoc-if-not atan atanh atom base-char base-string bignum bit bit-and bit-andc1 bit-andc2 bit-eqv bit-ior bit-nand bit-nor bit-not bit-orc1 bit-orc2 bit-vector bit-vector-p bit-xor block boole boole-1 boole-2 boolean boole-and boole-andc1 boole-andc2 boole-c1 boole-c2 boole-clr boole-eqv boole-ior boole-nand boole-nor boole-orc1 boole-orc2 boole-set boole-xor both-case-p boundp break broadcast-stream broadcast-stream-streams built-in-class butlast byte byte-position byte-size caaaar caaadr caaar caadar caaddr caadr caar cadaar cadadr cadar caddar cadddr caddr cadr call-arguments-limit call-method call-next-method capitalize car case catch ccase cdaaar cdaadr cdaar cdadar cdaddr cdadr cdar cddaar cddadr cddar cdddar cddddr cdddr cddr cdr ceiling cell-error cell-error-name cerror change-class char char< char<= char= char> char>= char/= character characterp char-bit char-bits char-bits-limit char-code char-code-limit char-control-bit char-downcase char-equal char-font char-font-limit char-greaterp char-hyper-bit char-int char-lessp char-meta-bit char-name char-not-equal char-not-greaterp char-not-lessp char-super-bit char-upcase check-type cis class class-name class-of clear-input clear-output close clrhash code-char coerce commonp compilation-speed compile compiled-function compiled-function-p compile-file compile-file-pathname compiler-let compiler-macro compiler-macro-function complement complex complexp compute-applicable-methods compute-restarts concatenate concatenated-stream concatenated-stream-streams cond condition conjugate cons consp constantly constantp continue control-error copy-alist copy-list copy-pprint-dispatch copy-readtable copy-seq copy-structure copy-symbol copy-tree cos cosh count count-if count-if-not ctypecase debug decf declaim declaration declare decode-float decode-universal-time delete delete-duplicates delete-file delete-if delete-if-not delete-package denominator deposit-field describe describe-object destructuring-bind digit-char digit-char-p directory directory-namestring disassemble division-by-zero do do* do-all-symbols documentation do-exeternal-symbols do-external-symbols dolist do-symbols dotimes double-float double-float-epsilon double-float-negative-epsilon dpb dribble dynamic-extent ecase echo-stream echo-stream-input-stream echo-stream-output-stream ed eighth elt encode-universal-time end-of-file endp enough-namestring ensure-directories-exist ensure-generic-function eq eql equal equalp error etypecase eval evalhook eval-when evenp every exp export expt extended-char fboundp fceiling fdefinition ffloor fifth file-author file-error file-error-pathname file-length file-namestring file-position file-stream file-string-length file-write-date fill fill-pointer find find-all-symbols find-class find-if find-if-not find-method find-package find-restart find-symbol finish-output first fixnum flet float float-digits floating-point-inexact floating-point-invalid-operation floating-point-overflow floating-point-underflow floatp float-precision float-radix float-sign floor fmakunbound force-output format formatter fourth fresh-line fround ftruncate ftype funcall function function-keywords function-lambda-expression functionp gbitp gcd generic-function gensym gentemp get get-decoded-time get-dispatch-macro-character getf gethash get-internal-real-time get-internal-run-time get-macro-character get-output-stream-string get-properties get-setf-expansion get-setf-method get-universal-time go graphic-char-p handler-bind handler-case hash-table hash-table-count hash-table-p hash-table-rehash-size hash-table-rehash-threshold hash-table-size hash-table-test host-namestring identity if if-exists ignorable ignore ignore-errors imagpart import incf initialize-instance inline in-package in-package input-stream-p inspect int-char integer integer-decode-float integer-length integerp interactive-stream-p intern internal-time-units-per-second intersection invalid-method-error invoke-debugger invoke-restart invoke-restart-interactively isqrt keyword keywordp labels lambda lambda-list-keywords lambda-parameters-limit last lcm ldb ldb-test ldiff least-negative-double-float least-negative-long-float least-negative-normalized-double-float least-negative-normalized-long-float least-negative-normalized-short-float least-negative-normalized-single-float least-negative-short-float least-negative-single-float least-positive-double-float least-positive-long-float least-positive-normalized-double-float least-positive-normalized-long-float least-positive-normalized-short-float least-positive-normalized-single-float least-positive-short-float least-positive-single-float length let let* lisp lisp-implementation-type lisp-implementation-version list list* list-all-packages listen list-length listp load load-logical-pathname-translations load-time-value locally log logand logandc1 logandc2 logbitp logcount logeqv logical-pathname logical-pathname-translations logior lognand lognor lognot logorc1 logorc2 logtest logxor long-float long-float-epsilon long-float-negative-epsilon long-site-name loop loop-finish lower-case-p machine-instance machine-type machine-version macroexpand macroexpand-1 macroexpand-l macro-function macrolet make-array make-array make-broadcast-stream make-char make-concatenated-stream make-condition make-dispatch-macro-character make-echo-stream make-hash-table make-instance make-instances-obsolete make-list make-load-form make-load-form-saving-slots make-method make-package make-pathname make-random-state make-sequence make-string make-string-input-stream make-string-output-stream make-symbol make-synonym-stream make-two-way-stream makunbound map mapc mapcan mapcar mapcon maphash map-into mapl maplist mask-field max member member-if member-if-not merge merge-pathname merge-pathnames method method-combination method-combination-error method-qualifiers min minusp mismatch mod most-negative-double-float most-negative-fixnum most-negative-long-float most-negative-short-float most-negative-single-float most-positive-double-float most-positive-fixnum most-positive-long-float most-positive-short-float most-positive-single-float muffle-warning multiple-value-bind multiple-value-call multiple-value-list multiple-value-prog1 multiple-value-seteq multiple-value-setq multiple-values-limit name-char namestring nbutlast nconc next-method-p nil nintersection ninth no-applicable-method no-next-method not notany notevery notinline nreconc nreverse nset-difference nset-exclusive-or nstring nstring-capitalize nstring-downcase nstring-upcase nsublis nsubst nsubst-if nsubst-if-not nsubstitute nsubstitute-if nsubstitute-if-not nth nthcdr nth-value null number numberp numerator nunion oddp open open-stream-p optimize or otherwise output-stream-p package package-error package-error-package package-name package-nicknames packagep package-shadowing-symbols package-used-by-list package-use-list pairlis parse-error parse-integer parse-namestring pathname pathname-device pathname-directory pathname-host pathname-match-p pathname-name pathnamep pathname-type pathname-version peek-char phase pi plusp pop position position-if position-if-not pprint pprint-dispatch pprint-exit-if-list-exhausted pprint-fill pprint-indent pprint-linear pprint-logical-block pprint-newline pprint-pop pprint-tab pprint-tabular prin1 prin1-to-string princ princ-to-string print print-not-readable print-not-readable-object print-object print-unreadable-object probe-file proclaim prog prog* prog1 prog2 progn program-error progv provide psetf psetq push pushnew putprop quote random random-state random-state-p rassoc rassoc-if rassoc-if-not ratio rational rationalize rationalp read read-byte read-char read-char-no-hang read-delimited-list reader-error read-eval-print read-from-string read-line read-preserving-whitespace read-sequence readtable readtable-case readtablep real realp realpart reduce reinitialize-instance rem remf remhash remove remove-duplicates remove-if remove-if-not remove-method remprop rename-file rename-package replace require rest restart restart-bind restart-case restart-name return return-from revappend reverse room rotatef round row-major-aref rplaca rplacd safety satisfies sbit scale-float schar search second sequence serious-condition set set-char-bit set-difference set-dispatch-macro-character set-exclusive-or setf set-macro-character set-pprint-dispatch setq set-syntax-from-char seventh shadow shadowing-import shared-initialize shiftf short-float short-float-epsilon short-float-negative-epsilon short-site-name signal signed-byte signum simle-condition simple-array simple-base-string simple-bit-vector simple-bit-vector-p simple-condition-format-arguments simple-condition-format-control simple-error simple-string simple-string-p simple-type-error simple-vector simple-vector-p simple-warning sin single-flaot-epsilon single-float single-float-epsilon single-float-negative-epsilon sinh sixth sleep slot-boundp slot-exists-p slot-makunbound slot-missing slot-unbound slot-value software-type software-version some sort space special special-form-p special-operator-p speed sqrt stable-sort standard standard-char standard-char-p standard-class standard-generic-function standard-method standard-object step storage-condition store-value stream stream-element-type stream-error stream-error-stream stream-external-format streamp streamup string string< string<= string= string> string>= string/= string-capitalize string-char string-char-p string-downcase string-equal string-greaterp string-left-trim string-lessp string-not-equal string-not-greaterp string-not-lessp stringp string-right-strim string-right-trim string-stream string-trim string-upcase structure structure-class structure-object style-warning sublim sublis subseq subsetp subst subst-if subst-if-not substitute substitute-if substitute-if-not subtypep svref sxhash symbol symbol-function symbol-macrolet symbol-name symbolp symbol-package symbol-plist symbol-value synonym-stream synonym-stream-symbol sys system t tagbody tailp tan tanh tenth terpri the third throw time trace translate-logical-pathname translate-pathname tree-equal truename truncase truncate two-way-stream two-way-stream-input-stream two-way-stream-output-stream type typecase type-error type-error-datum type-error-expected-type type-of typep unbound-slot unbound-slot-instance unbound-variable undefined-function unexport unintern union unless unread unread-char unsigned-byte untrace unuse-package unwind-protect update-instance-for-different-class update-instance-for-redefined-class upgraded-array-element-type upgraded-complex-part-type upper-case-p use-package user user-homedir-pathname use-value values values-list vector vectorp vector-pop vector-push vector-push-extend warn warning when wild-pathname-p with-accessors with-compilation-unit with-condition-restarts with-hash-table-iterator with-input-from-string with-open-file with-open-stream with-output-to-string with-package-iterator with-simple-restart with-slots with-standard-io-syntax write write-byte write-char write-line write-sequence write-string write-to-string yes-or-no-p y-or-n-p zerop"@@ -77,16 +74,16 @@ regex_'23'5btf'5d = compileRegex "#[tf]" regex_'5cs'2a'5bA'2dZa'2dz0'2d9'2d'2b'5c'3c'5c'3e'2f'2f'5c'2a'5d'2a'5cs'2a = compileRegex "\\s*[A-Za-z0-9-+\\<\\>//\\*]*\\s*" -defaultAttributes = [("Normal",NormalTok),("MultiLineComment",CommentTok),("function_decl",FunctionTok),("SpecialNumber",NormalTok),("String",StringTok)]+defaultAttributes = [(("Common Lisp","Normal"),NormalTok),(("Common Lisp","MultiLineComment"),CommentTok),(("Common Lisp","function_decl"),FunctionTok),(("Common Lisp","SpecialNumber"),NormalTok),(("Common Lisp","String"),StringTok)] -parseRules "Normal" =+parseRules ("Common Lisp","Normal") = (((pRegExpr regex_'3b'2b'5cs'2aBEGIN'2e'2a'24 >>= withAttribute RegionMarkerTok)) <|> ((pRegExpr regex_'3b'2b'5cs'2aEND'2e'2a'24 >>= withAttribute RegionMarkerTok)) <|> ((pRegExpr regex_'3b'2e'2a'24 >>= withAttribute CommentTok)) <|>- ((pDetect2Chars False '#' '|' >>= withAttribute CommentTok) >>~ pushContext "MultiLineComment")+ ((pDetect2Chars False '#' '|' >>= withAttribute CommentTok) >>~ pushContext ("Common Lisp","MultiLineComment")) <|> ((pDetectChar False '(' >>= withAttribute NormalTok)) <|>@@ -100,13 +97,13 @@ <|> ((pKeyword " \n\t.(),%&;[]^{|}~" list_variables >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t.(),%&;[]^{|}~" list_definitions >>= withAttribute KeywordTok) >>~ pushContext "function_decl")+ ((pKeyword " \n\t.(),%&;[]^{|}~" list_definitions >>= withAttribute KeywordTok) >>~ pushContext ("Common Lisp","function_decl")) <|> ((pRegExpr regex_'23'5c'5c'2e >>= withAttribute CharTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Common Lisp","String")) <|>- ((pRegExpr regex_'23'5bbodxei'5d >>= withAttribute CharTok) >>~ pushContext "SpecialNumber")+ ((pRegExpr regex_'23'5bbodxei'5d >>= withAttribute CharTok) >>~ pushContext ("Common Lisp","SpecialNumber")) <|> ((pRegExpr regex_'23'5btf'5d >>= withAttribute DecValTok)) <|>@@ -114,13 +111,13 @@ <|> ((pInt >>= withAttribute DecValTok))) -parseRules "MultiLineComment" =+parseRules ("Common Lisp","MultiLineComment") = ((pDetect2Chars False '|' '#' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "function_decl" =+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)) -parseRules "SpecialNumber" =+parseRules ("Common Lisp","SpecialNumber") = (((pFloat >>= withAttribute FloatTok) >>~ (popContext)) <|> ((pInt >>= withAttribute DecValTok) >>~ (popContext))@@ -129,13 +126,12 @@ <|> ((pHlCHex >>= withAttribute FloatTok) >>~ (popContext))) -parseRules "String" =+parseRules ("Common Lisp","String") = (((pRegExpr regex_'23'5c'5c'2e >>= withAttribute CharTok)) <|> ((pHlCStringChar >>= withAttribute NormalTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Cpp.hs view
@@ -9,7 +9,6 @@ import qualified Text.Highlighting.Kate.Syntax.Doxygen import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -28,37 +27,39 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "C++" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("C++",["Normal"])], synStLanguage = "C++", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("C++","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "String" -> (popContext) >> pEndLine- "Region Marker" -> (popContext) >> pEndLine- "Commentar 1" -> (popContext) >> pEndLine- "Commentar 2" -> return ()- "AfterHash" -> (popContext) >> pEndLine- "Preprocessor" -> (popContext) >> pEndLine- "Define" -> (popContext) >> pEndLine- "Commentar/Preprocessor" -> return ()- "Outscoped" -> return ()- "Outscoped intern" -> return ()+ ("C++","Normal") -> return ()+ ("C++","String") -> (popContext) >> pEndLine+ ("C++","Region Marker") -> (popContext) >> pEndLine+ ("C++","Commentar 1") -> (popContext) >> pEndLine+ ("C++","Commentar 2") -> return ()+ ("C++","AfterHash") -> (popContext) >> pEndLine+ ("C++","Preprocessor") -> (popContext) >> pEndLine+ ("C++","Define") -> (popContext) >> pEndLine+ ("C++","Commentar/Preprocessor") -> return ()+ ("C++","Outscoped") -> return ()+ ("C++","Outscoped intern") -> return () _ -> return () withAttribute attr txt = do@@ -67,10 +68,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "asm break case catch class constexpr const_cast continue decltype default delete do dynamic_cast else enum explicit export extern false final friend for goto if inline namespace new noexcept nullptr operator override private protected public qobject_cast reinterpret_cast return sizeof static_assert static_cast struct switch template this throw true try typedef typeid type_info typename union using virtual while and and_eq bad_cast bad_typeid bitand bitor compl not not_eq or or_eq xor xor_eq" list_extensions = Set.fromList $ words $ "K_DCOP Q_ARG Q_ASSERT Q_ASSERT_X Q_CHECK_PTR Q_CLASSINFO Q_CLEANUP_RESOURCE Q_D Q_DECLARE_FLAGS Q_DECLARE_FLAGS Q_DECLARE_INTERFACE Q_DECLARE_METATYPE Q_DECLARE_OPERATORS_FOR_FLAGS Q_DECLARE_PRIVATE Q_DECLARE_PUBLIC Q_DECLARE_SHARED Q_DECLARE_TYPEINFO Q_DISABLE_COPY Q_ENUMS Q_EXPORT Q_FLAGS Q_FOREACH Q_FOREVER Q_GADGET Q_GLOBAL_STATIC Q_GLOBAL_STATIC_WITH_ARGS Q_INIT_RESOURCE Q_INTERFACES Q_INVOKABLE Q_NOREPLY Q_OBJECT Q_OVERRIDE Q_PRIVATE_SLOT Q_PROPERTY Q_Q Q_RETURN_ARG Q_SCRIPTABLE Q_SETS Q_SIGNALS Q_SLOTS Q_UNUSED SIGNAL SLOT TRUE FALSE connect disconnect emit signals slots foreach forever qint8 qint16 qint32 qint64 qlonglong qptrdiff qreal quint8 quint16 quint32 quint64 quintptr qulonglong" list_types = Set.fromList $ words $ "auto bool char char16_t char32_t const double float int long mutable register short signed static unsigned void volatile uchar uint int8_t int16_t int32_t int64_t uint8_t uint16_t uint32_t uint64_t wchar_t"@@ -84,18 +81,18 @@ regex_'23'5cs'2aif = compileRegex "#\\s*if" regex_'23'5cs'2ael'28'3f'3ase'7cif'29 = compileRegex "#\\s*el(?:se|if)" -defaultAttributes = [("Normal",NormalTok),("String",StringTok),("Region Marker",RegionMarkerTok),("Commentar 1",CommentTok),("Commentar 2",CommentTok),("AfterHash",ErrorTok),("Preprocessor",OtherTok),("Define",OtherTok),("Commentar/Preprocessor",CommentTok),("Outscoped",CommentTok),("Outscoped intern",CommentTok)]+defaultAttributes = [(("C++","Normal"),NormalTok),(("C++","String"),StringTok),(("C++","Region Marker"),RegionMarkerTok),(("C++","Commentar 1"),CommentTok),(("C++","Commentar 2"),CommentTok),(("C++","AfterHash"),ErrorTok),(("C++","Preprocessor"),OtherTok),(("C++","Define"),OtherTok),(("C++","Commentar/Preprocessor"),CommentTok),(("C++","Outscoped"),CommentTok),(("C++","Outscoped intern"),CommentTok)] -parseRules "Normal" =+parseRules ("C++","Normal") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'5cs'2b0'5cs'2a'24 >>= withAttribute OtherTok) >>~ pushContext "Outscoped")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'5cs'2b0'5cs'2a'24 >>= withAttribute OtherTok) >>~ pushContext ("C++","Outscoped")) <|>- ((pFirstNonSpace >> lookAhead (pDetectChar False '#') >> pushContext "AfterHash" >> currentContext >>= parseRules))+ ((pFirstNonSpace >> lookAhead (pDetectChar False '#') >> pushContext ("C++","AfterHash") >> currentContext >>= parseRules)) <|>- ((pFirstNonSpace >> pString False "//BEGIN" >>= withAttribute RegionMarkerTok) >>~ pushContext "Region Marker")+ ((pFirstNonSpace >> pString False "//BEGIN" >>= withAttribute RegionMarkerTok) >>~ pushContext ("C++","Region Marker")) <|>- ((pFirstNonSpace >> pString False "//END" >>= withAttribute RegionMarkerTok) >>~ pushContext "Region Marker")+ ((pFirstNonSpace >> pString False "//END" >>= withAttribute RegionMarkerTok) >>~ pushContext ("C++","Region Marker")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|>@@ -105,7 +102,7 @@ <|> ((pHlCChar >>= withAttribute CharTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("C++","String")) <|> ((pDetectIdentifier >>= withAttribute NormalTok)) <|>@@ -133,9 +130,9 @@ <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression)) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("C++","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("C++","Commentar 2")) <|> ((pDetectChar False '{' >>= withAttribute NormalTok)) <|>@@ -143,17 +140,17 @@ <|> ((pAnyChar ":!%&()+,-/.*<=>?[]{|}~^;" >>= withAttribute NormalTok))) -parseRules "String" =+parseRules ("C++","String") = (((pLineContinue >>= withAttribute StringTok)) <|> ((pHlCStringChar >>= withAttribute CharTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Region Marker" =+parseRules ("C++","Region Marker") = pzero -parseRules "Commentar 1" =+parseRules ("C++","Commentar 1") = (((pLineContinue >>= withAttribute CommentTok)) <|> ((pDetectSpaces >>= withAttribute CommentTok))@@ -162,7 +159,7 @@ <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "Commentar 2" =+parseRules ("C++","Commentar 2") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))@@ -171,18 +168,18 @@ <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "AfterHash" =- (((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'28'3f'3adef'7cndef'29'3f'28'3f'3d'5cs'2b'5cS'29 >>= withAttribute OtherTok) >>~ pushContext "Preprocessor")+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")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute OtherTok) >>~ pushContext "Preprocessor")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute OtherTok) >>~ pushContext ("C++","Preprocessor")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2adefine'2e'2a'28'28'3f'3d'5c'5c'29'29 >>= withAttribute OtherTok) >>~ pushContext "Define")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2adefine'2e'2a'28'28'3f'3d'5c'5c'29'29 >>= withAttribute OtherTok) >>~ pushContext ("C++","Define")) <|>- ((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 "Preprocessor")+ ((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 "Preprocessor"))+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2b'5b0'2d9'5d'2b >>= withAttribute OtherTok) >>~ pushContext ("C++","Preprocessor"))) -parseRules "Preprocessor" =+parseRules ("C++","Preprocessor") = (((pLineContinue >>= withAttribute OtherTok)) <|> ((pRangeDetect '"' '"' >>= withAttribute OtherTok))@@ -191,21 +188,21 @@ <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression >>= ((withAttribute OtherTok) . snd))) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar/Preprocessor")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("C++","Commentar/Preprocessor")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1"))+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("C++","Commentar 1"))) -parseRules "Define" =+parseRules ("C++","Define") = ((pLineContinue >>= withAttribute OtherTok)) -parseRules "Commentar/Preprocessor" =+parseRules ("C++","Commentar/Preprocessor") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "Outscoped" =+parseRules ("C++","Outscoped") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))@@ -214,35 +211,36 @@ <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression >>= ((withAttribute CommentTok) . snd))) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("C++","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("C++","Commentar 2")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext "Outscoped intern")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext ("C++","Outscoped intern")) <|> ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2ael'28'3f'3ase'7cif'29 >>= withAttribute OtherTok) >>~ (popContext)) <|> ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute OtherTok) >>~ (popContext))) -parseRules "Outscoped intern" =+parseRules ("C++","Outscoped intern") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetectIdentifier >>= withAttribute CommentTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("C++","String")) <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression >>= ((withAttribute CommentTok) . snd))) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("C++","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("C++","Commentar 2")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext "Outscoped intern")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext ("C++","Outscoped intern")) <|> ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "" = parseRules "Normal"+parseRules ("Doxygen", _) = Text.Highlighting.Kate.Syntax.Doxygen.parseExpression+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Cs.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Doxygen import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,31 +26,33 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "C#" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("C#",["Normal"])], synStLanguage = "C#", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("C#","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "String" -> (popContext) >> pEndLine- "Member" -> (popContext) >> pEndLine- "Commentar 1" -> (popContext) >> pEndLine- "Commentar 2" -> return ()+ ("C#","Normal") -> return ()+ ("C#","String") -> (popContext) >> pEndLine+ ("C#","Member") -> (popContext) >> pEndLine+ ("C#","Commentar 1") -> (popContext) >> pEndLine+ ("C#","Commentar 2") -> return () _ -> return () withAttribute attr txt = do@@ -60,10 +61,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "abstract as base break case catch class checked continue default delegate do else enum event explicit extern false for foreach finally fixed goto if implicit in interface internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw true try typeof unchecked unsafe using virtual while #if #else #elif #endif #define #undef #warning #error #line" list_types = Set.fromList $ words $ "bool byte char const decimal double float int long object uint ushort ulong sbyte short string void" @@ -78,9 +75,9 @@ regex_'5b'2e'5d'7b1'2c1'7d = compileRegex "[.]{1,1}" regex_'5cb'5b'5f'5cw'5d'5b'5f'5cw'5cd'5d'2a'28'3f'3d'5b'5cs'5d'2a'29 = compileRegex "\\b[_\\w][_\\w\\d]*(?=[\\s]*)" -defaultAttributes = [("Normal",NormalTok),("String",StringTok),("Member",NormalTok),("Commentar 1",CommentTok),("Commentar 2",CommentTok)]+defaultAttributes = [(("C#","Normal"),NormalTok),(("C#","String"),StringTok),(("C#","Member"),NormalTok),(("C#","Commentar 1"),CommentTok),(("C#","Commentar 2"),CommentTok)] -parseRules "Normal" =+parseRules ("C#","Normal") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_types >>= withAttribute DataTypeTok))@@ -109,13 +106,13 @@ <|> ((pHlCChar >>= withAttribute CharTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("C#","String")) <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression)) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("C#","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("C#","Commentar 2")) <|> ((pDetectChar False '{' >>= withAttribute NormalTok)) <|>@@ -137,28 +134,28 @@ <|> ((pRegExpr regex_'5cb'5b'5f'5cw'5d'5b'5f'5cw'5cd'5d'2a'28'3f'3d'5b'5cs'5d'2a'5b'28'5d'29 >>= withAttribute FunctionTok)) <|>- ((pRegExpr regex_'5b'2e'5d'7b1'2c1'7d >>= withAttribute NormalTok) >>~ pushContext "Member")+ ((pRegExpr regex_'5b'2e'5d'7b1'2c1'7d >>= withAttribute NormalTok) >>~ pushContext ("C#","Member")) <|> ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))) -parseRules "String" =+parseRules ("C#","String") = (((pLineContinue >>= withAttribute StringTok) >>~ (popContext)) <|> ((pHlCStringChar >>= withAttribute CharTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Member" =+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)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "Commentar 1" =+parseRules ("C#","Commentar 1") = pzero -parseRules "Commentar 2" =+parseRules ("C#","Commentar 2") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "" = parseRules "Normal"+parseRules ("Doxygen", _) = Text.Highlighting.Kate.Syntax.Doxygen.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Css.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,45 +26,47 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "CSS" }- context <- currentContext <|> (pushContext "Base" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("CSS",["Base"])], synStLanguage = "CSS", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("CSS","Base")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Base" -> return ()- "FindRuleSets" -> return ()- "FindValues" -> return ()- "FindStrings" -> return ()- "FindComments" -> return ()- "Media" -> return ()- "Media2" -> return ()- "SelAttr" -> return ()- "SelPseudo" -> (popContext) >> pEndLine- "Import" -> return ()- "Comment" -> return ()- "RuleSet" -> return ()- "Rule" -> return ()- "Rule2" -> return ()- "PropParen" -> return ()- "PropParen2" -> return ()- "StringDQ" -> return ()- "StringSQ" -> return ()- "InsideString" -> return ()+ ("CSS","Base") -> return ()+ ("CSS","FindRuleSets") -> return ()+ ("CSS","FindValues") -> return ()+ ("CSS","FindStrings") -> return ()+ ("CSS","FindComments") -> return ()+ ("CSS","Media") -> return ()+ ("CSS","Media2") -> return ()+ ("CSS","SelAttr") -> return ()+ ("CSS","SelPseudo") -> (popContext) >> pEndLine+ ("CSS","Import") -> return ()+ ("CSS","Comment") -> return ()+ ("CSS","RuleSet") -> return ()+ ("CSS","Rule") -> return ()+ ("CSS","Rule2") -> return ()+ ("CSS","PropParen") -> return ()+ ("CSS","PropParen2") -> return ()+ ("CSS","StringDQ") -> return ()+ ("CSS","StringSQ") -> return ()+ ("CSS","InsideString") -> return () _ -> return () withAttribute attr txt = do@@ -74,10 +75,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_properties = Set.fromList $ words $ "azimuth background background-attachment background-color background-image background-position background-repeat border border-bottom border-bottom-color border-bottom-style border-bottom-width border-collapse border-color border-left border-left-color border-left-style border-left-width border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-style border-top-width border-width bottom caption-side clear clip color content counter-increment counter-reset cue cue-after cue-before cursor direction display elevation empty-cells float font font-family font-size font-size-adjust font-stretch font-style font-variant font-weight height left letter-spacing line-height list-style list-style-image list-style-keyword list-style-position list-style-type margin margin-bottom margin-left margin-right margin-top marker-offset max-height max-width min-height min-width orphans outline outline-color outline-style outline-width overflow padding padding-bottom padding-left padding-right padding-top page page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position quotes richness right size speak speak-header speak-numeral speak-punctuation speech-rate stress table-layout text-align text-decoration text-decoration-color text-indent text-shadow text-transform top unicode-bidi vertical-align visibility voice-family volume white-space widows width word-spacing z-index border-bottom-image border-bottom-left-image border-bottom-left-radius border-bottom-right-image border-bottom-right-radius border-corner-image border-image border-left-image border-radius border-right-image border-top-image border-top-left-image border-top-left-radius border-top-right-image border-top-right-radius box-shadow box-sizing opacity outline-offset overflow-x overflow-y text-overflow text-shadow -moz-border-bottom-colors -moz-border-left-colors -moz-border-radius -moz-border-right-colors -moz-border-top-colors -moz-box-flex -o-background-size -o-text-overflow -khtml-background-size konq_bgpos_x konq_bgpos_y -webkit-background-size font-family font-size font-stretch font-style font-variant font-weight unicode-range units-per-em src panose-1 stemv stemh slope cap-height x-height ascent descent widths bbox definition-src baseline centerline mathline topline" list_types = Set.fromList $ words $ "inherit none hidden dotted dashed solid double groove ridge inset outset xx-small x-small small medium large x-large xx-large smaller larger italic oblique small-caps normal bold bolder lighter light 100 200 300 400 500 600 700 800 900 transparent repeat repeat-x repeat-y no-repeat baseline sub super top text-top middle bottom text-bottom left right center justify konq-center disc circle square box decimal decimal-leading-zero lower-roman upper-roman lower-greek lower-alpha lower-latin upper-alpha upper-latin hebrew armenian georgian cjk-ideographic hiragana katakana hiragana-iroha katakana-iroha inline inline-block block list-item run-in compact marker table inline-table table-row-group table-header-group table-footer-group table-row table-column-group table-column table-cell table-caption auto crosshair default pointer move e-resize ne-resize nw-resize n-resize se-resize sw-resize s-resize w-resize text wait help above absolute always avoid below bidi-override blink both capitalize caption clip close-quote collapse condensed crop cross ellipsis ellipsis-word embed expanded extra-condensed extra-expanded fixed hand hide higher icon inside invert landscape level line-through loud lower lowercase ltr menu message-box mix narrower no-close-quote no-open-quote nowrap open-quote outside overline portrait pre pre-line pre-wrap relative rtl scroll semi-condensed semi-expanded separate show small-caption static static-position status-bar thick thin ultra-condensed ultra-expanded underline uppercase visible wider break serif sans-serif cursive fantasy monospace border-box content-box -moz-box" list_colors = Set.fromList $ words $ "aqua black blue cyan fuchsia gray green lime maroon navy olive purple red silver teal white yellow activeborder activecaption appworkspace background buttonface buttonhighlight buttonshadow buttontext captiontext graytext highlight highlighttext inactiveborder inactivecaption inactivecaptiontext infobackground infotext menu menutext scrollbar threeddarkshadow threedface threedhighlight threedlightshadow threedshadow window windowframe windowtext"@@ -103,25 +100,25 @@ regex_'21important'5cb = compileRegex "!important\\b" regex_'5c'5c'5b'22'27'5d = compileRegex "\\\\[\"']" -defaultAttributes = [("Base",NormalTok),("FindRuleSets",NormalTok),("FindValues",NormalTok),("FindStrings",NormalTok),("FindComments",NormalTok),("Media",NormalTok),("Media2",NormalTok),("SelAttr",CharTok),("SelPseudo",DecValTok),("Import",NormalTok),("Comment",CommentTok),("RuleSet",NormalTok),("Rule",NormalTok),("Rule2",NormalTok),("PropParen",NormalTok),("PropParen2",NormalTok),("StringDQ",StringTok),("StringSQ",StringTok),("InsideString",StringTok)]+defaultAttributes = [(("CSS","Base"),NormalTok),(("CSS","FindRuleSets"),NormalTok),(("CSS","FindValues"),NormalTok),(("CSS","FindStrings"),NormalTok),(("CSS","FindComments"),NormalTok),(("CSS","Media"),NormalTok),(("CSS","Media2"),NormalTok),(("CSS","SelAttr"),CharTok),(("CSS","SelPseudo"),DecValTok),(("CSS","Import"),NormalTok),(("CSS","Comment"),CommentTok),(("CSS","RuleSet"),NormalTok),(("CSS","Rule"),NormalTok),(("CSS","Rule2"),NormalTok),(("CSS","PropParen"),NormalTok),(("CSS","PropParen2"),NormalTok),(("CSS","StringDQ"),StringTok),(("CSS","StringSQ"),StringTok),(("CSS","InsideString"),StringTok)] -parseRules "Base" =+parseRules ("CSS","Base") = (((pLineContinue >>= withAttribute NormalTok)) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((parseRules "FindRuleSets")))+ ((parseRules ("CSS","FindRuleSets")))) -parseRules "FindRuleSets" =- (((pRegExpr regex_'40media'5cb >>= withAttribute DecValTok) >>~ pushContext "Media")+parseRules ("CSS","FindRuleSets") =+ (((pRegExpr regex_'40media'5cb >>= withAttribute DecValTok) >>~ pushContext ("CSS","Media")) <|>- ((pRegExpr regex_'40import'5cb >>= withAttribute DecValTok) >>~ pushContext "Import")+ ((pRegExpr regex_'40import'5cb >>= withAttribute DecValTok) >>~ pushContext ("CSS","Import")) <|> ((pRegExpr regex_'40'28font'2dface'7ccharset'29'5cb >>= withAttribute DecValTok)) <|>- ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext "RuleSet")+ ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext ("CSS","RuleSet")) <|>- ((pDetectChar False '[' >>= withAttribute CharTok) >>~ pushContext "SelAttr")+ ((pDetectChar False '[' >>= withAttribute CharTok) >>~ pushContext ("CSS","SelAttr")) <|> ((pRegExpr regex_'23'28'5ba'2dzA'2dZ0'2d9'5c'2d'5f'5d'7c'5b'5cx80'2d'5cxFF'5d'7c'5c'5c'5b0'2d9A'2dFa'2df'5d'7b1'2c6'7d'29'2a >>= withAttribute FloatTok)) <|>@@ -129,69 +126,69 @@ <|> ((pRegExpr regex_'3alang'5c'28'5b'5cw'5f'2d'5d'2b'5c'29 >>= withAttribute DecValTok)) <|>- ((pDetectChar False ':' >>= withAttribute DecValTok) >>~ pushContext "SelPseudo")+ ((pDetectChar False ':' >>= withAttribute DecValTok) >>~ pushContext ("CSS","SelPseudo")) <|>- ((parseRules "FindStrings"))+ ((parseRules ("CSS","FindStrings"))) <|>- ((parseRules "FindComments")))+ ((parseRules ("CSS","FindComments")))) -parseRules "FindValues" =+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))) -parseRules "FindStrings" =- (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "StringDQ")+parseRules ("CSS","FindStrings") =+ (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("CSS","StringDQ")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "StringSQ"))+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("CSS","StringSQ"))) -parseRules "FindComments" =+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 "Comment"))+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("CSS","Comment"))) -parseRules "Media" =- (((pDetectChar False '{' >>= withAttribute DecValTok) >>~ pushContext "Media2")+parseRules ("CSS","Media") =+ (((pDetectChar False '{' >>= withAttribute DecValTok) >>~ pushContext ("CSS","Media2")) <|> ((pKeyword " \n\t.():!+,<=>&*/;?[]^{|}~\\" list_mediatypes >>= withAttribute DecValTok)) <|> ((pDetectChar False ',' >>= withAttribute DecValTok)) <|>- ((parseRules "FindComments"))+ ((parseRules ("CSS","FindComments"))) <|> ((pRegExpr regex_'5cS'2b >>= withAttribute ErrorTok))) -parseRules "Media2" =+parseRules ("CSS","Media2") = (((pDetectChar False '}' >>= withAttribute DecValTok) >>~ (popContext >> popContext)) <|>- ((parseRules "FindRuleSets")))+ ((parseRules ("CSS","FindRuleSets")))) -parseRules "SelAttr" =+parseRules ("CSS","SelAttr") = (((pDetectChar False ']' >>= withAttribute CharTok) >>~ (popContext)) <|>- ((parseRules "FindStrings")))+ ((parseRules ("CSS","FindStrings")))) -parseRules "SelPseudo" =+parseRules ("CSS","SelPseudo") = (((pKeyword " \n\t.():!+,<=>&*/;?[]^{|}~\\" list_pseudoclasses >>= withAttribute DecValTok) >>~ (popContext)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "Import" =+parseRules ("CSS","Import") = (((pDetectChar False ';' >>= withAttribute DecValTok) >>~ (popContext)) <|> ((pKeyword " \n\t.():!+,<=>&*/;?[]^{|}~\\" list_mediatypes >>= withAttribute DecValTok)) <|>- ((parseRules "FindValues"))+ ((parseRules ("CSS","FindValues"))) <|>- ((parseRules "FindStrings"))+ ((parseRules ("CSS","FindStrings"))) <|>- ((parseRules "FindComments")))+ ((parseRules ("CSS","FindComments")))) -parseRules "Comment" =+parseRules ("CSS","Comment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))@@ -200,23 +197,23 @@ <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "RuleSet" =+parseRules ("CSS","RuleSet") = (((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pKeyword " \n\t.():!+,<=>&*/;?[]^{|}~\\" list_properties >>= withAttribute KeywordTok) >>~ pushContext "Rule")+ ((pKeyword " \n\t.():!+,<=>&*/;?[]^{|}~\\" list_properties >>= withAttribute KeywordTok) >>~ pushContext ("CSS","Rule")) <|>- ((pRegExpr regex_'2d'3f'5bA'2dZa'2dz'5f'2d'5d'2b'28'3f'3d'5cs'2a'3a'29 >>= withAttribute KeywordTok) >>~ pushContext "Rule")+ ((pRegExpr regex_'2d'3f'5bA'2dZa'2dz'5f'2d'5d'2b'28'3f'3d'5cs'2a'3a'29 >>= withAttribute KeywordTok) >>~ pushContext ("CSS","Rule")) <|>- ((parseRules "FindComments"))+ ((parseRules ("CSS","FindComments"))) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "Rule" =- (((pDetectChar False ':' >>= withAttribute KeywordTok) >>~ pushContext "Rule2")+parseRules ("CSS","Rule") =+ (((pDetectChar False ':' >>= withAttribute KeywordTok) >>~ pushContext ("CSS","Rule2")) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "Rule2" =+parseRules ("CSS","Rule2") = (((pDetectChar False ';' >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|> ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))@@ -227,47 +224,47 @@ <|> ((pRegExpr regex_'23'28'5b0'2d9A'2dFa'2df'5d'7b3'7d'29'7b1'2c4'7d'5cb >>= withAttribute DataTypeTok)) <|>- ((pKeyword " \n\t.():!+,<=>&*/;?[]^{|}~\\" list_paren >>= withAttribute DataTypeTok) >>~ pushContext "PropParen")+ ((pKeyword " \n\t.():!+,<=>&*/;?[]^{|}~\\" list_paren >>= withAttribute DataTypeTok) >>~ pushContext ("CSS","PropParen")) <|> ((pRegExpr regex_'21important'5cb >>= withAttribute KeywordTok)) <|>- ((parseRules "FindValues"))+ ((parseRules ("CSS","FindValues"))) <|>- ((parseRules "FindStrings"))+ ((parseRules ("CSS","FindStrings"))) <|>- ((parseRules "FindComments")))+ ((parseRules ("CSS","FindComments")))) -parseRules "PropParen" =- (((pDetectChar False '(' >>= withAttribute DataTypeTok) >>~ pushContext "PropParen2")+parseRules ("CSS","PropParen") =+ (((pDetectChar False '(' >>= withAttribute DataTypeTok) >>~ pushContext ("CSS","PropParen2")) <|>- ((parseRules "FindComments"))+ ((parseRules ("CSS","FindComments"))) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "PropParen2" =+parseRules ("CSS","PropParen2") = (((pDetectChar False ')' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext)) <|>- ((parseRules "FindValues"))+ ((parseRules ("CSS","FindValues"))) <|>- ((parseRules "FindStrings"))+ ((parseRules ("CSS","FindStrings"))) <|>- ((parseRules "FindComments")))+ ((parseRules ("CSS","FindComments")))) -parseRules "StringDQ" =+parseRules ("CSS","StringDQ") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "InsideString")))+ ((parseRules ("CSS","InsideString")))) -parseRules "StringSQ" =+parseRules ("CSS","StringSQ") = (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "InsideString")))+ ((parseRules ("CSS","InsideString")))) -parseRules "InsideString" =+parseRules ("CSS","InsideString") = (((pRegExpr regex_'5c'5c'5b'22'27'5d >>= withAttribute StringTok)) <|> ((pDetectIdentifier >>= withAttribute StringTok))) -parseRules "" = parseRules "Base"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/D.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,65 +26,67 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "D" }- context <- currentContext <|> (pushContext "normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("D",["normal"])], synStLanguage = "D", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("D","normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "normal" -> return ()- "StartingLetter" -> (popContext) >> pEndLine- "Properties" -> return ()- "NumberLiteral" -> return ()- "LinePragma" -> (popContext) >> pEndLine- "UnicodeShort" -> (popContext) >> pEndLine- "UnicodeLong" -> (popContext) >> pEndLine- "HTMLEntity" -> (popContext) >> pEndLine- "ModuleName" -> return ()- "Linkage" -> return ()- "Linkage2" -> return ()- "Version" -> return ()- "Version2" -> return ()- "Scope" -> return ()- "Scope2" -> return ()- "Pragma" -> return ()- "Pragma2" -> return ()- "RawString" -> return ()- "BQString" -> return ()- "HexString" -> return ()- "CharLiteral" -> pushContext "CharLiteralClosing" >> return ()- "CharLiteralClosing" -> (popContext >> popContext) >> pEndLine- "String" -> return ()- "CommentRules" -> (popContext) >> pEndLine- "Region Marker" -> (popContext) >> pEndLine- "CommentLine" -> (popContext) >> pEndLine- "CommentBlock" -> return ()- "CommentNested" -> return ()- "DdocNormal" -> return ()- "DdocLine" -> (popContext) >> pEndLine- "DdocBlock" -> return ()- "DdocNested" -> return ()- "DdocNested2" -> return ()- "DdocMacro" -> return ()- "DdocMacro2" -> return ()- "DdocMacro3" -> return ()- "MacroRules" -> return ()- "DdocBlockCode" -> return ()- "DdocNestedCode" -> return ()+ ("D","normal") -> return ()+ ("D","StartingLetter") -> (popContext) >> pEndLine+ ("D","Properties") -> return ()+ ("D","NumberLiteral") -> return ()+ ("D","LinePragma") -> (popContext) >> pEndLine+ ("D","UnicodeShort") -> (popContext) >> pEndLine+ ("D","UnicodeLong") -> (popContext) >> pEndLine+ ("D","HTMLEntity") -> (popContext) >> pEndLine+ ("D","ModuleName") -> return ()+ ("D","Linkage") -> return ()+ ("D","Linkage2") -> return ()+ ("D","Version") -> return ()+ ("D","Version2") -> return ()+ ("D","Scope") -> return ()+ ("D","Scope2") -> return ()+ ("D","Pragma") -> return ()+ ("D","Pragma2") -> return ()+ ("D","RawString") -> return ()+ ("D","BQString") -> return ()+ ("D","HexString") -> return ()+ ("D","CharLiteral") -> pushContext ("D","CharLiteralClosing") >> return ()+ ("D","CharLiteralClosing") -> (popContext >> popContext) >> pEndLine+ ("D","String") -> return ()+ ("D","CommentRules") -> (popContext) >> pEndLine+ ("D","Region Marker") -> (popContext) >> pEndLine+ ("D","CommentLine") -> (popContext) >> pEndLine+ ("D","CommentBlock") -> return ()+ ("D","CommentNested") -> return ()+ ("D","DdocNormal") -> return ()+ ("D","DdocLine") -> (popContext) >> pEndLine+ ("D","DdocBlock") -> return ()+ ("D","DdocNested") -> return ()+ ("D","DdocNested2") -> return ()+ ("D","DdocMacro") -> return ()+ ("D","DdocMacro2") -> return ()+ ("D","DdocMacro3") -> return ()+ ("D","MacroRules") -> return ()+ ("D","DdocBlockCode") -> return ()+ ("D","DdocNestedCode") -> return () _ -> return () withAttribute attr txt = do@@ -94,10 +95,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_userkeywords = Set.fromList $ words $ "" list_statements = Set.fromList $ words $ "asm body break case catch continue default do else finally for foreach foreach_reverse goto if mixin return switch throw try while with synchronized" list_attributes = Set.fromList $ words $ "abstract align auto const export final immutable inout invariant lazy nothrow override package private protected public pure ref static out scope"@@ -157,32 +154,32 @@ regex_'2d'7b3'2c'7d'28'24'7c'5cs'29 = compileRegex "-{3,}($|\\s)" regex_'5c'2b'2b'2f = compileRegex "\\++/" -defaultAttributes = [("normal",NormalTok),("StartingLetter",NormalTok),("Properties",NormalTok),("NumberLiteral",NormalTok),("LinePragma",KeywordTok),("UnicodeShort",StringTok),("UnicodeLong",StringTok),("HTMLEntity",StringTok),("ModuleName",NormalTok),("Linkage",NormalTok),("Linkage2",NormalTok),("Version",NormalTok),("Version2",NormalTok),("Scope",NormalTok),("Scope2",NormalTok),("Pragma",KeywordTok),("Pragma2",KeywordTok),("RawString",StringTok),("BQString",StringTok),("HexString",StringTok),("CharLiteral",CharTok),("CharLiteralClosing",ErrorTok),("String",StringTok),("CommentRules",NormalTok),("Region Marker",RegionMarkerTok),("CommentLine",CommentTok),("CommentBlock",CommentTok),("CommentNested",CommentTok),("DdocNormal",NormalTok),("DdocLine",CommentTok),("DdocBlock",CommentTok),("DdocNested",CommentTok),("DdocNested2",CommentTok),("DdocMacro",ErrorTok),("DdocMacro2",NormalTok),("DdocMacro3",NormalTok),("MacroRules",NormalTok),("DdocBlockCode",NormalTok),("DdocNestedCode",NormalTok)]+defaultAttributes = [(("D","normal"),NormalTok),(("D","StartingLetter"),NormalTok),(("D","Properties"),NormalTok),(("D","NumberLiteral"),NormalTok),(("D","LinePragma"),KeywordTok),(("D","UnicodeShort"),StringTok),(("D","UnicodeLong"),StringTok),(("D","HTMLEntity"),StringTok),(("D","ModuleName"),NormalTok),(("D","Linkage"),NormalTok),(("D","Linkage2"),NormalTok),(("D","Version"),NormalTok),(("D","Version2"),NormalTok),(("D","Scope"),NormalTok),(("D","Scope2"),NormalTok),(("D","Pragma"),KeywordTok),(("D","Pragma2"),KeywordTok),(("D","RawString"),StringTok),(("D","BQString"),StringTok),(("D","HexString"),StringTok),(("D","CharLiteral"),CharTok),(("D","CharLiteralClosing"),ErrorTok),(("D","String"),StringTok),(("D","CommentRules"),NormalTok),(("D","Region Marker"),RegionMarkerTok),(("D","CommentLine"),CommentTok),(("D","CommentBlock"),CommentTok),(("D","CommentNested"),CommentTok),(("D","DdocNormal"),NormalTok),(("D","DdocLine"),CommentTok),(("D","DdocBlock"),CommentTok),(("D","DdocNested"),CommentTok),(("D","DdocNested2"),CommentTok),(("D","DdocMacro"),ErrorTok),(("D","DdocMacro2"),NormalTok),(("D","DdocMacro3"),NormalTok),(("D","MacroRules"),NormalTok),(("D","DdocBlockCode"),NormalTok),(("D","DdocNestedCode"),NormalTok)] -parseRules "normal" =+parseRules ("D","normal") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((lookAhead (pRegExpr regex_'5ba'2dzA'2dZ'5f'5d) >> pushContext "StartingLetter" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'5ba'2dzA'2dZ'5f'5d) >> pushContext ("D","StartingLetter") >> currentContext >>= parseRules)) <|> ((pHlCStringChar >>= withAttribute StringTok)) <|>- ((pDetect2Chars False '\\' 'u' >>= withAttribute StringTok) >>~ pushContext "UnicodeShort")+ ((pDetect2Chars False '\\' 'u' >>= withAttribute StringTok) >>~ pushContext ("D","UnicodeShort")) <|>- ((pDetect2Chars False '\\' 'U' >>= withAttribute StringTok) >>~ pushContext "UnicodeLong")+ ((pDetect2Chars False '\\' 'U' >>= withAttribute StringTok) >>~ pushContext ("D","UnicodeLong")) <|>- ((pDetect2Chars False '\\' '&' >>= withAttribute StringTok) >>~ pushContext "HTMLEntity")+ ((pDetect2Chars False '\\' '&' >>= withAttribute StringTok) >>~ pushContext ("D","HTMLEntity")) <|>- ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ pushContext "CharLiteral")+ ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ pushContext ("D","CharLiteral")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("D","String")) <|>- ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext "BQString")+ ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext ("D","BQString")) <|>- ((pFirstNonSpace >> pString False "//BEGIN" >>= withAttribute RegionMarkerTok) >>~ pushContext "Region Marker")+ ((pFirstNonSpace >> pString False "//BEGIN" >>= withAttribute RegionMarkerTok) >>~ pushContext ("D","Region Marker")) <|>- ((pFirstNonSpace >> pString False "//END" >>= withAttribute RegionMarkerTok) >>~ pushContext "Region Marker")+ ((pFirstNonSpace >> pString False "//END" >>= withAttribute RegionMarkerTok) >>~ pushContext ("D","Region Marker")) <|>- ((parseRules "CommentRules"))+ ((parseRules ("D","CommentRules"))) <|> ((pString False "..." >>= withAttribute NormalTok)) <|>@@ -190,11 +187,11 @@ <|> ((pRegExpr regex_'5c'2e'5cd'5b'5cd'5f'5d'2a'28'5beE'5d'5b'2d'2b'5d'3f'5cd'5b'5cd'5f'5d'2a'29'3f'5bfFL'5d'3fi'3f >>= withAttribute FloatTok)) <|>- ((pDetectChar False '.' >>= withAttribute NormalTok) >>~ pushContext "Properties")+ ((pDetectChar False '.' >>= withAttribute NormalTok) >>~ pushContext ("D","Properties")) <|>- ((lookAhead (pRegExpr regex_'5cd) >> pushContext "NumberLiteral" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'5cd) >> pushContext ("D","NumberLiteral") >> currentContext >>= parseRules)) <|>- ((pString False "#line" >>= withAttribute KeywordTok) >>~ pushContext "LinePragma")+ ((pString False "#line" >>= withAttribute KeywordTok) >>~ pushContext ("D","LinePragma")) <|> ((pDetectChar False '{' >>= withAttribute NormalTok)) <|>@@ -202,7 +199,7 @@ <|> ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))) -parseRules "StartingLetter" =+parseRules ("D","StartingLetter") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((lookAhead (pRegExpr regex_'5b'5ea'2dzA'2dZ'5f'5d) >> (popContext) >> currentContext >>= parseRules))@@ -211,7 +208,7 @@ <|> ((pRegExpr regex_out'5cs'2a'28'3f'3d'28'5c'28'28'5ba'2dzA'2dZ'5f'5d'5b'5cw'5f'5d'2a'29'3f'5c'29'5cs'2a'29'3f'5c'7b'29 >>= withAttribute KeywordTok)) <|>- ((pRegExpr regex_scope'5cs'2a'28'3f'3d'5c'28'29 >>= withAttribute KeywordTok) >>~ pushContext "Scope")+ ((pRegExpr regex_scope'5cs'2a'28'3f'3d'5c'28'29 >>= withAttribute KeywordTok) >>~ pushContext ("D","Scope")) <|> ((pRegExpr regex_import'5cs'2a'28'3f'3d'5c'28'29 >>= withAttribute KeywordTok)) <|>@@ -229,38 +226,38 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_templates >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_modules >>= withAttribute KeywordTok) >>~ pushContext "ModuleName")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_modules >>= withAttribute KeywordTok) >>~ pushContext ("D","ModuleName")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_types >>= withAttribute DataTypeTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_libsymbols >>= withAttribute DataTypeTok)) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_linkage >>= withAttribute KeywordTok) >>~ pushContext "Linkage")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_linkage >>= withAttribute KeywordTok) >>~ pushContext ("D","Linkage")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_specialtokens >>= withAttribute NormalTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_tests >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_pragma >>= withAttribute KeywordTok) >>~ pushContext "Pragma")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_pragma >>= withAttribute KeywordTok) >>~ pushContext ("D","Pragma")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_version >>= withAttribute KeywordTok) >>~ pushContext "Version")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_version >>= withAttribute KeywordTok) >>~ pushContext ("D","Version")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_deprecated >>= withAttribute KeywordTok)) <|>- ((pDetect2Chars False 'r' '"' >>= withAttribute StringTok) >>~ pushContext "RawString")+ ((pDetect2Chars False 'r' '"' >>= withAttribute StringTok) >>~ pushContext ("D","RawString")) <|>- ((pDetect2Chars False 'x' '"' >>= withAttribute StringTok) >>~ pushContext "HexString")+ ((pDetect2Chars False 'x' '"' >>= withAttribute StringTok) >>~ pushContext ("D","HexString")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_userkeywords >>= withAttribute DataTypeTok)) <|> ((pDetectIdentifier >>= withAttribute NormalTok))) -parseRules "Properties" =+parseRules ("D","Properties") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_properties >>= withAttribute DataTypeTok) >>~ (popContext)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "NumberLiteral" =+parseRules ("D","NumberLiteral") = (((pRegExpr regex_0'5bxX'5d'5b'5cda'2dfA'2dF'5f'5d'2a'28'5c'2e'5b'5cda'2dfA'2dF'5f'5d'2a'29'3f'5bpP'5d'5b'2d'2b'5d'3f'5cd'5b'5cd'5f'5d'2a'5bfFL'5d'3fi'3f >>= withAttribute FloatTok) >>~ (popContext)) <|> ((pRegExpr regex_'5cd'5b'5f'5cd'5d'2a'28'5c'2e'28'3f'21'5c'2e'29'5b'5f'5cd'5d'2a'28'5beE'5d'5b'2d'2b'5d'3f'5cd'5b'5f'5cd'5d'2a'29'3f'5bfFL'5d'3fi'3f'7c'5beE'5d'5b'2d'2b'5d'3f'5cd'5b'5f'5cd'5d'2a'5bfFL'5d'3fi'3f'7c'5bfF'5di'3f'7c'5bfFL'5d'3fi'29 >>= withAttribute FloatTok) >>~ (popContext))@@ -275,7 +272,7 @@ <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "LinePragma" =+parseRules ("D","LinePragma") = (((pDetectSpaces >>= withAttribute KeywordTok)) <|> ((pRegExpr regex_'28'280'28'5b0'2d7'5f'5d'2b'7c'5bbB'5d'5f'2a'5b01'5d'5b01'5f'5d'2a'7c'5bxX'5d'5f'2a'5b'5cda'2dfA'2dF'5d'5b'5cda'2dfA'2dF'5f'5d'2a'29'29'7c'5cd'2b'5b'5cd'5f'5d'2a'29'28L'5buU'5d'3f'7c'5buU'5dL'3f'29'3f >>= withAttribute DecValTok))@@ -284,62 +281,62 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_specialtokens >>= withAttribute NormalTok)) <|>- ((parseRules "CommentRules"))+ ((parseRules ("D","CommentRules"))) <|> ((pRegExpr regex_'2e'2b >>= withAttribute ErrorTok) >>~ (popContext))) -parseRules "UnicodeShort" =+parseRules ("D","UnicodeShort") = ((pRegExpr regex_'5b'5cda'2dfA'2dF'5d'7b4'7d >>= withAttribute StringTok) >>~ (popContext)) -parseRules "UnicodeLong" =+parseRules ("D","UnicodeLong") = ((pRegExpr regex_'5b'5cda'2dfA'2dF'5d'7b8'7d >>= withAttribute StringTok) >>~ (popContext)) -parseRules "HTMLEntity" =+parseRules ("D","HTMLEntity") = (((pRegExpr regex_'5ba'2dzA'2dZ'5d'5cw'2b'3b >>= withAttribute StringTok) >>~ (popContext)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "ModuleName" =+parseRules ("D","ModuleName") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((parseRules "CommentRules"))+ ((parseRules ("D","CommentRules"))) <|> ((lookAhead (pRegExpr regex_'5b'5e'5cs'5cw'2e'3a'2c'3d'5d) >> (popContext) >> currentContext >>= parseRules))) -parseRules "Linkage" =+parseRules ("D","Linkage") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Linkage2")+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("D","Linkage2")) <|>- ((parseRules "CommentRules"))+ ((parseRules ("D","CommentRules"))) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "Linkage2" =+parseRules ("D","Linkage2") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pString False "C++" >>= withAttribute NormalTok) >>~ (popContext >> popContext)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_ltypes >>= withAttribute NormalTok) >>~ (popContext >> popContext)) <|>- ((parseRules "CommentRules"))+ ((parseRules ("D","CommentRules"))) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext >> popContext)) <|> ((pRegExpr regex_'5b'5e'29'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext >> popContext))) -parseRules "Version" =+parseRules ("D","Version") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '=' >>= withAttribute NormalTok) >>~ pushContext "Version2")+ ((pDetectChar False '=' >>= withAttribute NormalTok) >>~ pushContext ("D","Version2")) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Version2")+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("D","Version2")) <|>- ((parseRules "CommentRules"))+ ((parseRules ("D","CommentRules"))) <|> ((pRegExpr regex_'5b'5e'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext))) -parseRules "Version2" =+parseRules ("D","Version2") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_vtypes >>= withAttribute NormalTok) >>~ (popContext >> popContext))@@ -348,84 +345,84 @@ <|> ((pRegExpr regex_'5cd'2b'5b'5cd'5f'5d'2a'28L'5buU'5d'3f'7c'5buU'5dL'3f'29'3f >>= withAttribute DecValTok) >>~ (popContext >> popContext)) <|>- ((parseRules "CommentRules"))+ ((parseRules ("D","CommentRules"))) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext >> popContext)) <|> ((pRegExpr regex_'5b'5e'29'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext >> popContext))) -parseRules "Scope" =+parseRules ("D","Scope") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Scope2")+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("D","Scope2")) <|>- ((parseRules "CommentRules"))+ ((parseRules ("D","CommentRules"))) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "Scope2" =+parseRules ("D","Scope2") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_scope'5fkeywords >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((parseRules "CommentRules"))+ ((parseRules ("D","CommentRules"))) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext >> popContext)) <|> ((pRegExpr regex_'5b'5e'29'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext >> popContext))) -parseRules "Pragma" =+parseRules ("D","Pragma") = (((pDetectSpaces >>= withAttribute KeywordTok)) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Pragma2")+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("D","Pragma2")) <|>- ((parseRules "CommentRules"))+ ((parseRules ("D","CommentRules"))) <|> ((pRegExpr regex_'5b'5e'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext))) -parseRules "Pragma2" =+parseRules ("D","Pragma2") = (((pDetectSpaces >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_ptypes >>= withAttribute NormalTok) >>~ (popContext >> popContext)) <|> ((pDetectIdentifier >>= withAttribute NormalTok) >>~ (popContext >> popContext)) <|>- ((parseRules "CommentRules"))+ ((parseRules ("D","CommentRules"))) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext >> popContext)) <|> ((pRegExpr regex_'5b'5e'29'5cs'5cn'5d'2b >>= withAttribute ErrorTok) >>~ (popContext >> popContext))) -parseRules "RawString" =+parseRules ("D","RawString") = ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) -parseRules "BQString" =+parseRules ("D","BQString") = ((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext)) -parseRules "HexString" =+parseRules ("D","HexString") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) <|> ((pRegExpr regex_'5b'5e'5csa'2dfA'2dF'5cd'22'5d'2b >>= withAttribute ErrorTok))) -parseRules "CharLiteral" =+parseRules ("D","CharLiteral") = (((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext)) <|>- ((pHlCStringChar >>= withAttribute StringTok) >>~ pushContext "CharLiteralClosing")+ ((pHlCStringChar >>= withAttribute StringTok) >>~ pushContext ("D","CharLiteralClosing")) <|>- ((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) >>~ pushContext "CharLiteralClosing")+ ((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) >>~ pushContext ("D","CharLiteralClosing")) <|>- ((pRegExpr regex_'5c'5c'2e >>= withAttribute ErrorTok) >>~ pushContext "CharLiteralClosing")+ ((pRegExpr regex_'5c'5c'2e >>= withAttribute ErrorTok) >>~ pushContext ("D","CharLiteralClosing")) <|>- ((pRegExpr regex_'2e >>= withAttribute CharTok) >>~ pushContext "CharLiteralClosing")+ ((pRegExpr regex_'2e >>= withAttribute CharTok) >>~ pushContext ("D","CharLiteralClosing")) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "CharLiteralClosing" =+parseRules ("D","CharLiteralClosing") = (((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext >> popContext)) <|> ((popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "String" =+parseRules ("D","String") = (((pHlCStringChar >>= withAttribute StringTok)) <|> ((pDetect2Chars False '"' 'c' >>= withAttribute StringTok) >>~ (popContext))@@ -436,64 +433,64 @@ <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((pDetect2Chars False '\\' 'u' >>= withAttribute StringTok) >>~ pushContext "UnicodeShort")+ ((pDetect2Chars False '\\' 'u' >>= withAttribute StringTok) >>~ pushContext ("D","UnicodeShort")) <|>- ((pDetect2Chars False '\\' 'U' >>= withAttribute StringTok) >>~ pushContext "UnicodeLong")+ ((pDetect2Chars False '\\' 'U' >>= withAttribute StringTok) >>~ pushContext ("D","UnicodeLong")) <|>- ((pDetect2Chars False '\\' '&' >>= withAttribute StringTok) >>~ pushContext "HTMLEntity"))+ ((pDetect2Chars False '\\' '&' >>= withAttribute StringTok) >>~ pushContext ("D","HTMLEntity"))) -parseRules "CommentRules" =- (((parseRules "DdocNormal"))+parseRules ("D","CommentRules") =+ (((parseRules ("D","DdocNormal"))) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "CommentLine")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("D","CommentLine")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "CommentBlock")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("D","CommentBlock")) <|>- ((pDetect2Chars False '/' '+' >>= withAttribute CommentTok) >>~ pushContext "CommentNested"))+ ((pDetect2Chars False '/' '+' >>= withAttribute CommentTok) >>~ pushContext ("D","CommentNested"))) -parseRules "Region Marker" =+parseRules ("D","Region Marker") = pzero -parseRules "CommentLine" =+parseRules ("D","CommentLine") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "CommentBlock" =+parseRules ("D","CommentBlock") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "CommentNested" =+parseRules ("D","CommentNested") = (((pDetectSpaces >>= withAttribute CommentTok)) <|>- ((pDetect2Chars False '/' '+' >>= withAttribute CommentTok) >>~ pushContext "CommentNested")+ ((pDetect2Chars False '/' '+' >>= withAttribute CommentTok) >>~ pushContext ("D","CommentNested")) <|> ((pDetect2Chars False '+' '/' >>= withAttribute CommentTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "DdocNormal" =- (((pRegExpr regex_'2f'7b3'2c'7d >>= withAttribute CommentTok) >>~ pushContext "DdocLine")+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 "DdocBlock")+ ((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 "DdocNested"))+ ((pRegExpr regex_'2f'5c'2b'7b2'2c'7d'28'3f'21'2f'29 >>= withAttribute CommentTok) >>~ pushContext ("D","DdocNested"))) -parseRules "DdocLine" =+parseRules ("D","DdocLine") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pDetectIdentifier >>= withAttribute CommentTok)) <|>- ((pDetect2Chars False '$' '(' >>= withAttribute OtherTok) >>~ pushContext "DdocMacro")+ ((pDetect2Chars False '$' '(' >>= withAttribute OtherTok) >>~ pushContext ("D","DdocMacro")) <|> ((pRegExpr regex_'5b'5cw'5f'5d'2b'3a'28'24'7c'5cs'29 >>= withAttribute KeywordTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "DdocBlock" =+parseRules ("D","DdocBlock") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pDetectIdentifier >>= withAttribute CommentTok))@@ -502,7 +499,7 @@ <|> ((pFirstNonSpace >> pDetectChar False '*' >>= withAttribute CommentTok)) <|>- ((pDetect2Chars False '$' '(' >>= withAttribute OtherTok) >>~ pushContext "DdocMacro")+ ((pDetect2Chars False '$' '(' >>= withAttribute OtherTok) >>~ pushContext ("D","DdocMacro")) <|> ((pRegExpr regex_'5b'5cw'5f'5d'2b'3a'28'24'7c'5cs'29 >>= withAttribute KeywordTok)) <|>@@ -510,20 +507,20 @@ <|> ((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 "DdocBlockCode"))+ ((pRegExpr regex_'2d'7b3'2c'7d'28'24'7c'5cs'29 >>= withAttribute CommentTok) >>~ pushContext ("D","DdocBlockCode"))) -parseRules "DdocNested" =+parseRules ("D","DdocNested") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pDetectIdentifier >>= withAttribute CommentTok)) <|>- ((pDetect2Chars False '/' '+' >>= withAttribute CommentTok) >>~ pushContext "DdocNested2")+ ((pDetect2Chars False '/' '+' >>= withAttribute CommentTok) >>~ pushContext ("D","DdocNested2")) <|> ((pRegExpr regex_'5c'2b'2b'2f >>= withAttribute CommentTok) >>~ (popContext)) <|> ((pFirstNonSpace >> pDetectChar False '+' >>= withAttribute CommentTok)) <|>- ((pDetect2Chars False '$' '(' >>= withAttribute OtherTok) >>~ pushContext "DdocMacro")+ ((pDetect2Chars False '$' '(' >>= withAttribute OtherTok) >>~ pushContext ("D","DdocMacro")) <|> ((pRegExpr regex_'5b'5cw'5f'5d'2b'3a'28'24'7c'5cs'29 >>= withAttribute KeywordTok)) <|>@@ -531,44 +528,44 @@ <|> ((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 "DdocNestedCode"))+ ((pRegExpr regex_'2d'7b3'2c'7d'28'24'7c'5cs'29 >>= withAttribute CommentTok) >>~ pushContext ("D","DdocNestedCode"))) -parseRules "DdocNested2" =+parseRules ("D","DdocNested2") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pDetectIdentifier >>= withAttribute CommentTok)) <|> ((pRegExpr regex_'5c'2b'2b'2f >>= withAttribute CommentTok) >>~ (popContext)) <|>- ((parseRules "DdocNested")))+ ((parseRules ("D","DdocNested")))) -parseRules "DdocMacro" =+parseRules ("D","DdocMacro") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext)) <|>- ((parseRules "MacroRules"))+ ((parseRules ("D","MacroRules"))) <|>- ((pDetectIdentifier >>= withAttribute OtherTok) >>~ pushContext "DdocMacro2"))+ ((pDetectIdentifier >>= withAttribute OtherTok) >>~ pushContext ("D","DdocMacro2"))) -parseRules "DdocMacro2" =+parseRules ("D","DdocMacro2") = (((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>- ((parseRules "MacroRules")))+ ((parseRules ("D","MacroRules")))) -parseRules "DdocMacro3" =+parseRules ("D","DdocMacro3") = (((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "MacroRules")))+ ((parseRules ("D","MacroRules")))) -parseRules "MacroRules" =- (((pDetect2Chars False '$' '(' >>= withAttribute OtherTok) >>~ pushContext "DdocMacro")+parseRules ("D","MacroRules") =+ (((pDetect2Chars False '$' '(' >>= withAttribute OtherTok) >>~ pushContext ("D","DdocMacro")) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "DdocMacro3")+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("D","DdocMacro3")) <|> ((pFirstNonSpace >> pDetectChar False '*' >>= withAttribute CommentTok))) -parseRules "DdocBlockCode" =+parseRules ("D","DdocBlockCode") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5c'2a'2b'2f >>= withAttribute CommentTok) >>~ (popContext >> popContext))@@ -581,7 +578,7 @@ <|> ((Text.Highlighting.Kate.Syntax.D.parseExpression))) -parseRules "DdocNestedCode" =+parseRules ("D","DdocNestedCode") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5c'2b'2b'2f >>= withAttribute CommentTok) >>~ (popContext >> popContext))@@ -594,6 +591,7 @@ <|> ((Text.Highlighting.Kate.Syntax.D.parseExpression))) -parseRules "" = parseRules "normal"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression+parseRules ("D", _) = Text.Highlighting.Kate.Syntax.D.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Diff.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -25,41 +24,43 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Diff" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Diff",["Normal"])], synStLanguage = "Diff", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Diff","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "FindDiff" -> return ()- "File" -> return ()- "Chunk" -> return ()- "ChunkInFile" -> return ()- "RFile" -> return ()- "RChunk" -> return ()- "RChunkInFile" -> return ()- "RChunkNew" -> return ()- "RChunkInFileNew" -> return ()- "File" -> (popContext) >> pEndLine- "Removed" -> (popContext) >> pEndLine- "Added" -> (popContext) >> pEndLine- "ChangedOld" -> (popContext) >> pEndLine- "ChangedNew" -> (popContext) >> pEndLine+ ("Diff","Normal") -> return ()+ ("Diff","FindDiff") -> return ()+ ("Diff","File") -> return ()+ ("Diff","Chunk") -> return ()+ ("Diff","ChunkInFile") -> return ()+ ("Diff","RFile") -> return ()+ ("Diff","RChunk") -> return ()+ ("Diff","RChunkInFile") -> return ()+ ("Diff","RChunkNew") -> return ()+ ("Diff","RChunkInFileNew") -> return ()+ ("Diff","File") -> (popContext) >> pEndLine+ ("Diff","Removed") -> (popContext) >> pEndLine+ ("Diff","Added") -> (popContext) >> pEndLine+ ("Diff","ChangedOld") -> (popContext) >> pEndLine+ ("Diff","ChangedNew") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -68,11 +69,7 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'28'5c'40'5c'40'7c'5cd'29'2e'2a'24 = compileRegex "(\\@\\@|\\d).*$" regex_'5c'2a'2b'24 = compileRegex "\\*+$" regex_Only_in_'2e'2a'3a'2e'2a'24 = compileRegex "Only in .*:.*$"@@ -87,54 +84,54 @@ regex_'5c'2a'5c'2a'5c'2a_'2e'2a_'5c'2a'5c'2a'5c'2a'5c'2a'24 = compileRegex "\\*\\*\\* .* \\*\\*\\*\\*$" regex_'5c'2d'5c'2d'5c'2d_'2e'2a_'5c'2d'5c'2d'5c'2d'5c'2d'24 = compileRegex "\\-\\-\\- .* \\-\\-\\-\\-$" -defaultAttributes = [("Normal",NormalTok),("FindDiff",NormalTok),("File",NormalTok),("Chunk",NormalTok),("ChunkInFile",NormalTok),("RFile",NormalTok),("RChunk",NormalTok),("RChunkInFile",NormalTok),("RChunkNew",NormalTok),("RChunkInFileNew",NormalTok),("File",KeywordTok),("Removed",StringTok),("Added",OtherTok),("ChangedOld",StringTok),("ChangedNew",OtherTok)]+defaultAttributes = [(("Diff","Normal"),NormalTok),(("Diff","FindDiff"),NormalTok),(("Diff","File"),NormalTok),(("Diff","Chunk"),NormalTok),(("Diff","ChunkInFile"),NormalTok),(("Diff","RFile"),NormalTok),(("Diff","RChunk"),NormalTok),(("Diff","RChunkInFile"),NormalTok),(("Diff","RChunkNew"),NormalTok),(("Diff","RChunkInFileNew"),NormalTok),(("Diff","File"),KeywordTok),(("Diff","Removed"),StringTok),(("Diff","Added"),OtherTok),(("Diff","ChangedOld"),StringTok),(("Diff","ChangedNew"),OtherTok)] -parseRules "Normal" =- (((pColumn 0 >> pRegExpr regex_'28'5c'40'5c'40'7c'5cd'29'2e'2a'24 >>= withAttribute DataTypeTok) >>~ pushContext "Chunk")+parseRules ("Diff","Normal") =+ (((pColumn 0 >> pRegExpr regex_'28'5c'40'5c'40'7c'5cd'29'2e'2a'24 >>= withAttribute DataTypeTok) >>~ pushContext ("Diff","Chunk")) <|>- ((pColumn 0 >> pRegExpr regex_'5c'2a'2b'24 >>= withAttribute DataTypeTok) >>~ pushContext "RChunk")+ ((pColumn 0 >> pRegExpr regex_'5c'2a'2b'24 >>= withAttribute DataTypeTok) >>~ pushContext ("Diff","RChunk")) <|> ((pColumn 0 >> pRegExpr regex_Only_in_'2e'2a'3a'2e'2a'24 >>= withAttribute KeywordTok)) <|>- ((pColumn 0 >> pRegExpr regex_diff'2e'2a'24 >>= withAttribute KeywordTok) >>~ pushContext "RFile")+ ((pColumn 0 >> pRegExpr regex_diff'2e'2a'24 >>= withAttribute KeywordTok) >>~ pushContext ("Diff","RFile")) <|> ((pColumn 0 >> pRegExpr regex_'3d'3d'3d'3d'2e'2a'24 >>= withAttribute KeywordTok)) <|>- ((pColumn 0 >> pRegExpr regex_'28'5c'2a'5c'2a'5c'2a'7c'5c'2d'5c'2d'5c'2d'29'2e'2a'24 >>= withAttribute KeywordTok) >>~ pushContext "File")+ ((pColumn 0 >> pRegExpr regex_'28'5c'2a'5c'2a'5c'2a'7c'5c'2d'5c'2d'5c'2d'29'2e'2a'24 >>= withAttribute KeywordTok) >>~ pushContext ("Diff","File")) <|>- ((parseRules "FindDiff"))+ ((parseRules ("Diff","FindDiff"))) <|>- ((pColumn 0 >> pDetectChar False '!' >>= withAttribute NormalTok) >>~ pushContext "ChangedOld"))+ ((pColumn 0 >> pDetectChar False '!' >>= withAttribute NormalTok) >>~ pushContext ("Diff","ChangedOld"))) -parseRules "FindDiff" =+parseRules ("Diff","FindDiff") = (((pColumn 0 >> pRegExpr regex_'5c'2d'5c'2d'5c'2d'2e'2a'24 >>= withAttribute KeywordTok)) <|> ((pColumn 0 >> pRegExpr regex_'28'5c'2b'5c'2b'5c'2b'7c'5c'2d'5c'2d'5c'2d'29'2e'2a'24 >>= withAttribute DataTypeTok)) <|>- ((pColumn 0 >> pAnyChar "+>" >>= withAttribute OtherTok) >>~ pushContext "Added")+ ((pColumn 0 >> pAnyChar "+>" >>= withAttribute OtherTok) >>~ pushContext ("Diff","Added")) <|>- ((pColumn 0 >> pAnyChar "-<" >>= withAttribute StringTok) >>~ pushContext "Removed"))+ ((pColumn 0 >> pAnyChar "-<" >>= withAttribute StringTok) >>~ pushContext ("Diff","Removed"))) -parseRules "File" =- (((parseRules "FindDiff"))+parseRules ("Diff","File") =+ (((parseRules ("Diff","FindDiff"))) <|>- ((pColumn 0 >> pRegExpr regex_'28'5c'40'5c'40'7c'5cd'29'2e'2a'24 >>= withAttribute DataTypeTok) >>~ pushContext "ChunkInFile")+ ((pColumn 0 >> pRegExpr regex_'28'5c'40'5c'40'7c'5cd'29'2e'2a'24 >>= withAttribute DataTypeTok) >>~ pushContext ("Diff","ChunkInFile")) <|>- ((pColumn 0 >> pRegExpr regex_'5c'2a'2b'24 >>= withAttribute DataTypeTok) >>~ pushContext "RChunkInFile")+ ((pColumn 0 >> pRegExpr regex_'5c'2a'2b'24 >>= withAttribute DataTypeTok) >>~ pushContext ("Diff","RChunkInFile")) <|> ((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 "ChangedOld"))+ ((pColumn 0 >> pDetectChar False '!' >>= withAttribute StringTok) >>~ pushContext ("Diff","ChangedOld"))) -parseRules "Chunk" =- (((parseRules "FindDiff"))+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 "ChangedOld"))+ ((pColumn 0 >> pDetectChar False '!' >>= withAttribute StringTok) >>~ pushContext ("Diff","ChangedOld"))) -parseRules "ChunkInFile" =- (((parseRules "FindDiff"))+parseRules ("Diff","ChunkInFile") =+ (((parseRules ("Diff","FindDiff"))) <|> ((pColumn 0 >> lookAhead (pRegExpr regex_'28'5c'40'5c'40'7c'5cd'29'2e'2a'24) >> (popContext) >> currentContext >>= parseRules)) <|>@@ -142,62 +139,61 @@ <|> ((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 "ChangedOld"))+ ((pColumn 0 >> pDetectChar False '!' >>= withAttribute StringTok) >>~ pushContext ("Diff","ChangedOld"))) -parseRules "RFile" =+parseRules ("Diff","RFile") = (((pColumn 0 >> lookAhead (pRegExpr regex_'28diff'7cOnly_in_'2e'2a'3a'29'2e'2a'24) >> (popContext) >> currentContext >>= parseRules)) <|> ((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 DataTypeTok)) <|>- ((pColumn 0 >> pRegExpr regex_'5c'2a'2b'24 >>= withAttribute DataTypeTok) >>~ pushContext "RChunkInFile")+ ((pColumn 0 >> pRegExpr regex_'5c'2a'2b'24 >>= withAttribute DataTypeTok) >>~ pushContext ("Diff","RChunkInFile")) <|>- ((parseRules "File")))+ ((parseRules ("Diff","File")))) -parseRules "RChunk" =+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 "RChunkNew")+ ((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 "Chunk")))+ ((parseRules ("Diff","Chunk")))) -parseRules "RChunkInFile" =+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 "RChunkInFileNew")+ ((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 "ChunkInFile")))+ ((parseRules ("Diff","ChunkInFile")))) -parseRules "RChunkNew" =+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 "ChangedNew")+ ((pColumn 0 >> pDetectChar False '!' >>= withAttribute OtherTok) >>~ pushContext ("Diff","ChangedNew")) <|>- ((parseRules "FindDiff")))+ ((parseRules ("Diff","FindDiff")))) -parseRules "RChunkInFileNew" =+parseRules ("Diff","RChunkInFileNew") = (((pColumn 0 >> lookAhead (pRegExpr regex_'28'5c'40'5c'40'7c'5cd'29'2e'2a'24) >> (popContext >> popContext) >> currentContext >>= parseRules)) <|> ((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 >> popContext) >> currentContext >>= parseRules)) <|>- ((pColumn 0 >> pDetectChar False '!' >>= withAttribute OtherTok) >>~ pushContext "ChangedNew")+ ((pColumn 0 >> pDetectChar False '!' >>= withAttribute OtherTok) >>~ pushContext ("Diff","ChangedNew")) <|>- ((parseRules "FindDiff")))+ ((parseRules ("Diff","FindDiff")))) -parseRules "File" =+parseRules ("Diff","File") = pzero -parseRules "Removed" =+parseRules ("Diff","Removed") = pzero -parseRules "Added" =+parseRules ("Diff","Added") = pzero -parseRules "ChangedOld" =+parseRules ("Diff","ChangedOld") = pzero -parseRules "ChangedNew" =+parseRules ("Diff","ChangedNew") = pzero -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Djangotemplate.hs view
@@ -10,7 +10,6 @@ import qualified Text.Highlighting.Kate.Syntax.Css import qualified Text.Highlighting.Kate.Syntax.Javascript import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -29,65 +28,67 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Django HTML Template" }- context <- currentContext <|> (pushContext "Start" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Django HTML Template",["Start"])], synStLanguage = "Django HTML Template", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Django HTML Template","Start")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Start" -> return ()- "In Block" -> return ()- "FindTemplate" -> return ()- "Template Comment" -> return ()- "Template Var" -> return ()- "Template Filter" -> return ()- "Template Tag" -> return ()- "Found Block Tag" -> return ()- "In Block Tag" -> return ()- "Non Matching Tag" -> return ()- "In Template Tag" -> return ()- "Single A-string" -> return ()- "Single Q-string" -> return ()- "FindHTML" -> return ()- "FindEntityRefs" -> return ()- "FindPEntityRefs" -> return ()- "FindAttributes" -> return ()- "FindDTDRules" -> return ()- "Comment" -> return ()- "CDATA" -> return ()- "PI" -> return ()- "Doctype" -> return ()- "Doctype Internal Subset" -> return ()- "Doctype Markupdecl" -> return ()- "Doctype Markupdecl DQ" -> return ()- "Doctype Markupdecl SQ" -> return ()- "El Open" -> return ()- "El Close" -> return ()- "El Close 2" -> return ()- "El Close 3" -> return ()- "CSS" -> return ()- "CSS content" -> return ()- "JS" -> return ()- "JS content" -> return ()- "JS comment close" -> (popContext) >> pEndLine- "Value" -> return ()- "Value NQ" -> (popContext >> popContext) >> pEndLine- "Value DQ" -> return ()- "Value SQ" -> return ()+ ("Django HTML Template","Start") -> return ()+ ("Django HTML Template","In Block") -> return ()+ ("Django HTML Template","FindTemplate") -> return ()+ ("Django HTML Template","Template Comment") -> return ()+ ("Django HTML Template","Template Var") -> return ()+ ("Django HTML Template","Template Filter") -> return ()+ ("Django HTML Template","Template Tag") -> return ()+ ("Django HTML Template","Found Block Tag") -> return ()+ ("Django HTML Template","In Block Tag") -> return ()+ ("Django HTML Template","Non Matching Tag") -> return ()+ ("Django HTML Template","In Template Tag") -> return ()+ ("Django HTML Template","Single A-string") -> return ()+ ("Django HTML Template","Single Q-string") -> return ()+ ("Django HTML Template","FindHTML") -> return ()+ ("Django HTML Template","FindEntityRefs") -> return ()+ ("Django HTML Template","FindPEntityRefs") -> return ()+ ("Django HTML Template","FindAttributes") -> return ()+ ("Django HTML Template","FindDTDRules") -> return ()+ ("Django HTML Template","Comment") -> return ()+ ("Django HTML Template","CDATA") -> return ()+ ("Django HTML Template","PI") -> return ()+ ("Django HTML Template","Doctype") -> return ()+ ("Django HTML Template","Doctype Internal Subset") -> return ()+ ("Django HTML Template","Doctype Markupdecl") -> return ()+ ("Django HTML Template","Doctype Markupdecl DQ") -> return ()+ ("Django HTML Template","Doctype Markupdecl SQ") -> return ()+ ("Django HTML Template","El Open") -> return ()+ ("Django HTML Template","El Close") -> return ()+ ("Django HTML Template","El Close 2") -> return ()+ ("Django HTML Template","El Close 3") -> return ()+ ("Django HTML Template","CSS") -> return ()+ ("Django HTML Template","CSS content") -> return ()+ ("Django HTML Template","JS") -> return ()+ ("Django HTML Template","JS content") -> return ()+ ("Django HTML Template","JS comment close") -> (popContext) >> pEndLine+ ("Django HTML Template","Value") -> return ()+ ("Django HTML Template","Value NQ") -> (popContext >> popContext) >> pEndLine+ ("Django HTML Template","Value DQ") -> return ()+ ("Django HTML Template","Value SQ") -> return () _ -> return () withAttribute attr txt = do@@ -96,10 +97,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_blocktags = Set.fromList $ words $ "for block if ifequal ifnotequal ifchanged blocktrans spaceless autoescape" list_endblocktags = Set.fromList $ words $ "endfor endblock endif endifequal endifnotequal endifchanged endblocktrans endspaceless endautoescape" @@ -132,36 +129,36 @@ regex_'2f'28'3f'21'3e'29 = compileRegex "/(?!>)" regex_'5b'5e'2f'3e'3c'22'27'5cs'5d = compileRegex "[^/><\"'\\s]" -defaultAttributes = [("Start",NormalTok),("In Block",NormalTok),("FindTemplate",NormalTok),("Template Comment",CommentTok),("Template Var",FunctionTok),("Template Filter",OtherTok),("Template Tag",FunctionTok),("Found Block Tag",FunctionTok),("In Block Tag",FunctionTok),("Non Matching Tag",FunctionTok),("In Template Tag",FunctionTok),("Single A-string",StringTok),("Single Q-string",StringTok),("FindHTML",NormalTok),("FindEntityRefs",NormalTok),("FindPEntityRefs",NormalTok),("FindAttributes",NormalTok),("FindDTDRules",NormalTok),("Comment",CommentTok),("CDATA",NormalTok),("PI",NormalTok),("Doctype",NormalTok),("Doctype Internal Subset",NormalTok),("Doctype Markupdecl",NormalTok),("Doctype Markupdecl DQ",StringTok),("Doctype Markupdecl SQ",StringTok),("El Open",NormalTok),("El Close",NormalTok),("El Close 2",NormalTok),("El Close 3",NormalTok),("CSS",NormalTok),("CSS content",NormalTok),("JS",NormalTok),("JS content",NormalTok),("JS comment close",CommentTok),("Value",NormalTok),("Value NQ",NormalTok),("Value DQ",StringTok),("Value SQ",StringTok)]+defaultAttributes = [(("Django HTML Template","Start"),NormalTok),(("Django HTML Template","In Block"),NormalTok),(("Django HTML Template","FindTemplate"),NormalTok),(("Django HTML Template","Template Comment"),CommentTok),(("Django HTML Template","Template Var"),FunctionTok),(("Django HTML Template","Template Filter"),OtherTok),(("Django HTML Template","Template Tag"),FunctionTok),(("Django HTML Template","Found Block Tag"),FunctionTok),(("Django HTML Template","In Block Tag"),FunctionTok),(("Django HTML Template","Non Matching Tag"),FunctionTok),(("Django HTML Template","In Template Tag"),FunctionTok),(("Django HTML Template","Single A-string"),StringTok),(("Django HTML Template","Single Q-string"),StringTok),(("Django HTML Template","FindHTML"),NormalTok),(("Django HTML Template","FindEntityRefs"),NormalTok),(("Django HTML Template","FindPEntityRefs"),NormalTok),(("Django HTML Template","FindAttributes"),NormalTok),(("Django HTML Template","FindDTDRules"),NormalTok),(("Django HTML Template","Comment"),CommentTok),(("Django HTML Template","CDATA"),NormalTok),(("Django HTML Template","PI"),NormalTok),(("Django HTML Template","Doctype"),NormalTok),(("Django HTML Template","Doctype Internal Subset"),NormalTok),(("Django HTML Template","Doctype Markupdecl"),NormalTok),(("Django HTML Template","Doctype Markupdecl DQ"),StringTok),(("Django HTML Template","Doctype Markupdecl SQ"),StringTok),(("Django HTML Template","El Open"),NormalTok),(("Django HTML Template","El Close"),NormalTok),(("Django HTML Template","El Close 2"),NormalTok),(("Django HTML Template","El Close 3"),NormalTok),(("Django HTML Template","CSS"),NormalTok),(("Django HTML Template","CSS content"),NormalTok),(("Django HTML Template","JS"),NormalTok),(("Django HTML Template","JS content"),NormalTok),(("Django HTML Template","JS comment close"),CommentTok),(("Django HTML Template","Value"),NormalTok),(("Django HTML Template","Value NQ"),NormalTok),(("Django HTML Template","Value DQ"),StringTok),(("Django HTML Template","Value SQ"),StringTok)] -parseRules "Start" =+parseRules ("Django HTML Template","Start") = (((pRegExpr regex_'5c'7b'25'5cs'2aend'5ba'2dz'5d'2b'5cs'2a'25'5c'7d >>= withAttribute ErrorTok)) <|>- ((parseRules "FindTemplate"))+ ((parseRules ("Django HTML Template","FindTemplate"))) <|>- ((parseRules "FindHTML")))+ ((parseRules ("Django HTML Template","FindHTML")))) -parseRules "In Block" =+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 "FindTemplate"))+ ((parseRules ("Django HTML Template","FindTemplate"))) <|>- ((parseRules "FindHTML")))+ ((parseRules ("Django HTML Template","FindHTML")))) -parseRules "FindTemplate" =- (((pRegExpr regex_'5c'7b'25'5cs'2acomment'5cs'2a'25'5c'7d >>= withAttribute CommentTok) >>~ pushContext "Template Comment")+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 "Template Var")+ ((pDetect2Chars False '{' '{' >>= withAttribute FunctionTok) >>~ pushContext ("Django HTML Template","Template Var")) <|>- ((pDetect2Chars False '{' '%' >>= withAttribute FunctionTok) >>~ pushContext "Template Tag"))+ ((pDetect2Chars False '{' '%' >>= withAttribute FunctionTok) >>~ pushContext ("Django HTML Template","Template Tag"))) -parseRules "Template Comment" =+parseRules ("Django HTML Template","Template Comment") = ((pRegExpr regex_'5c'7b'25'5cs'2aendcomment'5cs'2a'25'5c'7d >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "Template Var" =+parseRules ("Django HTML Template","Template Var") = (((pDetect2Chars False '}' '}' >>= withAttribute FunctionTok) >>~ (popContext)) <|>- ((pDetectChar False '|' >>= withAttribute OtherTok) >>~ pushContext "Template Filter")+ ((pDetectChar False '|' >>= withAttribute OtherTok) >>~ pushContext ("Django HTML Template","Template Filter")) <|> ((pDetect2Chars False '{' '{' >>= withAttribute ErrorTok)) <|>@@ -169,12 +166,12 @@ <|> ((pDetect2Chars False '%' '}' >>= withAttribute ErrorTok))) -parseRules "Template Filter" =+parseRules ("Django HTML Template","Template Filter") = (((pDetect2Chars False '}' '}' >>= withAttribute FunctionTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Single A-string")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Django HTML Template","Single A-string")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Single Q-string")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Django HTML Template","Single Q-string")) <|> ((pDetect2Chars False '{' '{' >>= withAttribute ErrorTok)) <|>@@ -182,34 +179,34 @@ <|> ((pDetect2Chars False '%' '}' >>= withAttribute ErrorTok))) -parseRules "Template Tag" =- (((lookAhead (pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_blocktags) >> pushContext "Found Block Tag" >> currentContext >>= parseRules))+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 "In Template Tag"))+ ((pDetectIdentifier >>= withAttribute FunctionTok) >>~ pushContext ("Django HTML Template","In Template Tag"))) -parseRules "Found Block Tag" =- ((pRegExpr regex_'28'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a'29 >>= withAttribute FunctionTok) >>~ pushContext "In Block Tag")+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")) -parseRules "In Block Tag" =+parseRules ("Django HTML Template","In Block Tag") = (((pRegExprDynamic "\\{%\\s*end%1\\s*%\\}" >>= withAttribute FunctionTok) >>~ (popContext >> popContext >> popContext)) <|>- ((lookAhead (pRegExpr regex_'5c'7b'25'5cs'2aend'5ba'2dz'5d'2b'5cs'2a'25'5c'7d) >> pushContext "Non Matching Tag" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'5c'7b'25'5cs'2aend'5ba'2dz'5d'2b'5cs'2a'25'5c'7d) >> pushContext ("Django HTML Template","Non Matching Tag") >> currentContext >>= parseRules)) <|>- ((pDetect2Chars False '%' '}' >>= withAttribute FunctionTok) >>~ pushContext "In Block")+ ((pDetect2Chars False '%' '}' >>= withAttribute FunctionTok) >>~ pushContext ("Django HTML Template","In Block")) <|>- ((parseRules "In Template Tag")))+ ((parseRules ("Django HTML Template","In Template Tag")))) -parseRules "Non Matching Tag" =+parseRules ("Django HTML Template","Non Matching Tag") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_endblocktags >>= withAttribute ErrorTok) >>~ (popContext)) <|> ((pDetectIdentifier >>= withAttribute FunctionTok) >>~ (popContext))) -parseRules "In Template Tag" =+parseRules ("Django HTML Template","In Template Tag") = (((pDetect2Chars False '%' '}' >>= withAttribute FunctionTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Single A-string")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Django HTML Template","Single A-string")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Single Q-string")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Django HTML Template","Single Q-string")) <|> ((pDetect2Chars False '{' '{' >>= withAttribute ErrorTok)) <|>@@ -217,81 +214,81 @@ <|> ((pDetect2Chars False '}' '}' >>= withAttribute ErrorTok))) -parseRules "Single A-string" =+parseRules ("Django HTML Template","Single A-string") = (((pHlCStringChar >>= withAttribute StringTok)) <|> ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Single Q-string" =+parseRules ("Django HTML Template","Single Q-string") = (((pHlCStringChar >>= withAttribute StringTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "FindHTML" =+parseRules ("Django HTML Template","FindHTML") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pDetectIdentifier >>= withAttribute NormalTok)) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("Django HTML Template","Comment")) <|>- ((pString False "<![CDATA[" >>= withAttribute BaseNTok) >>~ pushContext "CDATA")+ ((pString False "<![CDATA[" >>= withAttribute BaseNTok) >>~ pushContext ("Django HTML Template","CDATA")) <|>- ((pRegExpr regex_'3c'21DOCTYPE'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext "Doctype")+ ((pRegExpr regex_'3c'21DOCTYPE'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext ("Django HTML Template","Doctype")) <|>- ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "PI")+ ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","PI")) <|>- ((pRegExpr regex_'3cstyle'5cb >>= withAttribute KeywordTok) >>~ pushContext "CSS")+ ((pRegExpr regex_'3cstyle'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","CSS")) <|>- ((pRegExpr regex_'3cscript'5cb >>= withAttribute KeywordTok) >>~ pushContext "JS")+ ((pRegExpr regex_'3cscript'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","JS")) <|>- ((pRegExpr regex_'3cpre'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3cpre'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","El Open")) <|>- ((pRegExpr regex_'3cdiv'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3cdiv'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","El Open")) <|>- ((pRegExpr regex_'3ctable'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3ctable'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","El Open")) <|>- ((pRegExpr regex_'3c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","El Open")) <|>- ((pRegExpr regex_'3c'2fpre'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2fpre'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","El Close")) <|>- ((pRegExpr regex_'3c'2fdiv'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2fdiv'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","El Close")) <|>- ((pRegExpr regex_'3c'2ftable'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2ftable'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","El Close")) <|>- ((pRegExpr regex_'3c'2f'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2f'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","El Close")) <|>- ((parseRules "FindDTDRules"))+ ((parseRules ("Django HTML Template","FindDTDRules"))) <|>- ((parseRules "FindEntityRefs")))+ ((parseRules ("Django HTML Template","FindEntityRefs")))) -parseRules "FindEntityRefs" =+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))) -parseRules "FindPEntityRefs" =+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))) -parseRules "FindAttributes" =+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 "Value"))+ ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("Django HTML Template","Value"))) -parseRules "FindDTDRules" =- ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext "Doctype Markupdecl")+parseRules ("Django HTML Template","FindDTDRules") =+ ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("Django HTML Template","Doctype Markupdecl")) -parseRules "Comment" =+parseRules ("Django HTML Template","Comment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|>- ((parseRules "FindTemplate"))+ ((parseRules ("Django HTML Template","FindTemplate"))) <|> ((pDetectIdentifier >>= withAttribute CommentTok)) <|>@@ -299,7 +296,7 @@ <|> ((pRegExpr regex_'2d'28'2d'28'3f'21'2d'3e'29'29'2b >>= withAttribute ErrorTok))) -parseRules "CDATA" =+parseRules ("Django HTML Template","CDATA") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pDetectIdentifier >>= withAttribute NormalTok))@@ -308,126 +305,126 @@ <|> ((pString False "]]>" >>= withAttribute DecValTok))) -parseRules "PI" =+parseRules ("Django HTML Template","PI") = ((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext)) -parseRules "Doctype" =+parseRules ("Django HTML Template","Doctype") = (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext "Doctype Internal Subset"))+ ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("Django HTML Template","Doctype Internal Subset"))) -parseRules "Doctype Internal Subset" =+parseRules ("Django HTML Template","Doctype Internal Subset") = (((pDetectChar False ']' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((parseRules "FindDTDRules"))+ ((parseRules ("Django HTML Template","FindDTDRules"))) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("Django HTML Template","Comment")) <|>- ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "PI")+ ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","PI")) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("Django HTML Template","FindPEntityRefs")))) -parseRules "Doctype Markupdecl" =+parseRules ("Django HTML Template","Doctype Markupdecl") = (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Doctype Markupdecl DQ")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Django HTML Template","Doctype Markupdecl DQ")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Doctype Markupdecl SQ"))+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Django HTML Template","Doctype Markupdecl SQ"))) -parseRules "Doctype Markupdecl DQ" =+parseRules ("Django HTML Template","Doctype Markupdecl DQ") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("Django HTML Template","FindPEntityRefs")))) -parseRules "Doctype Markupdecl SQ" =+parseRules ("Django HTML Template","Doctype Markupdecl SQ") = (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("Django HTML Template","FindPEntityRefs")))) -parseRules "El Open" =+parseRules ("Django HTML Template","El Open") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "FindAttributes"))+ ((parseRules ("Django HTML Template","FindAttributes"))) <|>- ((parseRules "FindTemplate"))+ ((parseRules ("Django HTML Template","FindTemplate"))) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "El Close" =+parseRules ("Django HTML Template","El Close") = (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "El Close 2" =+parseRules ("Django HTML Template","El Close 2") = (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "El Close 3" =+parseRules ("Django HTML Template","El Close 3") = (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext >> popContext)) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "CSS" =+parseRules ("Django HTML Template","CSS") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext "CSS content")+ ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","CSS content")) <|>- ((parseRules "FindAttributes"))+ ((parseRules ("Django HTML Template","FindAttributes"))) <|>- ((parseRules "FindTemplate"))+ ((parseRules ("Django HTML Template","FindTemplate"))) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "CSS content" =- (((pRegExpr regex_'3c'2fstyle'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close 2")+parseRules ("Django HTML Template","CSS content") =+ (((pRegExpr regex_'3c'2fstyle'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","El Close 2")) <|>- ((parseRules "FindTemplate"))+ ((parseRules ("Django HTML Template","FindTemplate"))) <|> ((Text.Highlighting.Kate.Syntax.Css.parseExpression))) -parseRules "JS" =+parseRules ("Django HTML Template","JS") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext "JS content")+ ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","JS content")) <|>- ((parseRules "FindTemplate"))+ ((parseRules ("Django HTML Template","FindTemplate"))) <|>- ((parseRules "FindAttributes"))+ ((parseRules ("Django HTML Template","FindAttributes"))) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "JS content" =- (((pRegExpr regex_'3c'2fscript'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close 2")+parseRules ("Django HTML Template","JS content") =+ (((pRegExpr regex_'3c'2fscript'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","El Close 2")) <|>- ((pRegExpr regex_'2f'2f'28'3f'3d'2e'2a'3c'2fscript'5cb'29 >>= withAttribute CommentTok) >>~ pushContext "JS comment close")+ ((pRegExpr regex_'2f'2f'28'3f'3d'2e'2a'3c'2fscript'5cb'29 >>= withAttribute CommentTok) >>~ pushContext ("Django HTML Template","JS comment close")) <|>- ((parseRules "FindTemplate"))+ ((parseRules ("Django HTML Template","FindTemplate"))) <|> ((Text.Highlighting.Kate.Syntax.Javascript.parseExpression))) -parseRules "JS comment close" =- (((pRegExpr regex_'3c'2fscript'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close 3")+parseRules ("Django HTML Template","JS comment close") =+ (((pRegExpr regex_'3c'2fscript'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Django HTML Template","El Close 3")) <|>- ((parseRules "FindTemplate"))+ ((parseRules ("Django HTML Template","FindTemplate"))) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "Value" =- (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Value DQ")+parseRules ("Django HTML Template","Value") =+ (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Django HTML Template","Value DQ")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Value SQ")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Django HTML Template","Value SQ")) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|>- (pushContext "Value NQ" >> currentContext >>= parseRules))+ (pushContext ("Django HTML Template","Value NQ") >> currentContext >>= parseRules)) -parseRules "Value NQ" =- (((parseRules "FindEntityRefs"))+parseRules ("Django HTML Template","Value NQ") =+ (((parseRules ("Django HTML Template","FindEntityRefs"))) <|>- ((parseRules "FindTemplate"))+ ((parseRules ("Django HTML Template","FindTemplate"))) <|> ((pRegExpr regex_'2f'28'3f'21'3e'29 >>= withAttribute StringTok)) <|>@@ -435,20 +432,22 @@ <|> ((popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "Value DQ" =+parseRules ("Django HTML Template","Value DQ") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext >> popContext)) <|>- ((parseRules "FindTemplate"))+ ((parseRules ("Django HTML Template","FindTemplate"))) <|>- ((parseRules "FindEntityRefs")))+ ((parseRules ("Django HTML Template","FindEntityRefs")))) -parseRules "Value SQ" =+parseRules ("Django HTML Template","Value SQ") = (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext >> popContext)) <|>- ((parseRules "FindTemplate"))+ ((parseRules ("Django HTML Template","FindTemplate"))) <|>- ((parseRules "FindEntityRefs")))+ ((parseRules ("Django HTML Template","FindEntityRefs")))) -parseRules "" = parseRules "Start"+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" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Doxygen.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,58 +26,60 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Doxygen" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Doxygen",["Normal"])], synStLanguage = "Doxygen", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Doxygen","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "LineComment" -> (popContext) >> pEndLine- "BlockComment" -> return ()- "ML_TagWord" -> (popContext) >> pEndLine- "ML_TagParam" -> (popContext) >> pEndLine- "ML_TagWordWord" -> (popContext) >> pEndLine- "ML_Tag2ndWord" -> (popContext >> popContext) >> pEndLine- "ML_TagString" -> (popContext) >> pEndLine- "ML_TagWordString" -> (popContext) >> pEndLine- "ML_htmltag" -> return ()- "ML_htmlcomment" -> return ()- "ML_identifiers" -> return ()- "ML_types1" -> return ()- "ML_types2" -> return ()- "SL_TagWord" -> (popContext) >> pEndLine- "SL_TagParam" -> (popContext) >> pEndLine- "SL_TagWordWord" -> (popContext) >> pEndLine- "SL_Tag2ndWord" -> (popContext >> popContext) >> pEndLine- "SL_TagString" -> (popContext) >> pEndLine- "SL_TagWordString" -> (popContext) >> pEndLine- "SL_htmltag" -> (popContext) >> pEndLine- "SL_htmlcomment" -> (popContext) >> pEndLine- "SL_identifiers" -> (popContext) >> pEndLine- "SL_types1" -> (popContext) >> pEndLine- "SL_types2" -> (popContext) >> pEndLine- "SL_DetectEnv" -> (popContext) >> pEndLine- "SL_DetectComment" -> (popContext) >> pEndLine- "Code" -> return ()- "Verbatim" -> return ()- "Formula" -> return ()- "Msc" -> return ()- "Dot" -> return ()+ ("Doxygen","Normal") -> return ()+ ("Doxygen","LineComment") -> (popContext) >> pEndLine+ ("Doxygen","BlockComment") -> return ()+ ("Doxygen","ML_TagWord") -> (popContext) >> pEndLine+ ("Doxygen","ML_TagParam") -> (popContext) >> pEndLine+ ("Doxygen","ML_TagWordWord") -> (popContext) >> pEndLine+ ("Doxygen","ML_Tag2ndWord") -> (popContext >> popContext) >> pEndLine+ ("Doxygen","ML_TagString") -> (popContext) >> pEndLine+ ("Doxygen","ML_TagWordString") -> (popContext) >> pEndLine+ ("Doxygen","ML_htmltag") -> return ()+ ("Doxygen","ML_htmlcomment") -> return ()+ ("Doxygen","ML_identifiers") -> return ()+ ("Doxygen","ML_types1") -> return ()+ ("Doxygen","ML_types2") -> return ()+ ("Doxygen","SL_TagWord") -> (popContext) >> pEndLine+ ("Doxygen","SL_TagParam") -> (popContext) >> pEndLine+ ("Doxygen","SL_TagWordWord") -> (popContext) >> pEndLine+ ("Doxygen","SL_Tag2ndWord") -> (popContext >> popContext) >> pEndLine+ ("Doxygen","SL_TagString") -> (popContext) >> pEndLine+ ("Doxygen","SL_TagWordString") -> (popContext) >> pEndLine+ ("Doxygen","SL_htmltag") -> (popContext) >> pEndLine+ ("Doxygen","SL_htmlcomment") -> (popContext) >> pEndLine+ ("Doxygen","SL_identifiers") -> (popContext) >> pEndLine+ ("Doxygen","SL_types1") -> (popContext) >> pEndLine+ ("Doxygen","SL_types2") -> (popContext) >> pEndLine+ ("Doxygen","SL_DetectEnv") -> (popContext) >> pEndLine+ ("Doxygen","SL_DetectComment") -> (popContext) >> pEndLine+ ("Doxygen","Code") -> return ()+ ("Doxygen","Verbatim") -> return ()+ ("Doxygen","Formula") -> return ()+ ("Doxygen","Msc") -> return ()+ ("Doxygen","Dot") -> return () _ -> return () withAttribute attr txt = do@@ -87,10 +88,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_TagOnly = Set.fromList $ words $ "\\arg @arg \\author @author \\authors @authors \\brief @brief \\bug @bug \\callgraph @callgraph \\callergraph @callergraph \\date @date \\deprecated @deprecated \\details @details \\else @else \\endcond @endcond \\endhtmlonly @endhtmlonly \\endif @endif \\enditernal @enditernal \\endlatexonly @endlatexonly \\endlink @endlink \\endmanonly @endmanonly \\endrtfonly @endrtfonly \\endxmlonly @endxmlonly \\f[ @f[ \\f] @f] \\f$ @f$ \\hideinitializer @hideinitializer \\htmlonly @htmlonly \\internal @internal \\invariant @invariant \\latexonly @latexonly \\li @li \\manonly @manonly \\n @n \\nosubgrouping @nosubgrouping \\only @only \\post @post \\pre @pre \\private @pivate \\privatesection @pivatesection \\protected @protected \\protectedsection @protectedsection \\public @public \\publicsection @publicsection \\remarks @remarks \\return @return \\returns @returns \\result @result \\rtfonly @rtfonly \\sa @sa \\see @see \\short @short \\showinitializer @showinitializer \\since @since \\tableofcontents @tableofcontents \\test @test \\version @version \\xmlonly @xmlonly \\# @# \\$ @$ \\% @% \\& @& \\> @> \\< @< \\\" @\" \\:: @:: \\@ @@ \\\\ @\\ \\~ @~" list_TagWord = Set.fromList $ words $ "\\a @a \\anchor @anchor \\b @b \\c @c \\cond @cond \\copybrief @copybrief \\copydetails @copydetails \\copydoc @copydoc \\def @def \\dir @dir \\dontinclude @dontinclude \\e @e \\elseif @elseif \\em @em \\enum @enum \\example @example \\exception @exception \\exceptions @exceptions \\extends @extends \\file @file \\htmlinclude @htmlinclude \\if @if \\ifnot @ifnot \\implements @implements \\include @include \\includelineno @includelineno \\link @link \\memberof @memberof \\namespace @namespace \\p @p \\package @package \\property @property \\relatedalso @relatedalso \\relatesalso @relatesalso \\related @related \\relates @relates \\retval @retval \\throw @throw \\throws @throws \\verbinclude @verbinclude \\version @version \\xrefitem @xrefitem" list_TagParam = Set.fromList $ words $ "\\param @param \\tparam @tparam"@@ -128,12 +125,12 @@ regex_'5b'40'5c'5c'5dendmsc'5cb = compileRegex "[@\\\\]endmsc\\b" regex_'5b'40'5c'5c'5denddot'5cb = compileRegex "[@\\\\]enddot\\b" -defaultAttributes = [("Normal",NormalTok),("LineComment",CommentTok),("BlockComment",CommentTok),("ML_TagWord",CommentTok),("ML_TagParam",CommentTok),("ML_TagWordWord",CommentTok),("ML_Tag2ndWord",CommentTok),("ML_TagString",CommentTok),("ML_TagWordString",CommentTok),("ML_htmltag",OtherTok),("ML_htmlcomment",CommentTok),("ML_identifiers",OtherTok),("ML_types1",DataTypeTok),("ML_types2",DataTypeTok),("SL_TagWord",CommentTok),("SL_TagParam",CommentTok),("SL_TagWordWord",CommentTok),("SL_Tag2ndWord",CommentTok),("SL_TagString",CommentTok),("SL_TagWordString",CommentTok),("SL_htmltag",OtherTok),("SL_htmlcomment",CommentTok),("SL_identifiers",OtherTok),("SL_types1",DataTypeTok),("SL_types2",DataTypeTok),("SL_DetectEnv",CommentTok),("SL_DetectComment",CommentTok),("Code",CommentTok),("Verbatim",CommentTok),("Formula",CommentTok),("Msc",CommentTok),("Dot",CommentTok)]+defaultAttributes = [(("Doxygen","Normal"),NormalTok),(("Doxygen","LineComment"),CommentTok),(("Doxygen","BlockComment"),CommentTok),(("Doxygen","ML_TagWord"),CommentTok),(("Doxygen","ML_TagParam"),CommentTok),(("Doxygen","ML_TagWordWord"),CommentTok),(("Doxygen","ML_Tag2ndWord"),CommentTok),(("Doxygen","ML_TagString"),CommentTok),(("Doxygen","ML_TagWordString"),CommentTok),(("Doxygen","ML_htmltag"),OtherTok),(("Doxygen","ML_htmlcomment"),CommentTok),(("Doxygen","ML_identifiers"),OtherTok),(("Doxygen","ML_types1"),DataTypeTok),(("Doxygen","ML_types2"),DataTypeTok),(("Doxygen","SL_TagWord"),CommentTok),(("Doxygen","SL_TagParam"),CommentTok),(("Doxygen","SL_TagWordWord"),CommentTok),(("Doxygen","SL_Tag2ndWord"),CommentTok),(("Doxygen","SL_TagString"),CommentTok),(("Doxygen","SL_TagWordString"),CommentTok),(("Doxygen","SL_htmltag"),OtherTok),(("Doxygen","SL_htmlcomment"),CommentTok),(("Doxygen","SL_identifiers"),OtherTok),(("Doxygen","SL_types1"),DataTypeTok),(("Doxygen","SL_types2"),DataTypeTok),(("Doxygen","SL_DetectEnv"),CommentTok),(("Doxygen","SL_DetectComment"),CommentTok),(("Doxygen","Code"),CommentTok),(("Doxygen","Verbatim"),CommentTok),(("Doxygen","Formula"),CommentTok),(("Doxygen","Msc"),CommentTok),(("Doxygen","Dot"),CommentTok)] -parseRules "Normal" =- (((pRegExpr regex_'2f'2f'28'21'7c'28'2f'28'3f'3d'5b'5e'2f'5d'7c'24'29'29'29'3c'3f >>= withAttribute CommentTok) >>~ pushContext "LineComment")+parseRules ("Doxygen","Normal") =+ (((pRegExpr regex_'2f'2f'28'21'7c'28'2f'28'3f'3d'5b'5e'2f'5d'7c'24'29'29'29'3c'3f >>= withAttribute CommentTok) >>~ pushContext ("Doxygen","LineComment")) <|>- ((pRegExpr regex_'2f'5c'2a'28'5c'2a'5b'5e'2a'2f'5d'7c'21'7c'5b'2a'21'5d'3c'7c'5c'2a'24'29 >>= withAttribute CommentTok) >>~ pushContext "BlockComment")+ ((pRegExpr regex_'2f'5c'2a'28'5c'2a'5b'5e'2a'2f'5d'7c'21'7c'5b'2a'21'5d'3c'7c'5c'2a'24'29 >>= withAttribute CommentTok) >>~ pushContext ("Doxygen","BlockComment")) <|> ((pRegExpr regex_'2f'2f'5cs'2a'40'5c'7b'5cs'2a'24 >>= withAttribute RegionMarkerTok)) <|>@@ -143,38 +140,38 @@ <|> ((pRegExpr regex_'2f'5c'2a'5cs'2a'40'5c'7d'5cs'2a'5c'2a'2f >>= withAttribute RegionMarkerTok))) -parseRules "LineComment" =+parseRules ("Doxygen","LineComment") = (((pLineContinue >>= withAttribute CommentTok)) <|> ((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|>- ((parseRules "SL_DetectEnv"))+ ((parseRules ("Doxygen","SL_DetectEnv"))) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagOnly >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWord >>= withAttribute KeywordTok) >>~ pushContext "SL_TagWord")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWord >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","SL_TagWord")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagParam >>= withAttribute KeywordTok) >>~ pushContext "SL_TagParam")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagParam >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","SL_TagParam")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWordWord >>= withAttribute KeywordTok) >>~ pushContext "SL_TagWordWord")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWordWord >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","SL_TagWordWord")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagString >>= withAttribute KeywordTok) >>~ pushContext "SL_TagString")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagString >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","SL_TagString")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWordString >>= withAttribute KeywordTok) >>~ pushContext "SL_TagWordString")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWordString >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","SL_TagWordString")) <|> ((pRegExpr regex_'5b'40'5c'5c'5d'5b'5e'40'5c'5c_'5ct'5d'2b >>= withAttribute NormalTok)) <|> ((pDetectIdentifier >>= withAttribute CommentTok)) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "SL_htmlcomment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("Doxygen","SL_htmlcomment")) <|> ((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 "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"))) -parseRules "BlockComment" =+parseRules ("Doxygen","BlockComment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))@@ -185,19 +182,19 @@ <|> ((pDetect2Chars False '@' '}' >>= withAttribute RegionMarkerTok)) <|>- ((parseRules "SL_DetectEnv"))+ ((parseRules ("Doxygen","SL_DetectEnv"))) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagOnly >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWord >>= withAttribute KeywordTok) >>~ pushContext "ML_TagWord")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWord >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","ML_TagWord")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagParam >>= withAttribute KeywordTok) >>~ pushContext "ML_TagParam")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagParam >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","ML_TagParam")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWordWord >>= withAttribute KeywordTok) >>~ pushContext "ML_TagWordWord")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWordWord >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","ML_TagWordWord")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagString >>= withAttribute KeywordTok) >>~ pushContext "ML_TagString")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagString >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","ML_TagString")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWordString >>= withAttribute KeywordTok) >>~ pushContext "ML_TagWordString")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWordString >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","ML_TagWordString")) <|> ((pRegExpr regex_'5b'40'5c'5c'5d'5b'5e'40'5c'5c_'5ct'5d'2b >>= withAttribute NormalTok)) <|>@@ -207,98 +204,98 @@ <|> ((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 "ML_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","ML_htmltag")) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "ML_htmlcomment"))+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("Doxygen","ML_htmlcomment"))) -parseRules "ML_TagWord" =+parseRules ("Doxygen","ML_TagWord") = (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules)) <|>- ((parseRules "SL_TagWord")))+ ((parseRules ("Doxygen","SL_TagWord")))) -parseRules "ML_TagParam" =+parseRules ("Doxygen","ML_TagParam") = (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules)) <|> ((pDetectSpaces >>= withAttribute CommentTok)) <|>- ((pString False "[in]" >>= withAttribute KeywordTok) >>~ pushContext "ML_Tag2ndWord")+ ((pString False "[in]" >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","ML_Tag2ndWord")) <|>- ((pString False "[out]" >>= withAttribute KeywordTok) >>~ pushContext "ML_Tag2ndWord")+ ((pString False "[out]" >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","ML_Tag2ndWord")) <|>- ((pString False "[in,out]" >>= withAttribute KeywordTok) >>~ pushContext "ML_Tag2ndWord")+ ((pString False "[in,out]" >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","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))) -parseRules "ML_TagWordWord" =+parseRules ("Doxygen","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 "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) >>~ pushContext ("Doxygen","ML_Tag2ndWord")) <|> ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))) -parseRules "ML_Tag2ndWord" =+parseRules ("Doxygen","ML_Tag2ndWord") = (((lookAhead (pDetect2Chars False '*' '/') >> (popContext >> popContext) >> currentContext >>= parseRules)) <|>- ((parseRules "SL_Tag2ndWord")))+ ((parseRules ("Doxygen","SL_Tag2ndWord")))) -parseRules "ML_TagString" =+parseRules ("Doxygen","ML_TagString") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules)) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "ML_htmlcomment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("Doxygen","ML_htmlcomment")) <|> ((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 "ML_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","ML_htmltag")) <|> ((pRegExpr regex_'2e >>= withAttribute StringTok))) -parseRules "ML_TagWordString" =+parseRules ("Doxygen","ML_TagWordString") = (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules)) <|>- ((parseRules "SL_TagWordString")))+ ((parseRules ("Doxygen","SL_TagWordString")))) -parseRules "ML_htmltag" =+parseRules ("Doxygen","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 "ML_identifiers"))+ ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("Doxygen","ML_identifiers"))) -parseRules "ML_htmlcomment" =+parseRules ("Doxygen","ML_htmlcomment") = (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "ML_identifiers" =+parseRules ("Doxygen","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 "ML_types1")+ ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ pushContext ("Doxygen","ML_types1")) <|>- ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext "ML_types2"))+ ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("Doxygen","ML_types2"))) -parseRules "ML_types1" =+parseRules ("Doxygen","ML_types1") = (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules)) <|> ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))) -parseRules "ML_types2" =+parseRules ("Doxygen","ML_types2") = (((lookAhead (pDetect2Chars False '*' '/') >> (popContext) >> currentContext >>= parseRules)) <|> ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))) -parseRules "SL_TagWord" =+parseRules ("Doxygen","SL_TagWord") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((lookAhead (pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_TagWord) >> (popContext) >> currentContext >>= parseRules))@@ -307,86 +304,86 @@ <|> ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))) -parseRules "SL_TagParam" =+parseRules ("Doxygen","SL_TagParam") = (((pDetectSpaces >>= withAttribute CommentTok)) <|>- ((pString False "[in]" >>= withAttribute KeywordTok) >>~ pushContext "SL_Tag2ndWord")+ ((pString False "[in]" >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","SL_Tag2ndWord")) <|>- ((pString False "[out]" >>= withAttribute KeywordTok) >>~ pushContext "SL_Tag2ndWord")+ ((pString False "[out]" >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","SL_Tag2ndWord")) <|>- ((pString False "[in,out]" >>= withAttribute KeywordTok) >>~ pushContext "SL_Tag2ndWord")+ ((pString False "[in,out]" >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","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))) -parseRules "SL_TagWordWord" =+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 "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) >>~ pushContext ("Doxygen","SL_Tag2ndWord")) <|> ((pRegExpr regex_'5cS >>= withAttribute KeywordTok))) -parseRules "SL_Tag2ndWord" =+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))) -parseRules "SL_TagString" =+parseRules ("Doxygen","SL_TagString") = (((pDetectSpaces >>= withAttribute CommentTok)) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "SL_htmlcomment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("Doxygen","SL_htmlcomment")) <|> ((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 "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")) <|> ((pRegExpr regex_'2e >>= withAttribute StringTok))) -parseRules "SL_TagWordString" =+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))) -parseRules "SL_htmltag" =+parseRules ("Doxygen","SL_htmltag") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext "SL_identifiers"))+ ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("Doxygen","SL_identifiers"))) -parseRules "SL_htmlcomment" =+parseRules ("Doxygen","SL_htmlcomment") = (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "SL_identifiers" =+parseRules ("Doxygen","SL_identifiers") = (((pRegExpr regex_'5cs'2a'23'3f'5ba'2dzA'2dZ0'2d9'5d'2a >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ pushContext "SL_types1")+ ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ pushContext ("Doxygen","SL_types1")) <|>- ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext "SL_types2"))+ ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("Doxygen","SL_types2"))) -parseRules "SL_types1" =+parseRules ("Doxygen","SL_types1") = ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext)) -parseRules "SL_types2" =+parseRules ("Doxygen","SL_types2") = ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext)) -parseRules "SL_DetectEnv" =- (((pRegExpr regex_'5b'40'5c'5c'5dcode'5cb >>= withAttribute KeywordTok) >>~ pushContext "Code")+parseRules ("Doxygen","SL_DetectEnv") =+ (((pRegExpr regex_'5b'40'5c'5c'5dcode'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","Code")) <|>- ((pRegExpr regex_'5b'40'5c'5c'5dverbatim'5cb >>= withAttribute KeywordTok) >>~ pushContext "Verbatim")+ ((pRegExpr regex_'5b'40'5c'5c'5dverbatim'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","Verbatim")) <|>- ((pRegExpr regex_'5b'40'5c'5c'5df'5c'5b >>= withAttribute KeywordTok) >>~ pushContext "Formula")+ ((pRegExpr regex_'5b'40'5c'5c'5df'5c'5b >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","Formula")) <|>- ((pRegExpr regex_'5b'40'5c'5c'5dmsc'5cb >>= withAttribute KeywordTok) >>~ pushContext "Msc")+ ((pRegExpr regex_'5b'40'5c'5c'5dmsc'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","Msc")) <|>- ((pRegExpr regex_'5b'40'5c'5c'5ddot'5cb >>= withAttribute KeywordTok) >>~ pushContext "Dot")+ ((pRegExpr regex_'5b'40'5c'5c'5ddot'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Doxygen","Dot")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" list_Note >>= withAttribute KeywordTok)) <|>@@ -398,38 +395,38 @@ <|> ((pRegExpr regex_'26'5bA'2dZa'2dz'5d'2b'3b >>= withAttribute OtherTok))) -parseRules "SL_DetectComment" =+parseRules ("Doxygen","SL_DetectComment") = (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext)) <|> ((pDetectChar False '*' >>= withAttribute CommentTok)) <|> ((pString False "///" >>= withAttribute CommentTok))) -parseRules "Code" =- (((parseRules "SL_DetectComment"))+parseRules ("Doxygen","Code") =+ (((parseRules ("Doxygen","SL_DetectComment"))) <|> ((pRegExpr regex_'5b'40'5c'5c'5dendcode'5cb >>= withAttribute KeywordTok) >>~ (popContext))) -parseRules "Verbatim" =- (((parseRules "SL_DetectComment"))+parseRules ("Doxygen","Verbatim") =+ (((parseRules ("Doxygen","SL_DetectComment"))) <|> ((pRegExpr regex_'5b'40'5c'5c'5dendverbatim'5cb >>= withAttribute KeywordTok) >>~ (popContext))) -parseRules "Formula" =- (((parseRules "SL_DetectComment"))+parseRules ("Doxygen","Formula") =+ (((parseRules ("Doxygen","SL_DetectComment"))) <|> ((pRegExpr regex_'5b'40'5c'5c'5df'5c'5d >>= withAttribute KeywordTok) >>~ (popContext))) -parseRules "Msc" =- (((parseRules "SL_DetectComment"))+parseRules ("Doxygen","Msc") =+ (((parseRules ("Doxygen","SL_DetectComment"))) <|> ((pRegExpr regex_'5b'40'5c'5c'5dendmsc'5cb >>= withAttribute KeywordTok) >>~ (popContext))) -parseRules "Dot" =- (((parseRules "SL_DetectComment"))+parseRules ("Doxygen","Dot") =+ (((parseRules ("Doxygen","SL_DetectComment"))) <|> ((pRegExpr regex_'5b'40'5c'5c'5denddot'5cb >>= withAttribute KeywordTok) >>~ (popContext))) -parseRules "" = parseRules "Normal"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Dtd.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,32 +26,34 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "DTD" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("DTD",["Normal"])], synStLanguage = "DTD", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("DTD","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "Comment" -> return ()- "PI" -> return ()- "Declaration" -> return ()- "String" -> return ()- "InlineComment" -> (popContext) >> pEndLine+ ("DTD","Normal") -> return ()+ ("DTD","Comment") -> return ()+ ("DTD","PI") -> return ()+ ("DTD","Declaration") -> return ()+ ("DTD","String") -> return ()+ ("DTD","InlineComment") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -61,10 +62,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_Category = Set.fromList $ words $ "EMPTY ANY CDATA ID IDREF IDREFS NMTOKEN NMTOKENS ENTITY ENTITIES NOTATION PUBLIC SYSTEM NDATA" list_Keywords = Set.fromList $ words $ "#PCDATA #REQUIRED #IMPLIED #FIXED" @@ -74,26 +71,26 @@ regex_'5cb'5b'5c'2d'5cw'5cd'5c'2e'3a'5f'5d'2b'5cb = compileRegex "\\b[\\-\\w\\d\\.:_]+\\b" regex_'25'5b'5c'2d'5cw'5cd'5c'2e'3a'5f'5d'2b'3b = compileRegex "%[\\-\\w\\d\\.:_]+;" -defaultAttributes = [("Normal",NormalTok),("Comment",CommentTok),("PI",NormalTok),("Declaration",NormalTok),("String",StringTok),("InlineComment",CommentTok)]+defaultAttributes = [(("DTD","Normal"),NormalTok),(("DTD","Comment"),CommentTok),(("DTD","PI"),NormalTok),(("DTD","Declaration"),NormalTok),(("DTD","String"),StringTok),(("DTD","InlineComment"),CommentTok)] -parseRules "Normal" =+parseRules ("DTD","Normal") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("DTD","Comment")) <|>- ((pString False "<?xml" >>= withAttribute KeywordTok) >>~ pushContext "PI")+ ((pString False "<?xml" >>= withAttribute KeywordTok) >>~ pushContext ("DTD","PI")) <|>- ((pString False "<!ELEMENT" >>= withAttribute DataTypeTok) >>~ pushContext "Declaration")+ ((pString False "<!ELEMENT" >>= withAttribute DataTypeTok) >>~ pushContext ("DTD","Declaration")) <|>- ((pString False "<!ATTLIST" >>= withAttribute DataTypeTok) >>~ pushContext "Declaration")+ ((pString False "<!ATTLIST" >>= withAttribute DataTypeTok) >>~ pushContext ("DTD","Declaration")) <|>- ((pString False "<!NOTATION" >>= withAttribute DataTypeTok) >>~ pushContext "Declaration")+ ((pString False "<!NOTATION" >>= withAttribute DataTypeTok) >>~ pushContext ("DTD","Declaration")) <|>- ((pString False "<!ENTITY" >>= withAttribute DataTypeTok) >>~ pushContext "Declaration")+ ((pString False "<!ENTITY" >>= withAttribute DataTypeTok) >>~ pushContext ("DTD","Declaration")) <|> ((pDetectIdentifier >>= withAttribute NormalTok))) -parseRules "Comment" =+parseRules ("DTD","Comment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))@@ -102,17 +99,17 @@ <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "PI" =+parseRules ("DTD","PI") = ((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext)) -parseRules "Declaration" =- (((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "Comment")+parseRules ("DTD","Declaration") =+ (((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("DTD","Comment")) <|>- ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext "InlineComment")+ ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("DTD","InlineComment")) <|> ((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("DTD","String")) <|> ((pRegExpr regex_'28'2d'7cO'29'5cs'28'2d'7cO'29 >>= withAttribute DataTypeTok)) <|>@@ -130,14 +127,14 @@ <|> ((pRegExpr regex_'5cb'5b'5c'2d'5cw'5cd'5c'2e'3a'5f'5d'2b'5cb >>= withAttribute FunctionTok))) -parseRules "String" =+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))) -parseRules "InlineComment" =+parseRules ("DTD","InlineComment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ (popContext))@@ -146,6 +143,6 @@ <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "" = parseRules "Normal"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Eiffel.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,29 +25,31 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Eiffel" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Eiffel",["Normal"])], synStLanguage = "Eiffel", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Eiffel","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "Quoted String" -> (popContext) >> pEndLine- "Documentation" -> (popContext) >> pEndLine+ ("Eiffel","Normal") -> return ()+ ("Eiffel","Quoted String") -> (popContext) >> pEndLine+ ("Eiffel","Documentation") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -57,18 +58,14 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "agent alias all and as assign class convert create creation debug deferred do else elseif end expanded export external feature from frozen if implies indexing infix inherit inspect is like local loop not obsolete old once or prefix pure redefine reference rename rescue retry separate then undefine" list_predefined'2dentities = Set.fromList $ words $ "Current False Precursor Result True TUPLE" list_assertions = Set.fromList $ words $ "check ensure require variant invariant" -defaultAttributes = [("Normal",NormalTok),("Quoted String",StringTok),("Documentation",CommentTok)]+defaultAttributes = [(("Eiffel","Normal"),NormalTok),(("Eiffel","Quoted String"),StringTok),(("Eiffel","Documentation"),CommentTok)] -parseRules "Normal" =+parseRules ("Eiffel","Normal") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_predefined'2dentities >>= withAttribute OtherTok))@@ -81,16 +78,15 @@ <|> ((pHlCChar >>= withAttribute CharTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Quoted String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Eiffel","Quoted String")) <|>- ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext "Documentation"))+ ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("Eiffel","Documentation"))) -parseRules "Quoted String" =+parseRules ("Eiffel","Quoted String") = ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) -parseRules "Documentation" =+parseRules ("Eiffel","Documentation") = pzero -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Email.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -25,27 +24,29 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Email" }- context <- currentContext <|> (pushContext "headder" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Email",["headder"])], synStLanguage = "Email", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = False, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Email","headder")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = False, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "headder" -> return ()+ ("Email","headder") -> return () _ -> return () withAttribute attr txt = do@@ -54,11 +55,7 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'5bTt'5do'3a'2e'2a'24 = compileRegex "[Tt]o:.*$" regex_'5bFf'5drom'3a'2e'2a'24 = compileRegex "[Ff]rom:.*$" regex_'5bCc'5d'5bCc'5d'3a'2e'2a'24 = compileRegex "[Cc][Cc]:.*$"@@ -116,9 +113,9 @@ regex_'5bA'2dZa'2dz0'2d9'2b'3d'2f'5d'2b'3d'24 = compileRegex "[A-Za-z0-9+=/]+=$" regex_'28'2d_'29'3f'2d'2d'28'2d'2d'2e'2a'29'3f = compileRegex "(- )?--(--.*)?" -defaultAttributes = [("headder",NormalTok)]+defaultAttributes = [(("Email","headder"),NormalTok)] -parseRules "headder" =+parseRules ("Email","headder") = (((pColumn 0 >> pRegExpr regex_'5bTt'5do'3a'2e'2a'24 >>= withAttribute AlertTok)) <|> ((pColumn 0 >> pRegExpr regex_'5bFf'5drom'3a'2e'2a'24 >>= withAttribute AlertTok))@@ -235,6 +232,5 @@ <|> ((pColumn 0 >> pRegExpr regex_'28'2d_'29'3f'2d'2d'28'2d'2d'2e'2a'29'3f >>= withAttribute AlertTok))) -parseRules "" = parseRules "headder" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Erlang.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,31 +26,33 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Erlang" }- context <- currentContext <|> (pushContext "Normal Text" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Erlang",["Normal Text"])], synStLanguage = "Erlang", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Erlang","Normal Text")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal Text" -> (popContext) >> pEndLine- "isfunction" -> (popContext) >> pEndLine- "atomquote" -> (popContext) >> pEndLine- "stringquote" -> (popContext) >> pEndLine- "comment" -> (popContext) >> pEndLine+ ("Erlang","Normal Text") -> (popContext) >> pEndLine+ ("Erlang","isfunction") -> (popContext) >> pEndLine+ ("Erlang","atomquote") -> (popContext) >> pEndLine+ ("Erlang","stringquote") -> (popContext) >> pEndLine+ ("Erlang","comment") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -60,10 +61,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "after begin case catch cond end fun if let of query receive all_true some_true" list_operators = Set.fromList $ words $ "div rem or xor bor bxor bsl bsr and band not bnot" list_functions = Set.fromList $ words $ "abs accept alarm apply atom_to_list binary_to_list binary_to_term check_process_code concat_binary date delete_module disconnect_node element erase exit float float_to_list garbage_collect get get_keys group_leader halt hd integer_to_list is_alive is_atom is_binary is_boolean is_float is_function is_integer is_list is_number is_pid is_port is_process_alive is_record is_reference is_tuple length link list_to_atom list_to_binary list_to_float list_to_integer list_to_pid list_to_tuple load_module loaded localtime make_ref module_loaded node nodes now open_port pid_to_list port_close port_command port_connect port_control ports pre_loaded process_flag process_info processes purge_module put register registered round self setelement size spawn spawn_link spawn_opt split_binary statistics term_to_binary throw time tl trunc tuple_to_list unlink unregister whereis"@@ -82,9 +79,9 @@ regex_'28'3f'3a'28'3f'3a'5c'5c'27'29'3f'5b'5e'27'5d'2a'29'2a'27 = compileRegex "(?:(?:\\\\')?[^']*)*'" regex_'28'3f'3a'28'3f'3a'5c'5c'22'29'3f'5b'5e'22'5d'2a'29'2a'22 = compileRegex "(?:(?:\\\\\")?[^\"]*)*\"" -defaultAttributes = [("Normal Text",NormalTok),("isfunction",FunctionTok),("atomquote",CharTok),("stringquote",StringTok),("comment",CommentTok)]+defaultAttributes = [(("Erlang","Normal Text"),NormalTok),(("Erlang","isfunction"),FunctionTok),(("Erlang","atomquote"),CharTok),(("Erlang","stringquote"),StringTok),(("Erlang","comment"),CommentTok)] -parseRules "Normal Text" =+parseRules ("Erlang","Normal Text") = (((pColumn 0 >> pRegExpr regex_'28'3f'3a'2dmodule'7c'2dexport'7c'2ddefine'7c'2dundef'7c'2difdef'7c'2difndef'7c'2delse'7c'2dendif'7c'2dinclude'7c'2dinclude'5flib'29 >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok))@@ -99,19 +96,19 @@ <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "comment")+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("Erlang","comment")) <|> ((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'3a'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)) <|>- ((lookAhead (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'5c'28) >> pushContext "isfunction" >> currentContext >>= parseRules))+ ((lookAhead (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'5c'28) >> pushContext ("Erlang","isfunction") >> currentContext >>= parseRules)) <|> ((pRegExpr regex_'5cb'5b'5fA'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 DataTypeTok) >>~ (popContext)) <|>- ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ pushContext "atomquote")+ ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ pushContext ("Erlang","atomquote")) <|> ((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 CharTok) >>~ (popContext)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "stringquote")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Erlang","stringquote")) <|> ((pRegExpr regex_'5b0'2d9'5d'2b'5c'2e'5b0'2d9'5d'2b'28'3f'3a'5beE'5d'5b'2b'2d'5d'3f'5b0'2d9'5d'2b'29'3f >>= withAttribute FloatTok) >>~ (popContext)) <|>@@ -121,22 +118,22 @@ <|> ((pRegExpr regex_'5b0'2d9'5d'2b >>= withAttribute DecValTok) >>~ (popContext))) -parseRules "isfunction" =+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)) -parseRules "atomquote" =+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)) -parseRules "stringquote" =+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)) -parseRules "comment" =+parseRules ("Erlang","comment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "" = parseRules "Normal Text"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Fortran.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,46 +25,48 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Fortran" }- context <- currentContext <|> (pushContext "default" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Fortran",["default"])], synStLanguage = "Fortran", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = False, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Fortran","default")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = False, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "default" -> return ()- "find_preprocessor" -> return ()- "find_op_and_log" -> return ()- "find_comments" -> return ()- "find_symbols" -> return ()- "inside_func_paren" -> return ()- "find_io_stmnts" -> return ()- "find_io_paren" -> return ()- "format_stmnt" -> return ()- "find_begin_stmnts" -> return ()- "find_end_stmnts" -> return ()- "find_mid_stmnts" -> return ()- "find_decls" -> return ()- "find_paren" -> (popContext) >> pEndLine- "find_intrinsics" -> return ()- "find_numbers" -> return ()- "find_strings" -> return ()- "string_1" -> return ()- "string_2" -> return ()- "end_of_string" -> return ()+ ("Fortran","default") -> return ()+ ("Fortran","find_preprocessor") -> return ()+ ("Fortran","find_op_and_log") -> return ()+ ("Fortran","find_comments") -> return ()+ ("Fortran","find_symbols") -> return ()+ ("Fortran","inside_func_paren") -> return ()+ ("Fortran","find_io_stmnts") -> return ()+ ("Fortran","find_io_paren") -> return ()+ ("Fortran","format_stmnt") -> return ()+ ("Fortran","find_begin_stmnts") -> return ()+ ("Fortran","find_end_stmnts") -> return ()+ ("Fortran","find_mid_stmnts") -> return ()+ ("Fortran","find_decls") -> return ()+ ("Fortran","find_paren") -> (popContext) >> pEndLine+ ("Fortran","find_intrinsics") -> return ()+ ("Fortran","find_numbers") -> return ()+ ("Fortran","find_strings") -> return ()+ ("Fortran","string_1") -> return ()+ ("Fortran","string_2") -> return ()+ ("Fortran","end_of_string") -> return () _ -> return () withAttribute attr txt = do@@ -74,10 +75,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "allocate break call case common continue cycle deallocate default forall where elsewhere equivalence exit external for go goto if implicit include interface intrinsic namelist none nullify operator assignment pause procedure pure elemental record recursive result return select selectcase stop to use only entry while" list_io'5ffunctions = Set.fromList $ words $ "access backspace close inquire open print read rewind write format" list_io'5fkeywords = Set.fromList $ words $ "unit end err fmt iostat status advance size eor"@@ -134,49 +131,49 @@ regex_'5b'5e'22'5d'2a'22 = compileRegex "[^\"]*\"" regex_'28'21'2e'2a'29'3f'24 = compileRegex "(!.*)?$" -defaultAttributes = [("default",NormalTok),("find_preprocessor",NormalTok),("find_op_and_log",NormalTok),("find_comments",NormalTok),("find_symbols",NormalTok),("inside_func_paren",NormalTok),("find_io_stmnts",NormalTok),("find_io_paren",NormalTok),("format_stmnt",NormalTok),("find_begin_stmnts",NormalTok),("find_end_stmnts",NormalTok),("find_mid_stmnts",NormalTok),("find_decls",NormalTok),("find_paren",DataTypeTok),("find_intrinsics",NormalTok),("find_numbers",NormalTok),("find_strings",StringTok),("string_1",StringTok),("string_2",StringTok),("end_of_string",StringTok)]+defaultAttributes = [(("Fortran","default"),NormalTok),(("Fortran","find_preprocessor"),NormalTok),(("Fortran","find_op_and_log"),NormalTok),(("Fortran","find_comments"),NormalTok),(("Fortran","find_symbols"),NormalTok),(("Fortran","inside_func_paren"),NormalTok),(("Fortran","find_io_stmnts"),NormalTok),(("Fortran","find_io_paren"),NormalTok),(("Fortran","format_stmnt"),NormalTok),(("Fortran","find_begin_stmnts"),NormalTok),(("Fortran","find_end_stmnts"),NormalTok),(("Fortran","find_mid_stmnts"),NormalTok),(("Fortran","find_decls"),NormalTok),(("Fortran","find_paren"),DataTypeTok),(("Fortran","find_intrinsics"),NormalTok),(("Fortran","find_numbers"),NormalTok),(("Fortran","find_strings"),StringTok),(("Fortran","string_1"),StringTok),(("Fortran","string_2"),StringTok),(("Fortran","end_of_string"),StringTok)] -parseRules "default" =- (((parseRules "find_strings"))+parseRules ("Fortran","default") =+ (((parseRules ("Fortran","find_strings"))) <|>- ((parseRules "find_decls"))+ ((parseRules ("Fortran","find_decls"))) <|>- ((parseRules "find_intrinsics"))+ ((parseRules ("Fortran","find_intrinsics"))) <|>- ((parseRules "find_io_stmnts"))+ ((parseRules ("Fortran","find_io_stmnts"))) <|>- ((parseRules "find_op_and_log"))+ ((parseRules ("Fortran","find_op_and_log"))) <|>- ((parseRules "find_numbers"))+ ((parseRules ("Fortran","find_numbers"))) <|>- ((parseRules "find_preprocessor"))+ ((parseRules ("Fortran","find_preprocessor"))) <|>- ((parseRules "find_comments"))+ ((parseRules ("Fortran","find_comments"))) <|>- ((parseRules "find_symbols"))+ ((parseRules ("Fortran","find_symbols"))) <|>- ((parseRules "find_begin_stmnts"))+ ((parseRules ("Fortran","find_begin_stmnts"))) <|>- ((parseRules "find_end_stmnts"))+ ((parseRules ("Fortran","find_end_stmnts"))) <|>- ((parseRules "find_mid_stmnts")))+ ((parseRules ("Fortran","find_mid_stmnts")))) -parseRules "find_preprocessor" =+parseRules ("Fortran","find_preprocessor") = ((pColumn 0 >> pRegExpr regex_'28'23'7ccDEC'5c'24'7cCDEC'5c'24'29'2e'2a'24 >>= withAttribute OtherTok)) -parseRules "find_op_and_log" =+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))) -parseRules "find_comments" =+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))) -parseRules "find_symbols" =+parseRules ("Fortran","find_symbols") = (((pDetect2Chars False '*' '*' >>= withAttribute KeywordTok)) <|> ((pDetect2Chars False '(' '/' >>= withAttribute KeywordTok))@@ -187,34 +184,34 @@ <|> ((pAnyChar "()," >>= withAttribute NormalTok))) -parseRules "inside_func_paren" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "inside_func_paren")+parseRules ("Fortran","inside_func_paren") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Fortran","inside_func_paren")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "find_strings"))+ ((parseRules ("Fortran","find_strings"))) <|>- ((parseRules "find_intrinsics"))+ ((parseRules ("Fortran","find_intrinsics"))) <|>- ((parseRules "find_numbers")))+ ((parseRules ("Fortran","find_numbers")))) -parseRules "find_io_stmnts" =- (((pRegExpr regex_'5cb'28read'7cwrite'7cbackspace'7crewind'7cend'5cs'2afile'7cclose'29'5cs'2a'5b'28'5d >>= withAttribute FunctionTok) >>~ pushContext "find_io_paren")+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")) <|>- ((pRegExpr regex_'5cbopen'5cs'2a'5b'28'5d >>= withAttribute FunctionTok) >>~ pushContext "find_io_paren")+ ((pRegExpr regex_'5cbopen'5cs'2a'5b'28'5d >>= withAttribute FunctionTok) >>~ pushContext ("Fortran","find_io_paren")) <|>- ((pRegExpr regex_'5cbinquire'5cs'2a'5b'28'5d >>= withAttribute FunctionTok) >>~ pushContext "find_io_paren")+ ((pRegExpr regex_'5cbinquire'5cs'2a'5b'28'5d >>= withAttribute FunctionTok) >>~ pushContext ("Fortran","find_io_paren")) <|>- ((pRegExpr regex_'5cbformat'5cs'2a'5b'28'5d >>= withAttribute FunctionTok) >>~ pushContext "format_stmnt")+ ((pRegExpr regex_'5cbformat'5cs'2a'5b'28'5d >>= withAttribute FunctionTok) >>~ pushContext ("Fortran","format_stmnt")) <|> ((pRegExpr regex_'5cbend'5cs'2afile'5cb >>= withAttribute FunctionTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_io'5ffunctions >>= withAttribute FunctionTok))) -parseRules "find_io_paren" =+parseRules ("Fortran","find_io_paren") = (((pDetectChar False '*' >>= withAttribute FunctionTok)) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "inside_func_paren")+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Fortran","inside_func_paren")) <|> ((pDetectChar False ')' >>= withAttribute FunctionTok) >>~ (popContext)) <|>@@ -224,16 +221,16 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_open'5fkeywords >>= withAttribute FunctionTok)) <|>- ((parseRules "find_strings"))+ ((parseRules ("Fortran","find_strings"))) <|>- ((parseRules "find_intrinsics"))+ ((parseRules ("Fortran","find_intrinsics"))) <|>- ((parseRules "find_numbers"))+ ((parseRules ("Fortran","find_numbers"))) <|>- ((parseRules "find_symbols")))+ ((parseRules ("Fortran","find_symbols")))) -parseRules "format_stmnt" =- (((pDetectChar False '(' >>= withAttribute FunctionTok) >>~ pushContext "format_stmnt")+parseRules ("Fortran","format_stmnt") =+ (((pDetectChar False '(' >>= withAttribute FunctionTok) >>~ pushContext ("Fortran","format_stmnt")) <|> ((pDetectChar False ')' >>= withAttribute FunctionTok) >>~ (popContext)) <|>@@ -241,11 +238,11 @@ <|> ((pAnyChar ":" >>= withAttribute FunctionTok)) <|>- ((parseRules "find_strings"))+ ((parseRules ("Fortran","find_strings"))) <|>- ((parseRules "find_symbols")))+ ((parseRules ("Fortran","find_symbols")))) -parseRules "find_begin_stmnts" =+parseRules ("Fortran","find_begin_stmnts") = (((pRegExpr regex_'5cbmodule'5cs'2bprocedure'5cb >>= withAttribute KeywordTok)) <|> ((pRegExpr regex_'5cb'28subroutine'7cfunction'7cblock'5cs'2adata'29'5cb >>= withAttribute KeywordTok))@@ -254,7 +251,7 @@ <|> ((pRegExpr regex_'5cb'28then'7cdo'29'5cb >>= withAttribute KeywordTok))) -parseRules "find_end_stmnts" =+parseRules ("Fortran","find_end_stmnts") = (((pRegExpr regex_'5cbend'5cs'2a'28subroutine'7cfunction'7cblock'5cs'2adata'29'5cb >>= withAttribute KeywordTok)) <|> ((pRegExpr regex_'5cbend'5cs'2a'28program'7cmodule'29'5cb >>= withAttribute KeywordTok))@@ -267,12 +264,12 @@ <|> ((pRegExpr regex_'5cbend'5cb >>= withAttribute KeywordTok))) -parseRules "find_mid_stmnts" =+parseRules ("Fortran","find_mid_stmnts") = (((pRegExpr regex_'5cbelse'5cb >>= withAttribute KeywordTok)) <|> ((pRegExpr regex_'5cbcontains'5cb >>= withAttribute KeywordTok))) -parseRules "find_decls" =+parseRules ("Fortran","find_decls") = (((pRegExpr regex_'5cbinteger'5b'5c'2a'5d'5cd'7b1'2c2'7d >>= withAttribute DataTypeTok)) <|> ((pRegExpr regex_'5cbreal'5b'5c'2a'5d'5cd'7b1'2c2'7d >>= withAttribute DataTypeTok))@@ -285,24 +282,24 @@ <|> ((pColumn 0 >> pRegExpr regex_'5cs'2adata'5cb >>= withAttribute DataTypeTok)) <|>- ((pColumn 0 >> pRegExpr regex_'5cs'2areal'5cs'2a'5b'28'5d >>= withAttribute DataTypeTok) >>~ pushContext "find_paren")+ ((pColumn 0 >> pRegExpr regex_'5cs'2areal'5cs'2a'5b'28'5d >>= withAttribute DataTypeTok) >>~ pushContext ("Fortran","find_paren")) <|> ((pColumn 0 >> pRegExpr regex_'5cs'2areal'28'3f'21'5b'5cw'5c'2a'5d'29 >>= withAttribute DataTypeTok)) <|> ((pRegExpr regex_'5cbcharacter'5b'2a'5d'5b0'2d9'5d'2b'5cb >>= withAttribute DataTypeTok)) <|>- ((pRegExpr regex_'5cb'28type'7cinteger'7ccomplex'7ccharacter'7clogical'7cintent'7cdimension'29'5cb'5cs'2a'5b'28'5d >>= withAttribute DataTypeTok) >>~ pushContext "find_paren")+ ((pRegExpr regex_'5cb'28type'7cinteger'7ccomplex'7ccharacter'7clogical'7cintent'7cdimension'29'5cb'5cs'2a'5b'28'5d >>= withAttribute DataTypeTok) >>~ pushContext ("Fortran","find_paren")) <|> ((pRegExpr regex_'5cb'28type'7cinteger'7ccomplex'7ccharacter'7clogical'7cintent'7cdimension'29'5cb >>= withAttribute DataTypeTok)) <|> ((pDetect2Chars False ':' ':' >>= withAttribute DataTypeTok))) -parseRules "find_paren" =- (((pDetectChar False '(' >>= withAttribute DataTypeTok) >>~ pushContext "find_paren")+parseRules ("Fortran","find_paren") =+ (((pDetectChar False '(' >>= withAttribute DataTypeTok) >>~ pushContext ("Fortran","find_paren")) <|> ((pDetectChar False ')' >>= withAttribute DataTypeTok) >>~ (popContext))) -parseRules "find_intrinsics" =+parseRules ("Fortran","find_intrinsics") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_elemental'5fprocs >>= withAttribute KeywordTok))@@ -313,7 +310,7 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_non'5felem'5fsubr >>= withAttribute KeywordTok))) -parseRules "find_numbers" =+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)) <|> ((pRegExpr regex_'5cb'5b0'2d9'5d'2b'5c'2e'5b0'2d9'5d'2a'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'28'3f'21'5ba'2dz'5d'29 >>= withAttribute FloatTok))@@ -324,30 +321,30 @@ <|> ((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))) -parseRules "find_strings" =- (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "string_1")+parseRules ("Fortran","find_strings") =+ (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Fortran","string_1")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "string_2"))+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Fortran","string_2"))) -parseRules "string_1" =+parseRules ("Fortran","string_1") = (((pRegExpr regex_'5b'5e'27'5d'2a'27 >>= withAttribute StringTok) >>~ (popContext)) <|>- ((pRegExpr regex_'26'5cs'2a'24 >>= withAttribute KeywordTok) >>~ pushContext "end_of_string")+ ((pRegExpr regex_'26'5cs'2a'24 >>= withAttribute KeywordTok) >>~ pushContext ("Fortran","end_of_string")) <|>- ((pRegExpr regex_'2e'2a'28'3f'3d'26'5cs'2a'24'29 >>= withAttribute StringTok) >>~ pushContext "end_of_string")+ ((pRegExpr regex_'2e'2a'28'3f'3d'26'5cs'2a'24'29 >>= withAttribute StringTok) >>~ pushContext ("Fortran","end_of_string")) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "string_2" =+parseRules ("Fortran","string_2") = (((pRegExpr regex_'5b'5e'22'5d'2a'22 >>= withAttribute StringTok) >>~ (popContext)) <|>- ((pRegExpr regex_'26'5cs'2a'24 >>= withAttribute KeywordTok) >>~ pushContext "end_of_string")+ ((pRegExpr regex_'26'5cs'2a'24 >>= withAttribute KeywordTok) >>~ pushContext ("Fortran","end_of_string")) <|>- ((pRegExpr regex_'2e'2a'28'3f'3d'26'5cs'2a'24'29 >>= withAttribute StringTok) >>~ pushContext "end_of_string")+ ((pRegExpr regex_'2e'2a'28'3f'3d'26'5cs'2a'24'29 >>= withAttribute StringTok) >>~ pushContext ("Fortran","end_of_string")) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "end_of_string" =+parseRules ("Fortran","end_of_string") = (((pDetectSpaces >>= withAttribute StringTok)) <|> ((pRegExpr regex_'26'5cs'2a'24 >>= withAttribute KeywordTok))@@ -358,6 +355,5 @@ <|> ((popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "" = parseRules "default" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Fsharp.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,37 +25,39 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "FSharp" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("FSharp",["Normal"])], synStLanguage = "FSharp", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("FSharp","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "Singleline Comment" -> (popContext) >> pEndLine- "Multiline Comment" -> return ()- "String Constant" -> return ()- "Block" -> return ()- "Sig" -> return ()- "Struct" -> return ()- "Object" -> return ()- "ModuleEnv" -> return ()- "ModuleEnv2" -> return ()- "Camlp4 Quotation Constant" -> return ()+ ("FSharp","Normal") -> return ()+ ("FSharp","Singleline Comment") -> (popContext) >> pEndLine+ ("FSharp","Multiline Comment") -> return ()+ ("FSharp","String Constant") -> return ()+ ("FSharp","Block") -> return ()+ ("FSharp","Sig") -> return ()+ ("FSharp","Struct") -> return ()+ ("FSharp","Object") -> return ()+ ("FSharp","ModuleEnv") -> return ()+ ("FSharp","ModuleEnv2") -> return ()+ ("FSharp","Camlp4 Quotation Constant") -> return () _ -> return () withAttribute attr txt = do@@ -65,10 +66,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "abstract and as assert base class delegate dowcast downto elif else exception extern false for fun function functor global if in inherit inline interfaece internal lazy let match member mutable namespace new not null of or override private public rec ref return static then to true try type upcast use val void when while with yield" list_core_types = Set.fromList $ words $ "bool byte sbyte int16 uint16 int uint32 int64 uint64 nativeint unativeint char string decimal unit void float32 single float double bigint option seq" list_symbols = Set.fromList $ words $ "?"@@ -98,12 +95,12 @@ regex_'5c'5c'28'5c'5c'7c'3e'3e'7c'3c'3c'29 = compileRegex "\\\\(\\\\|>>|<<)" 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 = compileRegex "\\\\<:[A-Za-z\\0300-\\0326\\0330-\\0366\\0370-\\0377_][A-Za-z\\0300-\\0326\\0330-\\0366\\0370-\\03770-9_']*<" -defaultAttributes = [("Normal",NormalTok),("Singleline Comment",CommentTok),("Multiline Comment",CommentTok),("String Constant",StringTok),("Block",NormalTok),("Sig",NormalTok),("Struct",NormalTok),("Object",NormalTok),("ModuleEnv",NormalTok),("ModuleEnv2",NormalTok),("Camlp4 Quotation Constant",StringTok)]+defaultAttributes = [(("FSharp","Normal"),NormalTok),(("FSharp","Singleline Comment"),CommentTok),(("FSharp","Multiline Comment"),CommentTok),(("FSharp","String Constant"),StringTok),(("FSharp","Block"),NormalTok),(("FSharp","Sig"),NormalTok),(("FSharp","Struct"),NormalTok),(("FSharp","Object"),NormalTok),(("FSharp","ModuleEnv"),NormalTok),(("FSharp","ModuleEnv2"),NormalTok),(("FSharp","Camlp4 Quotation Constant"),StringTok)] -parseRules "Normal" =- (((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext "Multiline Comment")+parseRules ("FSharp","Normal") =+ (((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("FSharp","Multiline Comment")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute NormalTok) >>~ pushContext "Singleline Comment")+ ((pDetect2Chars False '/' '/' >>= withAttribute NormalTok) >>~ pushContext ("FSharp","Singleline Comment")) <|> ((pDetectChar False '(' >>= withAttribute NormalTok)) <|>@@ -129,31 +126,31 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_done >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_module'5fenvironment >>= withAttribute OtherTok) >>~ pushContext "ModuleEnv")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_module'5fenvironment >>= withAttribute OtherTok) >>~ pushContext ("FSharp","ModuleEnv")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_begin >>= withAttribute KeywordTok) >>~ pushContext "Block")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_begin >>= withAttribute KeywordTok) >>~ pushContext ("FSharp","Block")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_object >>= withAttribute KeywordTok) >>~ pushContext "Object")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_object >>= withAttribute KeywordTok) >>~ pushContext ("FSharp","Object")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_sig >>= withAttribute KeywordTok) >>~ pushContext "Sig")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_sig >>= withAttribute KeywordTok) >>~ pushContext ("FSharp","Sig")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_struct >>= withAttribute KeywordTok) >>~ pushContext "Struct")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_struct >>= withAttribute KeywordTok) >>~ pushContext ("FSharp","Struct")) <|> ((pRegExpr regex_'60'5cs'2a'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 >>= withAttribute NormalTok)) <|>- ((lookAhead (pRegExpr regex_'5bA'2dZ'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a'5cs'2a'5c'2e) >> pushContext "ModuleEnv2" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'5bA'2dZ'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a'5cs'2a'5c'2e) >> pushContext ("FSharp","ModuleEnv2") >> currentContext >>= parseRules)) <|> ((pRegExpr regex_'5bA'2dZ'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a >>= withAttribute NormalTok)) <|> ((pFirstNonSpace >> pRegExpr regex_'23'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'2e'2a'24 >>= withAttribute OtherTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String Constant")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("FSharp","String Constant")) <|> ((pRegExpr regex_'27'28'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'7c'5b'5e'27'5d'29'27 >>= withAttribute CharTok)) <|>- ((pDetect2Chars False '<' '<' >>= withAttribute StringTok) >>~ pushContext "Camlp4 Quotation Constant")+ ((pDetect2Chars False '<' '<' >>= withAttribute StringTok) >>~ pushContext ("FSharp","Camlp4 Quotation Constant")) <|>- ((pRegExpr regex_'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 StringTok) >>~ pushContext "Camlp4 Quotation Constant")+ ((pRegExpr regex_'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 StringTok) >>~ pushContext ("FSharp","Camlp4 Quotation Constant")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|>@@ -171,68 +168,67 @@ <|> ((pRegExpr regex_'2d'3f'5b0'2d9'5d'5b0'2d9'5f'5d'2a >>= withAttribute DecValTok))) -parseRules "Singleline Comment" =+parseRules ("FSharp","Singleline Comment") = pzero -parseRules "Multiline Comment" =+parseRules ("FSharp","Multiline Comment") = (((pDetect2Chars False '*' ')' >>= withAttribute CommentTok) >>~ (popContext)) <|>- ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext "Multiline Comment"))+ ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("FSharp","Multiline Comment"))) -parseRules "String Constant" =+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))) -parseRules "Block" =+parseRules ("FSharp","Block") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "Normal")))+ ((parseRules ("FSharp","Normal")))) -parseRules "Sig" =+parseRules ("FSharp","Sig") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "Normal")))+ ((parseRules ("FSharp","Normal")))) -parseRules "Struct" =+parseRules ("FSharp","Struct") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "Normal")))+ ((parseRules ("FSharp","Normal")))) -parseRules "Object" =+parseRules ("FSharp","Object") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "Normal")))+ ((parseRules ("FSharp","Normal")))) -parseRules "ModuleEnv" =+parseRules ("FSharp","ModuleEnv") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((lookAhead (pRegExpr regex_'5bA'2dZ'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a'5cs'2a'5c'2e) >> pushContext "ModuleEnv2" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'5bA'2dZ'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a'5cs'2a'5c'2e) >> pushContext ("FSharp","ModuleEnv2") >> currentContext >>= parseRules)) <|> ((pRegExpr regex_'5bA'2dZ'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a >>= withAttribute NormalTok) >>~ (popContext)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "ModuleEnv2" =+parseRules ("FSharp","ModuleEnv2") = (((pRegExpr regex_'5bA'2dZ'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a >>= withAttribute NormalTok)) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pString False "." >>= withAttribute KeywordTok) >>~ (popContext))) -parseRules "Camlp4 Quotation Constant" =+parseRules ("FSharp","Camlp4 Quotation Constant") = (((pDetect2Chars False '>' '>' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((pDetect2Chars False '<' '<' >>= withAttribute StringTok) >>~ pushContext "Camlp4 Quotation Constant")+ ((pDetect2Chars False '<' '<' >>= withAttribute StringTok) >>~ pushContext ("FSharp","Camlp4 Quotation Constant")) <|>- ((pRegExpr regex_'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 StringTok) >>~ pushContext "Camlp4 Quotation Constant")+ ((pRegExpr regex_'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 StringTok) >>~ pushContext ("FSharp","Camlp4 Quotation Constant")) <|> ((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))) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Gnuassembler.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,33 +26,35 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "GNU Assembler" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("GNU Assembler",["Normal"])], synStLanguage = "GNU Assembler", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("GNU Assembler","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "Commentar 1" -> return ()- "Commentar 2" -> (popContext) >> pEndLine- "String" -> (popContext) >> pEndLine- "Preprocessor" -> (popContext) >> pEndLine- "Define" -> (popContext) >> pEndLine- "Some Context" -> (popContext) >> pEndLine+ ("GNU Assembler","Normal") -> return ()+ ("GNU Assembler","Commentar 1") -> return ()+ ("GNU Assembler","Commentar 2") -> (popContext) >> pEndLine+ ("GNU Assembler","String") -> (popContext) >> pEndLine+ ("GNU Assembler","Preprocessor") -> (popContext) >> pEndLine+ ("GNU Assembler","Define") -> (popContext) >> pEndLine+ ("GNU Assembler","Some Context") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -62,10 +63,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ ".abort .align .app-file .appline .ascii .asciz .att_syntax .balign .balignl .balignw .byte .code16 .code32 .comm .common.s .common .data .dc.b .dc.d .dc.l .dc.s .dc.w .dc.x .dc .dcb.b .dcb.d .dcb.l .dcb.s .dcb.w .dcb.x .dcb .debug .def .desc .dim .double .ds.b .ds.d .ds.l .ds.p .ds.s .ds.w .ds.x .ds .dsect .eject .else .elsec .elseif .end .endc .endef .endfunc .endif .endm .endr .equ .equiv .err .exitm .extend .extern .fail .file .fill .float .format .func .global .globl .hidden .hword .ident .if .ifc .ifdef .ifeq .ifeqs .ifge .ifgt .ifle .iflt .ifnc .ifndef .ifne .ifnes .ifnotdef .include .int .intel_syntax .internal .irep .irepc .irp .irpc .lcomm .lflags .line .linkonce .list .llen .ln .long .lsym .macro .mexit .name .noformat .nolist .nopage noprefix .octa .offset .org .p2align .p2alignl .p2alignw .page .plen .popsection .previous .print .protected .psize .purgem .pushsection .quad .rodata .rep .rept .rva .sbttl .scl .sect.s .sect .section.s .section .set .short .single .size .skip .sleb128 .space .spc .stabd .stabn .stabs .string .struct .subsection .symver .tag .text .title .ttl .type .uleb128 .use .val .version .vtable_entry .vtable_inherit .weak .word .xcom .xdef .xref .xstabs .zero .arm .bss .code .even .force_thumb .ldouble .loc .ltorg .packed .pool .req .thumb .thumb_func .thumb_set" regex_'5b'5f'5cw'5cd'2d'5d'2a'5cs'2a'3a = compileRegex "[_\\w\\d-]*\\s*:"@@ -78,9 +75,9 @@ regex_'23'5cs'2adefine'2e'2a'28'28'3f'3d'5c'5c'29'29 = compileRegex "#\\s*define.*((?=\\\\))" 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 = compileRegex "#\\s*(?:el(?:se|if)|include(?:_next)?|define|undef|line|error|warning|pragma)" -defaultAttributes = [("Normal",NormalTok),("Commentar 1",CommentTok),("Commentar 2",CommentTok),("String",StringTok),("Preprocessor",OtherTok),("Define",OtherTok),("Some Context",NormalTok)]+defaultAttributes = [(("GNU Assembler","Normal"),NormalTok),(("GNU Assembler","Commentar 1"),CommentTok),(("GNU Assembler","Commentar 2"),CommentTok),(("GNU Assembler","String"),StringTok),(("GNU Assembler","Preprocessor"),OtherTok),(("GNU Assembler","Define"),OtherTok),(("GNU Assembler","Some Context"),NormalTok)] -parseRules "Normal" =+parseRules ("GNU Assembler","Normal") = (((pRegExpr regex_'5b'5f'5cw'5cd'2d'5d'2a'5cs'2a'3a >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok))@@ -101,46 +98,46 @@ <|> ((pRegExpr regex_'27'28'5c'5cx'5b0'2d9a'2dfA'2dF'5d'5b0'2d9a'2dfA'2dF'5d'3f'7c'5c'5c'5b0'2d7'5d'3f'5b0'2d7'5d'3f'5b0'2d7'5d'3f'7c'5c'5c'2e'7c'2e'29 >>= withAttribute CharTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("GNU Assembler","String")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'28'3f'3adef'7cndef'29'3f'28'3f'3d'5cs'2b'5cS'29 >>= withAttribute OtherTok) >>~ pushContext "Preprocessor")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'28'3f'3adef'7cndef'29'3f'28'3f'3d'5cs'2b'5cS'29 >>= withAttribute OtherTok) >>~ pushContext ("GNU Assembler","Preprocessor")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute OtherTok) >>~ pushContext "Preprocessor")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute OtherTok) >>~ pushContext ("GNU Assembler","Preprocessor")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2adefine'2e'2a'28'28'3f'3d'5c'5c'29'29 >>= withAttribute OtherTok) >>~ pushContext "Define")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2adefine'2e'2a'28'28'3f'3d'5c'5c'29'29 >>= withAttribute OtherTok) >>~ pushContext ("GNU Assembler","Define")) <|>- ((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 "Preprocessor")+ ((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 ("GNU Assembler","Preprocessor")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("GNU Assembler","Commentar 1")) <|>- ((pAnyChar "@;#" >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pAnyChar "@;#" >>= withAttribute CommentTok) >>~ pushContext ("GNU Assembler","Commentar 2")) <|> ((pAnyChar "!#%&*()+,-<=>?/:[]^{|}~" >>= withAttribute NormalTok))) -parseRules "Commentar 1" =+parseRules ("GNU Assembler","Commentar 1") = (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Commentar 2" =+parseRules ("GNU Assembler","Commentar 2") = ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) -parseRules "String" =- (((pLineContinue >>= withAttribute StringTok) >>~ pushContext "Some Context")+parseRules ("GNU Assembler","String") =+ (((pLineContinue >>= withAttribute StringTok) >>~ pushContext ("GNU Assembler","Some Context")) <|> ((pHlCStringChar >>= withAttribute CharTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Preprocessor" =+parseRules ("GNU Assembler","Preprocessor") = pzero -parseRules "Define" =+parseRules ("GNU Assembler","Define") = ((pLineContinue >>= withAttribute OtherTok)) -parseRules "Some Context" =+parseRules ("GNU Assembler","Some Context") = pzero -parseRules "" = parseRules "Normal"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Go.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,31 +26,33 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Go" }- context <- currentContext <|> (pushContext "normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Go",["normal"])], synStLanguage = "Go", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Go","normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "normal" -> return ()- "Commentar 1" -> (popContext) >> pEndLine- "Commentar 2" -> return ()- "String" -> (popContext) >> pEndLine- "Multiline String" -> return ()+ ("Go","normal") -> return ()+ ("Go","Commentar 1") -> (popContext) >> pEndLine+ ("Go","Commentar 2") -> return ()+ ("Go","String") -> (popContext) >> pEndLine+ ("Go","Multiline String") -> return () _ -> return () withAttribute attr txt = do@@ -60,19 +61,15 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "break case chan const continue default defer else fallthrough for func go goto if import interface map package range return select struct switch type var" list_types = Set.fromList $ words $ "bool byte complex64 complex128 error float float32 float64 int int8 int16 int32 int64 rune string uint uint8 uint16 uint32 uint64" list_builtin = Set.fromList $ words $ "append cap close complex copy imag len make new panic print println real recover" list_predeclared = Set.fromList $ words $ "false nil true iota" -defaultAttributes = [("normal",NormalTok),("Commentar 1",CommentTok),("Commentar 2",CommentTok),("String",StringTok),("Multiline String",StringTok)]+defaultAttributes = [(("Go","normal"),NormalTok),(("Go","Commentar 1"),CommentTok),(("Go","Commentar 2"),CommentTok),(("Go","String"),StringTok),(("Go","Multiline String"),StringTok)] -parseRules "normal" =+parseRules ("Go","normal") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\'\"" list_keywords >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\'\"" list_predeclared >>= withAttribute OtherTok))@@ -85,9 +82,9 @@ <|> ((pDetectChar False '}' >>= withAttribute NormalTok)) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Go","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Go","Commentar 2")) <|> ((pHlCOct >>= withAttribute BaseNTok)) <|>@@ -95,13 +92,13 @@ <|> ((pHlCChar >>= withAttribute CharTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Go","String")) <|>- ((pDetectChar False '`' >>= withAttribute NormalTok) >>~ pushContext "Multiline String")+ ((pDetectChar False '`' >>= withAttribute NormalTok) >>~ pushContext ("Go","Multiline String")) <|> ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))) -parseRules "Commentar 1" =+parseRules ("Go","Commentar 1") = (((pLineContinue >>= withAttribute CommentTok)) <|> ((pDetectSpaces >>= withAttribute CommentTok))@@ -110,7 +107,7 @@ <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "Commentar 2" =+parseRules ("Go","Commentar 2") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))@@ -119,20 +116,20 @@ <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "String" =+parseRules ("Go","String") = (((pLineContinue >>= withAttribute StringTok)) <|> ((pHlCStringChar >>= withAttribute CharTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Multiline String" =+parseRules ("Go","Multiline String") = (((pLineContinue >>= withAttribute StringTok)) <|> ((pHlCStringChar >>= withAttribute CharTok)) <|> ((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "" = parseRules "normal"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Haskell.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,32 +25,34 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Haskell" }- context <- currentContext <|> (pushContext "code" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Haskell",["code"])], synStLanguage = "Haskell", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Haskell","code")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "code" -> return ()- "comment" -> (popContext) >> pEndLine- "comments" -> return ()- "char" -> (popContext) >> pEndLine- "string" -> return ()- "infix" -> return ()+ ("Haskell","code") -> return ()+ ("Haskell","comment") -> (popContext) >> pEndLine+ ("Haskell","comments") -> return ()+ ("Haskell","char") -> (popContext) >> pEndLine+ ("Haskell","string") -> return ()+ ("Haskell","infix") -> return () _ -> return () withAttribute attr txt = do@@ -60,10 +61,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "as case class data deriving do else hiding if import in infixl infixr instance let module newtype of primitive qualified then type where" list_prelude_function = Set.fromList $ words $ "FilePath IOError abs acos acosh all and any appendFile approxRational asTypeOf asin asinh atan atan2 atanh basicIORun break catch ceiling chr compare concat concatMap const cos cosh curry cycle decodeFloat denominator digitToInt div divMod drop dropWhile either elem encodeFloat enumFrom enumFromThen enumFromThenTo enumFromTo error even exp exponent fail filter flip floatDigits floatRadix floatRange floor fmap foldl foldl1 foldr foldr1 fromDouble fromEnum fromInt fromInteger fromIntegral fromRational fst gcd getChar getContents getLine group head id inRange index init intToDigit interact ioError isAlpha isAlphaNum isAscii isControl isDenormalized isDigit isHexDigit isIEEE isInfinite isLower isNaN isNegativeZero isOctDigit isPrint isSpace isUpper iterate last lcm length lex lexDigits lexLitChar lines log logBase lookup map mapM mapM_ max maxBound maximum maybe min minBound minimum mod negate not notElem null numerator odd or ord otherwise pack pi pred primExitWith print product properFraction putChar putStr putStrLn quot quotRem range rangeSize read readDec readFile readFloat readHex readIO readInt readList readLitChar readLn readOct readParen readSigned reads readsPrec realToFrac recip rem repeat replicate return reverse round scaleFloat scanl scanl1 scanr scanr1 seq sequence sequence_ show showChar showInt showList showLitChar showParen showSigned showString shows showsPrec significand signum sin sinh snd sort span splitAt sqrt subtract succ sum tail take takeWhile tan tanh threadToIOResult toEnum toInt toInteger toLower toRational toUpper truncate uncurry undefined unlines until unwords unzip unzip3 userError words writeFile zip zip3 zipWith zipWith3" list_prelude_class = Set.fromList $ words $ "Bounded Enum Eq Floating Fractional Functor Integral Ix Monad Num Ord Read Real RealFloat RealFrac Show"@@ -83,14 +80,14 @@ regex_'28'5bA'2dZ'5d'5ba'2dzA'2dZ0'2d9'5f'27'5d'2a'5c'2e'29'2a'5bA'2dZ'5d'5ba'2dzA'2dZ0'2d9'5f'27'5d'2a = compileRegex "([A-Z][a-zA-Z0-9_']*\\.)*[A-Z][a-zA-Z0-9_']*" regex_'5c'5c'2e = compileRegex "\\\\." -defaultAttributes = [("code",NormalTok),("comment",CommentTok),("comments",CommentTok),("char",CharTok),("string",StringTok),("infix",OtherTok)]+defaultAttributes = [(("Haskell","code"),NormalTok),(("Haskell","comment"),CommentTok),(("Haskell","comments"),CommentTok),(("Haskell","char"),CharTok),(("Haskell","string"),StringTok),(("Haskell","infix"),OtherTok)] -parseRules "code" =+parseRules ("Haskell","code") = (((pRegExpr regex_'5c'7b'2d'23'2e'2a'23'2d'5c'7d >>= withAttribute OtherTok)) <|>- ((pRegExpr regex_'5c'7b'2d'5b'5e'23'5d'3f >>= withAttribute CommentTok) >>~ pushContext "comments")+ ((pRegExpr regex_'5c'7b'2d'5b'5e'23'5d'3f >>= withAttribute CommentTok) >>~ pushContext ("Haskell","comments")) <|>- ((pRegExpr regex_'2d'2d'5b'5e'5c'2d'21'23'5c'24'25'26'5c'2a'5c'2b'2f'3c'3d'3e'5c'3f'5c'40'5c'5e'5c'7c'7e'5c'2e'3a'5d'2e'2a'24 >>= withAttribute CommentTok) >>~ pushContext "comment")+ ((pRegExpr regex_'2d'2d'5b'5e'5c'2d'21'23'5c'24'25'26'5c'2a'5c'2b'2f'3c'3d'3e'5c'3f'5c'40'5c'5e'5c'7c'7e'5c'2e'3a'5d'2e'2a'24 >>= withAttribute CommentTok) >>~ pushContext ("Haskell","comment")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|>@@ -122,35 +119,34 @@ <|> ((pRegExpr regex_'28'5bA'2dZ'5d'5ba'2dzA'2dZ0'2d9'5f'27'5d'2a'5c'2e'29'2a'5bA'2dZ'5d'5ba'2dzA'2dZ0'2d9'5f'27'5d'2a >>= withAttribute DataTypeTok)) <|>- ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ pushContext "char")+ ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ pushContext ("Haskell","char")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "string")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Haskell","string")) <|>- ((pDetectChar False '`' >>= withAttribute OtherTok) >>~ pushContext "infix")+ ((pDetectChar False '`' >>= withAttribute OtherTok) >>~ pushContext ("Haskell","infix")) <|> ((pDetect2Chars False '.' '.' >>= withAttribute OtherTok)) <|> ((pAnyChar "\8229" >>= withAttribute OtherTok))) -parseRules "comment" =+parseRules ("Haskell","comment") = pzero -parseRules "comments" =+parseRules ("Haskell","comments") = ((pDetect2Chars False '-' '}' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "char" =+parseRules ("Haskell","char") = (((pRegExpr regex_'5c'5c'2e >>= withAttribute CharTok)) <|> ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext))) -parseRules "string" =+parseRules ("Haskell","string") = (((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "infix" =+parseRules ("Haskell","infix") = ((pDetectChar False '`' >>= withAttribute OtherTok) >>~ (popContext)) -parseRules "" = parseRules "code" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Haxe.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,32 +25,34 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Haxe" }- context <- currentContext <|> (pushContext "normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Haxe",["normal"])], synStLanguage = "Haxe", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Haxe","normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "normal" -> return ()- "ModuleName" -> return ()- "RawString" -> return ()- "String" -> return ()- "CommentLine" -> (popContext) >> pEndLine- "CommentBlock" -> return ()+ ("Haxe","normal") -> return ()+ ("Haxe","ModuleName") -> return ()+ ("Haxe","RawString") -> return ()+ ("Haxe","String") -> return ()+ ("Haxe","CommentLine") -> (popContext) >> pEndLine+ ("Haxe","CommentBlock") -> return () _ -> return () withAttribute attr txt = do@@ -60,10 +61,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "break case cast catch class continue default else enum extends false for function if implements in inline interface new null override private public return static super switch this throw trace true try typedef untyped var while" list_modules = Set.fromList $ words $ "package import" list_types = Set.fromList $ words $ "Array Void Bool Int UInt Float Dynamic String List Error Unknown Type"@@ -77,16 +74,16 @@ regex_'5b'5e'5cs'5cw'2e'3a'2c'5d = compileRegex "[^\\s\\w.:,]" 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 = compileRegex "\\\\(u[\\da-fA-F]{4}|U[\\da-fA-F]{8}|&[a-zA-Z]\\w+;)" -defaultAttributes = [("normal",NormalTok),("ModuleName",NormalTok),("RawString",StringTok),("String",StringTok),("CommentLine",CommentTok),("CommentBlock",CommentTok)]+defaultAttributes = [(("Haxe","normal"),NormalTok),(("Haxe","ModuleName"),NormalTok),(("Haxe","RawString"),StringTok),(("Haxe","String"),StringTok),(("Haxe","CommentLine"),CommentTok),(("Haxe","CommentBlock"),CommentTok)] -parseRules "normal" =+parseRules ("Haxe","normal") = (((pRegExpr regex_'23if'28'5cs'2b'5cw'2b'29'3f >>= withAttribute OtherTok) >>~ (popContext)) <|> ((pRegExpr regex_'23'28else'7celseif'7cend'7cerror'29 >>= withAttribute OtherTok) >>~ (popContext)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_modules >>= withAttribute KeywordTok) >>~ pushContext "ModuleName")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_modules >>= withAttribute KeywordTok) >>~ pushContext ("Haxe","ModuleName")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_types >>= withAttribute DataTypeTok)) <|>@@ -94,13 +91,13 @@ <|> ((pHlCStringChar >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "RawString")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Haxe","RawString")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Haxe","String")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "CommentLine")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Haxe","CommentLine")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "CommentBlock")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Haxe","CommentBlock")) <|> ((pDetectChar False '{' >>= withAttribute NormalTok)) <|>@@ -118,17 +115,17 @@ <|> ((pRegExpr regex_'5cd'2b >>= withAttribute DecValTok) >>~ (popContext))) -parseRules "ModuleName" =- (((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "CommentLine")+parseRules ("Haxe","ModuleName") =+ (((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Haxe","CommentLine")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "CommentBlock")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Haxe","CommentBlock")) <|> ((pRegExpr regex_'5b'5e'5cs'5cw'2e'3a'2c'5d >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "RawString" =+parseRules ("Haxe","RawString") = ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)) -parseRules "String" =+parseRules ("Haxe","String") = (((pDetect2Chars False '\\' '"' >>= withAttribute StringTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))@@ -137,12 +134,11 @@ <|> ((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))) -parseRules "CommentLine" =+parseRules ("Haxe","CommentLine") = pzero -parseRules "CommentBlock" =+parseRules ("Haxe","CommentBlock") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "" = parseRules "normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Html.hs view
@@ -10,7 +10,6 @@ import qualified Text.Highlighting.Kate.Syntax.Css import qualified Text.Highlighting.Kate.Syntax.Javascript import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -28,53 +27,55 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "HTML" }- context <- currentContext <|> (pushContext "Start" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("HTML",["Start"])], synStLanguage = "HTML", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("HTML","Start")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Start" -> return ()- "FindHTML" -> return ()- "FindEntityRefs" -> return ()- "FindPEntityRefs" -> return ()- "FindAttributes" -> return ()- "FindDTDRules" -> return ()- "Comment" -> return ()- "CDATA" -> return ()- "PI" -> return ()- "Doctype" -> return ()- "Doctype Internal Subset" -> return ()- "Doctype Markupdecl" -> return ()- "Doctype Markupdecl DQ" -> return ()- "Doctype Markupdecl SQ" -> return ()- "El Open" -> return ()- "El Close" -> return ()- "El Close 2" -> return ()- "El Close 3" -> return ()- "CSS" -> return ()- "CSS content" -> return ()- "JS" -> return ()- "JS content" -> return ()- "JS comment close" -> (popContext) >> pEndLine- "Value" -> return ()- "Value NQ" -> (popContext >> popContext) >> pEndLine- "Value DQ" -> return ()- "Value SQ" -> return ()+ ("HTML","Start") -> return ()+ ("HTML","FindHTML") -> return ()+ ("HTML","FindEntityRefs") -> return ()+ ("HTML","FindPEntityRefs") -> return ()+ ("HTML","FindAttributes") -> return ()+ ("HTML","FindDTDRules") -> return ()+ ("HTML","Comment") -> return ()+ ("HTML","CDATA") -> return ()+ ("HTML","PI") -> return ()+ ("HTML","Doctype") -> return ()+ ("HTML","Doctype Internal Subset") -> return ()+ ("HTML","Doctype Markupdecl") -> return ()+ ("HTML","Doctype Markupdecl DQ") -> return ()+ ("HTML","Doctype Markupdecl SQ") -> return ()+ ("HTML","El Open") -> return ()+ ("HTML","El Close") -> return ()+ ("HTML","El Close 2") -> return ()+ ("HTML","El Close 3") -> return ()+ ("HTML","CSS") -> return ()+ ("HTML","CSS content") -> return ()+ ("HTML","JS") -> return ()+ ("HTML","JS content") -> return ()+ ("HTML","JS comment close") -> (popContext) >> pEndLine+ ("HTML","Value") -> return ()+ ("HTML","Value NQ") -> (popContext >> popContext) >> pEndLine+ ("HTML","Value DQ") -> return ()+ ("HTML","Value SQ") -> return () _ -> return () withAttribute attr txt = do@@ -83,11 +84,7 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'3c'21DOCTYPE'5cs'2b = compileRegex "<!DOCTYPE\\s+" regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a = compileRegex "<\\?[\\w:-]*" regex_'3cstyle'5cb = compileRegex "<style\\b"@@ -119,83 +116,83 @@ regex_'2f'28'3f'21'3e'29 = compileRegex "/(?!>)" regex_'5b'5e'2f'3e'3c'22'27'5cs'5d = compileRegex "[^/><\"'\\s]" -defaultAttributes = [("Start",NormalTok),("FindHTML",NormalTok),("FindEntityRefs",NormalTok),("FindPEntityRefs",NormalTok),("FindAttributes",NormalTok),("FindDTDRules",NormalTok),("Comment",CommentTok),("CDATA",NormalTok),("PI",NormalTok),("Doctype",NormalTok),("Doctype Internal Subset",NormalTok),("Doctype Markupdecl",NormalTok),("Doctype Markupdecl DQ",StringTok),("Doctype Markupdecl SQ",StringTok),("El Open",NormalTok),("El Close",NormalTok),("El Close 2",NormalTok),("El Close 3",NormalTok),("CSS",NormalTok),("CSS content",NormalTok),("JS",NormalTok),("JS content",NormalTok),("JS comment close",CommentTok),("Value",NormalTok),("Value NQ",NormalTok),("Value DQ",StringTok),("Value SQ",StringTok)]+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 "Start" =- ((parseRules "FindHTML"))+parseRules ("HTML","Start") =+ ((parseRules ("HTML","FindHTML"))) -parseRules "FindHTML" =+parseRules ("HTML","FindHTML") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pDetectIdentifier >>= withAttribute NormalTok)) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("HTML","Comment")) <|>- ((pString False "<![CDATA[" >>= withAttribute BaseNTok) >>~ pushContext "CDATA")+ ((pString False "<![CDATA[" >>= withAttribute BaseNTok) >>~ pushContext ("HTML","CDATA")) <|>- ((pRegExpr regex_'3c'21DOCTYPE'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext "Doctype")+ ((pRegExpr regex_'3c'21DOCTYPE'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext ("HTML","Doctype")) <|>- ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "PI")+ ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("HTML","PI")) <|>- ((pRegExpr regex_'3cstyle'5cb >>= withAttribute KeywordTok) >>~ pushContext "CSS")+ ((pRegExpr regex_'3cstyle'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","CSS")) <|>- ((pRegExpr regex_'3cscript'5cb >>= withAttribute KeywordTok) >>~ pushContext "JS")+ ((pRegExpr regex_'3cscript'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","JS")) <|>- ((pRegExpr regex_'3cpre'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3cpre'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Open")) <|>- ((pRegExpr regex_'3cdiv'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3cdiv'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Open")) <|>- ((pRegExpr regex_'3ctable'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3ctable'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Open")) <|>- ((pRegExpr regex_'3cul'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3cul'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Open")) <|>- ((pRegExpr regex_'3col'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3col'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Open")) <|>- ((pRegExpr regex_'3cdl'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3cdl'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Open")) <|>- ((pRegExpr regex_'3c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Open")) <|>- ((pRegExpr regex_'3c'2fpre'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2fpre'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Close")) <|>- ((pRegExpr regex_'3c'2fdiv'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2fdiv'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Close")) <|>- ((pRegExpr regex_'3c'2ftable'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2ftable'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Close")) <|>- ((pRegExpr regex_'3c'2ful'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2ful'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Close")) <|>- ((pRegExpr regex_'3c'2fol'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2fol'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Close")) <|>- ((pRegExpr regex_'3c'2fdl'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2fdl'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Close")) <|>- ((pRegExpr regex_'3c'2f'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2f'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Close")) <|>- ((parseRules "FindDTDRules"))+ ((parseRules ("HTML","FindDTDRules"))) <|>- ((parseRules "FindEntityRefs")))+ ((parseRules ("HTML","FindEntityRefs")))) -parseRules "FindEntityRefs" =+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))) -parseRules "FindPEntityRefs" =+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))) -parseRules "FindAttributes" =+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 "Value"))+ ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("HTML","Value"))) -parseRules "FindDTDRules" =- ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext "Doctype Markupdecl")+parseRules ("HTML","FindDTDRules") =+ ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("HTML","Doctype Markupdecl")) -parseRules "Comment" =+parseRules ("HTML","Comment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))@@ -206,7 +203,7 @@ <|> ((pRegExpr regex_'2d'28'2d'28'3f'21'2d'3e'29'29'2b >>= withAttribute ErrorTok))) -parseRules "CDATA" =+parseRules ("HTML","CDATA") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pDetectIdentifier >>= withAttribute NormalTok))@@ -215,112 +212,112 @@ <|> ((pString False "]]>" >>= withAttribute DecValTok))) -parseRules "PI" =+parseRules ("HTML","PI") = ((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext)) -parseRules "Doctype" =+parseRules ("HTML","Doctype") = (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext "Doctype Internal Subset"))+ ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("HTML","Doctype Internal Subset"))) -parseRules "Doctype Internal Subset" =+parseRules ("HTML","Doctype Internal Subset") = (((pDetectChar False ']' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((parseRules "FindDTDRules"))+ ((parseRules ("HTML","FindDTDRules"))) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("HTML","Comment")) <|>- ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "PI")+ ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("HTML","PI")) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("HTML","FindPEntityRefs")))) -parseRules "Doctype Markupdecl" =+parseRules ("HTML","Doctype Markupdecl") = (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Doctype Markupdecl DQ")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("HTML","Doctype Markupdecl DQ")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Doctype Markupdecl SQ"))+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("HTML","Doctype Markupdecl SQ"))) -parseRules "Doctype Markupdecl DQ" =+parseRules ("HTML","Doctype Markupdecl DQ") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("HTML","FindPEntityRefs")))) -parseRules "Doctype Markupdecl SQ" =+parseRules ("HTML","Doctype Markupdecl SQ") = (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("HTML","FindPEntityRefs")))) -parseRules "El Open" =+parseRules ("HTML","El Open") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "FindAttributes"))+ ((parseRules ("HTML","FindAttributes"))) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "El Close" =+parseRules ("HTML","El Close") = (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "El Close 2" =+parseRules ("HTML","El Close 2") = (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "El Close 3" =+parseRules ("HTML","El Close 3") = (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext >> popContext)) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "CSS" =+parseRules ("HTML","CSS") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext "CSS content")+ ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext ("HTML","CSS content")) <|>- ((parseRules "FindAttributes"))+ ((parseRules ("HTML","FindAttributes"))) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "CSS content" =- (((pRegExpr regex_'3c'2fstyle'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close 2")+parseRules ("HTML","CSS content") =+ (((pRegExpr regex_'3c'2fstyle'5cb >>= withAttribute KeywordTok) >>~ pushContext ("HTML","El Close 2")) <|> ((Text.Highlighting.Kate.Syntax.Css.parseExpression))) -parseRules "JS" =+parseRules ("HTML","JS") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext "JS content")+ ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext ("HTML","JS content")) <|>- ((parseRules "FindAttributes"))+ ((parseRules ("HTML","FindAttributes"))) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "JS content" =- (((pRegExpr regex_'3c'2fscript'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close 2")+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 "JS comment close")+ ((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))) -parseRules "JS comment close" =- (((pRegExpr regex_'3c'2fscript'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close 3")+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)))) -parseRules "Value" =- (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Value DQ")+parseRules ("HTML","Value") =+ (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("HTML","Value DQ")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Value SQ")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("HTML","Value SQ")) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|>- (pushContext "Value NQ" >> currentContext >>= parseRules))+ (pushContext ("HTML","Value NQ") >> currentContext >>= parseRules)) -parseRules "Value NQ" =- (((parseRules "FindEntityRefs"))+parseRules ("HTML","Value NQ") =+ (((parseRules ("HTML","FindEntityRefs"))) <|> ((pRegExpr regex_'2f'28'3f'21'3e'29 >>= withAttribute StringTok)) <|>@@ -328,16 +325,18 @@ <|> ((popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "Value DQ" =+parseRules ("HTML","Value DQ") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext >> popContext)) <|>- ((parseRules "FindEntityRefs")))+ ((parseRules ("HTML","FindEntityRefs")))) -parseRules "Value SQ" =+parseRules ("HTML","Value SQ") = (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext >> popContext)) <|>- ((parseRules "FindEntityRefs")))+ ((parseRules ("HTML","FindEntityRefs")))) -parseRules "" = parseRules "Start"+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" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Ini.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,29 +26,31 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "INI Files" }- context <- currentContext <|> (pushContext "ini" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("INI Files",["ini"])], synStLanguage = "INI Files", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("INI Files","ini")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "ini" -> return ()- "Value" -> (popContext) >> pEndLine- "Comment" -> (popContext) >> pEndLine+ ("INI Files","ini") -> return ()+ ("INI Files","Value") -> (popContext) >> pEndLine+ ("INI Files","Comment") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -58,27 +59,23 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "on off default defaults localhost null true false yes no normal e_all e_error e_warning e_parse e_notice e_strict e_core_error e_core_warning e_compile_error e_compile_warning e_user_error e_user_warning e_user_notice" regex_'3b'2e'2a'24 = compileRegex ";.*$" regex_'23'2e'2a'24 = compileRegex "#.*$" -defaultAttributes = [("ini",DataTypeTok),("Value",StringTok),("Comment",CommentTok)]+defaultAttributes = [(("INI Files","ini"),DataTypeTok),(("INI Files","Value"),StringTok),(("INI Files","Comment"),CommentTok)] -parseRules "ini" =+parseRules ("INI Files","ini") = (((pRangeDetect '[' ']' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext "Value")+ ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("INI Files","Value")) <|>- ((pFirstNonSpace >> pDetectChar False ';' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pFirstNonSpace >> pDetectChar False ';' >>= withAttribute CommentTok) >>~ pushContext ("INI Files","Comment")) <|>- ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "Comment"))+ ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("INI Files","Comment"))) -parseRules "Value" =+parseRules ("INI Files","Value") = (((pFloat >>= withAttribute FloatTok)) <|> ((pInt >>= withAttribute DecValTok))@@ -89,13 +86,13 @@ <|> ((pRegExpr regex_'23'2e'2a'24 >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Comment" =+parseRules ("INI Files","Comment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "" = parseRules "ini"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Java.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Javadoc import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,37 +26,39 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Java" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Java",["Normal"])], synStLanguage = "Java", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Java","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "InFunctionCall" -> return ()- "String" -> (popContext) >> pEndLine- "EnterPrintf" -> return ()- "Printf" -> return ()- "PrintfString" -> (popContext) >> pEndLine- "Member" -> (popContext) >> pEndLine- "StaticImports" -> (popContext) >> pEndLine- "Imports" -> (popContext) >> pEndLine- "Commentar 1" -> (popContext) >> pEndLine- "Commentar 2" -> return ()+ ("Java","Normal") -> return ()+ ("Java","InFunctionCall") -> return ()+ ("Java","String") -> (popContext) >> pEndLine+ ("Java","EnterPrintf") -> return ()+ ("Java","Printf") -> return ()+ ("Java","PrintfString") -> (popContext) >> pEndLine+ ("Java","Member") -> (popContext) >> pEndLine+ ("Java","StaticImports") -> (popContext) >> pEndLine+ ("Java","Imports") -> (popContext) >> pEndLine+ ("Java","Commentar 1") -> (popContext) >> pEndLine+ ("Java","Commentar 2") -> return () _ -> return () withAttribute attr txt = do@@ -66,10 +67,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_java15 = Set.fromList $ words $ "ACTIVE ACTIVITY_COMPLETED ACTIVITY_REQUIRED ARG_IN ARG_INOUT ARG_OUT AWTError AWTEvent AWTEventListener AWTEventListenerProxy AWTEventMulticaster AWTException AWTKeyStroke AWTPermission AbstractAction AbstractBorder AbstractButton AbstractCellEditor AbstractCollection AbstractColorChooserPanel AbstractDocument AbstractDocument.AttributeContext AbstractDocument.Content AbstractDocument.ElementEdit AbstractExecutorService AbstractInterruptibleChannel AbstractLayoutCache AbstractLayoutCache.NodeDimensions AbstractList AbstractListModel AbstractMap AbstractMethodError AbstractPreferences AbstractQueue AbstractQueuedSynchronizer AbstractSelectableChannel AbstractSelectionKey AbstractSelector AbstractSequentialList AbstractSet AbstractSpinnerModel AbstractTableModel AbstractUndoableEdit AbstractWriter AccessControlContext AccessControlException AccessController AccessException Accessible AccessibleAction AccessibleAttributeSequence AccessibleBundle AccessibleComponent AccessibleContext AccessibleEditableText AccessibleExtendedComponent AccessibleExtendedTable AccessibleExtendedText AccessibleHyperlink AccessibleHypertext AccessibleIcon AccessibleKeyBinding AccessibleObject AccessibleRelation AccessibleRelationSet AccessibleResourceBundle AccessibleRole AccessibleSelection AccessibleState AccessibleStateSet AccessibleStreamable AccessibleTable AccessibleTableModelChange AccessibleText AccessibleTextSequence AccessibleValue AccountException AccountExpiredException AccountLockedException AccountNotFoundException Acl AclEntry AclNotFoundException Action ActionEvent ActionListener ActionMap ActionMapUIResource Activatable ActivateFailedException ActivationDesc ActivationException ActivationGroup ActivationGroupDesc ActivationGroupDesc.CommandEnvironment ActivationGroupID ActivationGroup_Stub ActivationID ActivationInstantiator ActivationMonitor ActivationSystem Activator ActiveEvent ActivityCompletedException ActivityRequiredException AdapterActivator AdapterActivatorOperations AdapterAlreadyExists AdapterAlreadyExistsHelper AdapterInactive AdapterInactiveHelper AdapterManagerIdHelper AdapterNameHelper AdapterNonExistent AdapterNonExistentHelper AdapterStateHelper AddressHelper Adjustable AdjustmentEvent AdjustmentListener Adler32 AffineTransform AffineTransformOp AlgorithmParameterGenerator AlgorithmParameterGeneratorSpi AlgorithmParameterSpec AlgorithmParameters AlgorithmParametersSpi AllPermission AlphaComposite AlreadyBound AlreadyBoundException AlreadyBoundHelper AlreadyBoundHolder AlreadyConnectedException AncestorEvent AncestorListener AnnotatedElement Annotation Annotation AnnotationFormatError AnnotationTypeMismatchException Any AnyHolder AnySeqHelper AnySeqHelper AnySeqHolder AppConfigurationEntry AppConfigurationEntry.LoginModuleControlFlag Appendable Applet AppletContext AppletInitializer AppletStub ApplicationException Arc2D Arc2D.Double Arc2D.Float Area AreaAveragingScaleFilter ArithmeticException Array Array ArrayBlockingQueue ArrayIndexOutOfBoundsException ArrayList ArrayStoreException ArrayType Arrays AssertionError AsyncBoxView AsynchronousCloseException AtomicBoolean AtomicInteger AtomicIntegerArray AtomicIntegerFieldUpdater AtomicLong AtomicLongArray AtomicLongFieldUpdater AtomicMarkableReference AtomicReference AtomicReferenceArray AtomicReferenceFieldUpdater AtomicStampedReference Attr Attribute Attribute Attribute AttributeChangeNotification AttributeChangeNotificationFilter AttributeException AttributeInUseException AttributeList AttributeList AttributeList AttributeListImpl AttributeModificationException AttributeNotFoundException AttributeSet AttributeSet AttributeSet.CharacterAttribute AttributeSet.ColorAttribute AttributeSet.FontAttribute AttributeSet.ParagraphAttribute AttributeSetUtilities AttributeValueExp AttributedCharacterIterator AttributedCharacterIterator.Attribute AttributedString Attributes Attributes Attributes Attributes.Name Attributes2 Attributes2Impl AttributesImpl AudioClip AudioFileFormat AudioFileFormat.Type AudioFileReader AudioFileWriter AudioFormat AudioFormat.Encoding AudioInputStream AudioPermission AudioSystem AuthPermission AuthProvider AuthenticationException AuthenticationException AuthenticationNotSupportedException Authenticator Authenticator.RequestorType AuthorizeCallback Autoscroll BAD_CONTEXT BAD_INV_ORDER BAD_OPERATION BAD_PARAM BAD_POLICY BAD_POLICY_TYPE BAD_POLICY_VALUE BAD_QOS BAD_TYPECODE BMPImageWriteParam BackingStoreException BadAttributeValueExpException BadBinaryOpValueExpException BadKind BadLocationException BadPaddingException BadStringOperationException BandCombineOp BandedSampleModel BaseRowSet BasicArrowButton BasicAttribute BasicAttributes BasicBorders BasicBorders.ButtonBorder BasicBorders.FieldBorder BasicBorders.MarginBorder BasicBorders.MenuBarBorder BasicBorders.RadioButtonBorder BasicBorders.RolloverButtonBorder BasicBorders.SplitPaneBorder BasicBorders.ToggleButtonBorder BasicButtonListener BasicButtonUI BasicCheckBoxMenuItemUI BasicCheckBoxUI BasicColorChooserUI BasicComboBoxEditor BasicComboBoxEditor.UIResource BasicComboBoxRenderer BasicComboBoxRenderer.UIResource BasicComboBoxUI BasicComboPopup BasicControl BasicDesktopIconUI BasicDesktopPaneUI BasicDirectoryModel BasicEditorPaneUI BasicFileChooserUI BasicFormattedTextFieldUI BasicGraphicsUtils BasicHTML BasicIconFactory BasicInternalFrameTitlePane BasicInternalFrameUI BasicLabelUI BasicListUI BasicLookAndFeel BasicMenuBarUI BasicMenuItemUI BasicMenuUI BasicOptionPaneUI BasicOptionPaneUI.ButtonAreaLayout BasicPanelUI BasicPasswordFieldUI BasicPermission BasicPopupMenuSeparatorUI BasicPopupMenuUI BasicProgressBarUI BasicRadioButtonMenuItemUI BasicRadioButtonUI BasicRootPaneUI BasicScrollBarUI BasicScrollPaneUI BasicSeparatorUI BasicSliderUI BasicSpinnerUI BasicSplitPaneDivider BasicSplitPaneUI BasicStroke BasicTabbedPaneUI BasicTableHeaderUI BasicTableUI BasicTextAreaUI BasicTextFieldUI BasicTextPaneUI BasicTextUI BasicTextUI.BasicCaret BasicTextUI.BasicHighlighter BasicToggleButtonUI BasicToolBarSeparatorUI BasicToolBarUI BasicToolTipUI BasicTreeUI BasicViewportUI BatchUpdateException BeanContext BeanContextChild BeanContextChildComponentProxy BeanContextChildSupport BeanContextContainerProxy BeanContextEvent BeanContextMembershipEvent BeanContextMembershipListener BeanContextProxy BeanContextServiceAvailableEvent BeanContextServiceProvider BeanContextServiceProviderBeanInfo BeanContextServiceRevokedEvent BeanContextServiceRevokedListener BeanContextServices BeanContextServicesListener BeanContextServicesSupport BeanContextServicesSupport.BCSSServiceProvider BeanContextSupport BeanContextSupport.BCSIterator BeanDescriptor BeanInfo Beans BevelBorder Bidi BigDecimal BigInteger BinaryRefAddr BindException Binding Binding BindingHelper BindingHolder BindingIterator BindingIteratorHelper BindingIteratorHolder BindingIteratorOperations BindingIteratorPOA BindingListHelper BindingListHolder BindingType BindingTypeHelper BindingTypeHolder BitSet Blob BlockView BlockingQueue Book Boolean BooleanControl BooleanControl.Type BooleanHolder BooleanSeqHelper BooleanSeqHolder Border BorderFactory BorderLayout BorderUIResource BorderUIResource.BevelBorderUIResource BorderUIResource.CompoundBorderUIResource BorderUIResource.EmptyBorderUIResource BorderUIResource.EtchedBorderUIResource BorderUIResource.LineBorderUIResource BorderUIResource.MatteBorderUIResource BorderUIResource.TitledBorderUIResource BoundedRangeModel Bounds Bounds Box Box.Filler BoxLayout BoxView BoxedValueHelper BreakIterator BrokenBarrierException Buffer BufferCapabilities BufferCapabilities.FlipContents BufferOverflowException BufferStrategy BufferUnderflowException BufferedImage BufferedImageFilter BufferedImageOp BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter Button ButtonGroup ButtonModel ButtonUI Byte ByteArrayInputStream ByteArrayOutputStream ByteBuffer ByteChannel ByteHolder ByteLookupTable ByteOrder CDATASection CMMException CODESET_INCOMPATIBLE COMM_FAILURE CRC32 CRL CRLException CRLSelector CSS CSS.Attribute CTX_RESTRICT_SCOPE CacheRequest CacheResponse CachedRowSet Calendar Callable CallableStatement Callback CallbackHandler CancelablePrintJob CancellationException CancelledKeyException CannotProceed CannotProceedException CannotProceedHelper CannotProceedHolder CannotRedoException CannotUndoException Canvas CardLayout Caret CaretEvent CaretListener CellEditor CellEditorListener CellRendererPane CertPath CertPath.CertPathRep CertPathBuilder CertPathBuilderException CertPathBuilderResult CertPathBuilderSpi CertPathParameters CertPathTrustManagerParameters CertPathValidator CertPathValidatorException CertPathValidatorResult CertPathValidatorSpi CertSelector CertStore CertStoreException CertStoreParameters CertStoreSpi Certificate Certificate Certificate Certificate.CertificateRep CertificateEncodingException CertificateEncodingException CertificateException CertificateException CertificateExpiredException CertificateExpiredException CertificateFactory CertificateFactorySpi CertificateNotYetValidException CertificateNotYetValidException CertificateParsingException CertificateParsingException ChangeEvent ChangeListener ChangedCharSetException Channel ChannelBinding Channels CharArrayReader CharArrayWriter CharBuffer CharConversionException CharHolder CharSeqHelper CharSeqHolder CharSequence Character Character.Subset Character.UnicodeBlock CharacterCodingException CharacterData CharacterIterator Charset CharsetDecoder CharsetEncoder CharsetProvider Checkbox CheckboxGroup CheckboxMenuItem CheckedInputStream CheckedOutputStream Checksum Choice ChoiceCallback ChoiceFormat Chromaticity Cipher CipherInputStream CipherOutputStream CipherSpi Class ClassCastException ClassCircularityError ClassDefinition ClassDesc ClassFileTransformer ClassFormatError ClassLoader ClassLoaderRepository ClassLoadingMXBean ClassNotFoundException ClientRequestInfo ClientRequestInfoOperations ClientRequestInterceptor ClientRequestInterceptorOperations Clip Clipboard ClipboardOwner Clob CloneNotSupportedException Cloneable Closeable ClosedByInterruptException ClosedChannelException ClosedSelectorException CodeSets CodeSigner CodeSource Codec CodecFactory CodecFactoryHelper CodecFactoryOperations CodecOperations CoderMalfunctionError CoderResult CodingErrorAction CollationElementIterator CollationKey Collator Collection CollectionCertStoreParameters Collections Color ColorChooserComponentFactory ColorChooserUI ColorConvertOp ColorModel ColorSelectionModel ColorSpace ColorSupported ColorType ColorUIResource ComboBoxEditor ComboBoxModel ComboBoxUI ComboPopup Comment CommunicationException Comparable Comparator CompilationMXBean Compiler CompletionService CompletionStatus CompletionStatusHelper Component ComponentAdapter ComponentColorModel ComponentEvent ComponentIdHelper ComponentInputMap ComponentInputMapUIResource ComponentListener ComponentOrientation ComponentSampleModel ComponentUI ComponentView Composite CompositeContext CompositeData CompositeDataSupport CompositeName CompositeType CompositeView CompoundBorder CompoundControl CompoundControl.Type CompoundEdit CompoundName Compression ConcurrentHashMap ConcurrentLinkedQueue ConcurrentMap ConcurrentModificationException Condition Configuration ConfigurationException ConfirmationCallback ConnectException ConnectException ConnectIOException Connection ConnectionEvent ConnectionEventListener ConnectionPendingException ConnectionPoolDataSource ConsoleHandler Constructor Container ContainerAdapter ContainerEvent ContainerListener ContainerOrderFocusTraversalPolicy ContentHandler ContentHandler ContentHandlerFactory ContentModel Context Context ContextList ContextNotEmptyException ContextualRenderedImageFactory Control Control Control.Type ControlFactory ControllerEventListener ConvolveOp CookieHandler CookieHolder Copies CopiesSupported CopyOnWriteArrayList CopyOnWriteArraySet CountDownLatch CounterMonitor CounterMonitorMBean CredentialException CredentialExpiredException CredentialNotFoundException CropImageFilter CubicCurve2D CubicCurve2D.Double CubicCurve2D.Float Currency Current Current Current CurrentHelper CurrentHelper CurrentHelper CurrentHolder CurrentOperations CurrentOperations CurrentOperations Cursor CustomMarshal CustomValue Customizer CyclicBarrier DATA_CONVERSION DESKeySpec DESedeKeySpec DGC DHGenParameterSpec DHKey DHParameterSpec DHPrivateKey DHPrivateKeySpec DHPublicKey DHPublicKeySpec DISCARDING DOMConfiguration DOMError DOMErrorHandler DOMException DOMImplementation DOMImplementationLS DOMImplementationList DOMImplementationRegistry DOMImplementationSource DOMLocator DOMLocator DOMResult DOMSource DOMStringList DSAKey DSAKeyPairGenerator DSAParameterSpec DSAParams DSAPrivateKey DSAPrivateKeySpec DSAPublicKey DSAPublicKeySpec DTD DTDConstants DTDHandler DataBuffer DataBufferByte DataBufferDouble DataBufferFloat DataBufferInt DataBufferShort DataBufferUShort DataFlavor DataFormatException DataInput DataInputStream DataInputStream DataLine DataLine.Info DataOutput DataOutputStream DataOutputStream DataSource DataTruncation DatabaseMetaData DatagramChannel DatagramPacket DatagramSocket DatagramSocketImpl DatagramSocketImplFactory DatatypeConfigurationException DatatypeConstants DatatypeConstants.Field DatatypeFactory Date Date DateFormat DateFormat.Field DateFormatSymbols DateFormatter DateTimeAtCompleted DateTimeAtCreation DateTimeAtProcessing DateTimeSyntax DebugGraphics DecimalFormat DecimalFormatSymbols DeclHandler DefaultBoundedRangeModel DefaultButtonModel DefaultCaret DefaultCellEditor DefaultColorSelectionModel DefaultComboBoxModel DefaultDesktopManager DefaultEditorKit DefaultEditorKit.BeepAction DefaultEditorKit.CopyAction DefaultEditorKit.CutAction DefaultEditorKit.DefaultKeyTypedAction DefaultEditorKit.InsertBreakAction DefaultEditorKit.InsertContentAction DefaultEditorKit.InsertTabAction DefaultEditorKit.PasteAction DefaultFocusManager DefaultFocusTraversalPolicy DefaultFormatter DefaultFormatterFactory DefaultHandler DefaultHandler2 DefaultHighlighter DefaultHighlighter.DefaultHighlightPainter DefaultKeyboardFocusManager DefaultListCellRenderer DefaultListCellRenderer.UIResource DefaultListModel DefaultListSelectionModel DefaultLoaderRepository DefaultLoaderRepository DefaultMenuLayout DefaultMetalTheme DefaultMutableTreeNode DefaultPersistenceDelegate DefaultSingleSelectionModel DefaultStyledDocument DefaultStyledDocument.AttributeUndoableEdit DefaultStyledDocument.ElementSpec DefaultTableCellRenderer DefaultTableCellRenderer.UIResource DefaultTableColumnModel DefaultTableModel DefaultTextUI DefaultTreeCellEditor DefaultTreeCellRenderer DefaultTreeModel DefaultTreeSelectionModel DefinitionKind DefinitionKindHelper Deflater DeflaterOutputStream DelayQueue Delayed Delegate Delegate Delegate DelegationPermission Deprecated Descriptor DescriptorAccess DescriptorSupport DesignMode DesktopIconUI DesktopManager DesktopPaneUI Destination DestroyFailedException Destroyable Dialog Dictionary DigestException DigestInputStream DigestOutputStream Dimension Dimension2D DimensionUIResource DirContext DirObjectFactory DirStateFactory DirStateFactory.Result DirectColorModel DirectoryManager DisplayMode DnDConstants Doc DocAttribute DocAttributeSet DocFlavor DocFlavor.BYTE_ARRAY DocFlavor.CHAR_ARRAY DocFlavor.INPUT_STREAM DocFlavor.READER DocFlavor.SERVICE_FORMATTED DocFlavor.STRING DocFlavor.URL DocPrintJob Document Document DocumentBuilder DocumentBuilderFactory DocumentEvent DocumentEvent.ElementChange DocumentEvent.EventType DocumentFilter DocumentFilter.FilterBypass DocumentFragment DocumentHandler DocumentListener DocumentName DocumentParser DocumentType Documented DomainCombiner DomainManager DomainManagerOperations Double DoubleBuffer DoubleHolder DoubleSeqHelper DoubleSeqHolder DragGestureEvent DragGestureListener DragGestureRecognizer DragSource DragSourceAdapter DragSourceContext DragSourceDragEvent DragSourceDropEvent DragSourceEvent DragSourceListener DragSourceMotionListener Driver DriverManager DriverPropertyInfo DropTarget DropTarget.DropTargetAutoScroller DropTargetAdapter DropTargetContext DropTargetDragEvent DropTargetDropEvent DropTargetEvent DropTargetListener DuplicateFormatFlagsException DuplicateName DuplicateNameHelper Duration DynAny DynAny DynAnyFactory DynAnyFactoryHelper DynAnyFactoryOperations DynAnyHelper DynAnyOperations DynAnySeqHelper DynArray DynArray DynArrayHelper DynArrayOperations DynEnum DynEnum DynEnumHelper DynEnumOperations DynFixed DynFixed DynFixedHelper DynFixedOperations DynSequence DynSequence DynSequenceHelper DynSequenceOperations DynStruct DynStruct DynStructHelper DynStructOperations DynUnion DynUnion DynUnionHelper DynUnionOperations DynValue DynValue DynValueBox DynValueBoxOperations DynValueCommon DynValueCommonOperations DynValueHelper DynValueOperations DynamicImplementation DynamicImplementation DynamicMBean ECField ECFieldF2m ECFieldFp ECGenParameterSpec ECKey ECParameterSpec ECPoint ECPrivateKey ECPrivateKeySpec ECPublicKey ECPublicKeySpec ENCODING_CDR_ENCAPS EOFException EditorKit Element Element Element ElementIterator ElementType Ellipse2D Ellipse2D.Double Ellipse2D.Float EllipticCurve EmptyBorder EmptyStackException EncodedKeySpec Encoder Encoding EncryptedPrivateKeyInfo Entity Entity EntityReference EntityResolver EntityResolver2 Enum EnumConstantNotPresentException EnumControl EnumControl.Type EnumMap EnumSet EnumSyntax Enumeration Environment Error ErrorHandler ErrorListener ErrorManager EtchedBorder Event EventContext EventDirContext EventHandler EventListener EventListenerList EventListenerProxy EventObject EventQueue EventSetDescriptor Exception ExceptionDetailMessage ExceptionInInitializerError ExceptionList ExceptionListener Exchanger ExecutionException Executor ExecutorCompletionService ExecutorService Executors ExemptionMechanism ExemptionMechanismException ExemptionMechanismSpi ExpandVetoException ExportException Expression ExtendedRequest ExtendedResponse Externalizable FREE_MEM FactoryConfigurationError FailedLoginException FeatureDescriptor Fidelity Field FieldNameHelper FieldNameHelper FieldPosition FieldView File FileCacheImageInputStream FileCacheImageOutputStream FileChannel FileChannel.MapMode FileChooserUI FileDescriptor FileDialog FileFilter FileFilter FileHandler FileImageInputStream FileImageOutputStream FileInputStream FileLock FileLockInterruptionException FileNameMap FileNotFoundException FileOutputStream FilePermission FileReader FileSystemView FileView FileWriter FilenameFilter Filter FilterInputStream FilterOutputStream FilterReader FilterWriter FilteredImageSource FilteredRowSet Finishings FixedHeightLayoutCache FixedHolder FlatteningPathIterator FlavorEvent FlavorException FlavorListener FlavorMap FlavorTable Float FloatBuffer FloatControl FloatControl.Type FloatHolder FloatSeqHelper FloatSeqHolder FlowLayout FlowView FlowView.FlowStrategy Flushable FocusAdapter FocusEvent FocusListener FocusManager FocusTraversalPolicy Font FontFormatException FontMetrics FontRenderContext FontUIResource FormSubmitEvent FormSubmitEvent.MethodType FormView Format Format.Field FormatConversionProvider FormatFlagsConversionMismatchException FormatMismatch FormatMismatchHelper Formattable FormattableFlags Formatter Formatter FormatterClosedException ForwardRequest ForwardRequest ForwardRequestHelper ForwardRequestHelper Frame Future FutureTask GSSContext GSSCredential GSSException GSSManager GSSName GZIPInputStream GZIPOutputStream GapContent GarbageCollectorMXBean GatheringByteChannel GaugeMonitor GaugeMonitorMBean GeneralPath GeneralSecurityException GenericArrayType GenericDeclaration GenericSignatureFormatError GlyphJustificationInfo GlyphMetrics GlyphVector GlyphView GlyphView.GlyphPainter GradientPaint GraphicAttribute Graphics Graphics2D GraphicsConfigTemplate GraphicsConfiguration GraphicsDevice GraphicsEnvironment GrayFilter GregorianCalendar GridBagConstraints GridBagLayout GridLayout Group Guard GuardedObject HOLDING HTML HTML.Attribute HTML.Tag HTML.UnknownTag HTMLDocument HTMLDocument.Iterator HTMLEditorKit HTMLEditorKit.HTMLFactory HTMLEditorKit.HTMLTextAction HTMLEditorKit.InsertHTMLTextAction HTMLEditorKit.LinkController HTMLEditorKit.Parser HTMLEditorKit.ParserCallback HTMLFrameHyperlinkEvent HTMLWriter Handler HandlerBase HandshakeCompletedEvent HandshakeCompletedListener HasControls HashAttributeSet HashDocAttributeSet HashMap HashPrintJobAttributeSet HashPrintRequestAttributeSet HashPrintServiceAttributeSet HashSet Hashtable HeadlessException HierarchyBoundsAdapter HierarchyBoundsListener HierarchyEvent HierarchyListener Highlighter Highlighter.Highlight Highlighter.HighlightPainter HostnameVerifier HttpRetryException HttpURLConnection HttpsURLConnection HyperlinkEvent HyperlinkEvent.EventType HyperlinkListener ICC_ColorSpace ICC_Profile ICC_ProfileGray ICC_ProfileRGB IDLEntity IDLType IDLTypeHelper IDLTypeOperations ID_ASSIGNMENT_POLICY_ID ID_UNIQUENESS_POLICY_ID IIOByteBuffer IIOException IIOImage IIOInvalidTreeException IIOMetadata IIOMetadataController IIOMetadataFormat IIOMetadataFormatImpl IIOMetadataNode IIOParam IIOParamController IIOReadProgressListener IIOReadUpdateListener IIOReadWarningListener IIORegistry IIOServiceProvider IIOWriteProgressListener IIOWriteWarningListener IMPLICIT_ACTIVATION_POLICY_ID IMP_LIMIT INACTIVE INITIALIZE INTERNAL INTF_REPOS INVALID_ACTIVITY INVALID_TRANSACTION INV_FLAG INV_IDENT INV_OBJREF INV_POLICY IOException IOR IORHelper IORHolder IORInfo IORInfoOperations IORInterceptor IORInterceptorOperations IORInterceptor_3_0 IORInterceptor_3_0Helper IORInterceptor_3_0Holder IORInterceptor_3_0Operations IRObject IRObjectOperations Icon IconUIResource IconView IdAssignmentPolicy IdAssignmentPolicyOperations IdAssignmentPolicyValue IdUniquenessPolicy IdUniquenessPolicyOperations IdUniquenessPolicyValue IdentifierHelper Identity IdentityHashMap IdentityScope IllegalAccessError IllegalAccessException IllegalArgumentException IllegalBlockSizeException IllegalBlockingModeException IllegalCharsetNameException IllegalClassFormatException IllegalComponentStateException IllegalFormatCodePointException IllegalFormatConversionException IllegalFormatException IllegalFormatFlagsException IllegalFormatPrecisionException IllegalFormatWidthException IllegalMonitorStateException IllegalPathStateException IllegalSelectorException IllegalStateException IllegalThreadStateException Image ImageCapabilities ImageConsumer ImageFilter ImageGraphicAttribute ImageIO ImageIcon ImageInputStream ImageInputStreamImpl ImageInputStreamSpi ImageObserver ImageOutputStream ImageOutputStreamImpl ImageOutputStreamSpi ImageProducer ImageReadParam ImageReader ImageReaderSpi ImageReaderWriterSpi ImageTranscoder ImageTranscoderSpi ImageTypeSpecifier ImageView ImageWriteParam ImageWriter ImageWriterSpi ImagingOpException ImplicitActivationPolicy ImplicitActivationPolicyOperations ImplicitActivationPolicyValue IncompatibleClassChangeError IncompleteAnnotationException InconsistentTypeCode InconsistentTypeCode InconsistentTypeCodeHelper IndexColorModel IndexOutOfBoundsException IndexedPropertyChangeEvent IndexedPropertyDescriptor IndirectionException Inet4Address Inet6Address InetAddress InetSocketAddress Inflater InflaterInputStream InheritableThreadLocal Inherited InitialContext InitialContextFactory InitialContextFactoryBuilder InitialDirContext InitialLdapContext InlineView InputContext InputEvent InputMap InputMapUIResource InputMethod InputMethodContext InputMethodDescriptor InputMethodEvent InputMethodHighlight InputMethodListener InputMethodRequests InputMismatchException InputSource InputStream InputStream InputStream InputStreamReader InputSubset InputVerifier Insets InsetsUIResource InstanceAlreadyExistsException InstanceNotFoundException InstantiationError InstantiationException Instrument Instrumentation InsufficientResourcesException IntBuffer IntHolder Integer IntegerSyntax Interceptor InterceptorOperations InternalError InternalFrameAdapter InternalFrameEvent InternalFrameFocusTraversalPolicy InternalFrameListener InternalFrameUI InternationalFormatter InterruptedException InterruptedIOException InterruptedNamingException InterruptibleChannel IntrospectionException IntrospectionException Introspector Invalid InvalidActivityException InvalidAddress InvalidAddressHelper InvalidAddressHolder InvalidAlgorithmParameterException InvalidApplicationException InvalidAttributeIdentifierException InvalidAttributeValueException InvalidAttributeValueException InvalidAttributesException InvalidClassException InvalidDnDOperationException InvalidKeyException InvalidKeyException InvalidKeySpecException InvalidMarkException InvalidMidiDataException InvalidName InvalidName InvalidName InvalidNameException InvalidNameHelper InvalidNameHelper InvalidNameHolder InvalidObjectException InvalidOpenTypeException InvalidParameterException InvalidParameterSpecException InvalidPolicy InvalidPolicyHelper InvalidPreferencesFormatException InvalidPropertiesFormatException InvalidRelationIdException InvalidRelationServiceException InvalidRelationTypeException InvalidRoleInfoException InvalidRoleValueException InvalidSearchControlsException InvalidSearchFilterException InvalidSeq InvalidSlot InvalidSlotHelper InvalidTargetObjectTypeException InvalidTransactionException InvalidTypeForEncoding InvalidTypeForEncodingHelper InvalidValue InvalidValue InvalidValueHelper InvocationEvent InvocationHandler InvocationTargetException InvokeHandler IstringHelper ItemEvent ItemListener ItemSelectable Iterable Iterator IvParameterSpec JApplet JButton JCheckBox JCheckBoxMenuItem JColorChooser JComboBox JComboBox.KeySelectionManager JComponent JDesktopPane JDialog JEditorPane JFileChooser JFormattedTextField JFormattedTextField.AbstractFormatter JFormattedTextField.AbstractFormatterFactory JFrame JInternalFrame JInternalFrame.JDesktopIcon JLabel JLayeredPane JList JMException JMRuntimeException JMXAuthenticator JMXConnectionNotification JMXConnector JMXConnectorFactory JMXConnectorProvider JMXConnectorServer JMXConnectorServerFactory JMXConnectorServerMBean JMXConnectorServerProvider JMXPrincipal JMXProviderException JMXServerErrorException JMXServiceURL JMenu JMenuBar JMenuItem JOptionPane JPEGHuffmanTable JPEGImageReadParam JPEGImageWriteParam JPEGQTable JPanel JPasswordField JPopupMenu JPopupMenu.Separator JProgressBar JRadioButton JRadioButtonMenuItem JRootPane JScrollBar JScrollPane JSeparator JSlider JSpinner JSpinner.DateEditor JSpinner.DefaultEditor JSpinner.ListEditor JSpinner.NumberEditor JSplitPane JTabbedPane JTable JTable.PrintMode JTableHeader JTextArea JTextComponent JTextComponent.KeyBinding JTextField JTextPane JToggleButton JToggleButton.ToggleButtonModel JToolBar JToolBar.Separator JToolTip JTree JTree.DynamicUtilTreeNode JTree.EmptySelectionModel JViewport JWindow JarEntry JarException JarFile JarInputStream JarOutputStream JarURLConnection JdbcRowSet JobAttributes JobAttributes.DefaultSelectionType JobAttributes.DestinationType JobAttributes.DialogType JobAttributes.MultipleDocumentHandlingType JobAttributes.SidesType JobHoldUntil JobImpressions JobImpressionsCompleted JobImpressionsSupported JobKOctets JobKOctetsProcessed JobKOctetsSupported JobMediaSheets JobMediaSheetsCompleted JobMediaSheetsSupported JobMessageFromOperator JobName JobOriginatingUserName JobPriority JobPrioritySupported JobSheets JobState JobStateReason JobStateReasons JoinRowSet Joinable KerberosKey KerberosPrincipal KerberosTicket Kernel Key KeyAdapter KeyAgreement KeyAgreementSpi KeyAlreadyExistsException KeyEvent KeyEventDispatcher KeyEventPostProcessor KeyException KeyFactory KeyFactorySpi KeyGenerator KeyGeneratorSpi KeyListener KeyManagementException KeyManager KeyManagerFactory KeyManagerFactorySpi KeyPair KeyPairGenerator KeyPairGeneratorSpi KeyRep KeyRep.Type KeySpec KeyStore KeyStore.Builder KeyStore.CallbackHandlerProtection KeyStore.Entry KeyStore.LoadStoreParameter KeyStore.PasswordProtection KeyStore.PrivateKeyEntry KeyStore.ProtectionParameter KeyStore.SecretKeyEntry KeyStore.TrustedCertificateEntry KeyStoreBuilderParameters KeyStoreException KeyStoreSpi KeyStroke KeyboardFocusManager Keymap LDAPCertStoreParameters LIFESPAN_POLICY_ID LOCATION_FORWARD LSException LSInput LSLoadEvent LSOutput LSParser LSParserFilter LSProgressEvent LSResourceResolver LSSerializer LSSerializerFilter Label LabelUI LabelView LanguageCallback LastOwnerException LayeredHighlighter LayeredHighlighter.LayerPainter LayoutFocusTraversalPolicy LayoutManager LayoutManager2 LayoutQueue LdapContext LdapName LdapReferralException Lease Level LexicalHandler LifespanPolicy LifespanPolicyOperations LifespanPolicyValue LimitExceededException Line Line.Info Line2D Line2D.Double Line2D.Float LineBorder LineBreakMeasurer LineEvent LineEvent.Type LineListener LineMetrics LineNumberInputStream LineNumberReader LineUnavailableException LinkException LinkLoopException LinkRef LinkageError LinkedBlockingQueue LinkedHashMap LinkedHashSet LinkedList List List ListCellRenderer ListDataEvent ListDataListener ListIterator ListModel ListResourceBundle ListSelectionEvent ListSelectionListener ListSelectionModel ListUI ListView ListenerNotFoundException LoaderHandler LocalObject Locale LocateRegistry Locator Locator2 Locator2Impl LocatorImpl Lock LockSupport LogManager LogRecord LogStream Logger LoggingMXBean LoggingPermission LoginContext LoginException LoginModule Long LongBuffer LongHolder LongLongSeqHelper LongLongSeqHolder LongSeqHelper LongSeqHolder LookAndFeel LookupOp LookupTable MARSHAL MBeanAttributeInfo MBeanConstructorInfo MBeanException MBeanFeatureInfo MBeanInfo MBeanNotificationInfo MBeanOperationInfo MBeanParameterInfo MBeanPermission MBeanRegistration MBeanRegistrationException MBeanServer MBeanServerBuilder MBeanServerConnection MBeanServerDelegate MBeanServerDelegateMBean MBeanServerFactory MBeanServerForwarder MBeanServerInvocationHandler MBeanServerNotification MBeanServerNotificationFilter MBeanServerPermission MBeanTrustPermission MGF1ParameterSpec MLet MLetMBean Mac MacSpi MalformedInputException MalformedLinkException MalformedObjectNameException MalformedParameterizedTypeException MalformedURLException ManageReferralControl ManagementFactory ManagementPermission ManagerFactoryParameters Manifest Map Map.Entry MappedByteBuffer MarshalException MarshalledObject MaskFormatter MatchResult Matcher Math MathContext MatteBorder Media MediaName MediaPrintableArea MediaSize MediaSize.Engineering MediaSize.ISO MediaSize.JIS MediaSize.NA MediaSize.Other MediaSizeName MediaTracker MediaTray Member MemoryCacheImageInputStream MemoryCacheImageOutputStream MemoryHandler MemoryImageSource MemoryMXBean MemoryManagerMXBean MemoryNotificationInfo MemoryPoolMXBean MemoryType MemoryUsage Menu MenuBar MenuBarUI MenuComponent MenuContainer MenuDragMouseEvent MenuDragMouseListener MenuElement MenuEvent MenuItem MenuItemUI MenuKeyEvent MenuKeyListener MenuListener MenuSelectionManager MenuShortcut MessageDigest MessageDigestSpi MessageFormat MessageFormat.Field MessageProp MetaEventListener MetaMessage MetalBorders MetalBorders.ButtonBorder MetalBorders.Flush3DBorder MetalBorders.InternalFrameBorder MetalBorders.MenuBarBorder MetalBorders.MenuItemBorder MetalBorders.OptionDialogBorder MetalBorders.PaletteBorder MetalBorders.PopupMenuBorder MetalBorders.RolloverButtonBorder MetalBorders.ScrollPaneBorder MetalBorders.TableHeaderBorder MetalBorders.TextFieldBorder MetalBorders.ToggleButtonBorder MetalBorders.ToolBarBorder MetalButtonUI MetalCheckBoxIcon MetalCheckBoxUI MetalComboBoxButton MetalComboBoxEditor MetalComboBoxEditor.UIResource MetalComboBoxIcon MetalComboBoxUI MetalDesktopIconUI MetalFileChooserUI MetalIconFactory MetalIconFactory.FileIcon16 MetalIconFactory.FolderIcon16 MetalIconFactory.PaletteCloseIcon MetalIconFactory.TreeControlIcon MetalIconFactory.TreeFolderIcon MetalIconFactory.TreeLeafIcon MetalInternalFrameTitlePane MetalInternalFrameUI MetalLabelUI MetalLookAndFeel MetalMenuBarUI MetalPopupMenuSeparatorUI MetalProgressBarUI MetalRadioButtonUI MetalRootPaneUI MetalScrollBarUI MetalScrollButton MetalScrollPaneUI MetalSeparatorUI MetalSliderUI MetalSplitPaneUI MetalTabbedPaneUI MetalTextFieldUI MetalTheme MetalToggleButtonUI MetalToolBarUI MetalToolTipUI MetalTreeUI Method MethodDescriptor MidiChannel MidiDevice MidiDevice.Info MidiDeviceProvider MidiEvent MidiFileFormat MidiFileReader MidiFileWriter MidiMessage MidiSystem MidiUnavailableException MimeTypeParseException MinimalHTMLWriter MissingFormatArgumentException MissingFormatWidthException MissingResourceException Mixer Mixer.Info MixerProvider ModelMBean ModelMBeanAttributeInfo ModelMBeanConstructorInfo ModelMBeanInfo ModelMBeanInfoSupport ModelMBeanNotificationBroadcaster ModelMBeanNotificationInfo ModelMBeanOperationInfo ModificationItem Modifier Monitor MonitorMBean MonitorNotification MonitorSettingException MouseAdapter MouseDragGestureRecognizer MouseEvent MouseInfo MouseInputAdapter MouseInputListener MouseListener MouseMotionAdapter MouseMotionListener MouseWheelEvent MouseWheelListener MultiButtonUI MultiColorChooserUI MultiComboBoxUI MultiDesktopIconUI MultiDesktopPaneUI MultiDoc MultiDocPrintJob MultiDocPrintService MultiFileChooserUI MultiInternalFrameUI MultiLabelUI MultiListUI MultiLookAndFeel MultiMenuBarUI MultiMenuItemUI MultiOptionPaneUI MultiPanelUI MultiPixelPackedSampleModel MultiPopupMenuUI MultiProgressBarUI MultiRootPaneUI MultiScrollBarUI MultiScrollPaneUI MultiSeparatorUI MultiSliderUI MultiSpinnerUI MultiSplitPaneUI MultiTabbedPaneUI MultiTableHeaderUI MultiTableUI MultiTextUI MultiToolBarUI MultiToolTipUI MultiTreeUI MultiViewportUI MulticastSocket MultipleComponentProfileHelper MultipleComponentProfileHolder MultipleDocumentHandling MultipleMaster MutableAttributeSet MutableComboBoxModel MutableTreeNode NON_EXISTENT NO_IMPLEMENT NO_MEMORY NO_PERMISSION NO_RESOURCES NO_RESPONSE NVList Name NameAlreadyBoundException NameCallback NameClassPair NameComponent NameComponentHelper NameComponentHolder NameDynAnyPair NameDynAnyPairHelper NameDynAnyPairSeqHelper NameHelper NameHolder NameList NameNotFoundException NameParser NameValuePair NameValuePair NameValuePairHelper NameValuePairHelper NameValuePairSeqHelper NamedNodeMap NamedValue NamespaceChangeListener NamespaceContext NamespaceSupport Naming NamingContext NamingContextExt NamingContextExtHelper NamingContextExtHolder NamingContextExtOperations NamingContextExtPOA NamingContextHelper NamingContextHolder NamingContextOperations NamingContextPOA NamingEnumeration NamingEvent NamingException NamingExceptionEvent NamingListener NamingManager NamingSecurityException NavigationFilter NavigationFilter.FilterBypass NegativeArraySizeException NetPermission NetworkInterface NoClassDefFoundError NoConnectionPendingException NoContext NoContextHelper NoInitialContextException NoPermissionException NoRouteToHostException NoServant NoServantHelper NoSuchAlgorithmException NoSuchAttributeException NoSuchElementException NoSuchFieldError NoSuchFieldException NoSuchMethodError NoSuchMethodException NoSuchObjectException NoSuchPaddingException NoSuchProviderException Node NodeChangeEvent NodeChangeListener NodeList NonReadableChannelException NonWritableChannelException NoninvertibleTransformException NotActiveException NotBoundException NotCompliantMBeanException NotContextException NotEmpty NotEmptyHelper NotEmptyHolder NotFound NotFoundHelper NotFoundHolder NotFoundReason NotFoundReasonHelper NotFoundReasonHolder NotOwnerException NotSerializableException NotYetBoundException NotYetConnectedException Notation Notification NotificationBroadcaster NotificationBroadcasterSupport NotificationEmitter NotificationFilter NotificationFilterSupport NotificationListener NotificationResult NullCipher NullPointerException Number NumberFormat NumberFormat.Field NumberFormatException NumberFormatter NumberOfDocuments NumberOfInterveningJobs NumberUp NumberUpSupported NumericShaper OAEPParameterSpec OBJECT_NOT_EXIST OBJ_ADAPTER OMGVMCID ORB ORB ORBIdHelper ORBInitInfo ORBInitInfoOperations ORBInitializer ORBInitializerOperations ObjID Object Object ObjectAlreadyActive ObjectAlreadyActiveHelper ObjectChangeListener ObjectFactory ObjectFactoryBuilder ObjectHelper ObjectHolder ObjectIdHelper ObjectIdHelper ObjectImpl ObjectImpl ObjectInput ObjectInputStream ObjectInputStream.GetField ObjectInputValidation ObjectInstance ObjectName ObjectNotActive ObjectNotActiveHelper ObjectOutput ObjectOutputStream ObjectOutputStream.PutField ObjectReferenceFactory ObjectReferenceFactoryHelper ObjectReferenceFactoryHolder ObjectReferenceTemplate ObjectReferenceTemplateHelper ObjectReferenceTemplateHolder ObjectReferenceTemplateSeqHelper ObjectReferenceTemplateSeqHolder ObjectStreamClass ObjectStreamConstants ObjectStreamException ObjectStreamField ObjectView Observable Observer OceanTheme OctetSeqHelper OctetSeqHolder Oid OpenDataException OpenMBeanAttributeInfo OpenMBeanAttributeInfoSupport OpenMBeanConstructorInfo OpenMBeanConstructorInfoSupport OpenMBeanInfo OpenMBeanInfoSupport OpenMBeanOperationInfo OpenMBeanOperationInfoSupport OpenMBeanParameterInfo OpenMBeanParameterInfoSupport OpenType OpenType OperatingSystemMXBean Operation OperationNotSupportedException OperationsException Option OptionPaneUI OptionalDataException OrientationRequested OutOfMemoryError OutputDeviceAssigned OutputKeys OutputStream OutputStream OutputStream OutputStreamWriter OverlappingFileLockException OverlayLayout Override Owner PBEKey PBEKeySpec PBEParameterSpec PDLOverrideSupported PERSIST_STORE PKCS8EncodedKeySpec PKIXBuilderParameters PKIXCertPathBuilderResult PKIXCertPathChecker PKIXCertPathValidatorResult PKIXParameters POA POAHelper POAManager POAManagerOperations POAOperations PRIVATE_MEMBER PSSParameterSpec PSource PSource.PSpecified PUBLIC_MEMBER Pack200 Pack200.Packer Pack200.Unpacker Package PackedColorModel PageAttributes PageAttributes.ColorType PageAttributes.MediaType PageAttributes.OrientationRequestedType PageAttributes.OriginType PageAttributes.PrintQualityType PageFormat PageRanges Pageable PagedResultsControl PagedResultsResponseControl PagesPerMinute PagesPerMinuteColor Paint PaintContext PaintEvent Panel PanelUI Paper ParagraphView ParagraphView Parameter ParameterBlock ParameterDescriptor ParameterMetaData ParameterMode ParameterModeHelper ParameterModeHolder ParameterizedType ParseException ParsePosition Parser Parser ParserAdapter ParserConfigurationException ParserDelegator ParserFactory PartialResultException PasswordAuthentication PasswordCallback PasswordView Patch PathIterator Pattern PatternSyntaxException Permission Permission PermissionCollection Permissions PersistenceDelegate PersistentMBean PhantomReference Pipe Pipe.SinkChannel Pipe.SourceChannel PipedInputStream PipedOutputStream PipedReader PipedWriter PixelGrabber PixelInterleavedSampleModel PlainDocument PlainView Point Point2D Point2D.Double Point2D.Float PointerInfo Policy Policy Policy PolicyError PolicyErrorCodeHelper PolicyErrorHelper PolicyErrorHolder PolicyFactory PolicyFactoryOperations PolicyHelper PolicyHolder PolicyListHelper PolicyListHolder PolicyNode PolicyOperations PolicyQualifierInfo PolicyTypeHelper Polygon PooledConnection Popup PopupFactory PopupMenu PopupMenuEvent PopupMenuListener PopupMenuUI Port Port.Info PortUnreachableException PortableRemoteObject PortableRemoteObjectDelegate Position Position.Bias Predicate PreferenceChangeEvent PreferenceChangeListener Preferences PreferencesFactory PreparedStatement PresentationDirection Principal Principal PrincipalHolder PrintEvent PrintException PrintGraphics PrintJob PrintJobAdapter PrintJobAttribute PrintJobAttributeEvent PrintJobAttributeListener PrintJobAttributeSet PrintJobEvent PrintJobListener PrintQuality PrintRequestAttribute PrintRequestAttributeSet PrintService PrintServiceAttribute PrintServiceAttributeEvent PrintServiceAttributeListener PrintServiceAttributeSet PrintServiceLookup PrintStream PrintWriter Printable PrinterAbortException PrinterException PrinterGraphics PrinterIOException PrinterInfo PrinterIsAcceptingJobs PrinterJob PrinterLocation PrinterMakeAndModel PrinterMessageFromOperator PrinterMoreInfo PrinterMoreInfoManufacturer PrinterName PrinterResolution PrinterState PrinterStateReason PrinterStateReasons PrinterURI PriorityBlockingQueue PriorityQueue PrivateClassLoader PrivateCredentialPermission PrivateKey PrivateMLet PrivilegedAction PrivilegedActionException PrivilegedExceptionAction Process ProcessBuilder ProcessingInstruction ProfileDataException ProfileIdHelper ProgressBarUI ProgressMonitor ProgressMonitorInputStream Properties PropertyChangeEvent PropertyChangeListener PropertyChangeListenerProxy PropertyChangeSupport PropertyDescriptor PropertyEditor PropertyEditorManager PropertyEditorSupport PropertyPermission PropertyResourceBundle PropertyVetoException ProtectionDomain ProtocolException Provider Provider.Service ProviderException Proxy Proxy Proxy.Type ProxySelector PublicKey PushbackInputStream PushbackReader QName QuadCurve2D QuadCurve2D.Double QuadCurve2D.Float Query QueryEval QueryExp Queue QueuedJobCount RC2ParameterSpec RC5ParameterSpec REBIND REQUEST_PROCESSING_POLICY_ID RGBImageFilter RMIClassLoader RMIClassLoaderSpi RMIClientSocketFactory RMIConnection RMIConnectionImpl RMIConnectionImpl_Stub RMIConnector RMIConnectorServer RMICustomMaxStreamFormat RMIFailureHandler RMIIIOPServerImpl RMIJRMPServerImpl RMISecurityException RMISecurityManager RMIServer RMIServerImpl RMIServerImpl_Stub RMIServerSocketFactory RMISocketFactory RSAKey RSAKeyGenParameterSpec RSAMultiPrimePrivateCrtKey RSAMultiPrimePrivateCrtKeySpec RSAOtherPrimeInfo RSAPrivateCrtKey RSAPrivateCrtKeySpec RSAPrivateKey RSAPrivateKeySpec RSAPublicKey RSAPublicKeySpec RTFEditorKit Random RandomAccess RandomAccessFile Raster RasterFormatException RasterOp Rdn ReadOnlyBufferException ReadWriteLock Readable ReadableByteChannel Reader RealmCallback RealmChoiceCallback Receiver Rectangle Rectangle2D Rectangle2D.Double Rectangle2D.Float RectangularShape ReentrantLock ReentrantReadWriteLock ReentrantReadWriteLock.ReadLock ReentrantReadWriteLock.WriteLock Ref RefAddr Reference Reference ReferenceQueue ReferenceUriSchemesSupported Referenceable ReferralException ReflectPermission ReflectionException RefreshFailedException Refreshable Region RegisterableService Registry RegistryHandler RejectedExecutionException RejectedExecutionHandler Relation RelationException RelationNotFoundException RelationNotification RelationService RelationServiceMBean RelationServiceNotRegisteredException RelationSupport RelationSupportMBean RelationType RelationTypeNotFoundException RelationTypeSupport RemarshalException Remote RemoteCall RemoteException RemoteObject RemoteObjectInvocationHandler RemoteRef RemoteServer RemoteStub RenderContext RenderableImage RenderableImageOp RenderableImageProducer RenderedImage RenderedImageFactory Renderer RenderingHints RenderingHints.Key RepaintManager ReplicateScaleFilter RepositoryIdHelper Request RequestInfo RequestInfoOperations RequestProcessingPolicy RequestProcessingPolicyOperations RequestProcessingPolicyValue RequestingUserName RequiredModelMBean RescaleOp ResolutionSyntax ResolveResult Resolver ResourceBundle ResponseCache ResponseHandler Result ResultSet ResultSetMetaData Retention RetentionPolicy ReverbType Robot Role RoleInfo RoleInfoNotFoundException RoleList RoleNotFoundException RoleResult RoleStatus RoleUnresolved RoleUnresolvedList RootPaneContainer RootPaneUI RoundRectangle2D RoundRectangle2D.Double RoundRectangle2D.Float RoundingMode RowMapper RowSet RowSetEvent RowSetInternal RowSetListener RowSetMetaData RowSetMetaDataImpl RowSetReader RowSetWarning RowSetWriter RuleBasedCollator RunTime RunTimeOperations Runnable Runtime RuntimeErrorException RuntimeException RuntimeMBeanException RuntimeMXBean RuntimeOperationsException RuntimePermission SAXException SAXNotRecognizedException SAXNotSupportedException SAXParseException SAXParser SAXParserFactory SAXResult SAXSource SAXTransformerFactory SERVANT_RETENTION_POLICY_ID SQLData SQLException SQLInput SQLInputImpl SQLOutput SQLOutputImpl SQLPermission SQLWarning SSLContext SSLContextSpi SSLEngine SSLEngineResult SSLEngineResult.HandshakeStatus SSLEngineResult.Status SSLException SSLHandshakeException SSLKeyException SSLPeerUnverifiedException SSLPermission SSLProtocolException SSLServerSocket SSLServerSocketFactory SSLSession SSLSessionBindingEvent SSLSessionBindingListener SSLSessionContext SSLSocket SSLSocketFactory SUCCESSFUL SYNC_WITH_TRANSPORT SYSTEM_EXCEPTION SampleModel Sasl SaslClient SaslClientFactory SaslException SaslServer SaslServerFactory Savepoint Scanner ScatteringByteChannel ScheduledExecutorService ScheduledFuture ScheduledThreadPoolExecutor Schema SchemaFactory SchemaFactoryLoader SchemaViolationException ScrollBarUI ScrollPane ScrollPaneAdjustable ScrollPaneConstants ScrollPaneLayout ScrollPaneLayout.UIResource ScrollPaneUI Scrollable Scrollbar SealedObject SearchControls SearchResult SecretKey SecretKeyFactory SecretKeyFactorySpi SecretKeySpec SecureCacheResponse SecureClassLoader SecureRandom SecureRandomSpi Security SecurityException SecurityManager SecurityPermission Segment SelectableChannel SelectionKey Selector SelectorProvider Semaphore SeparatorUI Sequence SequenceInputStream Sequencer Sequencer.SyncMode SerialArray SerialBlob SerialClob SerialDatalink SerialException SerialJavaObject SerialRef SerialStruct Serializable SerializablePermission Servant ServantActivator ServantActivatorHelper ServantActivatorOperations ServantActivatorPOA ServantAlreadyActive ServantAlreadyActiveHelper ServantLocator ServantLocatorHelper ServantLocatorOperations ServantLocatorPOA ServantManager ServantManagerOperations ServantNotActive ServantNotActiveHelper ServantObject ServantRetentionPolicy ServantRetentionPolicyOperations ServantRetentionPolicyValue ServerCloneException ServerError ServerException ServerIdHelper ServerNotActiveException ServerRef ServerRequest ServerRequestInfo ServerRequestInfoOperations ServerRequestInterceptor ServerRequestInterceptorOperations ServerRuntimeException ServerSocket ServerSocketChannel ServerSocketFactory ServiceContext ServiceContextHelper ServiceContextHolder ServiceContextListHelper ServiceContextListHolder ServiceDetail ServiceDetailHelper ServiceIdHelper ServiceInformation ServiceInformationHelper ServiceInformationHolder ServiceNotFoundException ServicePermission ServiceRegistry ServiceRegistry.Filter ServiceUI ServiceUIFactory ServiceUnavailableException Set SetOfIntegerSyntax SetOverrideType SetOverrideTypeHelper Severity Shape ShapeGraphicAttribute SheetCollate Short ShortBuffer ShortBufferException ShortHolder ShortLookupTable ShortMessage ShortSeqHelper ShortSeqHolder Sides Signature SignatureException SignatureSpi SignedObject Signer SimpleAttributeSet SimpleBeanInfo SimpleDateFormat SimpleDoc SimpleFormatter SimpleTimeZone SimpleType SinglePixelPackedSampleModel SingleSelectionModel Size2DSyntax SizeLimitExceededException SizeRequirements SizeSequence Skeleton SkeletonMismatchException SkeletonNotFoundException SliderUI Socket SocketAddress SocketChannel SocketException SocketFactory SocketHandler SocketImpl SocketImplFactory SocketOptions SocketPermission SocketSecurityException SocketTimeoutException SoftBevelBorder SoftReference SortControl SortKey SortResponseControl SortedMap SortedSet SortingFocusTraversalPolicy Soundbank SoundbankReader SoundbankResource Source SourceDataLine SourceLocator SpinnerDateModel SpinnerListModel SpinnerModel SpinnerNumberModel SpinnerUI SplitPaneUI Spring SpringLayout SpringLayout.Constraints SslRMIClientSocketFactory SslRMIServerSocketFactory Stack StackOverflowError StackTraceElement StandardMBean StartTlsRequest StartTlsResponse State StateEdit StateEditable StateFactory Statement Statement StreamCorruptedException StreamHandler StreamPrintService StreamPrintServiceFactory StreamResult StreamSource StreamTokenizer Streamable StreamableValue StrictMath String StringBuffer StringBufferInputStream StringBuilder StringCharacterIterator StringContent StringHolder StringIndexOutOfBoundsException StringMonitor StringMonitorMBean StringNameHelper StringReader StringRefAddr StringSelection StringSeqHelper StringSeqHolder StringTokenizer StringValueExp StringValueHelper StringWriter Stroke Struct StructMember StructMemberHelper Stub StubDelegate StubNotFoundException Style StyleConstants StyleConstants.CharacterConstants StyleConstants.ColorConstants StyleConstants.FontConstants StyleConstants.ParagraphConstants StyleContext StyleSheet StyleSheet.BoxPainter StyleSheet.ListPainter StyledDocument StyledEditorKit StyledEditorKit.AlignmentAction StyledEditorKit.BoldAction StyledEditorKit.FontFamilyAction StyledEditorKit.FontSizeAction StyledEditorKit.ForegroundAction StyledEditorKit.ItalicAction StyledEditorKit.StyledTextAction StyledEditorKit.UnderlineAction Subject SubjectDelegationPermission SubjectDomainCombiner SupportedValuesAttribute SuppressWarnings SwingConstants SwingPropertyChangeSupport SwingUtilities SyncFactory SyncFactoryException SyncFailedException SyncProvider SyncProviderException SyncResolver SyncScopeHelper SynchronousQueue SynthConstants SynthContext SynthGraphicsUtils SynthLookAndFeel SynthPainter SynthStyle SynthStyleFactory Synthesizer SysexMessage System SystemColor SystemException SystemFlavorMap TAG_ALTERNATE_IIOP_ADDRESS TAG_CODE_SETS TAG_INTERNET_IOP TAG_JAVA_CODEBASE TAG_MULTIPLE_COMPONENTS TAG_ORB_TYPE TAG_POLICIES TAG_RMI_CUSTOM_MAX_STREAM_FORMAT TCKind THREAD_POLICY_ID TIMEOUT TRANSACTION_MODE TRANSACTION_REQUIRED TRANSACTION_ROLLEDBACK TRANSACTION_UNAVAILABLE TRANSIENT TRANSPORT_RETRY TabExpander TabSet TabStop TabableView TabbedPaneUI TableCellEditor TableCellRenderer TableColumn TableColumnModel TableColumnModelEvent TableColumnModelListener TableHeaderUI TableModel TableModelEvent TableModelListener TableUI TableView TabularData TabularDataSupport TabularType TagElement TaggedComponent TaggedComponentHelper TaggedComponentHolder TaggedProfile TaggedProfileHelper TaggedProfileHolder Target TargetDataLine TargetedNotification Templates TemplatesHandler Text TextAction TextArea TextAttribute TextComponent TextEvent TextField TextHitInfo TextInputCallback TextLayout TextLayout.CaretPolicy TextListener TextMeasurer TextOutputCallback TextSyntax TextUI TexturePaint Thread Thread.State Thread.UncaughtExceptionHandler ThreadDeath ThreadFactory ThreadGroup ThreadInfo ThreadLocal ThreadMXBean ThreadPolicy ThreadPolicyOperations ThreadPolicyValue ThreadPoolExecutor ThreadPoolExecutor.AbortPolicy ThreadPoolExecutor.CallerRunsPolicy ThreadPoolExecutor.DiscardOldestPolicy ThreadPoolExecutor.DiscardPolicy Throwable Tie TileObserver Time TimeLimitExceededException TimeUnit TimeZone TimeoutException Timer Timer Timer TimerAlarmClockNotification TimerMBean TimerNotification TimerTask Timestamp Timestamp TitledBorder TooManyListenersException ToolBarUI ToolTipManager ToolTipUI Toolkit Track TransactionRequiredException TransactionRolledbackException TransactionService TransactionalWriter TransferHandler Transferable TransformAttribute Transformer TransformerConfigurationException TransformerException TransformerFactory TransformerFactoryConfigurationError TransformerHandler Transmitter Transparency TreeCellEditor TreeCellRenderer TreeExpansionEvent TreeExpansionListener TreeMap TreeModel TreeModelEvent TreeModelListener TreeNode TreePath TreeSelectionEvent TreeSelectionListener TreeSelectionModel TreeSet TreeUI TreeWillExpandListener TrustAnchor TrustManager TrustManagerFactory TrustManagerFactorySpi Type TypeCode TypeCodeHolder TypeInfo TypeInfoProvider TypeMismatch TypeMismatch TypeMismatch TypeMismatchHelper TypeMismatchHelper TypeNotPresentException TypeVariable Types UID UIDefaults UIDefaults.ActiveValue UIDefaults.LazyInputMap UIDefaults.LazyValue UIDefaults.ProxyLazyValue UIManager UIManager.LookAndFeelInfo UIResource ULongLongSeqHelper ULongLongSeqHolder ULongSeqHelper ULongSeqHolder UNKNOWN UNKNOWN UNSUPPORTED_POLICY UNSUPPORTED_POLICY_VALUE URI URIException URIResolver URISyntax URISyntaxException URL URLClassLoader URLConnection URLDecoder URLEncoder URLStreamHandler URLStreamHandlerFactory URLStringHelper USER_EXCEPTION UShortSeqHelper UShortSeqHolder UTFDataFormatException UUID UndeclaredThrowableException UndoManager UndoableEdit UndoableEditEvent UndoableEditListener UndoableEditSupport UnexpectedException UnicastRemoteObject UnionMember UnionMemberHelper UnknownEncoding UnknownEncodingHelper UnknownError UnknownException UnknownFormatConversionException UnknownFormatFlagsException UnknownGroupException UnknownHostException UnknownHostException UnknownObjectException UnknownServiceException UnknownUserException UnknownUserExceptionHelper UnknownUserExceptionHolder UnmappableCharacterException UnmarshalException UnmodifiableClassException UnmodifiableSetException UnrecoverableEntryException UnrecoverableKeyException Unreferenced UnresolvedAddressException UnresolvedPermission UnsatisfiedLinkError UnsolicitedNotification UnsolicitedNotificationEvent UnsolicitedNotificationListener UnsupportedAddressTypeException UnsupportedAudioFileException UnsupportedCallbackException UnsupportedCharsetException UnsupportedClassVersionError UnsupportedEncodingException UnsupportedFlavorException UnsupportedLookAndFeelException UnsupportedOperationException UserDataHandler UserException Util UtilDelegate Utilities VMID VM_ABSTRACT VM_CUSTOM VM_NONE VM_TRUNCATABLE Validator ValidatorHandler ValueBase ValueBaseHelper ValueBaseHolder ValueExp ValueFactory ValueHandler ValueHandlerMultiFormat ValueInputStream ValueMember ValueMemberHelper ValueOutputStream VariableHeightLayoutCache Vector VerifyError VersionSpecHelper VetoableChangeListener VetoableChangeListenerProxy VetoableChangeSupport View ViewFactory ViewportLayout ViewportUI VirtualMachineError Visibility VisibilityHelper VoiceStatus Void VolatileImage WCharSeqHelper WCharSeqHolder WStringSeqHelper WStringSeqHolder WStringValueHelper WeakHashMap WeakReference WebRowSet WildcardType Window WindowAdapter WindowConstants WindowEvent WindowFocusListener WindowListener WindowStateListener WrappedPlainView WritableByteChannel WritableRaster WritableRenderedImage WriteAbortedException Writer WrongAdapter WrongAdapterHelper WrongPolicy WrongPolicyHelper WrongTransaction WrongTransactionHelper WrongTransactionHolder X500Principal X500PrivateCredential X509CRL X509CRLEntry X509CRLSelector X509CertSelector X509Certificate X509Certificate X509EncodedKeySpec X509ExtendedKeyManager X509Extension X509KeyManager X509TrustManager XAConnection XADataSource XAException XAResource XMLConstants XMLDecoder XMLEncoder XMLFilter XMLFilterImpl XMLFormatter XMLGregorianCalendar XMLParseException XMLReader XMLReaderAdapter XMLReaderFactory XPath XPathConstants XPathException XPathExpression XPathExpressionException XPathFactory XPathFactoryConfigurationException XPathFunction XPathFunctionException XPathFunctionResolver XPathVariableResolver Xid XmlReader XmlWriter ZipEntry ZipException ZipFile ZipInputStream ZipOutputStream ZoneView _BindingIteratorImplBase _BindingIteratorStub _DynAnyFactoryStub _DynAnyStub _DynArrayStub _DynEnumStub _DynFixedStub _DynSequenceStub _DynStructStub _DynUnionStub _DynValueStub _IDLTypeStub _NamingContextExtStub _NamingContextImplBase _NamingContextStub _PolicyStub _Remote_Stub _ServantActivatorStub _ServantLocatorStub AbstractAnnotationValueVisitor6 AbstractElementVisitor6 AbstractMarshallerImpl AbstractOwnableSynchronizer AbstractProcessor AbstractQueuedLongSynchronizer AbstractScriptEngine AbstractTypeVisitor6 AbstractUnmarshallerImpl ActivationDataFlavor AlgorithmMethod AnnotationMirror AnnotationValue AnnotationValueVisitor ArrayDeque AsyncHandler AttachmentMarshaller AttachmentPart AttachmentUnmarshaller Binder BindingProvider Bindings BlockingDeque BreakIteratorProvider C14NMethodParameterSpec CanonicalizationMethod Characters ClientInfoStatus CollapsedStringAdapter CollatorProvider CommandInfo CommandMap CommandObject CommonDataSource Compilable CompiledScript Completion Completions CompositeDataInvocationHandler CompositeDataView ConcurrentNavigableMap ConcurrentSkipListMap ConcurrentSkipListSet ConfigurationSpi Console ConstructorProperties CookieManager CookiePolicy CookieStore CurrencyNameProvider Data DataContentHandler DataContentHandlerFactory DataHandler DatatypeConverter DatatypeConverterInterface DateFormatProvider DateFormatSymbolsProvider DecimalFormatSymbolsProvider DeclaredType DefaultRowSorter DefaultValidationEventHandler DeflaterInputStream Deque DescriptorKey DescriptorRead Desktop Detail DetailEntry Diagnostic DiagnosticCollector DiagnosticListener DigestMethod DigestMethodParameterSpec Dispatch DOMCryptoContext DomHandler DOMSignContext DOMStructure DOMURIReference DOMValidateContext DropMode ElementFilter ElementKind ElementKindVisitor6 Elements ElementScanner6 ElementVisitor EndDocument EndElement Endpoint EntityDeclaration ErrorType EventException EventFilter EventReaderDelegate EventTarget ExcC14NParameterSpec ExecutableElement ExecutableType FileDataSource FileNameExtensionFilter FileObject Filer FilerException FileTypeMap ForwardingFileObject ForwardingJavaFileManager ForwardingJavaFileObject Generated GridBagLayoutInfo GroupLayout HandlerChain HandlerResolver HexBinaryAdapter HMACParameterSpec Holder HTTPBinding HttpCookie HTTPException IDN ImmutableDescriptor InflaterOutputStream InitParam InterfaceAddress Invocable IOError JavaCompiler JavaFileManager JavaFileObject JAXBContext JAXBElement JAXBException JAXBIntrospector JAXBResult JAXBSource JMX JMXAddressable KeyInfo KeyInfoFactory KeyName KeySelector KeySelectorException KeySelectorResult KeyValue LayoutPath LayoutStyle LinearGradientPaint LinkedBlockingDeque LocaleNameProvider LocaleServiceProvider Location LockInfo LogicalHandler LogicalMessage LogicalMessageContext MailcapCommandMap Marshaller MessageContext MessageFactory Messager MimeHeader MimeHeaders MimeType MimeTypeParameterList MimetypesFileTypeMap MirroredTypeException MirroredTypesException MLetContent MonitorInfo MultipleGradientPaint MutationEvent MXBean Namespace NavigableMap NavigableSet NClob NestingKind NodeSetData NormalizedStringAdapter Normalizer NoSuchMechanismException NotationDeclaration NotIdentifiableEvent NotIdentifiableEventImpl NoType NullType NumberFormatProvider OctetStreamData Oneway OptionChecker PackageElement ParseConversionEvent ParseConversionEventImpl Path2D PGPData PolicySpi PortInfo PostConstruct PreDestroy PrimitiveType PrintConversionEvent PrintConversionEventImpl ProcessingEnvironment Processor PropertyException RadialGradientPaint ReferenceType RequestWrapper Resource Resources Response ResponseWrapper RetrievalMethod RoundEnvironment RowFilter RowId RowIdLifetime RowSorter RowSorterEvent RowSorterListener RunnableFuture RunnableScheduledFuture SAAJMetaFactory SAAJResult SchemaOutputResolver ScriptContext ScriptEngine ScriptEngineFactory ScriptEngineManager ScriptException Service ServiceConfigurationError ServiceDelegate ServiceLoader ServiceMode SignatureMethod SignatureMethodParameterSpec SignatureProperties SignatureProperty SignedInfo SimpleAnnotationValueVisitor6 SimpleBindings SimpleElementVisitor6 SimpleJavaFileObject SimpleScriptContext SimpleTypeVisitor6 SOAPBinding SOAPBinding SOAPBody SOAPBodyElement SOAPConnection SOAPConnectionFactory SOAPConstants SOAPElement SOAPElementFactory SOAPEnvelope SOAPException SOAPFactory SOAPFault SOAPFaultElement SOAPFaultException SOAPHandler SOAPHeader SOAPHeaderElement SOAPMessage SOAPMessageContext SOAPMessageHandler SOAPMessageHandlers SOAPPart SortOrder SourceVersion SplashScreen SQLClientInfoException SQLDataException SQLFeatureNotSupportedException SQLIntegrityConstraintViolationException SQLInvalidAuthorizationSpecException SQLNonTransientConnectionException SQLNonTransientException SQLRecoverableException SQLSyntaxErrorException SQLTimeoutException SQLTransactionRollbackException SQLTransientConnectionException SQLTransientException SQLXML SSLParameters StandardEmitterMBean StandardJavaFileManager StandardLocation StartDocument StartElement StatementEvent StatementEventListener StAXResult StAXSource StreamFilter StreamReaderDelegate SupportedAnnotationTypes SupportedOptions SupportedSourceVersion SwingWorker SystemTray TableRowSorter TableStringConverter TimeZoneNameProvider Tool ToolProvider Transform TransformException TransformParameterSpec TransformService TrayIcon TypeConstraintException TypeElement TypeKind TypeKindVisitor6 TypeMirror TypeParameterElement TypeVisitor UIEvent UnknownAnnotationValueException UnknownElementException UnknownTypeException Unmarshaller UnmarshallerHandler UnsupportedDataTypeException URIDereferencer URIParameter URIReference URIReferenceException URLDataSource ValidationEvent ValidationEventCollector ValidationEventHandler ValidationEventImpl ValidationEventLocator ValidationEventLocatorImpl ValidationException VariableElement W3CDomHandler WebEndpoint WebFault WebMethod WebParam WebResult WebService WebServiceClient WebServiceContext WebServiceException WebServicePermission WebServiceProvider WebServiceRef WebServiceRefs Wrapper X509Data X509IssuerSerial XmlAccessOrder XmlAccessorOrder XmlAccessorType XmlAccessType XmlAdapter XmlAnyAttribute XmlAnyElement XmlAttachmentRef XmlAttribute XMLCryptoContext XmlElement XmlElementDecl XmlElementRef XmlElementRefs XmlElements XmlElementWrapper XmlEnum XmlEnumValue XMLEvent XMLEventAllocator XMLEventConsumer XMLEventFactory XMLEventReader XMLEventWriter XmlID XmlIDREF XmlInlineBinaryData XMLInputFactory XmlJavaTypeAdapter XmlJavaTypeAdapters XmlList XmlMimeType XmlMixed XmlNs XmlNsForm XMLObject XMLOutputFactory XmlRegistry XMLReporter XMLResolver XmlRootElement XmlSchema XmlSchemaType XmlSchemaTypes XMLSignature XMLSignatureException XMLSignatureFactory XMLSignContext XMLStreamConstants XMLStreamException XMLStreamReader XMLStreamWriter XMLStructure XmlTransient XmlType XMLValidateContext XmlValue XPathFilter2ParameterSpec XPathFilterParameterSpec XPathType XSLTTransformParameterSpec ZipError" list_keywords = Set.fromList $ words $ "abstract break case catch class continue default do else enum extends false finally for goto if implements instanceof @interface interface native new null private protected public return super strictfp switch synchronized this throws throw transient true try volatile while" list_types = Set.fromList $ words $ "boolean byte char const double final float int long short static void"@@ -90,9 +87,9 @@ regex_'5cb'5b'5fa'2dzA'2dZ'5d'5cw'2a'28'3f'3d'5b'5cs'5d'2a'29 = compileRegex "\\b[_a-zA-Z]\\w*(?=[\\s]*)" regex_'5cs'2a'2e'2a'3b = compileRegex "\\s*.*;" -defaultAttributes = [("Normal",NormalTok),("InFunctionCall",NormalTok),("String",StringTok),("EnterPrintf",NormalTok),("Printf",NormalTok),("PrintfString",StringTok),("Member",NormalTok),("StaticImports",NormalTok),("Imports",NormalTok),("Commentar 1",CommentTok),("Commentar 2",CommentTok)]+defaultAttributes = [(("Java","Normal"),NormalTok),(("Java","InFunctionCall"),NormalTok),(("Java","String"),StringTok),(("Java","EnterPrintf"),NormalTok),(("Java","Printf"),NormalTok),(("Java","PrintfString"),StringTok),(("Java","Member"),NormalTok),(("Java","StaticImports"),NormalTok),(("Java","Imports"),NormalTok),(("Java","Commentar 1"),CommentTok),(("Java","Commentar 2"),CommentTok)] -parseRules "Normal" =+parseRules ("Java","Normal") = (((Text.Highlighting.Kate.Syntax.Javadoc.parseExpression)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok))@@ -117,13 +114,13 @@ <|> ((pRegExpr regex_'2f'2f'5cs'2aEND'2e'2a'24 >>= withAttribute DecValTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Java","String")) <|>- ((pRegExpr regex_'5c'2e'28format'7cprintf'29'5cb >>= withAttribute FunctionTok) >>~ pushContext "EnterPrintf")+ ((pRegExpr regex_'5c'2e'28format'7cprintf'29'5cb >>= withAttribute FunctionTok) >>~ pushContext ("Java","EnterPrintf")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Java","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Java","Commentar 2")) <|> ((pDetectChar False '{' >>= withAttribute NormalTok)) <|>@@ -131,24 +128,24 @@ <|> ((pRegExpr regex_'5c'2e'7b3'2c3'7d'5cs'2b >>= withAttribute KeywordTok)) <|>- ((pRegExpr regex_'5cb'28import'5cs'2bstatic'29'5cb >>= withAttribute KeywordTok) >>~ pushContext "StaticImports")+ ((pRegExpr regex_'5cb'28import'5cs'2bstatic'29'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Java","StaticImports")) <|>- ((pRegExpr regex_'5cb'28package'7cimport'29'5cb >>= withAttribute KeywordTok) >>~ pushContext "Imports")+ ((pRegExpr regex_'5cb'28package'7cimport'29'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Java","Imports")) <|> ((pRegExpr regex_'5cb'5b'5f'5cw'5d'5b'5f'5cw'5cd'5d'2a'28'3f'3d'5b'5cs'5d'2a'28'2f'5c'2a'5cs'2a'5cd'2b'5cs'2a'5c'2a'2f'5cs'2a'29'3f'5b'28'5d'29 >>= withAttribute FunctionTok)) <|>- ((pRegExpr regex_'5b'2e'5d'7b1'2c1'7d >>= withAttribute NormalTok) >>~ pushContext "Member")+ ((pRegExpr regex_'5b'2e'5d'7b1'2c1'7d >>= withAttribute NormalTok) >>~ pushContext ("Java","Member")) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "InFunctionCall")+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Java","InFunctionCall")) <|> ((pAnyChar ":!%&+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))) -parseRules "InFunctionCall" =- (((parseRules "Normal"))+parseRules ("Java","InFunctionCall") =+ (((parseRules ("Java","Normal"))) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "String" =+parseRules ("Java","String") = (((pLineContinue >>= withAttribute StringTok)) <|> ((pHlCStringChar >>= withAttribute CharTok))@@ -157,19 +154,19 @@ <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "EnterPrintf" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Printf")+parseRules ("Java","EnterPrintf") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Java","Printf")) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "Printf" =- (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "PrintfString")+parseRules ("Java","Printf") =+ (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Java","PrintfString")) <|>- ((parseRules "InFunctionCall")))+ ((parseRules ("Java","InFunctionCall")))) -parseRules "PrintfString" =+parseRules ("Java","PrintfString") = (((pLineContinue >>= withAttribute StringTok)) <|> ((pHlCStringChar >>= withAttribute CharTok))@@ -182,23 +179,23 @@ <|> ((pRegExpr regex_'25'28'25'7cn'29 >>= withAttribute CharTok))) -parseRules "Member" =+parseRules ("Java","Member") = (((pRegExpr regex_'5cb'5b'5fa'2dzA'2dZ'5d'5cw'2a'28'3f'3d'5b'5cs'5d'2a'29 >>= withAttribute FunctionTok) >>~ (popContext)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "StaticImports" =+parseRules ("Java","StaticImports") = ((pRegExpr regex_'5cs'2a'2e'2a'3b >>= withAttribute KeywordTok) >>~ (popContext)) -parseRules "Imports" =+parseRules ("Java","Imports") = ((pRegExpr regex_'5cs'2a'2e'2a'3b >>= withAttribute KeywordTok) >>~ (popContext)) -parseRules "Commentar 1" =+parseRules ("Java","Commentar 1") = pzero -parseRules "Commentar 2" =+parseRules ("Java","Commentar 2") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "" = parseRules "Normal"+parseRules ("Javadoc", _) = Text.Highlighting.Kate.Syntax.Javadoc.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Javadoc.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Html import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,34 +25,36 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Javadoc" }- context <- currentContext <|> (pushContext "Start" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Javadoc",["Start"])], synStLanguage = "Javadoc", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Javadoc","Start")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Start" -> return ()- "FindJavadoc" -> return ()- "JavadocFSar" -> return ()- "Javadocar" -> return ()- "JavadocParam" -> (popContext) >> pEndLine- "InlineTagar" -> return ()- "LiteralTagar" -> return ()- "SeeTag" -> (popContext) >> pEndLine+ ("Javadoc","Start") -> return ()+ ("Javadoc","FindJavadoc") -> return ()+ ("Javadoc","JavadocFSar") -> return ()+ ("Javadoc","Javadocar") -> return ()+ ("Javadoc","JavadocParam") -> (popContext) >> pEndLine+ ("Javadoc","InlineTagar") -> return ()+ ("Javadoc","LiteralTagar") -> return ()+ ("Javadoc","SeeTag") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -62,11 +63,7 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'28'21'7c'5c'3f'29 = compileRegex "(!|\\?)" regex_'28'5c'2e'5cs'2a'24'29 = compileRegex "(\\.\\s*$)" regex_'28'5c'2e'5cs'29'28'3f'21'5b'5cda'2dz'5d'29 = compileRegex "(\\.\\s)(?![\\da-z])"@@ -75,56 +72,56 @@ regex_'5cS'2a'28'3f'3d'5c'2a'2f'29 = compileRegex "\\S*(?=\\*/)" regex_'5cS'2a'28'5cs'7c'24'29 = compileRegex "\\S*(\\s|$)" -defaultAttributes = [("Start",NormalTok),("FindJavadoc",NormalTok),("JavadocFSar",CommentTok),("Javadocar",CommentTok),("JavadocParam",CommentTok),("InlineTagar",KeywordTok),("LiteralTagar",KeywordTok),("SeeTag",KeywordTok)]+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 "Start" =- ((parseRules "FindJavadoc"))+parseRules ("Javadoc","Start") =+ ((parseRules ("Javadoc","FindJavadoc"))) -parseRules "FindJavadoc" =+parseRules ("Javadoc","FindJavadoc") = (((pString False "/**/" >>= withAttribute CommentTok)) <|>- ((pString False "/**" >>= withAttribute CommentTok) >>~ pushContext "JavadocFSar"))+ ((pString False "/**" >>= withAttribute CommentTok) >>~ pushContext ("Javadoc","JavadocFSar"))) -parseRules "JavadocFSar" =+parseRules ("Javadoc","JavadocFSar") = (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) <|>- ((pRegExpr regex_'28'21'7c'5c'3f'29 >>= withAttribute CommentTok) >>~ pushContext "Javadocar")+ ((pRegExpr regex_'28'21'7c'5c'3f'29 >>= withAttribute CommentTok) >>~ pushContext ("Javadoc","Javadocar")) <|>- ((pRegExpr regex_'28'5c'2e'5cs'2a'24'29 >>= withAttribute CommentTok) >>~ pushContext "Javadocar")+ ((pRegExpr regex_'28'5c'2e'5cs'2a'24'29 >>= withAttribute CommentTok) >>~ pushContext ("Javadoc","Javadocar")) <|>- ((pRegExpr regex_'28'5c'2e'5cs'29'28'3f'21'5b'5cda'2dz'5d'29 >>= withAttribute CommentTok) >>~ pushContext "Javadocar")+ ((pRegExpr regex_'28'5c'2e'5cs'29'28'3f'21'5b'5cda'2dz'5d'29 >>= withAttribute CommentTok) >>~ pushContext ("Javadoc","Javadocar")) <|>- ((pFirstNonSpace >> pRegExpr regex_'5c'2a'2a'5cs'2a'28'3f'3d'40'28author'7cdeprecated'7cexception'7cparam'7creturn'7csee'7cserial'7cserialData'7cserialField'7csince'7cthrows'7cversion'29'28'5cs'7c'24'29'29 >>= withAttribute CommentTok) >>~ pushContext "Javadocar")+ ((pFirstNonSpace >> pRegExpr regex_'5c'2a'2a'5cs'2a'28'3f'3d'40'28author'7cdeprecated'7cexception'7cparam'7creturn'7csee'7cserial'7cserialData'7cserialField'7csince'7cthrows'7cversion'29'28'5cs'7c'24'29'29 >>= withAttribute CommentTok) >>~ pushContext ("Javadoc","Javadocar")) <|>- ((pString False "{@code " >>= withAttribute KeywordTok) >>~ pushContext "LiteralTagar")+ ((pString False "{@code " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","LiteralTagar")) <|>- ((pString False "{@code " >>= withAttribute KeywordTok) >>~ pushContext "LiteralTagar")+ ((pString False "{@code " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","LiteralTagar")) <|> ((pString False "{@docRoot}" >>= withAttribute KeywordTok)) <|> ((pString False "{@inheritDoc}" >>= withAttribute KeywordTok)) <|>- ((pString False "{@link " >>= withAttribute KeywordTok) >>~ pushContext "InlineTagar")+ ((pString False "{@link " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","InlineTagar")) <|>- ((pString False "{@link " >>= withAttribute KeywordTok) >>~ pushContext "InlineTagar")+ ((pString False "{@link " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","InlineTagar")) <|>- ((pString False "{@linkplain " >>= withAttribute KeywordTok) >>~ pushContext "InlineTagar")+ ((pString False "{@linkplain " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","InlineTagar")) <|>- ((pString False "{@linkplain " >>= withAttribute KeywordTok) >>~ pushContext "InlineTagar")+ ((pString False "{@linkplain " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","InlineTagar")) <|>- ((pString False "{@literal " >>= withAttribute KeywordTok) >>~ pushContext "LiteralTagar")+ ((pString False "{@literal " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","LiteralTagar")) <|>- ((pString False "{@literal " >>= withAttribute KeywordTok) >>~ pushContext "LiteralTagar")+ ((pString False "{@literal " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","LiteralTagar")) <|> ((pString False "{@value}" >>= withAttribute KeywordTok)) <|>- ((pString False "{@value " >>= withAttribute KeywordTok) >>~ pushContext "InlineTagar")+ ((pString False "{@value " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","InlineTagar")) <|>- ((pString False "{@value " >>= withAttribute KeywordTok) >>~ pushContext "InlineTagar")+ ((pString False "{@value " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","InlineTagar")) <|> ((Text.Highlighting.Kate.Syntax.Html.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "Javadocar" =+parseRules ("Javadoc","Javadocar") = (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext)) <|> ((pFirstNonSpace >> pRegExpr regex_'5c'2a'2b'28'3f'21'2f'29 >>= withAttribute CommentTok))@@ -133,13 +130,13 @@ <|> ((pString False "@deprecated " >>= withAttribute KeywordTok)) <|>- ((pString False "@exception " >>= withAttribute KeywordTok) >>~ pushContext "JavadocParam")+ ((pString False "@exception " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","JavadocParam")) <|>- ((pString False "@param " >>= withAttribute KeywordTok) >>~ pushContext "JavadocParam")+ ((pString False "@param " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","JavadocParam")) <|> ((pString False "@return " >>= withAttribute KeywordTok)) <|>- ((pString False "@see " >>= withAttribute KeywordTok) >>~ pushContext "SeeTag")+ ((pString False "@see " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","SeeTag")) <|> ((pString False "@serial " >>= withAttribute KeywordTok)) <|>@@ -149,7 +146,7 @@ <|> ((pString False "@since " >>= withAttribute KeywordTok)) <|>- ((pString False "@throws " >>= withAttribute KeywordTok) >>~ pushContext "JavadocParam")+ ((pString False "@throws " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","JavadocParam")) <|> ((pString False "@version " >>= withAttribute KeywordTok)) <|>@@ -157,13 +154,13 @@ <|> ((pString False "@deprecated " >>= withAttribute KeywordTok)) <|>- ((pString False "@exception " >>= withAttribute KeywordTok) >>~ pushContext "JavadocParam")+ ((pString False "@exception " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","JavadocParam")) <|>- ((pString False "@param " >>= withAttribute KeywordTok) >>~ pushContext "JavadocParam")+ ((pString False "@param " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","JavadocParam")) <|> ((pString False "@return " >>= withAttribute KeywordTok)) <|>- ((pString False "@see " >>= withAttribute KeywordTok) >>~ pushContext "SeeTag")+ ((pString False "@see " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","SeeTag")) <|> ((pString False "@serial " >>= withAttribute KeywordTok)) <|>@@ -173,62 +170,62 @@ <|> ((pString False "@since " >>= withAttribute KeywordTok)) <|>- ((pString False "@throws " >>= withAttribute KeywordTok) >>~ pushContext "JavadocParam")+ ((pString False "@throws " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","JavadocParam")) <|> ((pString False "@version " >>= withAttribute KeywordTok)) <|>- ((pString False "{@code " >>= withAttribute KeywordTok) >>~ pushContext "LiteralTagar")+ ((pString False "{@code " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","LiteralTagar")) <|>- ((pString False "{@code " >>= withAttribute KeywordTok) >>~ pushContext "LiteralTagar")+ ((pString False "{@code " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","LiteralTagar")) <|> ((pString False "{@docRoot}" >>= withAttribute KeywordTok)) <|> ((pString False "{@inheritDoc}" >>= withAttribute KeywordTok)) <|>- ((pString False "{@link " >>= withAttribute KeywordTok) >>~ pushContext "InlineTagar")+ ((pString False "{@link " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","InlineTagar")) <|>- ((pString False "{@link " >>= withAttribute KeywordTok) >>~ pushContext "InlineTagar")+ ((pString False "{@link " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","InlineTagar")) <|>- ((pString False "{@linkplain " >>= withAttribute KeywordTok) >>~ pushContext "InlineTagar")+ ((pString False "{@linkplain " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","InlineTagar")) <|>- ((pString False "{@linkplain " >>= withAttribute KeywordTok) >>~ pushContext "InlineTagar")+ ((pString False "{@linkplain " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","InlineTagar")) <|>- ((pString False "{@literal " >>= withAttribute KeywordTok) >>~ pushContext "LiteralTagar")+ ((pString False "{@literal " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","LiteralTagar")) <|>- ((pString False "{@literal " >>= withAttribute KeywordTok) >>~ pushContext "LiteralTagar")+ ((pString False "{@literal " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","LiteralTagar")) <|> ((pString False "{@value}" >>= withAttribute KeywordTok)) <|>- ((pString False "{@value " >>= withAttribute KeywordTok) >>~ pushContext "InlineTagar")+ ((pString False "{@value " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","InlineTagar")) <|>- ((pString False "{@value " >>= withAttribute KeywordTok) >>~ pushContext "InlineTagar")+ ((pString False "{@value " >>= withAttribute KeywordTok) >>~ pushContext ("Javadoc","InlineTagar")) <|> ((Text.Highlighting.Kate.Syntax.Html.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "JavadocParam" =+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))) -parseRules "InlineTagar" =+parseRules ("Javadoc","InlineTagar") = (((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext >> popContext)) <|> ((Text.Highlighting.Kate.Syntax.Html.parseExpression >>= ((withAttribute KeywordTok) . snd)))) -parseRules "LiteralTagar" =+parseRules ("Javadoc","LiteralTagar") = (((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext >> popContext))) -parseRules "SeeTag" =+parseRules ("Javadoc","SeeTag") = (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext >> popContext)) <|> ((Text.Highlighting.Kate.Syntax.Html.parseExpression >>= ((withAttribute KeywordTok) . snd)))) -parseRules "" = parseRules "Start"+parseRules ("HTML", _) = Text.Highlighting.Kate.Syntax.Html.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Javascript.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,38 +26,40 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "JavaScript" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("JavaScript",["Normal"])], synStLanguage = "JavaScript", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("JavaScript","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "String" -> (popContext) >> pEndLine- "String 1" -> (popContext) >> pEndLine- "Comment" -> (popContext) >> pEndLine- "Multi/inline Comment" -> return ()- "Regular Expression" -> return ()- "(Internal regex catch)" -> return ()- "Regular Expression Character Class" -> return ()- "(regex caret first check)" -> (popContext) >> pEndLine- "(charclass caret first check)" -> (popContext) >> pEndLine- "region_marker" -> (popContext) >> pEndLine- "ObjectMember" -> return ()+ ("JavaScript","Normal") -> return ()+ ("JavaScript","String") -> (popContext) >> pEndLine+ ("JavaScript","String 1") -> (popContext) >> pEndLine+ ("JavaScript","Comment") -> (popContext) >> pEndLine+ ("JavaScript","Multi/inline Comment") -> return ()+ ("JavaScript","Regular Expression") -> return ()+ ("JavaScript","(Internal regex catch)") -> return ()+ ("JavaScript","Regular Expression Character Class") -> return ()+ ("JavaScript","(regex caret first check)") -> (popContext) >> pEndLine+ ("JavaScript","(charclass caret first check)") -> (popContext) >> pEndLine+ ("JavaScript","region_marker") -> (popContext) >> pEndLine+ ("JavaScript","ObjectMember") -> return () _ -> return () withAttribute attr txt = do@@ -67,10 +68,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "if else for in while do continue break with try catch finally switch case new var function return delete true false void throw typeof const default" list_functions = Set.fromList $ words $ "escape isFinite isNaN Number parseFloat parseInt reload taint unescape untaint write" list_objects = Set.fromList $ words $ "Anchor Applet Area Array Boolean Button Checkbox Date document window Image FileUpload Form Frame Function Hidden Link MimeType Math Max Min Layer navigator Object Password Plugin Radio RegExp Reset Screen Select String Text Textarea this Window"@@ -90,14 +87,14 @@ regex_'2f'2f'28'3f'3d'3b'29 = compileRegex "//(?=;)" regex_'5c'5c'5b'5c'5b'5c'5d'5d = compileRegex "\\\\[\\[\\]]" -defaultAttributes = [("Normal",NormalTok),("String",StringTok),("String 1",CharTok),("Comment",CommentTok),("Multi/inline Comment",CommentTok),("Regular Expression",OtherTok),("(Internal regex catch)",NormalTok),("Regular Expression Character Class",BaseNTok),("(regex caret first check)",FloatTok),("(charclass caret first check)",FloatTok),("region_marker",RegionMarkerTok),("ObjectMember",NormalTok)]+defaultAttributes = [(("JavaScript","Normal"),NormalTok),(("JavaScript","String"),StringTok),(("JavaScript","String 1"),CharTok),(("JavaScript","Comment"),CommentTok),(("JavaScript","Multi/inline Comment"),CommentTok),(("JavaScript","Regular Expression"),OtherTok),(("JavaScript","(Internal regex catch)"),NormalTok),(("JavaScript","Regular Expression Character Class"),BaseNTok),(("JavaScript","(regex caret first check)"),FloatTok),(("JavaScript","(charclass caret first check)"),FloatTok),(("JavaScript","region_marker"),RegionMarkerTok),(("JavaScript","ObjectMember"),NormalTok)] -parseRules "Normal" =+parseRules ("JavaScript","Normal") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pString False "//BEGIN" >>= withAttribute RegionMarkerTok) >>~ pushContext "region_marker")+ ((pString False "//BEGIN" >>= withAttribute RegionMarkerTok) >>~ pushContext ("JavaScript","region_marker")) <|>- ((pString False "//END" >>= withAttribute RegionMarkerTok) >>~ pushContext "region_marker")+ ((pString False "//END" >>= withAttribute RegionMarkerTok) >>~ pushContext ("JavaScript","region_marker")) <|> ((pFloat >>= withAttribute FloatTok)) <|>@@ -115,23 +112,23 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_events >>= withAttribute KeywordTok)) <|>- ((pDetectChar False '.' >>= withAttribute NormalTok) >>~ pushContext "ObjectMember")+ ((pDetectChar False '.' >>= withAttribute NormalTok) >>~ pushContext ("JavaScript","ObjectMember")) <|>- ((pRegExpr regex_'5cb'5b'5cw'5c'2e'5d'2b'28'3f'3d'5c'2e'29 >>= withAttribute KeywordTok) >>~ pushContext "ObjectMember")+ ((pRegExpr regex_'5cb'5b'5cw'5c'2e'5d'2b'28'3f'3d'5c'2e'29 >>= withAttribute KeywordTok) >>~ pushContext ("JavaScript","ObjectMember")) <|> ((pDetectIdentifier >>= withAttribute NormalTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("JavaScript","String")) <|>- ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ pushContext "String 1")+ ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ pushContext ("JavaScript","String 1")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("JavaScript","Comment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Multi/inline Comment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("JavaScript","Multi/inline Comment")) <|>- ((pRegExpr regex_'5b'3d'3f'3a'5d >>= withAttribute NormalTok) >>~ pushContext "(Internal regex catch)")+ ((pRegExpr regex_'5b'3d'3f'3a'5d >>= withAttribute NormalTok) >>~ pushContext ("JavaScript","(Internal regex catch)")) <|>- ((pRegExpr regex_'5c'28 >>= withAttribute NormalTok) >>~ pushContext "(Internal regex catch)")+ ((pRegExpr regex_'5c'28 >>= withAttribute NormalTok) >>~ pushContext ("JavaScript","(Internal regex catch)")) <|> ((pDetectChar False '{' >>= withAttribute NormalTok)) <|>@@ -139,7 +136,7 @@ <|> ((pAnyChar ":!%&+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))) -parseRules "String" =+parseRules ("JavaScript","String") = (((pDetectIdentifier >>= withAttribute StringTok)) <|> ((pHlCStringChar >>= withAttribute CharTok))@@ -148,7 +145,7 @@ <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "String 1" =+parseRules ("JavaScript","String 1") = (((pDetectIdentifier >>= withAttribute CharTok)) <|> ((pHlCStringChar >>= withAttribute CharTok))@@ -157,19 +154,19 @@ <|> ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext))) -parseRules "Comment" =+parseRules ("JavaScript","Comment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "Multi/inline Comment" =+parseRules ("JavaScript","Multi/inline Comment") = (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Regular Expression" =+parseRules ("JavaScript","Regular Expression") = (((pRegExpr regex_'2f'5big'5d'7b0'2c2'7d >>= withAttribute OtherTok) >>~ (popContext >> popContext >> popContext)) <|> ((pRegExpr regex_'5c'7b'5b'5cd'2c_'5d'2b'5c'7d >>= withAttribute FloatTok))@@ -178,7 +175,7 @@ <|> ((pRegExpr regex_'5c'5c'5bnrtvfDdSsWw'5d >>= withAttribute BaseNTok)) <|>- ((pDetectChar False '[' >>= withAttribute BaseNTok) >>~ pushContext "(charclass caret first check)")+ ((pDetectChar False '[' >>= withAttribute BaseNTok) >>~ pushContext ("JavaScript","(charclass caret first check)")) <|> ((pRegExpr regex_'5c'5c'2e >>= withAttribute FloatTok)) <|>@@ -186,42 +183,42 @@ <|> ((pAnyChar "?+*()|" >>= withAttribute FloatTok))) -parseRules "(Internal regex catch)" =+parseRules ("JavaScript","(Internal regex catch)") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'2f'2f'28'3f'3d'3b'29 >>= withAttribute OtherTok) >>~ (popContext)) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("JavaScript","Comment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Multi/inline Comment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("JavaScript","Multi/inline Comment")) <|>- ((pDetectChar False '/' >>= withAttribute OtherTok) >>~ pushContext "(regex caret first check)")+ ((pDetectChar False '/' >>= withAttribute OtherTok) >>~ pushContext ("JavaScript","(regex caret first check)")) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "Regular Expression Character Class" =+parseRules ("JavaScript","Regular Expression Character Class") = (((pRegExpr regex_'5c'5c'5b'5c'5b'5c'5d'5d >>= withAttribute BaseNTok)) <|> ((pRegExpr regex_'5c'5c'2e >>= withAttribute FloatTok)) <|> ((pDetectChar False ']' >>= withAttribute BaseNTok) >>~ (popContext >> popContext))) -parseRules "(regex caret first check)" =- (((pDetectChar False '^' >>= withAttribute FloatTok) >>~ pushContext "Regular Expression")+parseRules ("JavaScript","(regex caret first check)") =+ (((pDetectChar False '^' >>= withAttribute FloatTok) >>~ pushContext ("JavaScript","Regular Expression")) <|>- (pushContext "Regular Expression" >> currentContext >>= parseRules))+ (pushContext ("JavaScript","Regular Expression") >> currentContext >>= parseRules)) -parseRules "(charclass caret first check)" =- (((pDetectChar False '^' >>= withAttribute FloatTok) >>~ pushContext "Regular Expression Character Class")+parseRules ("JavaScript","(charclass caret first check)") =+ (((pDetectChar False '^' >>= withAttribute FloatTok) >>~ pushContext ("JavaScript","Regular Expression Character Class")) <|>- (pushContext "Regular Expression Character Class" >> currentContext >>= parseRules))+ (pushContext ("JavaScript","Regular Expression Character Class") >> currentContext >>= parseRules)) -parseRules "region_marker" =+parseRules ("JavaScript","region_marker") = (((pDetectIdentifier >>= withAttribute RegionMarkerTok)) <|> ((pDetectSpaces >>= withAttribute RegionMarkerTok))) -parseRules "ObjectMember" =+parseRules ("JavaScript","ObjectMember") = (((pDetectChar False '.' >>= withAttribute NormalTok)) <|> ((pDetectIdentifier >>= withAttribute FunctionTok))@@ -230,6 +227,6 @@ <|> ((lookAhead (pAnyChar "(){}:!%&+,-/.*<=>?[]|~^;") >> (popContext) >> currentContext >>= parseRules))) -parseRules "" = parseRules "Normal"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Json.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,32 +25,34 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "JSON" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("JSON",["Normal"])], synStLanguage = "JSON", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("JSON","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "Pair" -> return ()- "String_Key" -> return ()- "Value" -> return ()- "String_Value" -> return ()- "Array" -> return ()+ ("JSON","Normal") -> return ()+ ("JSON","Pair") -> return ()+ ("JSON","String_Key") -> return ()+ ("JSON","Value") -> return ()+ ("JSON","String_Value") -> return ()+ ("JSON","Array") -> return () _ -> return () withAttribute attr txt = do@@ -60,29 +61,25 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_Constants = Set.fromList $ words $ "null true false" regex_'5c'5c'28'3f'3a'5b'22'5c'5c'2fbfnrt'5d'7cu'5b0'2d9a'2dfA'2df'5d'7b4'7d'29 = compileRegex "\\\\(?:[\"\\\\/bfnrt]|u[0-9a-fA-f]{4})" 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 = compileRegex "-?(?:[0-9]|[1-9][0-9]+)\\.[0-9]+(?:[eE][+-]?[0-9]+)?" 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 = compileRegex "-?(?:[0-9]|[1-9][0-9]+)(?:[eE][+-]?[0-9]+)?" -defaultAttributes = [("Normal",ErrorTok),("Pair",ErrorTok),("String_Key",DataTypeTok),("Value",ErrorTok),("String_Value",StringTok),("Array",ErrorTok)]+defaultAttributes = [(("JSON","Normal"),ErrorTok),(("JSON","Pair"),ErrorTok),(("JSON","String_Key"),DataTypeTok),(("JSON","Value"),ErrorTok),(("JSON","String_Value"),StringTok),(("JSON","Array"),ErrorTok)] -parseRules "Normal" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "Pair")+parseRules ("JSON","Normal") =+ (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("JSON","Pair")) <|>- ((pDetectChar False '[' >>= withAttribute NormalTok) >>~ pushContext "Array")+ ((pDetectChar False '[' >>= withAttribute NormalTok) >>~ pushContext ("JSON","Array")) <|> ((pDetectSpaces >>= withAttribute NormalTok))) -parseRules "Pair" =- (((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext "String_Key")+parseRules ("JSON","Pair") =+ (((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("JSON","String_Key")) <|>- ((pDetectChar False ':' >>= withAttribute NormalTok) >>~ pushContext "Value")+ ((pDetectChar False ':' >>= withAttribute NormalTok) >>~ pushContext ("JSON","Value")) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)) <|>@@ -90,17 +87,17 @@ <|> ((pDetectSpaces >>= withAttribute NormalTok))) -parseRules "String_Key" =+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))) -parseRules "Value" =- (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String_Value")+parseRules ("JSON","Value") =+ (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("JSON","String_Value")) <|>- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "Pair")+ ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("JSON","Pair")) <|>- ((pDetectChar False '[' >>= withAttribute NormalTok) >>~ pushContext "Array")+ ((pDetectChar False '[' >>= withAttribute NormalTok) >>~ pushContext ("JSON","Array")) <|> ((lookAhead (pDetectChar False '}') >> (popContext) >> currentContext >>= parseRules)) <|>@@ -114,21 +111,21 @@ <|> ((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))) -parseRules "String_Value" =+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))) -parseRules "Array" =+parseRules ("JSON","Array") = (((pDetectChar False ',' >>= withAttribute NormalTok)) <|> ((pDetectChar False ']' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "Pair")+ ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("JSON","Pair")) <|>- ((pDetectChar False '[' >>= withAttribute NormalTok) >>~ pushContext "Array")+ ((pDetectChar False '[' >>= withAttribute NormalTok) >>~ pushContext ("JSON","Array")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String_Value")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("JSON","String_Value")) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|>@@ -138,6 +135,5 @@ <|> ((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))) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Jsp.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,49 +25,51 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "JSP" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("JSP",["Normal"])], synStLanguage = "JSP", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = False, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("JSP","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = False, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "Jsp Standard Directive" -> return ()- "Jsp Xml Directive" -> return ()- "Jsp Comment" -> return ()- "Jsp Custom Tag" -> return ()- "Jsp Standard Directive Value" -> return ()- "Jsp Xml Directive Value" -> return ()- "Jsp Custom Tag Value" -> return ()- "Jsp Double Quoted Param Value" -> return ()- "Jsp Single Quoted Param Value" -> return ()- "Jsp Double Quoted Custom Tag Value" -> return ()- "Jsp Single Quoted Custom Tag Value" -> return ()- "Jsp Scriptlet" -> return ()- "Jsp Expression" -> return ()- "Java Single-Line Comment" -> (popContext) >> pEndLine- "Java Multi-Line Comment" -> return ()- "Java String" -> return ()- "Html Attribute" -> return ()- "Html Value" -> return ()- "Html Double Quoted Value" -> return ()- "Html Single Quoted Value" -> return ()- "Html Unquoted Value" -> return ()- "Html Comment" -> return ()+ ("JSP","Normal") -> return ()+ ("JSP","Jsp Standard Directive") -> return ()+ ("JSP","Jsp Xml Directive") -> return ()+ ("JSP","Jsp Comment") -> return ()+ ("JSP","Jsp Custom Tag") -> return ()+ ("JSP","Jsp Standard Directive Value") -> return ()+ ("JSP","Jsp Xml Directive Value") -> return ()+ ("JSP","Jsp Custom Tag Value") -> return ()+ ("JSP","Jsp Double Quoted Param Value") -> return ()+ ("JSP","Jsp Single Quoted Param Value") -> return ()+ ("JSP","Jsp Double Quoted Custom Tag Value") -> return ()+ ("JSP","Jsp Single Quoted Custom Tag Value") -> return ()+ ("JSP","Jsp Scriptlet") -> return ()+ ("JSP","Jsp Expression") -> return ()+ ("JSP","Java Single-Line Comment") -> (popContext) >> pEndLine+ ("JSP","Java Multi-Line Comment") -> return ()+ ("JSP","Java String") -> return ()+ ("JSP","Html Attribute") -> return ()+ ("JSP","Html Value") -> return ()+ ("JSP","Html Double Quoted Value") -> return ()+ ("JSP","Html Single Quoted Value") -> return ()+ ("JSP","Html Unquoted Value") -> return ()+ ("JSP","Html Comment") -> return () _ -> return () withAttribute attr txt = do@@ -77,10 +78,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_java'2d1'2e4'2e2'2dclasses = Set.fromList $ words $ "ARG_IN ARG_INOUT ARG_OUT AWTError AWTEvent AWTEventListener AWTEventListenerProxy AWTEventMulticaster AWTException AWTKeyStroke AWTPermission AbstractAction AbstractBorder AbstractButton AbstractCellEditor AbstractCollection AbstractColorChooserPanel AbstractDocument AbstractFormatter AbstractFormatterFactory AbstractInterruptibleChannel AbstractLayoutCache AbstractList AbstractListModel AbstractMap AbstractMethodError AbstractPreferences AbstractSelectableChannel AbstractSelectionKey AbstractSelector AbstractSequentialList AbstractSet AbstractSpinnerModel AbstractTableModel AbstractUndoableEdit AbstractWriter AccessControlContext AccessControlException AccessController AccessException Accessible AccessibleAction AccessibleBundle AccessibleComponent AccessibleContext AccessibleEditableText AccessibleExtendedComponent AccessibleExtendedTable AccessibleHyperlink AccessibleHypertext AccessibleIcon AccessibleKeyBinding AccessibleObject AccessibleRelation AccessibleRelationSet AccessibleResourceBundle AccessibleRole AccessibleSelection AccessibleState AccessibleStateSet AccessibleTable AccessibleTableModelChange AccessibleText AccessibleValue AccountExpiredException Acl AclEntry AclNotFoundException Action ActionEvent ActionListener ActionMap ActionMapUIResource Activatable ActivateFailedException ActivationDesc ActivationException ActivationGroup ActivationGroupDesc ActivationGroupID ActivationGroup_Stub ActivationID ActivationInstantiator ActivationMonitor ActivationSystem Activator ActiveEvent ActiveValue AdapterActivator AdapterActivatorOperations AdapterAlreadyExists AdapterAlreadyExistsHelper AdapterInactive AdapterInactiveHelper AdapterNonExistent AdapterNonExistentHelper AddressHelper Adjustable AdjustmentEvent AdjustmentListener Adler32 AffineTransform AffineTransformOp AlgorithmParameterGenerator AlgorithmParameterGeneratorSpi AlgorithmParameterSpec AlgorithmParameters AlgorithmParametersSpi AlignmentAction AllPermission AlphaComposite AlreadyBound AlreadyBoundException AlreadyBoundHelper AlreadyBoundHolder AlreadyConnectedException AncestorEvent AncestorListener Annotation Any AnyHolder AnySeqHelper AnySeqHelper AnySeqHolder AppConfigurationEntry Applet AppletContext AppletInitializer AppletStub ApplicationException Arc2D Area AreaAveragingScaleFilter ArithmeticException Array Array ArrayIndexOutOfBoundsException ArrayList ArrayStoreException Arrays AssertionError AsyncBoxView AsynchronousCloseException Attr Attribute Attribute Attribute Attribute Attribute AttributeContext AttributeException AttributeInUseException AttributeList AttributeList AttributeListImpl AttributeModificationException AttributeSet AttributeSet AttributeSetUtilities AttributeUndoableEdit AttributedCharacterIterator AttributedString Attributes Attributes Attributes AttributesImpl AudioClip AudioFileFormat AudioFileReader AudioFileWriter AudioFormat AudioInputStream AudioPermission AudioSystem AuthPermission AuthenticationException AuthenticationNotSupportedException Authenticator Autoscroll BAD_CONTEXT BAD_INV_ORDER BAD_OPERATION BAD_PARAM BAD_POLICY BAD_POLICY_TYPE BAD_POLICY_VALUE BAD_TYPECODE BCSIterator BCSSServiceProvider BYTE_ARRAY BackingStoreException BadKind BadLocationException BadPaddingException BandCombineOp BandedSampleModel BasicArrowButton BasicAttribute BasicAttributes BasicBorders BasicButtonListener BasicButtonUI BasicCaret BasicCheckBoxMenuItemUI BasicCheckBoxUI BasicColorChooserUI BasicComboBoxEditor BasicComboBoxRenderer BasicComboBoxUI BasicComboPopup BasicDesktopIconUI BasicDesktopPaneUI BasicDirectoryModel BasicEditorPaneUI BasicFileChooserUI BasicFormattedTextFieldUI BasicGraphicsUtils BasicHTML BasicHighlighter BasicIconFactory BasicInternalFrameTitlePane BasicInternalFrameUI BasicLabelUI BasicListUI BasicLookAndFeel BasicMenuBarUI BasicMenuItemUI BasicMenuUI BasicOptionPaneUI BasicPanelUI BasicPasswordFieldUI BasicPermission BasicPopupMenuSeparatorUI BasicPopupMenuUI BasicProgressBarUI BasicRadioButtonMenuItemUI BasicRadioButtonUI BasicRootPaneUI BasicScrollBarUI BasicScrollPaneUI BasicSeparatorUI BasicSliderUI BasicSpinnerUI BasicSplitPaneDivider BasicSplitPaneUI BasicStroke BasicTabbedPaneUI BasicTableHeaderUI BasicTableUI BasicTextAreaUI BasicTextFieldUI BasicTextPaneUI BasicTextUI BasicToggleButtonUI BasicToolBarSeparatorUI BasicToolBarUI BasicToolTipUI BasicTreeUI BasicViewportUI BatchUpdateException BeanContext BeanContextChild BeanContextChildComponentProxy BeanContextChildSupport BeanContextContainerProxy BeanContextEvent BeanContextMembershipEvent BeanContextMembershipListener BeanContextProxy BeanContextServiceAvailableEvent BeanContextServiceProvider BeanContextServiceProviderBeanInfo BeanContextServiceRevokedEvent BeanContextServiceRevokedListener BeanContextServices BeanContextServicesListener BeanContextServicesSupport BeanContextSupport BeanDescriptor BeanInfo Beans BeepAction BevelBorder BevelBorderUIResource Bias Bidi BigDecimal BigInteger BinaryRefAddr BindException Binding Binding BindingHelper BindingHolder BindingIterator BindingIteratorHelper BindingIteratorHolder BindingIteratorOperations BindingIteratorPOA BindingListHelper BindingListHolder BindingType BindingTypeHelper BindingTypeHolder BitSet Blob BlockView BoldAction Book Boolean BooleanControl BooleanHolder BooleanSeqHelper BooleanSeqHolder Border BorderFactory BorderLayout BorderUIResource BoundedRangeModel Bounds Bounds Box BoxLayout BoxPainter BoxView BoxedValueHelper BreakIterator Buffer BufferCapabilities BufferOverflowException BufferStrategy BufferUnderflowException BufferedImage BufferedImageFilter BufferedImageOp BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter Button ButtonAreaLayout ButtonBorder ButtonBorder ButtonGroup ButtonModel ButtonUI Byte ByteArrayInputStream ByteArrayOutputStream ByteBuffer ByteChannel ByteHolder ByteLookupTable ByteOrder CDATASection CHAR_ARRAY CMMException COMM_FAILURE CRC32 CRL CRLException CRLSelector CSS CTX_RESTRICT_SCOPE Calendar CallableStatement Callback CallbackHandler CancelablePrintJob CancelledKeyException CannotProceed CannotProceedException CannotProceedHelper CannotProceedHolder CannotRedoException CannotUndoException Canvas CardLayout Caret CaretEvent CaretListener CaretPolicy CellEditor CellEditorListener CellRendererPane CertPath CertPathBuilder CertPathBuilderException CertPathBuilderResult CertPathBuilderSpi CertPathParameters CertPathRep CertPathValidator CertPathValidatorException CertPathValidatorResult CertPathValidatorSpi CertSelector CertStore CertStoreException CertStoreParameters CertStoreSpi Certificate Certificate Certificate CertificateEncodingException CertificateEncodingException CertificateException CertificateException CertificateExpiredException CertificateExpiredException CertificateFactory CertificateFactorySpi CertificateNotYetValidException CertificateNotYetValidException CertificateParsingException CertificateParsingException CertificateRep ChangeEvent ChangeListener ChangedCharSetException Channel ChannelBinding Channels CharArrayReader CharArrayWriter CharBuffer CharConversionException CharHolder CharSeqHelper CharSeqHolder CharSequence Character CharacterAttribute CharacterCodingException CharacterConstants CharacterData CharacterIterator Charset CharsetDecoder CharsetEncoder CharsetProvider Checkbox CheckboxGroup CheckboxMenuItem CheckedInputStream CheckedOutputStream Checksum Choice ChoiceCallback ChoiceFormat Chromaticity Cipher CipherInputStream CipherOutputStream CipherSpi Class ClassCastException ClassCircularityError ClassDesc ClassFormatError ClassLoader ClassNotFoundException ClientRequestInfo ClientRequestInfoOperations ClientRequestInterceptor ClientRequestInterceptorOperations Clip Clipboard ClipboardOwner Clob CloneNotSupportedException Cloneable ClosedByInterruptException ClosedChannelException ClosedSelectorException CodeSets CodeSource Codec CodecFactory CodecFactoryHelper CodecFactoryOperations CodecOperations CoderMalfunctionError CoderResult CodingErrorAction CollationElementIterator CollationKey Collator Collection CollectionCertStoreParameters Collections Color ColorAttribute ColorChooserComponentFactory ColorChooserUI ColorConstants ColorConvertOp ColorModel ColorSelectionModel ColorSpace ColorSupported ColorType ColorUIResource ComboBoxEditor ComboBoxModel ComboBoxUI ComboPopup CommandEnvironment Comment CommunicationException Comparable Comparator Compiler CompletionStatus CompletionStatusHelper Component ComponentAdapter ComponentColorModel ComponentEvent ComponentIdHelper ComponentInputMap ComponentInputMapUIResource ComponentListener ComponentOrientation ComponentSampleModel ComponentUI ComponentView Composite CompositeContext CompositeName CompositeView CompoundBorder CompoundBorderUIResource CompoundControl CompoundEdit CompoundName Compression ConcurrentModificationException Configuration ConfigurationException ConfirmationCallback ConnectException ConnectException ConnectIOException Connection ConnectionEvent ConnectionEventListener ConnectionPendingException ConnectionPoolDataSource ConsoleHandler Constraints Constructor Container ContainerAdapter ContainerEvent ContainerListener ContainerOrderFocusTraversalPolicy Content ContentHandler ContentHandler ContentHandlerFactory ContentModel Context Context ContextList ContextNotEmptyException ContextualRenderedImageFactory Control Control ControlFactory ControllerEventListener ConvolveOp CookieHolder Copies CopiesSupported CopyAction CredentialExpiredException CropImageFilter CubicCurve2D Currency Current Current Current CurrentHelper CurrentHelper CurrentHelper CurrentHolder CurrentOperations CurrentOperations CurrentOperations Cursor CustomMarshal CustomValue Customizer CutAction DATA_CONVERSION DESKeySpec DESedeKeySpec DGC DHGenParameterSpec DHKey DHParameterSpec DHPrivateKey DHPrivateKeySpec DHPublicKey DHPublicKeySpec DOMException DOMImplementation DOMLocator DOMResult DOMSource DSAKey DSAKeyPairGenerator DSAParameterSpec DSAParams DSAPrivateKey DSAPrivateKeySpec DSAPublicKey DSAPublicKeySpec DTD DTDConstants DTDHandler DataBuffer DataBufferByte DataBufferDouble DataBufferFloat DataBufferInt DataBufferShort DataBufferUShort DataFlavor DataFormatException DataInput DataInputStream DataInputStream DataLine DataOutput DataOutputStream DataOutputStream DataSource DataTruncation DatabaseMetaData DatagramChannel DatagramPacket DatagramSocket DatagramSocketImpl DatagramSocketImplFactory Date Date DateEditor DateFormat DateFormatSymbols DateFormatter DateTimeAtCompleted DateTimeAtCreation DateTimeAtProcessing DateTimeSyntax DebugGraphics DecimalFormat DecimalFormatSymbols DeclHandler DefaultBoundedRangeModel DefaultButtonModel DefaultCaret DefaultCellEditor DefaultColorSelectionModel DefaultComboBoxModel DefaultDesktopManager DefaultEditor DefaultEditorKit DefaultFocusManager DefaultFocusTraversalPolicy DefaultFormatter DefaultFormatterFactory DefaultHandler DefaultHighlightPainter DefaultHighlighter DefaultKeyTypedAction DefaultKeyboardFocusManager DefaultListCellRenderer DefaultListModel DefaultListSelectionModel DefaultMenuLayout DefaultMetalTheme DefaultMutableTreeNode DefaultPersistenceDelegate DefaultSelectionType DefaultSingleSelectionModel DefaultStyledDocument DefaultTableCellRenderer DefaultTableColumnModel DefaultTableModel DefaultTextUI DefaultTreeCellEditor DefaultTreeCellRenderer DefaultTreeModel DefaultTreeSelectionModel DefinitionKind DefinitionKindHelper Deflater DeflaterOutputStream Delegate Delegate Delegate DelegationPermission DesignMode DesktopIconUI DesktopManager DesktopPaneUI Destination DestinationType DestroyFailedException Destroyable Dialog DialogType Dictionary DigestException DigestInputStream DigestOutputStream Dimension Dimension2D DimensionUIResource DirContext DirObjectFactory DirStateFactory DirectColorModel DirectoryManager DisplayMode DnDConstants Doc DocAttribute DocAttributeSet DocFlavor DocPrintJob Document Document DocumentBuilder DocumentBuilderFactory DocumentEvent DocumentFilter DocumentFragment DocumentHandler DocumentListener DocumentName DocumentParser DocumentType DomainCombiner DomainManager DomainManagerOperations Double Double Double Double Double Double Double Double Double DoubleBuffer DoubleHolder DoubleSeqHelper DoubleSeqHolder DragGestureEvent DragGestureListener DragGestureRecognizer DragSource DragSourceAdapter DragSourceContext DragSourceDragEvent DragSourceDropEvent DragSourceEvent DragSourceListener DragSourceMotionListener Driver DriverManager DriverPropertyInfo DropTarget DropTargetAdapter DropTargetAutoScroller DropTargetContext DropTargetDragEvent DropTargetDropEvent DropTargetEvent DropTargetListener DuplicateName DuplicateNameHelper DynAny DynAny DynAnyFactory DynAnyFactoryHelper DynAnyFactoryOperations DynAnyHelper DynAnyOperations DynAnySeqHelper DynArray DynArray DynArrayHelper DynArrayOperations DynEnum DynEnum DynEnumHelper DynEnumOperations DynFixed DynFixed DynFixedHelper DynFixedOperations DynSequence DynSequence DynSequenceHelper DynSequenceOperations DynStruct DynStruct DynStructHelper DynStructOperations DynUnion DynUnion DynUnionHelper DynUnionOperations DynValue DynValue DynValueBox DynValueBoxOperations DynValueCommon DynValueCommonOperations DynValueHelper DynValueOperations DynamicImplementation DynamicImplementation DynamicUtilTreeNode ENCODING_CDR_ENCAPS EOFException EditorKit Element Element Element ElementChange ElementEdit ElementIterator ElementSpec Ellipse2D EmptyBorder EmptyBorderUIResource EmptySelectionModel EmptyStackException EncodedKeySpec Encoder Encoding Encoding EncryptedPrivateKeyInfo Engineering Entity Entity EntityReference EntityResolver Entry EnumControl EnumSyntax Enumeration Environment Error ErrorHandler ErrorListener ErrorManager EtchedBorder EtchedBorderUIResource Event EventContext EventDirContext EventHandler EventListener EventListenerList EventListenerProxy EventObject EventQueue EventSetDescriptor EventType EventType Exception ExceptionInInitializerError ExceptionList ExceptionListener ExemptionMechanism ExemptionMechanismException ExemptionMechanismSpi ExpandVetoException ExportException Expression ExtendedRequest ExtendedResponse Externalizable FREE_MEM FactoryConfigurationError FailedLoginException FeatureDescriptor Fidelity Field Field Field Field Field FieldBorder FieldNameHelper FieldNameHelper FieldPosition FieldView File FileCacheImageInputStream FileCacheImageOutputStream FileChannel FileChooserUI FileDescriptor FileDialog FileFilter FileFilter FileHandler FileIcon16 FileImageInputStream FileImageOutputStream FileInputStream FileLock FileLockInterruptionException FileNameMap FileNotFoundException FileOutputStream FilePermission FileReader FileSystemView FileView FileWriter FilenameFilter Filler Filter Filter FilterBypass FilterBypass FilterInputStream FilterOutputStream FilterReader FilterWriter FilteredImageSource Finishings FixedHeightLayoutCache FixedHolder FlatteningPathIterator FlavorException FlavorMap FlavorTable FlipContents Float Float Float Float Float Float Float Float Float FloatBuffer FloatControl FloatHolder FloatSeqHelper FloatSeqHolder FlowLayout FlowStrategy FlowView Flush3DBorder FocusAdapter FocusEvent FocusListener FocusManager FocusTraversalPolicy FolderIcon16 Font FontAttribute FontConstants FontFamilyAction FontFormatException FontMetrics FontRenderContext FontSizeAction FontUIResource ForegroundAction FormView Format FormatConversionProvider FormatMismatch FormatMismatchHelper Formatter ForwardRequest ForwardRequest ForwardRequestHelper ForwardRequestHelper Frame GSSContext GSSCredential GSSException GSSManager GSSName GZIPInputStream GZIPOutputStream GapContent GatheringByteChannel GeneralPath GeneralSecurityException GetField GlyphJustificationInfo GlyphMetrics GlyphPainter GlyphVector GlyphView GradientPaint GraphicAttribute Graphics Graphics2D GraphicsConfigTemplate GraphicsConfiguration GraphicsDevice GraphicsEnvironment GrayFilter GregorianCalendar GridBagConstraints GridBagLayout GridLayout Group Guard GuardedObject HTML HTMLDocument HTMLEditorKit HTMLEditorKit HTMLEditorKit HTMLFrameHyperlinkEvent HTMLWriter Handler HandlerBase HandshakeCompletedEvent HandshakeCompletedListener HasControls HashAttributeSet HashDocAttributeSet HashMap HashPrintJobAttributeSet HashPrintRequestAttributeSet HashPrintServiceAttributeSet HashSet Hashtable HeadlessException HierarchyBoundsAdapter HierarchyBoundsListener HierarchyEvent HierarchyListener Highlight HighlightPainter Highlighter HostnameVerifier HttpURLConnection HttpsURLConnection HyperlinkEvent HyperlinkListener ICC_ColorSpace ICC_Profile ICC_ProfileGray ICC_ProfileRGB IDLEntity IDLType IDLTypeHelper IDLTypeOperations ID_ASSIGNMENT_POLICY_ID ID_UNIQUENESS_POLICY_ID IIOByteBuffer IIOException IIOImage IIOInvalidTreeException IIOMetadata IIOMetadataController IIOMetadataFormat IIOMetadataFormatImpl IIOMetadataNode IIOParam IIOParamController IIOReadProgressListener IIOReadUpdateListener IIOReadWarningListener IIORegistry IIOServiceProvider IIOWriteProgressListener IIOWriteWarningListener IMPLICIT_ACTIVATION_POLICY_ID IMP_LIMIT INITIALIZE INPUT_STREAM INTERNAL INTF_REPOS INVALID_TRANSACTION INV_FLAG INV_IDENT INV_OBJREF INV_POLICY IOException IOR IORHelper IORHolder IORInfo IORInfoOperations IORInterceptor IORInterceptorOperations IRObject IRObjectOperations ISO Icon IconUIResource IconView IdAssignmentPolicy IdAssignmentPolicyOperations IdAssignmentPolicyValue IdUniquenessPolicy IdUniquenessPolicyOperations IdUniquenessPolicyValue IdentifierHelper Identity IdentityHashMap IdentityScope IllegalAccessError IllegalAccessException IllegalArgumentException IllegalBlockSizeException IllegalBlockingModeException IllegalCharsetNameException IllegalComponentStateException IllegalMonitorStateException IllegalPathStateException IllegalSelectorException IllegalStateException IllegalThreadStateException Image ImageCapabilities ImageConsumer ImageFilter ImageGraphicAttribute ImageIO ImageIcon ImageInputStream ImageInputStreamImpl ImageInputStreamSpi ImageObserver ImageOutputStream ImageOutputStreamImpl ImageOutputStreamSpi ImageProducer ImageReadParam ImageReader ImageReaderSpi ImageReaderWriterSpi ImageTranscoder ImageTranscoderSpi ImageTypeSpecifier ImageView ImageWriteParam ImageWriter ImageWriterSpi ImagingOpException ImplicitActivationPolicy ImplicitActivationPolicyOperations ImplicitActivationPolicyValue IncompatibleClassChangeError InconsistentTypeCode InconsistentTypeCode InconsistentTypeCodeHelper IndexColorModel IndexOutOfBoundsException IndexedPropertyDescriptor IndirectionException Inet4Address Inet6Address InetAddress InetSocketAddress Inflater InflaterInputStream Info Info Info Info Info InheritableThreadLocal InitialContext InitialContextFactory InitialContextFactoryBuilder InitialDirContext InitialLdapContext InlineView InputContext InputEvent InputMap InputMapUIResource InputMethod InputMethodContext InputMethodDescriptor InputMethodEvent InputMethodHighlight InputMethodListener InputMethodRequests InputSource InputStream InputStream InputStream InputStreamReader InputSubset InputVerifier InsertBreakAction InsertContentAction InsertHTMLTextAction InsertTabAction Insets InsetsUIResource InstantiationError InstantiationException Instrument InsufficientResourcesException IntBuffer IntHolder Integer IntegerSyntax Interceptor InterceptorOperations InternalError InternalFrameAdapter InternalFrameBorder InternalFrameEvent InternalFrameFocusTraversalPolicy InternalFrameListener InternalFrameUI InternationalFormatter InterruptedException InterruptedIOException InterruptedNamingException InterruptibleChannel IntrospectionException Introspector Invalid InvalidAddress InvalidAddressHelper InvalidAddressHolder InvalidAlgorithmParameterException InvalidAttributeIdentifierException InvalidAttributeValueException InvalidAttributesException InvalidClassException InvalidDnDOperationException InvalidKeyException InvalidKeySpecException InvalidMarkException InvalidMidiDataException InvalidName InvalidName InvalidName InvalidNameException InvalidNameHelper InvalidNameHelper InvalidNameHolder InvalidObjectException InvalidParameterException InvalidParameterSpecException InvalidPolicy InvalidPolicyHelper InvalidPreferencesFormatException InvalidSearchControlsException InvalidSearchFilterException InvalidSeq InvalidSlot InvalidSlotHelper InvalidTransactionException InvalidTypeForEncoding InvalidTypeForEncodingHelper InvalidValue InvalidValue InvalidValueHelper InvocationEvent InvocationHandler InvocationTargetException InvokeHandler IstringHelper ItalicAction ItemEvent ItemListener ItemSelectable Iterator Iterator IvParameterSpec JApplet JButton JCheckBox JCheckBoxMenuItem JColorChooser JComboBox JComponent JDesktopIcon JDesktopPane JDialog JEditorPane JFileChooser JFormattedTextField JFrame JIS JInternalFrame JLabel JLayeredPane JList JMenu JMenuBar JMenuItem JOptionPane JPEGHuffmanTable JPEGImageReadParam JPEGImageWriteParam JPEGQTable JPanel JPasswordField JPopupMenu JProgressBar JRadioButton JRadioButtonMenuItem JRootPane JScrollBar JScrollPane JSeparator JSlider JSpinner JSplitPane JTabbedPane JTable JTableHeader JTextArea JTextComponent JTextField JTextPane JToggleButton JToolBar JToolTip JTree JViewport JWindow JarEntry JarException JarFile JarInputStream JarOutputStream JarURLConnection JobAttributes JobHoldUntil JobImpressions JobImpressionsCompleted JobImpressionsSupported JobKOctets JobKOctetsProcessed JobKOctetsSupported JobMediaSheets JobMediaSheetsCompleted JobMediaSheetsSupported JobMessageFromOperator JobName JobOriginatingUserName JobPriority JobPrioritySupported JobSheets JobState JobStateReason JobStateReasons KerberosKey KerberosPrincipal KerberosTicket Kernel Key Key KeyAdapter KeyAgreement KeyAgreementSpi KeyBinding KeyEvent KeyEventDispatcher KeyEventPostProcessor KeyException KeyFactory KeyFactorySpi KeyGenerator KeyGeneratorSpi KeyListener KeyManagementException KeyManager KeyManagerFactory KeyManagerFactorySpi KeyPair KeyPairGenerator KeyPairGeneratorSpi KeySelectionManager KeySpec KeyStore KeyStoreException KeyStoreSpi KeyStroke KeyboardFocusManager Keymap LDAPCertStoreParameters LIFESPAN_POLICY_ID LOCATION_FORWARD Label LabelUI LabelView LanguageCallback LastOwnerException LayerPainter LayeredHighlighter LayoutFocusTraversalPolicy LayoutManager LayoutManager2 LayoutQueue LazyInputMap LazyValue LdapContext LdapReferralException Lease Level LexicalHandler LifespanPolicy LifespanPolicyOperations LifespanPolicyValue LimitExceededException Line Line2D LineBorder LineBorderUIResource LineBreakMeasurer LineEvent LineListener LineMetrics LineNumberInputStream LineNumberReader LineUnavailableException LinkController LinkException LinkLoopException LinkRef LinkageError LinkedHashMap LinkedHashSet LinkedList List List ListCellRenderer ListDataEvent ListDataListener ListEditor ListIterator ListModel ListPainter ListResourceBundle ListSelectionEvent ListSelectionListener ListSelectionModel ListUI ListView LoaderHandler LocalObject Locale LocateRegistry Locator LocatorImpl LogManager LogRecord LogStream Logger LoggingPermission LoginContext LoginException LoginModule LoginModuleControlFlag Long LongBuffer LongHolder LongLongSeqHelper LongLongSeqHolder LongSeqHelper LongSeqHolder LookAndFeel LookAndFeelInfo LookupOp LookupTable MARSHAL Mac MacSpi MalformedInputException MalformedLinkException MalformedURLException ManagerFactoryParameters Manifest Map MapMode MappedByteBuffer MarginBorder MarshalException MarshalledObject MaskFormatter Matcher Math MatteBorder MatteBorderUIResource Media MediaName MediaPrintableArea MediaSize MediaSizeName MediaTracker MediaTray MediaType Member MemoryCacheImageInputStream MemoryCacheImageOutputStream MemoryHandler MemoryImageSource Menu MenuBar MenuBarBorder MenuBarBorder MenuBarUI MenuComponent MenuContainer MenuDragMouseEvent MenuDragMouseListener MenuElement MenuEvent MenuItem MenuItemBorder MenuItemUI MenuKeyEvent MenuKeyListener MenuListener MenuSelectionManager MenuShortcut MessageDigest MessageDigestSpi MessageFormat MessageProp MetaEventListener MetaMessage MetalBorders MetalButtonUI MetalCheckBoxIcon MetalCheckBoxUI MetalComboBoxButton MetalComboBoxEditor MetalComboBoxIcon MetalComboBoxUI MetalDesktopIconUI MetalFileChooserUI MetalIconFactory MetalInternalFrameTitlePane MetalInternalFrameUI MetalLabelUI MetalLookAndFeel MetalPopupMenuSeparatorUI MetalProgressBarUI MetalRadioButtonUI MetalRootPaneUI MetalScrollBarUI MetalScrollButton MetalScrollPaneUI MetalSeparatorUI MetalSliderUI MetalSplitPaneUI MetalTabbedPaneUI MetalTextFieldUI MetalTheme MetalToggleButtonUI MetalToolBarUI MetalToolTipUI MetalTreeUI Method MethodDescriptor MidiChannel MidiDevice MidiDeviceProvider MidiEvent MidiFileFormat MidiFileReader MidiFileWriter MidiMessage MidiSystem MidiUnavailableException MimeTypeParseException MinimalHTMLWriter MissingResourceException Mixer MixerProvider ModificationItem Modifier MouseAdapter MouseDragGestureRecognizer MouseEvent MouseInputAdapter MouseInputListener MouseListener MouseMotionAdapter MouseMotionListener MouseWheelEvent MouseWheelListener MultiButtonUI MultiColorChooserUI MultiComboBoxUI MultiDesktopIconUI MultiDesktopPaneUI MultiDoc MultiDocPrintJob MultiDocPrintService MultiFileChooserUI MultiInternalFrameUI MultiLabelUI MultiListUI MultiLookAndFeel MultiMenuBarUI MultiMenuItemUI MultiOptionPaneUI MultiPanelUI MultiPixelPackedSampleModel MultiPopupMenuUI MultiProgressBarUI MultiRootPaneUI MultiScrollBarUI MultiScrollPaneUI MultiSeparatorUI MultiSliderUI MultiSpinnerUI MultiSplitPaneUI MultiTabbedPaneUI MultiTableHeaderUI MultiTableUI MultiTextUI MultiToolBarUI MultiToolTipUI MultiTreeUI MultiViewportUI MulticastSocket MultipleComponentProfileHelper MultipleComponentProfileHolder MultipleDocumentHandling MultipleDocumentHandlingType MultipleMaster MutableAttributeSet MutableComboBoxModel MutableTreeNode NA NO_IMPLEMENT NO_MEMORY NO_PERMISSION NO_RESOURCES NO_RESPONSE NVList Name Name NameAlreadyBoundException NameCallback NameClassPair NameComponent NameComponentHelper NameComponentHolder NameDynAnyPair NameDynAnyPairHelper NameDynAnyPairSeqHelper NameHelper NameHolder NameNotFoundException NameParser NameValuePair NameValuePair NameValuePairHelper NameValuePairHelper NameValuePairSeqHelper NamedNodeMap NamedValue NamespaceChangeListener NamespaceSupport Naming NamingContext NamingContextExt NamingContextExtHelper NamingContextExtHolder NamingContextExtOperations NamingContextExtPOA NamingContextHelper NamingContextHolder NamingContextOperations NamingContextPOA NamingEnumeration NamingEvent NamingException NamingExceptionEvent NamingListener NamingManager NamingSecurityException NavigationFilter NegativeArraySizeException NetPermission NetworkInterface NoClassDefFoundError NoConnectionPendingException NoContext NoContextHelper NoInitialContextException NoPermissionException NoRouteToHostException NoServant NoServantHelper NoSuchAlgorithmException NoSuchAttributeException NoSuchElementException NoSuchFieldError NoSuchFieldException NoSuchMethodError NoSuchMethodException NoSuchObjectException NoSuchPaddingException NoSuchProviderException Node NodeChangeEvent NodeChangeListener NodeDimensions NodeList NonReadableChannelException NonWritableChannelException NoninvertibleTransformException NotActiveException NotBoundException NotContextException NotEmpty NotEmptyHelper NotEmptyHolder NotFound NotFoundHelper NotFoundHolder NotFoundReason NotFoundReasonHelper NotFoundReasonHolder NotOwnerException NotSerializableException NotYetBoundException NotYetConnectedException Notation NullCipher NullPointerException Number NumberEditor NumberFormat NumberFormatException NumberFormatter NumberOfDocuments NumberOfInterveningJobs NumberUp NumberUpSupported NumericShaper OBJECT_NOT_EXIST OBJ_ADAPTER OMGVMCID ORB ORB ORBInitInfo ORBInitInfoOperations ORBInitializer ORBInitializerOperations ObjID Object Object ObjectAlreadyActive ObjectAlreadyActiveHelper ObjectChangeListener ObjectFactory ObjectFactoryBuilder ObjectHelper ObjectHolder ObjectIdHelper ObjectImpl ObjectImpl ObjectInput ObjectInputStream ObjectInputValidation ObjectNotActive ObjectNotActiveHelper ObjectOutput ObjectOutputStream ObjectStreamClass ObjectStreamConstants ObjectStreamException ObjectStreamField ObjectView Observable Observer OctetSeqHelper OctetSeqHolder Oid OpenType Operation OperationNotSupportedException Option OptionDialogBorder OptionPaneUI OptionalDataException OrientationRequested OrientationRequestedType OriginType Other OutOfMemoryError OutputDeviceAssigned OutputKeys OutputStream OutputStream OutputStream OutputStreamWriter OverlappingFileLockException OverlayLayout Owner PBEKey PBEKeySpec PBEParameterSpec PDLOverrideSupported PERSIST_STORE PKCS8EncodedKeySpec PKIXBuilderParameters PKIXCertPathBuilderResult PKIXCertPathChecker PKIXCertPathValidatorResult PKIXParameters POA POAHelper POAManager POAManagerOperations POAOperations PRIVATE_MEMBER PSSParameterSpec PUBLIC_MEMBER Package PackedColorModel PageAttributes PageFormat PageRanges Pageable PagesPerMinute PagesPerMinuteColor Paint PaintContext PaintEvent PaletteBorder PaletteCloseIcon Panel PanelUI Paper ParagraphAttribute ParagraphConstants ParagraphView ParagraphView Parameter ParameterBlock ParameterDescriptor ParameterMetaData ParameterMode ParameterModeHelper ParameterModeHolder ParseException ParsePosition Parser Parser Parser ParserAdapter ParserCallback ParserConfigurationException ParserDelegator ParserFactory PartialResultException PasswordAuthentication PasswordCallback PasswordView PasteAction Patch PathIterator Pattern PatternSyntaxException Permission Permission PermissionCollection Permissions PersistenceDelegate PhantomReference Pipe PipedInputStream PipedOutputStream PipedReader PipedWriter PixelGrabber PixelInterleavedSampleModel PlainDocument PlainView Point Point2D Policy Policy Policy PolicyError PolicyErrorCodeHelper PolicyErrorHelper PolicyErrorHolder PolicyFactory PolicyFactoryOperations PolicyHelper PolicyHolder PolicyListHelper PolicyListHolder PolicyNode PolicyOperations PolicyQualifierInfo PolicyTypeHelper Polygon PooledConnection Popup PopupFactory PopupMenu PopupMenuBorder PopupMenuEvent PopupMenuListener PopupMenuUI Port PortUnreachableException PortableRemoteObject PortableRemoteObjectDelegate Position PreferenceChangeEvent PreferenceChangeListener Preferences PreferencesFactory PreparedStatement PresentationDirection Principal Principal PrincipalHolder PrintEvent PrintException PrintGraphics PrintJob PrintJobAdapter PrintJobAttribute PrintJobAttributeEvent PrintJobAttributeListener PrintJobAttributeSet PrintJobEvent PrintJobListener PrintQuality PrintQualityType PrintRequestAttribute PrintRequestAttributeSet PrintService PrintServiceAttribute PrintServiceAttributeEvent PrintServiceAttributeListener PrintServiceAttributeSet PrintServiceLookup PrintStream PrintWriter Printable PrinterAbortException PrinterException PrinterGraphics PrinterIOException PrinterInfo PrinterIsAcceptingJobs PrinterJob PrinterLocation PrinterMakeAndModel PrinterMessageFromOperator PrinterMoreInfo PrinterMoreInfoManufacturer PrinterName PrinterResolution PrinterState PrinterStateReason PrinterStateReasons PrinterURI PrivateCredentialPermission PrivateKey PrivilegedAction PrivilegedActionException PrivilegedExceptionAction Process ProcessingInstruction ProfileDataException ProfileIdHelper ProgressBarUI ProgressMonitor ProgressMonitorInputStream Properties PropertyChangeEvent PropertyChangeListener PropertyChangeListenerProxy PropertyChangeSupport PropertyDescriptor PropertyEditor PropertyEditorManager PropertyEditorSupport PropertyPermission PropertyResourceBundle PropertyVetoException ProtectionDomain ProtocolException Provider ProviderException Proxy ProxyLazyValue PublicKey PushbackInputStream PushbackReader PutField QuadCurve2D QueuedJobCount RC2ParameterSpec RC5ParameterSpec READER REQUEST_PROCESSING_POLICY_ID RGBImageFilter RMIClassLoader RMIClassLoaderSpi RMIClientSocketFactory RMIFailureHandler RMISecurityException RMISecurityManager RMIServerSocketFactory RMISocketFactory RSAKey RSAKeyGenParameterSpec RSAMultiPrimePrivateCrtKey RSAMultiPrimePrivateCrtKeySpec RSAOtherPrimeInfo RSAPrivateCrtKey RSAPrivateCrtKeySpec RSAPrivateKey RSAPrivateKeySpec RSAPublicKey RSAPublicKeySpec RTFEditorKit RadioButtonBorder Random RandomAccess RandomAccessFile Raster RasterFormatException RasterOp ReadOnlyBufferException ReadableByteChannel Reader Receiver Rectangle Rectangle2D RectangularShape Ref RefAddr Reference Reference ReferenceQueue ReferenceUriSchemesSupported Referenceable ReferralException ReflectPermission RefreshFailedException Refreshable RegisterableService Registry RegistryHandler RemarshalException Remote RemoteCall RemoteException RemoteObject RemoteRef RemoteServer RemoteStub RenderContext RenderableImage RenderableImageOp RenderableImageProducer RenderedImage RenderedImageFactory Renderer RenderingHints RepaintManager ReplicateScaleFilter RepositoryIdHelper Request RequestInfo RequestInfoOperations RequestProcessingPolicy RequestProcessingPolicyOperations RequestProcessingPolicyValue RequestingUserName RescaleOp ResolutionSyntax ResolveResult Resolver ResourceBundle ResponseHandler Result Result ResultSet ResultSetMetaData ReverbType Robot RolloverButtonBorder RolloverButtonBorder RootPaneContainer RootPaneUI RoundRectangle2D RowMapper RowSet RowSetEvent RowSetInternal RowSetListener RowSetMetaData RowSetReader RowSetWriter RuleBasedCollator RunTime RunTimeOperations Runnable Runtime RuntimeException RuntimePermission SAXException SAXNotRecognizedException SAXNotSupportedException SAXParseException SAXParser SAXParserFactory SAXResult SAXSource SAXTransformerFactory SERVANT_RETENTION_POLICY_ID SERVICE_FORMATTED SQLData SQLException SQLInput SQLOutput SQLPermission SQLWarning SSLContext SSLContextSpi SSLException SSLHandshakeException SSLKeyException SSLPeerUnverifiedException SSLPermission SSLProtocolException SSLServerSocket SSLServerSocketFactory SSLSession SSLSessionBindingEvent SSLSessionBindingListener SSLSessionContext SSLSocket SSLSocketFactory STRING SUCCESSFUL SYNC_WITH_TRANSPORT SYSTEM_EXCEPTION SampleModel Savepoint ScatteringByteChannel SchemaViolationException ScrollBarUI ScrollPane ScrollPaneAdjustable ScrollPaneBorder ScrollPaneConstants ScrollPaneLayout ScrollPaneUI Scrollable Scrollbar SealedObject SearchControls SearchResult SecretKey SecretKeyFactory SecretKeyFactorySpi SecretKeySpec SecureClassLoader SecureRandom SecureRandomSpi Security SecurityException SecurityManager SecurityPermission Segment SelectableChannel SelectionKey Selector SelectorProvider Separator Separator SeparatorUI Sequence SequenceInputStream Sequencer Serializable SerializablePermission Servant ServantActivator ServantActivatorHelper ServantActivatorOperations ServantActivatorPOA ServantAlreadyActive ServantAlreadyActiveHelper ServantLocator ServantLocatorHelper ServantLocatorOperations ServantLocatorPOA ServantManager ServantManagerOperations ServantNotActive ServantNotActiveHelper ServantObject ServantRetentionPolicy ServantRetentionPolicyOperations ServantRetentionPolicyValue ServerCloneException ServerError ServerException ServerNotActiveException ServerRef ServerRequest ServerRequestInfo ServerRequestInfoOperations ServerRequestInterceptor ServerRequestInterceptorOperations ServerRuntimeException ServerSocket ServerSocketChannel ServerSocketFactory ServiceContext ServiceContextHelper ServiceContextHolder ServiceContextListHelper ServiceContextListHolder ServiceDetail ServiceDetailHelper ServiceIdHelper ServiceInformation ServiceInformationHelper ServiceInformationHolder ServicePermission ServiceRegistry ServiceUI ServiceUIFactory ServiceUnavailableException Set SetOfIntegerSyntax SetOverrideType SetOverrideTypeHelper Severity Shape ShapeGraphicAttribute SheetCollate Short ShortBuffer ShortBufferException ShortHolder ShortLookupTable ShortMessage ShortSeqHelper ShortSeqHolder Sides SidesType Signature SignatureException SignatureSpi SignedObject Signer SimpleAttributeSet SimpleBeanInfo SimpleDateFormat SimpleDoc SimpleFormatter SimpleTimeZone SinglePixelPackedSampleModel SingleSelectionModel SinkChannel Size2DSyntax SizeLimitExceededException SizeRequirements SizeSequence Skeleton SkeletonMismatchException SkeletonNotFoundException SliderUI Socket SocketAddress SocketChannel SocketException SocketFactory SocketHandler SocketImpl SocketImplFactory SocketOptions SocketPermission SocketSecurityException SocketTimeoutException SoftBevelBorder SoftReference SortedMap SortedSet SortingFocusTraversalPolicy Soundbank SoundbankReader SoundbankResource Source SourceChannel SourceDataLine SourceLocator SpinnerDateModel SpinnerListModel SpinnerModel SpinnerNumberModel SpinnerUI SplitPaneBorder SplitPaneUI Spring SpringLayout Stack StackOverflowError StackTraceElement StartTlsRequest StartTlsResponse State StateEdit StateEditable StateFactory Statement Statement StreamCorruptedException StreamHandler StreamPrintService StreamPrintServiceFactory StreamResult StreamSource StreamTokenizer Streamable StreamableValue StrictMath String StringBuffer StringBufferInputStream StringCharacterIterator StringContent StringHolder StringIndexOutOfBoundsException StringNameHelper StringReader StringRefAddr StringSelection StringSeqHelper StringSeqHolder StringTokenizer StringValueHelper StringWriter Stroke Struct StructMember StructMemberHelper Stub StubDelegate StubNotFoundException Style StyleConstants StyleContext StyleSheet StyledDocument StyledEditorKit StyledTextAction Subject SubjectDomainCombiner Subset SupportedValuesAttribute SwingConstants SwingPropertyChangeSupport SwingUtilities SyncFailedException SyncMode SyncScopeHelper Synthesizer SysexMessage System SystemColor SystemException SystemFlavorMap TAG_ALTERNATE_IIOP_ADDRESS TAG_CODE_SETS TAG_INTERNET_IOP TAG_JAVA_CODEBASE TAG_MULTIPLE_COMPONENTS TAG_ORB_TYPE TAG_POLICIES TCKind THREAD_POLICY_ID TRANSACTION_REQUIRED TRANSACTION_ROLLEDBACK TRANSIENT TRANSPORT_RETRY TabExpander TabSet TabStop TabableView TabbedPaneUI TableCellEditor TableCellRenderer TableColumn TableColumnModel TableColumnModelEvent TableColumnModelListener TableHeaderBorder TableHeaderUI TableModel TableModelEvent TableModelListener TableUI TableView Tag TagElement TaggedComponent TaggedComponentHelper TaggedComponentHolder TaggedProfile TaggedProfileHelper TaggedProfileHolder TargetDataLine Templates TemplatesHandler Text TextAction TextArea TextAttribute TextComponent TextEvent TextField TextFieldBorder TextHitInfo TextInputCallback TextLayout TextListener TextMeasurer TextOutputCallback TextSyntax TextUI TexturePaint Thread ThreadDeath ThreadGroup ThreadLocal ThreadPolicy ThreadPolicyOperations ThreadPolicyValue Throwable Tie TileObserver Time TimeLimitExceededException TimeZone Timer Timer TimerTask Timestamp TitledBorder TitledBorderUIResource ToggleButtonBorder ToggleButtonBorder ToggleButtonModel TooManyListenersException ToolBarBorder ToolBarUI ToolTipManager ToolTipUI Toolkit Track TransactionRequiredException TransactionRolledbackException TransactionService TransferHandler Transferable TransformAttribute Transformer TransformerConfigurationException TransformerException TransformerFactory TransformerFactoryConfigurationError TransformerHandler Transmitter Transparency TreeCellEditor TreeCellRenderer TreeControlIcon TreeExpansionEvent TreeExpansionListener TreeFolderIcon TreeLeafIcon TreeMap TreeModel TreeModelEvent TreeModelListener TreeNode TreePath TreeSelectionEvent TreeSelectionListener TreeSelectionModel TreeSet TreeUI TreeWillExpandListener TrustAnchor TrustManager TrustManagerFactory TrustManagerFactorySpi Type Type Type Type Type Type Type TypeCode TypeCodeHolder TypeMismatch TypeMismatch TypeMismatch TypeMismatchHelper TypeMismatchHelper Types UID UIDefaults UIManager UIResource UIResource UIResource UIResource UIResource UIResource UIResource ULongLongSeqHelper ULongLongSeqHolder ULongSeqHelper ULongSeqHolder UNKNOWN UNSUPPORTED_POLICY UNSUPPORTED_POLICY_VALUE URI URIException URIResolver URISyntax URISyntaxException URL URL URLClassLoader URLConnection URLDecoder URLEncoder URLStreamHandler URLStreamHandlerFactory URLStringHelper USER_EXCEPTION UShortSeqHelper UShortSeqHolder UTFDataFormatException UndeclaredThrowableException UnderlineAction UndoManager UndoableEdit UndoableEditEvent UndoableEditListener UndoableEditSupport UnexpectedException UnicastRemoteObject UnicodeBlock UnionMember UnionMemberHelper UnknownEncoding UnknownEncodingHelper UnknownError UnknownException UnknownGroupException UnknownHostException UnknownHostException UnknownObjectException UnknownServiceException UnknownTag UnknownUserException UnknownUserExceptionHelper UnknownUserExceptionHolder UnmappableCharacterException UnmarshalException UnmodifiableSetException UnrecoverableKeyException Unreferenced UnresolvedAddressException UnresolvedPermission UnsatisfiedLinkError UnsolicitedNotification UnsolicitedNotificationEvent UnsolicitedNotificationListener UnsupportedAddressTypeException UnsupportedAudioFileException UnsupportedCallbackException UnsupportedCharsetException UnsupportedClassVersionError UnsupportedEncodingException UnsupportedFlavorException UnsupportedLookAndFeelException UnsupportedOperationException UserException Util UtilDelegate Utilities VMID VM_ABSTRACT VM_CUSTOM VM_NONE VM_TRUNCATABLE ValueBase ValueBaseHelper ValueBaseHolder ValueFactory ValueHandler ValueMember ValueMemberHelper VariableHeightLayoutCache Vector VerifyError VersionSpecHelper VetoableChangeListener VetoableChangeListenerProxy VetoableChangeSupport View ViewFactory ViewportLayout ViewportUI VirtualMachineError Visibility VisibilityHelper VoiceStatus Void VolatileImage WCharSeqHelper WCharSeqHolder WStringSeqHelper WStringSeqHolder WStringValueHelper WeakHashMap WeakReference Window WindowAdapter WindowConstants WindowEvent WindowFocusListener WindowListener WindowStateListener WrappedPlainView WritableByteChannel WritableRaster WritableRenderedImage WriteAbortedException Writer WrongAdapter WrongAdapterHelper WrongPolicy WrongPolicyHelper WrongTransaction WrongTransactionHelper WrongTransactionHolder X500Principal X500PrivateCredential X509CRL X509CRLEntry X509CRLSelector X509CertSelector X509Certificate X509Certificate X509EncodedKeySpec X509Extension X509KeyManager X509TrustManager XAConnection XADataSource XAException XAResource XMLDecoder XMLEncoder XMLFilter XMLFilterImpl XMLFormatter XMLReader XMLReaderAdapter XMLReaderFactory Xid ZipEntry ZipException ZipFile ZipInputStream ZipOutputStream ZoneView _BindingIteratorImplBase _BindingIteratorStub _DynAnyFactoryStub _DynAnyStub _DynArrayStub _DynEnumStub _DynFixedStub _DynSequenceStub _DynStructStub _DynUnionStub _DynValueStub _IDLTypeStub _NamingContextExtStub _NamingContextImplBase _NamingContextStub _PolicyStub _Remote_Stub _ServantActivatorStub _ServantLocatorStub" list_java'2d1'2e4'2e2'2dkeywords = Set.fromList $ words $ "abstract assert break case catch class continue default do else extends false finally for goto if implements import instanceof interface native new null package private protected public return super strictfp switch synchronized this throws throw transient true try volatile while" list_java'2d1'2e4'2e2'2dtypes = Set.fromList $ words $ "boolean byte char const double final float int long short static void"@@ -104,148 +101,148 @@ regex_'5cs'2b = compileRegex "\\s+" regex_'5c'2f'2a'2d'2d'3e = compileRegex "\\/*-->" -defaultAttributes = [("Normal",NormalTok),("Jsp Standard Directive",OtherTok),("Jsp Xml Directive",OtherTok),("Jsp Comment",CommentTok),("Jsp Custom Tag",OtherTok),("Jsp Standard Directive Value",StringTok),("Jsp Xml Directive Value",StringTok),("Jsp Custom Tag Value",NormalTok),("Jsp Double Quoted Param Value",StringTok),("Jsp Single Quoted Param Value",StringTok),("Jsp Double Quoted Custom Tag Value",DataTypeTok),("Jsp Single Quoted Custom Tag Value",DataTypeTok),("Jsp Scriptlet",NormalTok),("Jsp Expression",NormalTok),("Java Single-Line Comment",CommentTok),("Java Multi-Line Comment",CommentTok),("Java String",StringTok),("Html Attribute",OtherTok),("Html Value",DataTypeTok),("Html Double Quoted Value",DataTypeTok),("Html Single Quoted Value",DataTypeTok),("Html Unquoted Value",DataTypeTok),("Html Comment",CommentTok)]+defaultAttributes = [(("JSP","Normal"),NormalTok),(("JSP","Jsp Standard Directive"),OtherTok),(("JSP","Jsp Xml Directive"),OtherTok),(("JSP","Jsp Comment"),CommentTok),(("JSP","Jsp Custom Tag"),OtherTok),(("JSP","Jsp Standard Directive Value"),StringTok),(("JSP","Jsp Xml Directive Value"),StringTok),(("JSP","Jsp Custom Tag Value"),NormalTok),(("JSP","Jsp Double Quoted Param Value"),StringTok),(("JSP","Jsp Single Quoted Param Value"),StringTok),(("JSP","Jsp Double Quoted Custom Tag Value"),DataTypeTok),(("JSP","Jsp Single Quoted Custom Tag Value"),DataTypeTok),(("JSP","Jsp Scriptlet"),NormalTok),(("JSP","Jsp Expression"),NormalTok),(("JSP","Java Single-Line Comment"),CommentTok),(("JSP","Java Multi-Line Comment"),CommentTok),(("JSP","Java String"),StringTok),(("JSP","Html Attribute"),OtherTok),(("JSP","Html Value"),DataTypeTok),(("JSP","Html Double Quoted Value"),DataTypeTok),(("JSP","Html Single Quoted Value"),DataTypeTok),(("JSP","Html Unquoted Value"),DataTypeTok),(("JSP","Html Comment"),CommentTok)] -parseRules "Normal" =- (((pRegExpr regex_'3c'25'40'5cs'2a'5ba'2dzA'2dZ0'2d9'5f'5c'2e'5d'2a >>= withAttribute NormalTok) >>~ pushContext "Jsp Standard Directive")+parseRules ("JSP","Normal") =+ (((pRegExpr regex_'3c'25'40'5cs'2a'5ba'2dzA'2dZ0'2d9'5f'5c'2e'5d'2a >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Standard Directive")) <|>- ((pRegExpr regex_'3c'5cs'2ajsp'3a'28declaration'7cexpression'7cscriptlet'29'5cs'2a'3e >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'5cs'2ajsp'3a'28declaration'7cexpression'7cscriptlet'29'5cs'2a'3e >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pRegExpr regex_'3c'5cs'2a'5c'2f'3fs'2ajsp'3a'5ba'2dzA'2dZ0'2d9'5f'5c'2e'5d'2a >>= withAttribute NormalTok) >>~ pushContext "Jsp Xml Directive")+ ((pRegExpr regex_'3c'5cs'2a'5c'2f'3fs'2ajsp'3a'5ba'2dzA'2dZ0'2d9'5f'5c'2e'5d'2a >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Xml Directive")) <|>- ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+ ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "Html Comment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Html Comment")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression")+ ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression")) <|>- ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5c'24'3f'5ba'2dzA'2dZ0'2d9'5f'5d'2a'3a'5c'24'3f'5ba'2dzA'2dZ0'2d9'5f'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "Jsp Custom Tag")+ ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5c'24'3f'5ba'2dzA'2dZ0'2d9'5f'5d'2a'3a'5c'24'3f'5ba'2dzA'2dZ0'2d9'5f'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("JSP","Jsp Custom Tag")) <|> ((pString False "<![CDATA[" >>= withAttribute NormalTok)) <|> ((pString False "]]>" >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'3c'5cs'2a'5c'2f'3f'5cs'2a'5ba'2dzA'2dZ0'2d9'5f'5d'2a >>= withAttribute NormalTok) >>~ pushContext "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"))) -parseRules "Jsp Standard Directive" =+parseRules ("JSP","Jsp Standard Directive") = (((pDetect2Chars False '%' '>' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext "Jsp Standard Directive Value")+ ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Standard Directive Value")) <|>- ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+ ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression")+ ((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 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"))) -parseRules "Jsp Xml Directive" =+parseRules ("JSP","Jsp Xml Directive") = (((pRegExpr regex_'5cs'2a'5c'2f'3f'5cs'2a'3e >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext "Jsp Xml Directive Value")+ ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Xml Directive Value")) <|>- ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+ ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression"))+ ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))) -parseRules "Jsp Comment" =+parseRules ("JSP","Jsp Comment") = ((pString False "--%>" >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "Jsp Custom Tag" =+parseRules ("JSP","Jsp Custom Tag") = (((pRegExpr regex_'5c'2f'3f'3e >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext "Jsp Custom Tag Value")+ ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Custom Tag Value")) <|>- ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+ ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression"))+ ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))) -parseRules "Jsp Standard Directive Value" =- (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+parseRules ("JSP","Jsp Standard Directive Value") =+ (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression")+ ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Jsp Double Quoted Param Value")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("JSP","Jsp Double Quoted Param Value")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Jsp Single Quoted Param Value")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("JSP","Jsp Single Quoted Param Value")) <|> ((pDetect2Chars False '%' '>' >>= withAttribute NormalTok) >>~ (popContext >> popContext))) -parseRules "Jsp Xml Directive Value" =- (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+parseRules ("JSP","Jsp Xml Directive Value") =+ (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression")+ ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Jsp Double Quoted Param Value")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("JSP","Jsp Double Quoted Param Value")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Jsp Single Quoted Param Value")+ ((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))) -parseRules "Jsp Custom Tag Value" =- (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+parseRules ("JSP","Jsp Custom Tag Value") =+ (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression")+ ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression")) <|>- ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext "Jsp Double Quoted Custom Tag Value")+ ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("JSP","Jsp Double Quoted Custom Tag Value")) <|>- ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ pushContext "Jsp Single Quoted Custom Tag Value")+ ((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ pushContext ("JSP","Jsp Single Quoted Custom Tag Value")) <|> ((pRegExpr regex_'5c'2f'3f'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext))) -parseRules "Jsp Double Quoted Param Value" =+parseRules ("JSP","Jsp Double Quoted Param Value") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext >> popContext)) <|>- ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+ ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression"))+ ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))) -parseRules "Jsp Single Quoted Param Value" =+parseRules ("JSP","Jsp Single Quoted Param Value") = (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext >> popContext)) <|>- ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+ ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression"))+ ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))) -parseRules "Jsp Double Quoted Custom Tag Value" =+parseRules ("JSP","Jsp Double Quoted Custom Tag Value") = (((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext)) <|>- ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+ ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression"))+ ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))) -parseRules "Jsp Single Quoted Custom Tag Value" =+parseRules ("JSP","Jsp Single Quoted Custom Tag Value") = (((pDetectChar False '\'' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext)) <|>- ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+ ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression"))+ ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))) -parseRules "Jsp Scriptlet" =+parseRules ("JSP","Jsp Scriptlet") = (((pDetect2Chars False '%' '>' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pRegExpr regex_'3c'5cs'2ajsp'3a'28declaration'7cexpression'7cscriptlet'29'5cs'2a'3e >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'5cs'2ajsp'3a'28declaration'7cexpression'7cscriptlet'29'5cs'2a'3e >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_java'2d1'2e4'2e2'2dkeywords >>= withAttribute KeywordTok)) <|>@@ -283,7 +280,7 @@ <|> ((pFirstNonSpace >> pRegExpr regex_'2f'2f'5cs'2aEND'2e'2a'24 >>= withAttribute DecValTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Java String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("JSP","Java String")) <|> ((pDetectChar False '{' >>= withAttribute NormalTok)) <|>@@ -291,11 +288,11 @@ <|> ((pAnyChar "!%&()+,-<=>?[]^{|}~" >>= withAttribute NormalTok)) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Java Single-Line Comment")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("JSP","Java Single-Line Comment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Java Multi-Line Comment"))+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("JSP","Java Multi-Line Comment"))) -parseRules "Jsp Expression" =+parseRules ("JSP","Jsp Expression") = (((pString False "'${'" >>= withAttribute NormalTok)) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext))@@ -332,93 +329,92 @@ <|> ((pHlCChar >>= withAttribute CharTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Java String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("JSP","Java String")) <|> ((pAnyChar "!%&()+,-<=>?[]^{|}~" >>= withAttribute NormalTok))) -parseRules "Java Single-Line Comment" =+parseRules ("JSP","Java Single-Line Comment") = pzero -parseRules "Java Multi-Line Comment" =+parseRules ("JSP","Java Multi-Line Comment") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "Java String" =+parseRules ("JSP","Java String") = (((pDetect2Chars False '\\' '"' >>= withAttribute StringTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Html Attribute" =+parseRules ("JSP","Html Attribute") = (((pRegExpr regex_'5c'2f'3f'3e >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext "Html Value")+ ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("JSP","Html Value")) <|>- ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+ ((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression"))+ ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression"))) -parseRules "Html Value" =- (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+parseRules ("JSP","Html Value") =+ (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression")+ ((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 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")) <|>- ((pRegExpr regex_'28'22'7c'26quot'3b'7c'26'2334'3b'29 >>= withAttribute DataTypeTok) >>~ pushContext "Html Double Quoted Value")+ ((pRegExpr regex_'28'22'7c'26quot'3b'7c'26'2334'3b'29 >>= withAttribute DataTypeTok) >>~ pushContext ("JSP","Html Double Quoted Value")) <|>- ((pRegExpr regex_'28'27'7c'26'2339'3b'29 >>= withAttribute DataTypeTok) >>~ pushContext "Html Single Quoted Value")+ ((pRegExpr regex_'28'27'7c'26'2339'3b'29 >>= withAttribute DataTypeTok) >>~ pushContext ("JSP","Html Single Quoted Value")) <|>- ((pRegExpr regex_'5cs'2a'23'3f'2d'3f'5f'3f'5c'2e'3f'5ba'2dzA'2dZ0'2d9'5d'2a >>= withAttribute DataTypeTok) >>~ pushContext "Html Unquoted Value")+ ((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))) -parseRules "Html Double Quoted Value" =- (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+parseRules ("JSP","Html Double Quoted Value") =+ (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression")+ ((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 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")) <|> ((pRegExpr regex_'28'22'7c'26quot'3b'7c'26'2334'3b'29 >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))) -parseRules "Html Single Quoted Value" =- (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+parseRules ("JSP","Html Single Quoted Value") =+ (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression")+ ((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 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")) <|> ((pRegExpr regex_'28'27'7c'26'2339'3b'29 >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))) -parseRules "Html Unquoted Value" =- (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+parseRules ("JSP","Html Unquoted Value") =+ (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression")+ ((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 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")) <|> ((pRegExpr regex_'5c'2f'3f'3e >>= withAttribute NormalTok) >>~ (popContext >> popContext >> popContext)) <|> ((pRegExpr regex_'5cs'2b >>= withAttribute DataTypeTok) >>~ (popContext >> popContext))) -parseRules "Html Comment" =- (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext "Jsp Comment")+parseRules ("JSP","Html Comment") =+ (((pString False "<%--" >>= withAttribute CommentTok) >>~ pushContext ("JSP","Jsp Comment")) <|>- ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext "Jsp Scriptlet")+ ((pRegExpr regex_'3c'25'28'21'7c'3d'29'3f >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Scriptlet")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext "Jsp Expression")+ ((pDetect2Chars False '$' '{' >>= withAttribute NormalTok) >>~ pushContext ("JSP","Jsp Expression")) <|> ((pRegExpr regex_'5c'2f'2a'2d'2d'3e >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Latex.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -25,83 +24,85 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "LaTeX" }- context <- currentContext <|> (pushContext "Normal Text" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("LaTeX",["Normal Text"])], synStLanguage = "LaTeX", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("LaTeX","Normal Text")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal Text" -> return ()- "NoWeb" -> return ()- "Sectioning" -> return ()- "SectioningInside" -> return ()- "SectioningContrSeq" -> (popContext) >> pEndLine- "SectioningMathMode" -> return ()- "SectioningMathContrSeq" -> (popContext) >> pEndLine- "Footnoting" -> return ()- "FootnotingInside" -> return ()- "FootnotingMathMode" -> return ()- "NewCommand" -> return ()- "DefCommand" -> return ()- "CommandParameterStart" -> return ()- "CommandParameter" -> return ()- "ContrSeq" -> (popContext) >> pEndLine- "ToEndOfLine" -> (popContext) >> pEndLine- "Verb" -> (popContext >> popContext) >> pEndLine- "VerbEnd" -> (popContext >> popContext >> popContext) >> pEndLine- "Label" -> return ()- "LabelOption" -> return ()- "LabelParameter" -> return ()- "FancyLabel" -> return ()- "FancyLabelParameter" -> return ()- "FancyLabelRoundBrackets" -> return ()- "FindEndEnvironment" -> return ()- "EndEnvironment" -> return ()- "EndLatexEnv" -> return ()- "FindBeginEnvironment" -> return ()- "BeginEnvironment" -> return ()- "LatexEnv" -> return ()- "VerbatimEnv" -> return ()- "VerbatimEnvParam" -> return ()- "Verbatim" -> return ()- "VerbFindEnd" -> (popContext) >> pEndLine- "CommentEnv" -> return ()- "BlockComment" -> return ()- "CommFindEnd" -> (popContext) >> pEndLine- "MathEnv" -> return ()- "MathEnvParam" -> return ()- "EnvCommon" -> return ()- "MathModeEnv" -> return ()- "MathFindEnd" -> (popContext) >> pEndLine- "TabEnv" -> return ()- "Tab" -> return ()- "Column Separator" -> return ()- "TabFindEnd" -> (popContext) >> pEndLine- "MathMode" -> return ()- "MathModeDisplay" -> return ()- "MathModeEquation" -> return ()- "MathModeEnsure" -> return ()- "MathModeCommon" -> return ()- "MathContrSeq" -> (popContext) >> pEndLine- "MathModeText" -> return ()- "MathModeTextParameterStart" -> return ()- "MathModeTextParameter" -> return ()- "Multiline Comment" -> return ()- "Comment" -> (popContext) >> pEndLine+ ("LaTeX","Normal Text") -> return ()+ ("LaTeX","NoWeb") -> return ()+ ("LaTeX","Sectioning") -> return ()+ ("LaTeX","SectioningInside") -> return ()+ ("LaTeX","SectioningContrSeq") -> (popContext) >> pEndLine+ ("LaTeX","SectioningMathMode") -> return ()+ ("LaTeX","SectioningMathContrSeq") -> (popContext) >> pEndLine+ ("LaTeX","Footnoting") -> return ()+ ("LaTeX","FootnotingInside") -> return ()+ ("LaTeX","FootnotingMathMode") -> return ()+ ("LaTeX","NewCommand") -> return ()+ ("LaTeX","DefCommand") -> return ()+ ("LaTeX","CommandParameterStart") -> return ()+ ("LaTeX","CommandParameter") -> return ()+ ("LaTeX","ContrSeq") -> (popContext) >> pEndLine+ ("LaTeX","ToEndOfLine") -> (popContext) >> pEndLine+ ("LaTeX","Verb") -> (popContext >> popContext) >> pEndLine+ ("LaTeX","VerbEnd") -> (popContext >> popContext >> popContext) >> pEndLine+ ("LaTeX","Label") -> return ()+ ("LaTeX","LabelOption") -> return ()+ ("LaTeX","LabelParameter") -> return ()+ ("LaTeX","FancyLabel") -> return ()+ ("LaTeX","FancyLabelParameter") -> return ()+ ("LaTeX","FancyLabelRoundBrackets") -> return ()+ ("LaTeX","FindEndEnvironment") -> return ()+ ("LaTeX","EndEnvironment") -> return ()+ ("LaTeX","EndLatexEnv") -> return ()+ ("LaTeX","FindBeginEnvironment") -> return ()+ ("LaTeX","BeginEnvironment") -> return ()+ ("LaTeX","LatexEnv") -> return ()+ ("LaTeX","VerbatimEnv") -> return ()+ ("LaTeX","VerbatimEnvParam") -> return ()+ ("LaTeX","Verbatim") -> return ()+ ("LaTeX","VerbFindEnd") -> (popContext) >> pEndLine+ ("LaTeX","CommentEnv") -> return ()+ ("LaTeX","BlockComment") -> return ()+ ("LaTeX","CommFindEnd") -> (popContext) >> pEndLine+ ("LaTeX","MathEnv") -> return ()+ ("LaTeX","MathEnvParam") -> return ()+ ("LaTeX","EnvCommon") -> return ()+ ("LaTeX","MathModeEnv") -> return ()+ ("LaTeX","MathFindEnd") -> (popContext) >> pEndLine+ ("LaTeX","TabEnv") -> return ()+ ("LaTeX","Tab") -> return ()+ ("LaTeX","Column Separator") -> return ()+ ("LaTeX","TabFindEnd") -> (popContext) >> pEndLine+ ("LaTeX","MathMode") -> return ()+ ("LaTeX","MathModeDisplay") -> return ()+ ("LaTeX","MathModeEquation") -> return ()+ ("LaTeX","MathModeEnsure") -> return ()+ ("LaTeX","MathModeCommon") -> return ()+ ("LaTeX","MathContrSeq") -> (popContext) >> pEndLine+ ("LaTeX","MathModeText") -> return ()+ ("LaTeX","MathModeTextParameterStart") -> return ()+ ("LaTeX","MathModeTextParameter") -> return ()+ ("LaTeX","Multiline Comment") -> return ()+ ("LaTeX","Comment") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -110,11 +111,7 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'5c'5cbegin'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 = compileRegex "\\\\begin(?=[^a-zA-Z])" regex_'5c'5cend'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 = compileRegex "\\\\end(?=[^a-zA-Z])" regex_'5c'5c'28cite'7cparencite'7cautocite'7cAutocite'7ccitetitle'29'5c'2a'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 = compileRegex "\\\\(cite|parencite|autocite|Autocite|citetitle)\\*(?=[^a-zA-Z])"@@ -175,92 +172,92 @@ regex_'5c'24'2e'2a'5c'24 = compileRegex "\\$.*\\$" regex_'28FIXME'7cTODO'29'3a'3f = compileRegex "(FIXME|TODO):?" -defaultAttributes = [("Normal Text",NormalTok),("NoWeb",NormalTok),("Sectioning",NormalTok),("SectioningInside",NormalTok),("SectioningContrSeq",NormalTok),("SectioningMathMode",NormalTok),("SectioningMathContrSeq",NormalTok),("Footnoting",NormalTok),("FootnotingInside",NormalTok),("FootnotingMathMode",NormalTok),("NewCommand",NormalTok),("DefCommand",NormalTok),("CommandParameterStart",NormalTok),("CommandParameter",NormalTok),("ContrSeq",NormalTok),("ToEndOfLine",NormalTok),("Verb",NormalTok),("VerbEnd",NormalTok),("Label",NormalTok),("LabelOption",NormalTok),("LabelParameter",NormalTok),("FancyLabel",NormalTok),("FancyLabelParameter",NormalTok),("FancyLabelRoundBrackets",NormalTok),("FindEndEnvironment",NormalTok),("EndEnvironment",NormalTok),("EndLatexEnv",NormalTok),("FindBeginEnvironment",NormalTok),("BeginEnvironment",NormalTok),("LatexEnv",NormalTok),("VerbatimEnv",NormalTok),("VerbatimEnvParam",NormalTok),("Verbatim",NormalTok),("VerbFindEnd",NormalTok),("CommentEnv",NormalTok),("BlockComment",CommentTok),("CommFindEnd",NormalTok),("MathEnv",NormalTok),("MathEnvParam",NormalTok),("EnvCommon",NormalTok),("MathModeEnv",NormalTok),("MathFindEnd",NormalTok),("TabEnv",NormalTok),("Tab",NormalTok),("Column Separator",NormalTok),("TabFindEnd",NormalTok),("MathMode",NormalTok),("MathModeDisplay",NormalTok),("MathModeEquation",NormalTok),("MathModeEnsure",NormalTok),("MathModeCommon",NormalTok),("MathContrSeq",NormalTok),("MathModeText",NormalTok),("MathModeTextParameterStart",NormalTok),("MathModeTextParameter",NormalTok),("Multiline Comment",CommentTok),("Comment",CommentTok)]+defaultAttributes = [(("LaTeX","Normal Text"),NormalTok),(("LaTeX","NoWeb"),NormalTok),(("LaTeX","Sectioning"),NormalTok),(("LaTeX","SectioningInside"),NormalTok),(("LaTeX","SectioningContrSeq"),NormalTok),(("LaTeX","SectioningMathMode"),NormalTok),(("LaTeX","SectioningMathContrSeq"),NormalTok),(("LaTeX","Footnoting"),NormalTok),(("LaTeX","FootnotingInside"),NormalTok),(("LaTeX","FootnotingMathMode"),NormalTok),(("LaTeX","NewCommand"),NormalTok),(("LaTeX","DefCommand"),NormalTok),(("LaTeX","CommandParameterStart"),NormalTok),(("LaTeX","CommandParameter"),NormalTok),(("LaTeX","ContrSeq"),NormalTok),(("LaTeX","ToEndOfLine"),NormalTok),(("LaTeX","Verb"),NormalTok),(("LaTeX","VerbEnd"),NormalTok),(("LaTeX","Label"),NormalTok),(("LaTeX","LabelOption"),NormalTok),(("LaTeX","LabelParameter"),NormalTok),(("LaTeX","FancyLabel"),NormalTok),(("LaTeX","FancyLabelParameter"),NormalTok),(("LaTeX","FancyLabelRoundBrackets"),NormalTok),(("LaTeX","FindEndEnvironment"),NormalTok),(("LaTeX","EndEnvironment"),NormalTok),(("LaTeX","EndLatexEnv"),NormalTok),(("LaTeX","FindBeginEnvironment"),NormalTok),(("LaTeX","BeginEnvironment"),NormalTok),(("LaTeX","LatexEnv"),NormalTok),(("LaTeX","VerbatimEnv"),NormalTok),(("LaTeX","VerbatimEnvParam"),NormalTok),(("LaTeX","Verbatim"),NormalTok),(("LaTeX","VerbFindEnd"),NormalTok),(("LaTeX","CommentEnv"),NormalTok),(("LaTeX","BlockComment"),CommentTok),(("LaTeX","CommFindEnd"),NormalTok),(("LaTeX","MathEnv"),NormalTok),(("LaTeX","MathEnvParam"),NormalTok),(("LaTeX","EnvCommon"),NormalTok),(("LaTeX","MathModeEnv"),NormalTok),(("LaTeX","MathFindEnd"),NormalTok),(("LaTeX","TabEnv"),NormalTok),(("LaTeX","Tab"),NormalTok),(("LaTeX","Column Separator"),NormalTok),(("LaTeX","TabFindEnd"),NormalTok),(("LaTeX","MathMode"),NormalTok),(("LaTeX","MathModeDisplay"),NormalTok),(("LaTeX","MathModeEquation"),NormalTok),(("LaTeX","MathModeEnsure"),NormalTok),(("LaTeX","MathModeCommon"),NormalTok),(("LaTeX","MathContrSeq"),NormalTok),(("LaTeX","MathModeText"),NormalTok),(("LaTeX","MathModeTextParameterStart"),NormalTok),(("LaTeX","MathModeTextParameter"),NormalTok),(("LaTeX","Multiline Comment"),CommentTok),(("LaTeX","Comment"),CommentTok)] -parseRules "Normal Text" =- (((pRegExpr regex_'5c'5cbegin'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext "FindBeginEnvironment")+parseRules ("LaTeX","Normal Text") =+ (((pRegExpr regex_'5c'5cbegin'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","FindBeginEnvironment")) <|>- ((pRegExpr regex_'5c'5cend'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext "FindEndEnvironment")+ ((pRegExpr regex_'5c'5cend'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","FindEndEnvironment")) <|>- ((pRegExpr regex_'5c'5c'28cite'7cparencite'7cautocite'7cAutocite'7ccitetitle'29'5c'2a'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext "Label")+ ((pRegExpr regex_'5c'5c'28cite'7cparencite'7cautocite'7cAutocite'7ccitetitle'29'5c'2a'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Label")) <|>- ((pRegExpr regex_'5c'5c'28cites'7cCites'7cparencites'7cParencites'7cautocites'7cAutocites'7csupercites'7cfootcites'7cFootcites'29'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext "FancyLabel")+ ((pRegExpr regex_'5c'5c'28cites'7cCites'7cparencites'7cParencites'7cautocites'7cAutocites'7csupercites'7cfootcites'7cFootcites'29'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","FancyLabel")) <|>- ((pRegExpr regex_'5c'5c'28cite'7cnocite'7cCite'7cparencite'7cParencite'7cfootcite'7cFootcite'7ctextcite'7cTextcite'7csupercite'7cautocite'7cAutocite'7cciteauthor'7cCiteauthor'7ccitetitle'7cciteyear'7cciteurl'7cnocite'7cfullcite'7cfootfullcite'29'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext "Label")+ ((pRegExpr regex_'5c'5c'28cite'7cnocite'7cCite'7cparencite'7cParencite'7cfootcite'7cFootcite'7ctextcite'7cTextcite'7csupercite'7cautocite'7cAutocite'7cciteauthor'7cCiteauthor'7ccitetitle'7cciteyear'7cciteurl'7cnocite'7cfullcite'7cfootfullcite'29'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Label")) <|>- ((pRegExpr regex_'5c'5c'28subref'5c'2a'3f'7ccref'5c'2a'3f'7clabel'7cpageref'7cautoref'7cref'7cvpageref'7cvref'7cpagecite'7ceqref'29'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext "Label")+ ((pRegExpr regex_'5c'5c'28subref'5c'2a'3f'7ccref'5c'2a'3f'7clabel'7cpageref'7cautoref'7cref'7cvpageref'7cvref'7cpagecite'7ceqref'29'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Label")) <|>- ((pRegExpr regex_'5c'5c'28part'7cchapter'7csection'7csubsection'7csubsubsection'7cparagraph'7csubparagraph'29'5c'2a'3f'5cs'2a'28'3f'3d'5b'5c'7b'5c'5b'5d'29 >>= withAttribute NormalTok) >>~ pushContext "Sectioning")+ ((pRegExpr regex_'5c'5c'28part'7cchapter'7csection'7csubsection'7csubsubsection'7cparagraph'7csubparagraph'29'5c'2a'3f'5cs'2a'28'3f'3d'5b'5c'7b'5c'5b'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Sectioning")) <|>- ((pRegExpr regex_'5c'5c'28footnote'29'5c'2a'3f'5cs'2a'28'3f'3d'5b'5c'7b'5c'5b'5d'29 >>= withAttribute NormalTok) >>~ pushContext "Footnoting")+ ((pRegExpr regex_'5c'5c'28footnote'29'5c'2a'3f'5cs'2a'28'3f'3d'5b'5c'7b'5c'5b'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Footnoting")) <|>- ((pRegExpr regex_'5c'5c'28renewcommand'7cprovidenewcommand'7cnewcommand'29'5c'2a'3f'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext "NewCommand")+ ((pRegExpr regex_'5c'5c'28renewcommand'7cprovidenewcommand'7cnewcommand'29'5c'2a'3f'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","NewCommand")) <|>- ((pRegExpr regex_'5c'5c'28e'7cg'7cx'29'3fdef'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext "DefCommand")+ ((pRegExpr regex_'5c'5c'28e'7cg'7cx'29'3fdef'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","DefCommand")) <|>- ((pRegExpr regex_'3c'3c'2e'2a'3e'3e'3d >>= withAttribute NormalTok) >>~ pushContext "NoWeb")+ ((pRegExpr regex_'3c'3c'2e'2a'3e'3e'3d >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","NoWeb")) <|>- ((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext "MathMode")+ ((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathMode")) <|>- ((pString False "\\[" >>= withAttribute NormalTok) >>~ pushContext "MathModeEquation")+ ((pString False "\\[" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeEquation")) <|>- ((pString False "\\iffalse" >>= withAttribute CommentTok) >>~ pushContext "Multiline Comment")+ ((pString False "\\iffalse" >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Multiline Comment")) <|>- ((pString False "\\ensuremath{" >>= withAttribute NormalTok) >>~ pushContext "MathModeEnsure")+ ((pString False "\\ensuremath{" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeEnsure")) <|>- ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext "ContrSeq")+ ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","ContrSeq")) <|>- ((pString False "$$" >>= withAttribute NormalTok) >>~ pushContext "MathModeDisplay")+ ((pString False "$$" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeDisplay")) <|>- ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ pushContext "MathMode")+ ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathMode")) <|> ((pFirstNonSpace >> pRegExpr regex_'25'5cs'2aBEGIN'2e'2a'24 >>= withAttribute RegionMarkerTok)) <|> ((pFirstNonSpace >> pRegExpr regex_'25'5cs'2aEND'2e'2a'24 >>= withAttribute RegionMarkerTok)) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment")) <|> ((pDetectChar False '\215' >>= withAttribute NormalTok))) -parseRules "NoWeb" =+parseRules ("LaTeX","NoWeb") = ((pColumn 0 >> pRegExpr regex_'5cs'2a'40'5cs'2a >>= withAttribute NormalTok) >>~ (popContext)) -parseRules "Sectioning" =+parseRules ("LaTeX","Sectioning") = (((pRegExpr regex_'5c'5b'5b'5e'5c'5d'5d'2a'5c'5d >>= withAttribute NormalTok)) <|> ((pDetectChar False ' ' >>= withAttribute NormalTok)) <|>- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "SectioningInside")+ ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","SectioningInside")) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment")) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "SectioningInside" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "SectioningInside")+parseRules ("LaTeX","SectioningInside") =+ (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","SectioningInside")) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext "SectioningMathMode")+ ((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","SectioningMathMode")) <|>- ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext "SectioningContrSeq")+ ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","SectioningContrSeq")) <|>- ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ pushContext "SectioningMathMode")+ ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","SectioningMathMode")) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment")) <|> ((pDetectChar False '\215' >>= withAttribute NormalTok))) -parseRules "SectioningContrSeq" =+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))) -parseRules "SectioningMathMode" =+parseRules ("LaTeX","SectioningMathMode") = (((pString False "$$" >>= withAttribute AlertTok)) <|> ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ (popContext))@@ -269,44 +266,44 @@ <|> ((pDetect2Chars False '\\' ']' >>= withAttribute AlertTok)) <|>- ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext "SectioningMathContrSeq")+ ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","SectioningMathContrSeq")) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment")) <|> ((pDetectChar False '\215' >>= withAttribute NormalTok))) -parseRules "SectioningMathContrSeq" =+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))) -parseRules "Footnoting" =+parseRules ("LaTeX","Footnoting") = (((pRegExpr regex_'5c'5b'5b'5e'5c'5d'5d'2a'5c'5d >>= withAttribute NormalTok)) <|> ((pDetectChar False ' ' >>= withAttribute NormalTok)) <|>- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "FootnotingInside")+ ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","FootnotingInside")) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment")) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "FootnotingInside" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "FootnotingInside")+parseRules ("LaTeX","FootnotingInside") =+ (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","FootnotingInside")) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext "FootnotingMathMode")+ ((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","FootnotingMathMode")) <|>- ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ pushContext "FootnotingMathMode")+ ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","FootnotingMathMode")) <|>- ((parseRules "Normal Text")))+ ((parseRules ("LaTeX","Normal Text")))) -parseRules "FootnotingMathMode" =+parseRules ("LaTeX","FootnotingMathMode") = (((pString False "$$" >>= withAttribute AlertTok)) <|> ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ (popContext))@@ -315,44 +312,44 @@ <|> ((pDetect2Chars False '\\' ']' >>= withAttribute AlertTok)) <|>- ((parseRules "MathMode")))+ ((parseRules ("LaTeX","MathMode")))) -parseRules "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 "CommandParameterStart")+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")) <|> ((pDetectChar False '}' >>= withAttribute AlertTok) >>~ (popContext)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "DefCommand" =- (((pRegExpr regex_'5cs'2a'5c'5c'5ba'2dzA'2dZ'5d'2b'5b'5e'5c'7b'5d'2a'5c'7b >>= withAttribute NormalTok) >>~ pushContext "CommandParameterStart")+parseRules ("LaTeX","DefCommand") =+ (((pRegExpr regex_'5cs'2a'5c'5c'5ba'2dzA'2dZ'5d'2b'5b'5e'5c'7b'5d'2a'5c'7b >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","CommandParameterStart")) <|> ((pDetectChar False '}' >>= withAttribute AlertTok) >>~ (popContext)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "CommandParameterStart" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "CommandParameter")+parseRules ("LaTeX","CommandParameterStart") =+ (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","CommandParameter")) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext >> popContext)) <|> ((pRegExpr regex_'5c'5c'2e >>= withAttribute NormalTok)) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment"))+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment"))) -parseRules "CommandParameter" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "CommandParameter")+parseRules ("LaTeX","CommandParameter") =+ (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","CommandParameter")) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pRegExpr regex_'5c'5c'2e >>= withAttribute NormalTok)) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment"))+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment"))) -parseRules "ContrSeq" =- (((pString False "verb*" >>= withAttribute NormalTok) >>~ pushContext "Verb")+parseRules ("LaTeX","ContrSeq") =+ (((pString False "verb*" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Verb")) <|>- ((pRegExpr regex_'28Verb'7cverb'7clstinline'29'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext "Verb")+ ((pRegExpr regex_'28Verb'7cverb'7clstinline'29'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Verb")) <|> ((pDetectChar False '\215' >>= withAttribute NormalTok)) <|>@@ -360,84 +357,84 @@ <|> ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "ToEndOfLine" =+parseRules ("LaTeX","ToEndOfLine") = pzero -parseRules "Verb" =- ((pRegExprDynamic "(.)" >>= withAttribute NormalTok) >>~ pushContext "VerbEnd")+parseRules ("LaTeX","Verb") =+ ((pRegExprDynamic "(.)" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","VerbEnd")) -parseRules "VerbEnd" =+parseRules ("LaTeX","VerbEnd") = (((pString True "%1" >>= withAttribute NormalTok) >>~ (popContext >> popContext >> popContext)) <|> ((pDetectChar False '\215' >>= withAttribute NormalTok)) <|> ((pRegExprDynamic "[^%1\\xd7]*" >>= withAttribute NormalTok))) -parseRules "Label" =- (((pRegExpr regex_'5cs'2a'5c'7b'5cs'2a >>= withAttribute NormalTok) >>~ pushContext "LabelParameter")+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 "LabelOption")+ ((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))) -parseRules "LabelOption" =- (((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext "MathMode")+parseRules ("LaTeX","LabelOption") =+ (((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathMode")) <|>- ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext "ContrSeq")+ ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","ContrSeq")) <|>- ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ pushContext "MathMode")+ ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathMode")) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment")) <|> ((pDetectChar False '\215' >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5cs'2a'5c'5d'5cs'2a >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "LabelParameter" =+parseRules ("LaTeX","LabelParameter") = (((pDetectChar False '\215' >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5cs'2a'5c'7d'5cs'2a >>= withAttribute NormalTok) >>~ (popContext >> popContext))) -parseRules "FancyLabel" =- (((pRegExpr regex_'5cs'2a'5c'7b'5cs'2a >>= withAttribute NormalTok) >>~ pushContext "FancyLabelParameter")+parseRules ("LaTeX","FancyLabel") =+ (((pRegExpr regex_'5cs'2a'5c'7b'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","FancyLabelParameter")) <|>- ((pRegExpr regex_'5cs'2a'5c'5b'5cs'2a >>= withAttribute NormalTok) >>~ pushContext "LabelOption")+ ((pRegExpr regex_'5cs'2a'5c'5b'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","LabelOption")) <|>- ((pRegExpr regex_'5cs'2a'5c'28'5cs'2a >>= withAttribute NormalTok) >>~ pushContext "FancyLabelRoundBrackets")+ ((pRegExpr regex_'5cs'2a'5c'28'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","FancyLabelRoundBrackets")) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "FancyLabelParameter" =+parseRules ("LaTeX","FancyLabelParameter") = (((pDetectChar False '\215' >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5cs'2a'5c'7d'5cs'2a >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "FancyLabelRoundBrackets" =- (((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext "MathMode")+parseRules ("LaTeX","FancyLabelRoundBrackets") =+ (((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathMode")) <|>- ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext "ContrSeq")+ ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","ContrSeq")) <|>- ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ pushContext "MathMode")+ ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathMode")) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment")) <|> ((pDetectChar False '\215' >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5cs'2a'5c'29'5cs'2a >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "FindEndEnvironment" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "EndEnvironment")+parseRules ("LaTeX","FindEndEnvironment") =+ (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","EndEnvironment")) <|> ((pRegExpr regex_'5cS >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "EndEnvironment" =- (((pRegExpr regex_'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ pushContext "EndLatexEnv")+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))) -parseRules "EndLatexEnv" =+parseRules ("LaTeX","EndLatexEnv") = (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext >> popContext >> popContext)) <|> ((pRegExpr regex_'5ba'2dzA'2dZ'5d'2b'28'5c'2a'29'3f >>= withAttribute NormalTok))@@ -446,63 +443,63 @@ <|> ((pRegExpr regex_'5ba'2dzA'2dZ'5d >>= withAttribute AlertTok) >>~ (popContext >> popContext >> popContext))) -parseRules "FindBeginEnvironment" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "BeginEnvironment")+parseRules ("LaTeX","FindBeginEnvironment") =+ (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","BeginEnvironment")) <|> ((pRegExpr regex_'5cS >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "BeginEnvironment" =- (((pRegExpr regex_'28lstlisting'7c'28B'7cL'29'3fVerbatim'29 >>= withAttribute NormalTok) >>~ pushContext "VerbatimEnvParam")+parseRules ("LaTeX","BeginEnvironment") =+ (((pRegExpr regex_'28lstlisting'7c'28B'7cL'29'3fVerbatim'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","VerbatimEnvParam")) <|>- ((pRegExpr regex_'28verbatim'7cboxedverbatim'29 >>= withAttribute NormalTok) >>~ pushContext "VerbatimEnv")+ ((pRegExpr regex_'28verbatim'7cboxedverbatim'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","VerbatimEnv")) <|>- ((pRegExpr regex_comment >>= withAttribute NormalTok) >>~ pushContext "CommentEnv")+ ((pRegExpr regex_comment >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","CommentEnv")) <|>- ((pRegExpr regex_'28alignat'7cxalignat'7cxxalignat'29 >>= withAttribute NormalTok) >>~ pushContext "MathEnvParam")+ ((pRegExpr regex_'28alignat'7cxalignat'7cxxalignat'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathEnvParam")) <|>- ((pRegExpr regex_'28equation'7cdisplaymath'7ceqnarray'7csubeqnarray'7cmath'7cmultline'7cgather'7calign'7cflalign'7cIEEEeqnarray'7cIEEEeqnarraybox'7csmallmatrix'7cpmatrix'7cbmatrix'7cBmatrix'7cvmatrix'7cVmatrix'29 >>= withAttribute NormalTok) >>~ pushContext "MathEnv")+ ((pRegExpr regex_'28equation'7cdisplaymath'7ceqnarray'7csubeqnarray'7cmath'7cmultline'7cgather'7calign'7cflalign'7cIEEEeqnarray'7cIEEEeqnarraybox'7csmallmatrix'7cpmatrix'7cbmatrix'7cBmatrix'7cvmatrix'7cVmatrix'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathEnv")) <|>- ((pRegExpr regex_'28tabularx'7ctabular'7csupertabular'7cmpsupertabular'7cxtabular'7cmpxtabular'7clongtable'29 >>= withAttribute NormalTok) >>~ pushContext "TabEnv")+ ((pRegExpr regex_'28tabularx'7ctabular'7csupertabular'7cmpsupertabular'7cxtabular'7cmpxtabular'7clongtable'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","TabEnv")) <|> ((pDetectChar False '\215' >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ pushContext "LatexEnv")+ ((pRegExpr regex_'5ba'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","LatexEnv")) <|> ((pRegExpr regex_'5cs'2b >>= withAttribute AlertTok) >>~ (popContext)) <|> ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5cxd7'5d >>= withAttribute AlertTok) >>~ (popContext))) -parseRules "LatexEnv" =+parseRules ("LaTeX","LatexEnv") = (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext >> popContext >> popContext)) <|> ((pRegExpr regex_'5ba'2dzA'2dZ'5d'2b >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5cs'2b >>= withAttribute AlertTok)) <|>- ((parseRules "EnvCommon")))+ ((parseRules ("LaTeX","EnvCommon")))) -parseRules "VerbatimEnv" =- (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext "Verbatim")+parseRules ("LaTeX","VerbatimEnv") =+ (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Verbatim")) <|> ((lookAhead (pRegExpr regex_'5ba'2dzA'2dZ'5d) >> (popContext) >> currentContext >>= parseRules)) <|>- ((parseRules "EnvCommon"))+ ((parseRules ("LaTeX","EnvCommon"))) <|> ((popContext >> popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "VerbatimEnvParam" =+parseRules ("LaTeX","VerbatimEnvParam") = (((pDetect2Chars False '}' '[' >>= withAttribute NormalTok)) <|>- ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext "Verbatim")+ ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Verbatim")) <|>- ((pDetectChar False ']' >>= withAttribute NormalTok) >>~ pushContext "Verbatim"))+ ((pDetectChar False ']' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Verbatim"))) -parseRules "Verbatim" =+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 "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"))) -parseRules "VerbFindEnd" =+parseRules ("LaTeX","VerbFindEnd") = (((pRegExpr regex_'5cs'2a'5c'7b >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'28verbatim'7clstlisting'7cboxedverbatim'7c'28B'7cL'29'3fVerbatim'29'5c'2a'3f >>= withAttribute NormalTok))@@ -511,21 +508,21 @@ <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "CommentEnv" =- (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext "BlockComment")+parseRules ("LaTeX","CommentEnv") =+ (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","BlockComment")) <|> ((lookAhead (pRegExpr regex_'5ba'2dzA'2dZ'5d) >> (popContext) >> currentContext >>= parseRules)) <|>- ((parseRules "EnvCommon"))+ ((parseRules ("LaTeX","EnvCommon"))) <|> ((popContext >> popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "BlockComment" =+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 "CommFindEnd"))+ ((pRegExpr regex_'5c'5cend'28'3f'3d'5cs'2a'5c'7bcomment'5c'2a'3f'5c'7d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","CommFindEnd"))) -parseRules "CommFindEnd" =+parseRules ("LaTeX","CommFindEnd") = (((pRegExpr regex_'5cs'2a'5c'7b >>= withAttribute NormalTok)) <|> ((pRegExpr regex_comment'5c'2a'3f >>= withAttribute NormalTok))@@ -534,23 +531,23 @@ <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "MathEnv" =- (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext "MathModeEnv")+parseRules ("LaTeX","MathEnv") =+ (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeEnv")) <|> ((lookAhead (pRegExpr regex_'5ba'2dzA'2dZ'5d) >> (popContext) >> currentContext >>= parseRules)) <|>- ((parseRules "EnvCommon")))+ ((parseRules ("LaTeX","EnvCommon")))) -parseRules "MathEnvParam" =- (((pRegExpr regex_'5c'7d'5c'7b'5b'5e'5c'7d'5d'2a'5c'7d >>= withAttribute NormalTok) >>~ pushContext "MathModeEnv")+parseRules ("LaTeX","MathEnvParam") =+ (((pRegExpr regex_'5c'7d'5c'7b'5b'5e'5c'7d'5d'2a'5c'7d >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeEnv")) <|>- ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext "MathModeEnv")+ ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeEnv")) <|> ((lookAhead (pRegExpr regex_'5ba'2dzA'2dZ'5d) >> (popContext) >> currentContext >>= parseRules)) <|>- ((parseRules "EnvCommon")))+ ((parseRules ("LaTeX","EnvCommon")))) -parseRules "EnvCommon" =+parseRules ("LaTeX","EnvCommon") = (((pDetectChar False '\215' >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5c'2a'28'3f'3d'5c'7d'29 >>= withAttribute NormalTok))@@ -559,10 +556,10 @@ <|> ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5cxd7'5d'5b'5e'5c'7d'5d'2a >>= withAttribute AlertTok) >>~ (popContext >> popContext >> popContext))) -parseRules "MathModeEnv" =- (((pRegExpr regex_'5c'5cbegin'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext "FindBeginEnvironment")+parseRules ("LaTeX","MathModeEnv") =+ (((pRegExpr regex_'5c'5cbegin'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","FindBeginEnvironment")) <|>- ((pRegExpr regex_'5c'5cend'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext "MathFindEnd")+ ((pRegExpr regex_'5c'5cend'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathFindEnd")) <|> ((pString False "\\(" >>= withAttribute AlertTok)) <|>@@ -572,15 +569,15 @@ <|> ((pString False "\\]" >>= withAttribute AlertTok)) <|>- ((pRegExpr regex_'5c'5c'28text'7cintertext'7cmbox'29'5cs'2a'28'3f'3d'5c'7b'29 >>= withAttribute NormalTok) >>~ pushContext "MathModeText")+ ((pRegExpr regex_'5c'5c'28text'7cintertext'7cmbox'29'5cs'2a'28'3f'3d'5c'7b'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeText")) <|>- ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext "MathContrSeq")+ ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathContrSeq")) <|> ((pString False "$$" >>= withAttribute AlertTok)) <|> ((pDetectChar False '$' >>= withAttribute AlertTok)) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment")) <|> ((pDetectChar False '\215' >>= withAttribute NormalTok)) <|>@@ -588,7 +585,7 @@ <|> ((pFirstNonSpace >> pRegExpr regex_'25'5cs'2aEND'2e'2a'24 >>= withAttribute RegionMarkerTok))) -parseRules "MathFindEnd" =+parseRules ("LaTeX","MathFindEnd") = (((pRegExpr regex_'5cs'2a'5c'7b >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'28equation'7cdisplaymath'7ceqnarray'7csubeqnarray'7cmath'7cmultline'7cgather'7calign'7cflalign'7calignat'7cxalignat'7cxxalignat'7cIEEEeqnarray'7cIEEEeqnarraybox'7csmallmatrix'7cpmatrix'7cbmatrix'7cBmatrix'7cvmatrix'7cVmatrix'29'5c'2a'3f >>= withAttribute NormalTok))@@ -597,32 +594,32 @@ <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "TabEnv" =- (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext "Tab")+parseRules ("LaTeX","TabEnv") =+ (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Tab")) <|> ((lookAhead (pRegExpr regex_'5ba'2dzA'2dZ'5d) >> (popContext) >> currentContext >>= parseRules)) <|>- ((parseRules "EnvCommon"))+ ((parseRules ("LaTeX","EnvCommon"))) <|> ((popContext >> popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "Tab" =+parseRules ("LaTeX","Tab") = (((pDetectChar False '&' >>= withAttribute NormalTok)) <|>- ((pString False "@{" >>= withAttribute NormalTok) >>~ pushContext "Column Separator")+ ((pString False "@{" >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Column Separator")) <|>- ((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 "TabFindEnd")+ ((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 "Normal Text")))+ ((parseRules ("LaTeX","Normal Text")))) -parseRules "Column Separator" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "Column Separator")+parseRules ("LaTeX","Column Separator") =+ (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","Column Separator")) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pRegExpr regex_'2e >>= withAttribute NormalTok))) -parseRules "TabFindEnd" =+parseRules ("LaTeX","TabFindEnd") = (((pRegExpr regex_'5cs'2a'5c'7b >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'28tabularx'7ctabular'7csupertabular'7cmpsupertabular'7cxtabular'7cmpxtabular'7clongtable'29'5c'2a'3f >>= withAttribute NormalTok))@@ -631,7 +628,7 @@ <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "MathMode" =+parseRules ("LaTeX","MathMode") = (((pString False "$$" >>= withAttribute AlertTok)) <|> ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ (popContext))@@ -640,9 +637,9 @@ <|> ((pDetect2Chars False '\\' ']' >>= withAttribute AlertTok)) <|>- ((parseRules "MathModeCommon")))+ ((parseRules ("LaTeX","MathModeCommon")))) -parseRules "MathModeDisplay" =+parseRules ("LaTeX","MathModeDisplay") = (((pString False "$$" >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pDetectChar False '$' >>= withAttribute AlertTok))@@ -651,9 +648,9 @@ <|> ((pDetect2Chars False '\\' ')' >>= withAttribute AlertTok)) <|>- ((parseRules "MathModeCommon")))+ ((parseRules ("LaTeX","MathModeCommon")))) -parseRules "MathModeEquation" =+parseRules ("LaTeX","MathModeEquation") = (((pDetect2Chars False '\\' ']' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pString False "$$" >>= withAttribute AlertTok))@@ -662,27 +659,27 @@ <|> ((pDetect2Chars False '\\' ')' >>= withAttribute AlertTok)) <|>- ((parseRules "MathModeCommon")))+ ((parseRules ("LaTeX","MathModeCommon")))) -parseRules "MathModeEnsure" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "MathModeEnsure")+parseRules ("LaTeX","MathModeEnsure") =+ (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeEnsure")) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "MathModeCommon")))+ ((parseRules ("LaTeX","MathModeCommon")))) -parseRules "MathModeCommon" =+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)) <|> ((pRegExpr regex_'5c'5cbegin'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5c'5cend'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'5c'5c'28text'7cintertext'7cmbox'29'5cs'2a'28'3f'3d'5c'7b'29 >>= withAttribute NormalTok) >>~ pushContext "MathModeText")+ ((pRegExpr regex_'5c'5c'28text'7cintertext'7cmbox'29'5cs'2a'28'3f'3d'5c'7b'29 >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeText")) <|>- ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext "MathContrSeq")+ ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathContrSeq")) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment")) <|> ((pFirstNonSpace >> pRegExpr regex_'25'5cs'2aBEGIN'2e'2a'24 >>= withAttribute RegionMarkerTok)) <|>@@ -690,52 +687,51 @@ <|> ((pDetectChar False '\215' >>= withAttribute NormalTok))) -parseRules "MathContrSeq" =+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))) -parseRules "MathModeText" =- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "MathModeTextParameterStart")+parseRules ("LaTeX","MathModeText") =+ ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeTextParameterStart")) -parseRules "MathModeTextParameterStart" =+parseRules ("LaTeX","MathModeTextParameterStart") = (((pRegExpr regex_'5c'5c'2e >>= withAttribute NormalTok)) <|> ((pDetectChar False '\215' >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5c'24'2e'2a'5c'24 >>= withAttribute NormalTok)) <|>- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "MathModeTextParameter")+ ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeTextParameter")) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment"))+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment"))) -parseRules "MathModeTextParameter" =+parseRules ("LaTeX","MathModeTextParameter") = (((pRegExpr regex_'5c'5c'2e >>= withAttribute NormalTok)) <|>- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "MathModeTextParameter")+ ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("LaTeX","MathModeTextParameter")) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pDetectChar False '\215' >>= withAttribute NormalTok)) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment"))+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Comment"))) -parseRules "Multiline Comment" =+parseRules ("LaTeX","Multiline Comment") = (((pString False "\\fi" >>= withAttribute CommentTok) >>~ (popContext)) <|> ((pString False "\\else" >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Comment" =+parseRules ("LaTeX","Comment") = (((pRegExpr regex_'28FIXME'7cTODO'29'3a'3f >>= withAttribute AlertTok)) <|>- ((pString False "\\KileResetHL" >>= withAttribute CommentTok) >>~ pushContext "Normal Text")+ ((pString False "\\KileResetHL" >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Normal Text")) <|>- ((pString False "\\KateResetHL" >>= withAttribute CommentTok) >>~ pushContext "Normal Text"))+ ((pString False "\\KateResetHL" >>= withAttribute CommentTok) >>~ pushContext ("LaTeX","Normal Text"))) -parseRules "" = parseRules "Normal Text" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Lex.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Cpp import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,47 +25,49 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Lex/Flex" }- context <- currentContext <|> (pushContext "Pre Start" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Lex/Flex",["Pre Start"])], synStLanguage = "Lex/Flex", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Lex/Flex","Pre Start")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Pre Start" -> return ()- "Definitions" -> return ()- "Rules" -> return ()- "User Code" -> return ()- "Percent Command" -> (popContext) >> pEndLine- "Comment" -> return ()- "Definition RegExpr" -> (popContext) >> pEndLine- "Rule RegExpr" -> (popContext) >> pEndLine- "RegExpr (" -> return ()- "RegExpr [" -> return ()- "RegExpr {" -> return ()- "RegExpr Q" -> return ()- "RegExpr Base" -> return ()- "Start Conditions Scope" -> return ()- "Action" -> (popContext) >> pEndLine- "Detect C" -> return ()- "Indented C" -> (popContext) >> pEndLine- "Lex C Bloc" -> return ()- "Lex Rule C Bloc" -> return ()- "Normal C Bloc" -> return ()- "Action C" -> (popContext) >> pEndLine+ ("Lex/Flex","Pre Start") -> return ()+ ("Lex/Flex","Definitions") -> return ()+ ("Lex/Flex","Rules") -> return ()+ ("Lex/Flex","User Code") -> return ()+ ("Lex/Flex","Percent Command") -> (popContext) >> pEndLine+ ("Lex/Flex","Comment") -> return ()+ ("Lex/Flex","Definition RegExpr") -> (popContext) >> pEndLine+ ("Lex/Flex","Rule RegExpr") -> (popContext) >> pEndLine+ ("Lex/Flex","RegExpr (") -> return ()+ ("Lex/Flex","RegExpr [") -> return ()+ ("Lex/Flex","RegExpr {") -> return ()+ ("Lex/Flex","RegExpr Q") -> return ()+ ("Lex/Flex","RegExpr Base") -> return ()+ ("Lex/Flex","Start Conditions Scope") -> return ()+ ("Lex/Flex","Action") -> (popContext) >> pEndLine+ ("Lex/Flex","Detect C") -> return ()+ ("Lex/Flex","Indented C") -> (popContext) >> pEndLine+ ("Lex/Flex","Lex C Bloc") -> return ()+ ("Lex/Flex","Lex Rule C Bloc") -> return ()+ ("Lex/Flex","Normal C Bloc") -> return ()+ ("Lex/Flex","Action C") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -75,11 +76,7 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'2e = compileRegex "." regex_'5bA'2dZa'2dz'5f'5d'5cw'2a'5cs'2b = compileRegex "[A-Za-z_]\\w*\\s+" regex_'5cS = compileRegex "\\S"@@ -92,139 +89,139 @@ regex_'5c'7c'5cs'2a'24 = compileRegex "\\|\\s*$" regex_'5cs = compileRegex "\\s" -defaultAttributes = [("Pre Start",NormalTok),("Definitions",NormalTok),("Rules",NormalTok),("User Code",NormalTok),("Percent Command",KeywordTok),("Comment",CommentTok),("Definition RegExpr",StringTok),("Rule RegExpr",StringTok),("RegExpr (",StringTok),("RegExpr [",StringTok),("RegExpr {",StringTok),("RegExpr Q",StringTok),("RegExpr Base",StringTok),("Start Conditions Scope",NormalTok),("Action",NormalTok),("Detect C",NormalTok),("Indented C",NormalTok),("Lex C Bloc",NormalTok),("Lex Rule C Bloc",NormalTok),("Normal C Bloc",NormalTok),("Action C",NormalTok)]+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 "Pre Start" =- ((lookAhead (pRegExpr regex_'2e) >> pushContext "Definitions" >> currentContext >>= parseRules))+parseRules ("Lex/Flex","Pre Start") =+ ((lookAhead (pRegExpr regex_'2e) >> pushContext ("Lex/Flex","Definitions") >> currentContext >>= parseRules)) -parseRules "Definitions" =- (((parseRules "Detect C"))+parseRules ("Lex/Flex","Definitions") =+ (((parseRules ("Lex/Flex","Detect C"))) <|>- ((pDetect2Chars False '%' '%' >>= withAttribute BaseNTok) >>~ pushContext "Rules")+ ((pDetect2Chars False '%' '%' >>= withAttribute BaseNTok) >>~ pushContext ("Lex/Flex","Rules")) <|>- ((pDetectChar False '%' >>= withAttribute KeywordTok) >>~ pushContext "Percent Command")+ ((pDetectChar False '%' >>= withAttribute KeywordTok) >>~ pushContext ("Lex/Flex","Percent Command")) <|>- ((pColumn 0 >> pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((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 "Definition RegExpr"))+ ((pColumn 0 >> pRegExpr regex_'5bA'2dZa'2dz'5f'5d'5cw'2a'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext ("Lex/Flex","Definition RegExpr"))) -parseRules "Rules" =- (((parseRules "Detect C"))+parseRules ("Lex/Flex","Rules") =+ (((parseRules ("Lex/Flex","Detect C"))) <|>- ((pDetect2Chars False '%' '%' >>= withAttribute BaseNTok) >>~ pushContext "User Code")+ ((pDetect2Chars False '%' '%' >>= withAttribute BaseNTok) >>~ pushContext ("Lex/Flex","User Code")) <|>- (pushContext "Rule RegExpr" >> currentContext >>= parseRules))+ (pushContext ("Lex/Flex","Rule RegExpr") >> currentContext >>= parseRules)) -parseRules "User Code" =+parseRules ("Lex/Flex","User Code") = ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression)) -parseRules "Percent Command" =+parseRules ("Lex/Flex","Percent Command") = pzero -parseRules "Comment" =+parseRules ("Lex/Flex","Comment") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "Definition RegExpr" =- (((parseRules "RegExpr Base"))+parseRules ("Lex/Flex","Definition RegExpr") =+ (((parseRules ("Lex/Flex","RegExpr Base"))) <|> ((pRegExpr regex_'5cS >>= withAttribute StringTok)) <|> ((pRegExpr regex_'2e'2a >>= withAttribute AlertTok))) -parseRules "Rule RegExpr" =- (((pRegExpr regex_'5c'7b'24 >>= withAttribute BaseNTok) >>~ pushContext "Start Conditions Scope")+parseRules ("Lex/Flex","Rule RegExpr") =+ (((pRegExpr regex_'5c'7b'24 >>= withAttribute BaseNTok) >>~ pushContext ("Lex/Flex","Start Conditions Scope")) <|>- ((parseRules "RegExpr Base"))+ ((parseRules ("Lex/Flex","RegExpr Base"))) <|> ((pRegExpr regex_'5cS >>= withAttribute StringTok)) <|>- ((pRegExpr regex_'5cs'2b >>= withAttribute NormalTok) >>~ pushContext "Action"))+ ((pRegExpr regex_'5cs'2b >>= withAttribute NormalTok) >>~ pushContext ("Lex/Flex","Action"))) -parseRules "RegExpr (" =- (((parseRules "RegExpr Base"))+parseRules ("Lex/Flex","RegExpr (") =+ (((parseRules ("Lex/Flex","RegExpr Base"))) <|> ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext)) <|> ((pRegExpr regex_'2e >>= withAttribute StringTok))) -parseRules "RegExpr [" =+parseRules ("Lex/Flex","RegExpr [") = (((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok)) <|> ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext)) <|> ((pRegExpr regex_'2e >>= withAttribute StringTok))) -parseRules "RegExpr {" =+parseRules ("Lex/Flex","RegExpr {") = (((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok)) <|> ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext)) <|> ((pRegExpr regex_'2e >>= withAttribute StringTok))) -parseRules "RegExpr Q" =+parseRules ("Lex/Flex","RegExpr Q") = (((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) <|> ((pRegExpr regex_'2e >>= withAttribute StringTok))) -parseRules "RegExpr Base" =+parseRules ("Lex/Flex","RegExpr Base") = (((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok)) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "RegExpr (")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Lex/Flex","RegExpr (")) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "RegExpr [")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Lex/Flex","RegExpr [")) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "RegExpr {")+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Lex/Flex","RegExpr {")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "RegExpr Q"))+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Lex/Flex","RegExpr Q"))) -parseRules "Start Conditions Scope" =+parseRules ("Lex/Flex","Start Conditions Scope") = (((pRegExpr regex_'5cs'2a'5c'7d >>= withAttribute BaseNTok) >>~ (popContext)) <|>- ((pRegExpr regex_'5cs'2a >>= withAttribute NormalTok) >>~ pushContext "Rule RegExpr")+ ((pRegExpr regex_'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("Lex/Flex","Rule RegExpr")) <|>- (pushContext "Rule RegExpr" >> currentContext >>= parseRules))+ (pushContext ("Lex/Flex","Rule RegExpr") >> currentContext >>= parseRules)) -parseRules "Action" =+parseRules ("Lex/Flex","Action") = (((pRegExpr regex_'5c'7c'5cs'2a'24 >>= withAttribute KeywordTok)) <|>- ((pDetect2Chars False '%' '{' >>= withAttribute BaseNTok) >>~ pushContext "Lex Rule C Bloc")+ ((pDetect2Chars False '%' '{' >>= withAttribute BaseNTok) >>~ pushContext ("Lex/Flex","Lex Rule C Bloc")) <|>- (pushContext "Action C" >> currentContext >>= parseRules))+ (pushContext ("Lex/Flex","Action C") >> currentContext >>= parseRules)) -parseRules "Detect C" =- (((pColumn 0 >> pRegExpr regex_'5cs >>= withAttribute NormalTok) >>~ pushContext "Indented C")+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 C Bloc"))+ ((pColumn 0 >> pDetect2Chars False '%' '{' >>= withAttribute BaseNTok) >>~ pushContext ("Lex/Flex","Lex C Bloc"))) -parseRules "Indented C" =+parseRules ("Lex/Flex","Indented C") = ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression)) -parseRules "Lex C Bloc" =+parseRules ("Lex/Flex","Lex C Bloc") = (((pColumn 0 >> pDetect2Chars False '%' '}' >>= withAttribute BaseNTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))) -parseRules "Lex Rule C Bloc" =+parseRules ("Lex/Flex","Lex Rule C Bloc") = (((pDetect2Chars False '%' '}' >>= withAttribute BaseNTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))) -parseRules "Normal C Bloc" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "Normal C Bloc")+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))) -parseRules "Action C" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "Normal C Bloc")+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))) -parseRules "" = parseRules "Pre Start"+parseRules ("C++", _) = Text.Highlighting.Kate.Syntax.Cpp.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/LiterateHaskell.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Haskell import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,32 +25,34 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Literate Haskell" }- context <- currentContext <|> (pushContext "text" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Literate Haskell",["text"])], synStLanguage = "Literate Haskell", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Literate Haskell","text")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "text" -> return ()- "normal" -> (popContext) >> pEndLine- "normals" -> return ()- "comments'" -> pushContext "uncomments" >> return ()- "uncomments" -> return ()- "recomments" -> (popContext) >> pEndLine+ ("Literate Haskell","text") -> return ()+ ("Literate Haskell","normal") -> (popContext) >> pEndLine+ ("Literate Haskell","normals") -> return ()+ ("Literate Haskell","comments'") -> pushContext ("Literate Haskell","uncomments") >> return ()+ ("Literate Haskell","uncomments") -> return ()+ ("Literate Haskell","recomments") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -60,47 +61,43 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'5c'7b'2d'5b'5e'23'5d = compileRegex "\\{-[^#]" -defaultAttributes = [("text",NormalTok),("normal",NormalTok),("normals",NormalTok),("comments'",CommentTok),("uncomments",NormalTok),("recomments",CommentTok)]+defaultAttributes = [(("Literate Haskell","text"),NormalTok),(("Literate Haskell","normal"),NormalTok),(("Literate Haskell","normals"),NormalTok),(("Literate Haskell","comments'"),CommentTok),(("Literate Haskell","uncomments"),NormalTok),(("Literate Haskell","recomments"),CommentTok)] -parseRules "text" =- (((pColumn 0 >> pDetectChar False '>' >>= withAttribute OtherTok) >>~ pushContext "normal")+parseRules ("Literate Haskell","text") =+ (((pColumn 0 >> pDetectChar False '>' >>= withAttribute OtherTok) >>~ pushContext ("Literate Haskell","normal")) <|>- ((pColumn 0 >> pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext "normal")+ ((pColumn 0 >> pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext ("Literate Haskell","normal")) <|>- ((pString False "\\begin{code}" >>= withAttribute NormalTok) >>~ pushContext "normals")+ ((pString False "\\begin{code}" >>= withAttribute NormalTok) >>~ pushContext ("Literate Haskell","normals")) <|>- ((pString False "\\begin{spec}" >>= withAttribute NormalTok) >>~ pushContext "normals"))+ ((pString False "\\begin{spec}" >>= withAttribute NormalTok) >>~ pushContext ("Literate Haskell","normals"))) -parseRules "normal" =- (((pRegExpr regex_'5c'7b'2d'5b'5e'23'5d >>= withAttribute CommentTok) >>~ pushContext "comments'")+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))) -parseRules "normals" =+parseRules ("Literate Haskell","normals") = (((pString False "\\end{code}" >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pString False "\\end{spec}" >>= withAttribute NormalTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Haskell.parseExpression))) -parseRules "comments'" =+parseRules ("Literate Haskell","comments'") = ((pDetect2Chars False '-' '}' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "uncomments" =- (((pColumn 0 >> pDetectChar False '>' >>= withAttribute OtherTok) >>~ pushContext "recomments")+parseRules ("Literate Haskell","uncomments") =+ (((pColumn 0 >> pDetectChar False '>' >>= withAttribute OtherTok) >>~ pushContext ("Literate Haskell","recomments")) <|>- ((pColumn 0 >> pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext "recomments"))+ ((pColumn 0 >> pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext ("Literate Haskell","recomments"))) -parseRules "recomments" =+parseRules ("Literate Haskell","recomments") = ((pDetect2Chars False '-' '}' >>= withAttribute CommentTok) >>~ (popContext >> popContext >> popContext)) -parseRules "" = parseRules "text"+parseRules ("Haskell", _) = Text.Highlighting.Kate.Syntax.Haskell.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Lua.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,34 +25,36 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Lua" }- context <- currentContext <|> (pushContext "Base" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Lua",["Base"])], synStLanguage = "Lua", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Lua","Base")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Base" -> pushContext "Normal" >> return ()- "Normal" -> return ()- "Comment" -> (popContext) >> pEndLine- "Block Comment" -> return ()- "String_single" -> pushContext "Error" >> return ()- "String_double" -> pushContext "Error" >> return ()- "String_block" -> return ()- "Error" -> return ()+ ("Lua","Base") -> pushContext ("Lua","Normal") >> return ()+ ("Lua","Normal") -> return ()+ ("Lua","Comment") -> (popContext) >> pEndLine+ ("Lua","Block Comment") -> return ()+ ("Lua","String_single") -> pushContext ("Lua","Error") >> return ()+ ("Lua","String_double") -> pushContext ("Lua","Error") >> return ()+ ("Lua","String_block") -> return ()+ ("Lua","Error") -> return () _ -> return () withAttribute attr txt = do@@ -62,10 +63,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "and function in local not or" list_control = Set.fromList $ words $ "break do else elseif end for if repeat return then until while" list_pseudo'2dvariables = Set.fromList $ words $ "nil false true"@@ -88,27 +85,27 @@ regex_'5c'5c'28a'7cb'7cf'7cn'7cr'7ct'7cv'7c'5c'5c'7c'22'7c'5c'27'7c'5b'7c'5d'29 = compileRegex "\\\\(a|b|f|n|r|t|v|\\\\|\"|\\'|[|])" regex_'5c'5c'5babfnrtv'27'22'5c'5c'5c'5b'5c'5d'5d = compileRegex "\\\\[abfnrtv'\"\\\\\\[\\]]" -defaultAttributes = [("Base",CommentTok),("Normal",NormalTok),("Comment",CommentTok),("Block Comment",CommentTok),("String_single",StringTok),("String_double",StringTok),("String_block",StringTok),("Error",ErrorTok)]+defaultAttributes = [(("Lua","Base"),CommentTok),(("Lua","Normal"),NormalTok),(("Lua","Comment"),CommentTok),(("Lua","Block Comment"),CommentTok),(("Lua","String_single"),StringTok),(("Lua","String_double"),StringTok),(("Lua","String_block"),StringTok),(("Lua","Error"),ErrorTok)] -parseRules "Base" =- (((pColumn 0 >> pRegExpr regex_'23'21'2e'2a'24 >>= withAttribute CommentTok) >>~ pushContext "Normal")+parseRules ("Lua","Base") =+ (((pColumn 0 >> pRegExpr regex_'23'21'2e'2a'24 >>= withAttribute CommentTok) >>~ pushContext ("Lua","Normal")) <|>- (pushContext "Normal" >> currentContext >>= parseRules))+ (pushContext ("Lua","Normal") >> currentContext >>= parseRules)) -parseRules "Normal" =+parseRules ("Lua","Normal") = (((pKeyword " \n\t():!+,-<=>%&*/;?[]^{|}~\\\"" list_deprecated >>= withAttribute ErrorTok)) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pRegExprDynamic "--\\[(=*)\\[" >>= withAttribute CommentTok) >>~ pushContext "Block Comment")+ ((pRegExprDynamic "--\\[(=*)\\[" >>= withAttribute CommentTok) >>~ pushContext ("Lua","Block Comment")) <|>- ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("Lua","Comment")) <|>- ((pRegExprDynamic "\\[(=*)\\[" >>= withAttribute StringTok) >>~ pushContext "String_block")+ ((pRegExprDynamic "\\[(=*)\\[" >>= withAttribute StringTok) >>~ pushContext ("Lua","String_block")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "String_single")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Lua","String_single")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String_double")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Lua","String_double")) <|> ((pKeyword " \n\t():!+,-<=>%&*/;?[]^{|}~\\\"" list_basefunc >>= withAttribute FunctionTok)) <|>@@ -156,36 +153,35 @@ <|> ((pAnyChar "[]().=~+-*/^><#;" >>= withAttribute OtherTok))) -parseRules "Comment" =+parseRules ("Lua","Comment") = (((pDetect2Chars False '-' '-' >>= withAttribute AlertTok)) <|> ((pKeyword " \n\t():!+,-<=>%&*/;?[]^{|}~\\\"" list_attention >>= withAttribute AlertTok))) -parseRules "Block Comment" =+parseRules ("Lua","Block Comment") = (((pRegExprDynamic "\\]%1\\]" >>= withAttribute CommentTok) >>~ (popContext)) <|> ((pDetect2Chars False '-' '-' >>= withAttribute AlertTok)) <|> ((pKeyword " \n\t():!+,-<=>%&*/;?[]^{|}~\\\"" list_attention >>= withAttribute AlertTok))) -parseRules "String_single" =+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))) -parseRules "String_double" =+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))) -parseRules "String_block" =+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))) -parseRules "Error" =+parseRules ("Lua","Error") = pzero -parseRules "" = parseRules "Base" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Makefile.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,36 +25,38 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Makefile" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Makefile",["Normal"])], synStLanguage = "Makefile", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Makefile","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "String" -> (popContext) >> pEndLine- "Value" -> (popContext) >> pEndLine- "VarFromValue(" -> return ()- "VarFromValue{" -> return ()- "VarFromNormal(" -> return ()- "VarFromNormal{" -> return ()- "FunctionCall(" -> return ()- "FunctionCall{" -> return ()- "Commands" -> (popContext) >> pEndLine+ ("Makefile","Normal") -> return ()+ ("Makefile","String") -> (popContext) >> pEndLine+ ("Makefile","Value") -> (popContext) >> pEndLine+ ("Makefile","VarFromValue(") -> return ()+ ("Makefile","VarFromValue{") -> return ()+ ("Makefile","VarFromNormal(") -> return ()+ ("Makefile","VarFromNormal{") -> return ()+ ("Makefile","FunctionCall(") -> return ()+ ("Makefile","FunctionCall{") -> return ()+ ("Makefile","Commands") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -64,10 +65,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "include define else endef endif ifdef ifeq ifndef ifneq" list_functions = Set.fromList $ words $ "call subst patsubst strip findstring filter filter-out sort word wordlist words firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath if or and foreach value eval origin flavor shell error warning info" @@ -78,22 +75,22 @@ regex_'40'5b'2d'5f'5cd'5cw'5d'2a'40 = compileRegex "@[-_\\d\\w]*@" regex_'5b'5f'5cw'2d'5d'2a'5cb = compileRegex "[_\\w-]*\\b" -defaultAttributes = [("Normal",NormalTok),("String",StringTok),("Value",StringTok),("VarFromValue(",DataTypeTok),("VarFromValue{",DataTypeTok),("VarFromNormal(",DataTypeTok),("VarFromNormal{",DataTypeTok),("FunctionCall(",StringTok),("FunctionCall{",StringTok),("Commands",NormalTok)]+defaultAttributes = [(("Makefile","Normal"),NormalTok),(("Makefile","String"),StringTok),(("Makefile","Value"),StringTok),(("Makefile","VarFromValue("),DataTypeTok),(("Makefile","VarFromValue{"),DataTypeTok),(("Makefile","VarFromNormal("),DataTypeTok),(("Makefile","VarFromNormal{"),DataTypeTok),(("Makefile","FunctionCall("),StringTok),(("Makefile","FunctionCall{"),StringTok),(("Makefile","Commands"),NormalTok)] -parseRules "Normal" =+parseRules ("Makefile","Normal") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|>- ((pRegExpr regex_'5b'5f'5cw'5cd'5d'2a'5cs'2a'28'3f'3d'3a'3d'7c'3d'7c'5c'2b'3d'7c'5c'3f'3d'29 >>= withAttribute DataTypeTok) >>~ pushContext "Value")+ ((pRegExpr regex_'5b'5f'5cw'5cd'5d'2a'5cs'2a'28'3f'3d'3a'3d'7c'3d'7c'5c'2b'3d'7c'5c'3f'3d'29 >>= withAttribute DataTypeTok) >>~ pushContext ("Makefile","Value")) <|> ((pFirstNonSpace >> pRegExpr regex_'5b'5f'5cw'5cd'2d'5d'2a'5cs'2a'3a >>= withAttribute DecValTok)) <|> ((pColumn 0 >> pRegExpr regex_'5b'2e'5d'2e'2a'3a >>= withAttribute OtherTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Makefile","String")) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute CharTok) >>~ pushContext "VarFromNormal{")+ ((pDetect2Chars False '$' '{' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromNormal{")) <|>- ((pDetect2Chars False '$' '(' >>= withAttribute CharTok) >>~ pushContext "VarFromNormal(")+ ((pDetect2Chars False '$' '(' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromNormal(")) <|> ((pDetect2Chars False '\\' '#' >>= withAttribute FloatTok)) <|>@@ -101,63 +98,62 @@ <|> ((pAnyChar "+*=%$():\\;" >>= withAttribute CharTok)) <|>- ((pFirstNonSpace >> pAnyChar "@-" >>= withAttribute CharTok) >>~ pushContext "Commands")+ ((pFirstNonSpace >> pAnyChar "@-" >>= withAttribute CharTok) >>~ pushContext ("Makefile","Commands")) <|> ((pRegExpr regex_'23'2e'2a'24 >>= withAttribute CommentTok))) -parseRules "String" =+parseRules ("Makefile","String") = (((pLineContinue >>= withAttribute StringTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Value" =+parseRules ("Makefile","Value") = (((pLineContinue >>= withAttribute CharTok)) <|>- ((pDetect2Chars False '$' '{' >>= withAttribute CharTok) >>~ pushContext "VarFromValue{")+ ((pDetect2Chars False '$' '{' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromValue{")) <|>- ((pDetect2Chars False '$' '(' >>= withAttribute CharTok) >>~ pushContext "VarFromValue(")+ ((pDetect2Chars False '$' '(' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromValue(")) <|> ((pRegExpr regex_'40'5b'2d'5f'5cd'5cw'5d'2a'40 >>= withAttribute FloatTok) >>~ (popContext)) <|> ((pDetectChar False ';' >>= withAttribute CharTok) >>~ (popContext))) -parseRules "VarFromValue(" =+parseRules ("Makefile","VarFromValue(") = ((pDetectChar False ')' >>= withAttribute CharTok) >>~ (popContext)) -parseRules "VarFromValue{" =+parseRules ("Makefile","VarFromValue{") = ((pDetectChar False '}' >>= withAttribute CharTok) >>~ (popContext)) -parseRules "VarFromNormal(" =- (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_functions >>= withAttribute KeywordTok) >>~ pushContext "FunctionCall(")+parseRules ("Makefile","VarFromNormal(") =+ (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_functions >>= withAttribute KeywordTok) >>~ pushContext ("Makefile","FunctionCall(")) <|> ((pDetectChar False ')' >>= withAttribute CharTok) >>~ (popContext))) -parseRules "VarFromNormal{" =- (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_functions >>= withAttribute KeywordTok) >>~ pushContext "FunctionCall{")+parseRules ("Makefile","VarFromNormal{") =+ (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_functions >>= withAttribute KeywordTok) >>~ pushContext ("Makefile","FunctionCall{")) <|> ((pDetectChar False '}' >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "FunctionCall(" =- (((pDetect2Chars False '$' '{' >>= withAttribute CharTok) >>~ pushContext "VarFromNormal{")+parseRules ("Makefile","FunctionCall(") =+ (((pDetect2Chars False '$' '{' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromNormal{")) <|>- ((pDetect2Chars False '$' '(' >>= withAttribute CharTok) >>~ pushContext "VarFromNormal(")+ ((pDetect2Chars False '$' '(' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromNormal(")) <|> ((pDetectChar False ')' >>= withAttribute CharTok) >>~ (popContext >> popContext))) -parseRules "FunctionCall{" =- (((pDetect2Chars False '$' '{' >>= withAttribute CharTok) >>~ pushContext "VarFromNormal{")+parseRules ("Makefile","FunctionCall{") =+ (((pDetect2Chars False '$' '{' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromNormal{")) <|>- ((pDetect2Chars False '$' '(' >>= withAttribute CharTok) >>~ pushContext "VarFromNormal(")+ ((pDetect2Chars False '$' '(' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromNormal(")) <|> ((pDetectChar False '}' >>= withAttribute CharTok) >>~ (popContext >> popContext))) -parseRules "Commands" =- (((pDetect2Chars False '$' '{' >>= withAttribute CharTok) >>~ pushContext "VarFromNormal{")+parseRules ("Makefile","Commands") =+ (((pDetect2Chars False '$' '{' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromNormal{")) <|>- ((pDetect2Chars False '$' '(' >>= withAttribute CharTok) >>~ pushContext "VarFromNormal(")+ ((pDetect2Chars False '$' '(' >>= withAttribute CharTok) >>~ pushContext ("Makefile","VarFromNormal(")) <|> ((pRegExpr regex_'5b'5f'5cw'2d'5d'2a'5cb >>= withAttribute BaseNTok) >>~ (popContext))) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Mandoc.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,29 +25,31 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Troff Mandoc" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Troff Mandoc",["Normal"])], synStLanguage = "Troff Mandoc", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Troff Mandoc","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "DetectDirective" -> (popContext) >> pEndLine- "Directive" -> (popContext) >> pEndLine+ ("Troff Mandoc","Normal") -> return ()+ ("Troff Mandoc","DetectDirective") -> (popContext) >> pEndLine+ ("Troff Mandoc","Directive") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -57,39 +58,34 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_headings = Set.fromList $ words $ "SH SS TH" list_paragraph = Set.fromList $ words $ "HP IP LP P PD PP RE RS TP" list_formatting = Set.fromList $ words $ "B BI BR I IB IR RB RI SM SB" list_others = Set.fromList $ words $ "DT" -defaultAttributes = [("Normal",NormalTok),("DetectDirective",FunctionTok),("Directive",StringTok)]+defaultAttributes = [(("Troff Mandoc","Normal"),NormalTok),(("Troff Mandoc","DetectDirective"),FunctionTok),(("Troff Mandoc","Directive"),StringTok)] -parseRules "Normal" =- (((parseRules "DetectComments##Roff"))+parseRules ("Troff Mandoc","Normal") =+ (((parseRules ("Troff Mandoc","DetectComments##Roff"))) <|>- ((pColumn 0 >> pDetectChar False '.' >>= withAttribute FunctionTok) >>~ pushContext "DetectDirective")+ ((pColumn 0 >> pDetectChar False '.' >>= withAttribute FunctionTok) >>~ pushContext ("Troff Mandoc","DetectDirective")) <|>- ((parseRules "DetectOthers##Roff")))+ ((parseRules ("Troff Mandoc","DetectOthers##Roff")))) -parseRules "DetectDirective" =- (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_headings >>= withAttribute KeywordTok) >>~ pushContext "Directive")+parseRules ("Troff Mandoc","DetectDirective") =+ (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_headings >>= withAttribute KeywordTok) >>~ pushContext ("Troff Mandoc","Directive")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_paragraph >>= withAttribute DataTypeTok) >>~ pushContext "Directive")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_paragraph >>= withAttribute DataTypeTok) >>~ pushContext ("Troff Mandoc","Directive")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_formatting >>= withAttribute KeywordTok) >>~ pushContext "Directive")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_formatting >>= withAttribute KeywordTok) >>~ pushContext ("Troff Mandoc","Directive")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_others >>= withAttribute FunctionTok) >>~ pushContext "Directive")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_others >>= withAttribute FunctionTok) >>~ pushContext ("Troff Mandoc","Directive")) <|>- ((parseRules "DetectDirective##Roff")))+ ((parseRules ("Troff Mandoc","DetectDirective##Roff")))) -parseRules "Directive" =- ((parseRules "Directive##Roff"))+parseRules ("Troff Mandoc","Directive") =+ ((parseRules ("Troff Mandoc","Directive##Roff"))) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Matlab.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,28 +25,30 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Matlab" }- context <- currentContext <|> (pushContext "_normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Matlab",["_normal"])], synStLanguage = "Matlab", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Matlab","_normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "_normal" -> (popContext) >> pEndLine- "_adjoint" -> (popContext) >> pEndLine+ ("Matlab","_normal") -> (popContext) >> pEndLine+ ("Matlab","_adjoint") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -56,10 +57,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_KeywordsList = Set.fromList $ words $ "break case catch classdef continue else elseif end for function global if otherwise parfor persistent return spmd switch try while methods properties events" regex_'5ba'2dzA'2dZ'5d'5cw'2a'28'3f'3d'27'29 = compileRegex "[a-zA-Z]\\w*(?=')"@@ -74,16 +71,16 @@ regex_'28'5cd'2b'28'5c'2e'5cd'2b'29'3f'7c'5c'2e'5cd'2b'29'28'5beE'5d'5b'2b'2d'5d'3f'5cd'2b'29'3f'5bij'5d'3f = compileRegex "(\\d+(\\.\\d+)?|\\.\\d+)([eE][+-]?\\d+)?[ij]?" regex_'27'2b = compileRegex "'+" -defaultAttributes = [("_normal",NormalTok),("_adjoint",NormalTok)]+defaultAttributes = [(("Matlab","_normal"),NormalTok),(("Matlab","_adjoint"),NormalTok)] -parseRules "_normal" =- (((pRegExpr regex_'5ba'2dzA'2dZ'5d'5cw'2a'28'3f'3d'27'29 >>= withAttribute NormalTok) >>~ pushContext "_adjoint")+parseRules ("Matlab","_normal") =+ (((pRegExpr regex_'5ba'2dzA'2dZ'5d'5cw'2a'28'3f'3d'27'29 >>= withAttribute NormalTok) >>~ pushContext ("Matlab","_adjoint")) <|>- ((pRegExpr regex_'28'5cd'2b'28'5c'2e'5cd'2b'29'3f'7c'5c'2e'5cd'2b'29'28'5beE'5d'5b'2b'2d'5d'3f'5cd'2b'29'3f'5bij'5d'3f'28'3f'3d'27'29 >>= withAttribute FloatTok) >>~ pushContext "_adjoint")+ ((pRegExpr regex_'28'5cd'2b'28'5c'2e'5cd'2b'29'3f'7c'5c'2e'5cd'2b'29'28'5beE'5d'5b'2b'2d'5d'3f'5cd'2b'29'3f'5bij'5d'3f'28'3f'3d'27'29 >>= withAttribute FloatTok) >>~ pushContext ("Matlab","_adjoint")) <|>- ((pRegExpr regex_'5b'5c'29'5c'5d'7d'5d'28'3f'3d'27'29 >>= withAttribute NormalTok) >>~ pushContext "_adjoint")+ ((pRegExpr regex_'5b'5c'29'5c'5d'7d'5d'28'3f'3d'27'29 >>= withAttribute NormalTok) >>~ pushContext ("Matlab","_adjoint")) <|>- ((pRegExpr regex_'5c'2e'27'28'3f'3d'27'29 >>= withAttribute NormalTok) >>~ pushContext "_adjoint")+ ((pRegExpr regex_'5c'2e'27'28'3f'3d'27'29 >>= withAttribute NormalTok) >>~ pushContext ("Matlab","_adjoint")) <|> ((pRegExpr regex_'27'5b'5e'27'5d'2a'28'27'27'5b'5e'27'5d'2a'29'2a'27'28'3f'3d'5b'5e'27'5d'7c'24'29 >>= withAttribute StringTok)) <|>@@ -125,9 +122,8 @@ <|> ((pAnyChar "*+-/\\&|<>~^=,;:@" >>= withAttribute NormalTok))) -parseRules "_adjoint" =+parseRules ("Matlab","_adjoint") = ((pRegExpr regex_'27'2b >>= withAttribute NormalTok) >>~ (popContext)) -parseRules "" = parseRules "_normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Maxima.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,29 +25,31 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Maxima" }- context <- currentContext <|> (pushContext "Normal Text" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Maxima",["Normal Text"])], synStLanguage = "Maxima", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Maxima","Normal Text")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal Text" -> (popContext) >> pEndLine- "String" -> return ()- "Comment" -> return ()+ ("Maxima","Normal Text") -> (popContext) >> pEndLine+ ("Maxima","String") -> return ()+ ("Maxima","Comment") -> return () _ -> return () withAttribute attr txt = do@@ -57,10 +58,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_MaximaKeyword = Set.fromList $ words $ "and do else elseif false for if in not or step then thru true while" list_SpecialComment = Set.fromList $ words $ "FIXME TODO" list_MaximaFunction = Set.fromList $ words $ "abasep abs absint absolute_real_time acos acosh acot acoth acsc acsch activate addcol add_edge add_edges addmatrices addrow add_vertex add_vertices adjacency_matrix adjoin adjoint af agd airy_ai airy_bi airy_dai airy_dbi algsys alg_type alias allroots alphacharp alphanumericp antid antidiff AntiDifference append appendfile apply apply1 apply2 applyb1 apropos args arithmetic arithsum array arrayapply arrayinfo arraymake ascii asec asech asin asinh askinteger asksign assoc assoc_legendre_p assoc_legendre_q assume asympa at atan atan2 atanh atensimp atom atvalue augcoefmatrix augmented_lagrangian_method av average_degree backtrace barsplot bashindices batch batchload bc2 bdvac belln bern bernpoly bessel bessel_i bessel_j bessel_k bessel_y beta bezout bffac bfhzeta bfloat bfloatp bfpsi bfpsi0 bfzeta biconected_components bimetric binomial bipartition block blockmatrixp bode_gain bode_phase bothcoef box boxplot break bug_report build_info buildq burn cabs canform canten cardinality carg cartan cartesian_product catch cbffac cdf_bernoulli cdf_beta cdf_binomial cdf_cauchy cdf_chi2 cdf_continuous_uniform cdf_discrete_uniform cdf_exp cdf_f cdf_gamma cdf_geometric cdf_gumbel cdf_hypergeometric cdf_laplace cdf_logistic cdf_lognormal cdf_negative_binomial cdf_normal cdf_pareto cdf_poisson cdf_rank_sum cdf_rayleigh cdf_signed_rank cdf_student_t cdf_weibull cdisplay ceiling central_moment cequal cequalignore cf cfdisrep cfexpand cgeodesic cgreaterp cgreaterpignore changename changevar chaosgame charat charfun charfun2 charlist charp charpoly chebyshev_t chebyshev_u checkdiv check_overlaps cholesky christof chromatic_index chromatic_number cint circulant_graph clear_edge_weight clear_rules clear_vertex_label clebsch_graph clessp clesspignore close closefile cmetric coeff coefmatrix cograd col collapse collectterms columnop columnspace columnswap columnvector combination combine comp2pui compare compfile compile compile_file complement_graph complete_bipartite_graph complete_graph components concan concat conjugate conmetderiv connected_components connect_vertices cons constantp constituent cont2part content continuous_freq contortion contour_plot contract contract_edge contragrad contrib_ode convert coord copy copy_graph copylist copymatrix cor cos cosh cot coth cov cov1 covdiff covect covers create_graph create_list csc csch csetup cspline ctaylor ct_coordsys ctransform ctranspose cube_graph cunlisp cv cycle_digraph cycle_graph dblint deactivate declare declare_translated declare_weight decsym defcon define define_variable defint defmatch defrule deftaylor degree_sequence del delete deleten delta demo demoivre denom depends derivdegree derivlist describe desolve determinant dgauss_a dgauss_b dgeev dgesvd diag diagmatrix diag_matrix diagmatrixp diameter diff digitcharp dimacs_export dimacs_import dimension direct discrete_freq disjoin disjointp disolate disp dispcon dispform dispfun dispJordan display disprule dispterms distrib divide divisors divsum dkummer_m dkummer_u dlange dodecahedron_graph dotproduct dotsimp dpart draw draw2d draw3d draw_graph dscalar echelon edge_coloring edges eigens_by_jacobi eigenvalues eigenvectors eighth einstein eivals eivects elapsed_real_time elapsed_run_time ele2comp ele2polynome ele2pui elem elementp eliminate elliptic_e elliptic_ec elliptic_eu elliptic_f elliptic_kc elliptic_pi ematrix empty_graph emptyp endcons entermatrix entertensor entier equal equalp equiv_classes erf errcatch error errormsg euler ev eval_string evenp every evolution evolution2d evundiff example exp expand expandwrt expandwrt_factored explose exponentialize express expt exsec extdiff extract_linear_equations extremal_subset ezgcd f90 facsum factcomb factor factorfacsum factorial factorout factorsum facts fast_central_elements fast_linsolve fasttimes featurep fft fib fibtophi fifth filename_merge file_search file_type fillarray findde find_root first fix flatten flength float floatnump floor flower_snark flush flush1deriv flushd flushnd forget fortran fourcos fourexpand fourier fourint fourintcos fourintsin foursimp foursin fourth fposition frame_bracket freeof freshline from_adjacency_matrix frucht_graph full_listify fullmap fullmapl fullratsimp fullratsubst fullsetify funcsolve fundef funmake funp gamma gauss_a gauss_b gaussprob gcd gcdex gcdivide gcfac gcfactor gd genfact gen_laguerre genmatrix geometric geometric_mean geosum get get_edge_weight get_lu_factors get_pixel get_vertex_label gfactor gfactorsum ggf girth global_variances gnuplot_close gnuplot_replot gnuplot_reset gnuplot_restart gnuplot_start go Gosper GosperSum gradef gramschmidt graph6_decode graph6_encode graph6_export graph6_import graph_center graph_charpoly graph_eigenvalues graph_order graph_periphery graph_product graph_size graph_union grid_graph grind grobner_basis grotzch_graph hamilton_cycle hamilton_path hankel harmonic harmonic_mean hav heawood_graph hermite hessian hilbert_matrix hipow histogram hodge horner ic1 ic2 ic_convert ichr1 ichr2 icosahedron_graph icurvature ident identfor identity idiff idim idummy ieqn ifactors iframes ifs ift igeodesic_coords ilt imagpart imetric implicit_derivative implicit_plot indexed_tensor indices induced_subgraph inferencep inference_result infix init_atensor init_ctensor in_neighbors innerproduct inpart inprod inrt integerp integer_partitions integrate intersect intersection intervalp intopois intosum invariant1 invariant2 inverse_jacobi_cd inverse_jacobi_cn inverse_jacobi_cs inverse_jacobi_dc inverse_jacobi_dn inverse_jacobi_ds inverse_jacobi_nc inverse_jacobi_nd inverse_jacobi_ns inverse_jacobi_sc inverse_jacobi_sd inverse_jacobi_sn invert invert_by_lu inv_mod is is_biconnected is_bipartite is_connected is_digraph is_edge_in_graph is_graph is_graph_or_digraph ishow is_isomorphic isolate isomorphism is_planar isqrt is_sconnected is_tree is_vertex_in_graph items_inference jacobi jacobian jacobi_cd jacobi_cn jacobi_cs jacobi_dc jacobi_dn jacobi_ds jacobi_nc jacobi_nd jacobi_ns jacobi_p jacobi_sc jacobi_sd jacobi_sn JF join jordan julia kdels kdelta kill killcontext kostka kron_delta kronecker_product kummer_m kummer_u kurtosis kurtosis_bernoulli kurtosis_beta kurtosis_binomial kurtosis_chi2 kurtosis_continuous_uniform kurtosis_discrete_uniform kurtosis_exp kurtosis_f kurtosis_gamma kurtosis_geometric kurtosis_gumbel kurtosis_hypergeometric kurtosis_laplace kurtosis_logistic kurtosis_lognormal kurtosis_negative_binomial kurtosis_normal kurtosis_pareto kurtosis_poisson kurtosis_rayleigh kurtosis_student_t kurtosis_weibull labels lagrange laguerre lambda laplace laplacian_matrix last lbfgs lc2kdt lcharp lc_l lcm lc_u ldefint ldisp ldisplay legendre_p legendre_q leinstein length let letrules letsimp levi_civita lfreeof lgtreillis lhs li liediff limit Lindstedt linear linearinterpol linear_program line_graph linsolve listarray list_correlations listify list_nc_monomials listoftens listofvars listp lmax lmin load loadfile local locate_matrix_entry log logand logarc logcontract logor logxor lopow lorentz_gauge lowercasep lpart lratsubst lreduce lriemann lsquares_estimates lsquares_estimates_approximate lsquares_estimates_exact lsquares_mse lsquares_residual_mse lsquares_residuals lsum ltreillis lu_backsub lu_factor macroexpand macroexpand1 make_array makebox makefact makegamma make_level_picture makelist makeOrders make_poly_continent make_poly_country make_polygon make_random_state make_rgb_picture makeset make_transform mandelbrot map mapatom maplist matchdeclare matchfix mat_cond mat_fullunblocker mat_function mat_norm matrix matrixmap matrixp matrix_size mattrace mat_trace mat_unblocker max max_clique max_degree max_flow maxi maximize_lp max_independent_set max_matching maybe mean mean_bernoulli mean_beta mean_binomial mean_chi2 mean_continuous_uniform mean_deviation mean_discrete_uniform mean_exp mean_f mean_gamma mean_geometric mean_gumbel mean_hypergeometric mean_laplace mean_logistic mean_lognormal mean_negative_binomial mean_normal mean_pareto mean_poisson mean_rayleigh mean_student_t mean_weibull median median_deviation member metricexpandall min min_degree minfactorial mini minimalPoly minimize_lp minimum_spanning_tree minor mnewton mod mode_declare mode_identity ModeMatrix moebius mon2schur mono monomial_dimensions multi_elem multinomial multinomial_coeff multi_orbit multi_pui multsym multthru mycielski_graph nary nc_degree ncexpt ncharpoly negative_picture neighbors newcontext newdet new_graph newline newton next_prime niceindices ninth noncentral_moment nonmetricity nonnegintegerp nonscalarp nonzeroandfreeof notequal nounify nptetrad nroots nterms ntermst nthroot nullity nullspace num numbered_boundaries numberp num_distinct_partitions numerval numfactor num_partitions nusum odd_girth oddp ode2 ode_check odelin op opena openr openw operatorp opsubst optimize orbit orbits ordergreat ordergreatp orderless orderlessp orthogonal_complement orthopoly_recur orthopoly_weight outermap out_neighbors outofpois pade parGosper parse_string part part2cont partfrac partition partition_set partpol path_digraph path_graph pdf_bernoulli pdf_beta pdf_binomial pdf_cauchy pdf_chi2 pdf_continuous_uniform pdf_discrete_uniform pdf_exp pdf_f pdf_gamma pdf_geometric pdf_gumbel pdf_hypergeometric pdf_laplace pdf_logistic pdf_lognormal pdf_negative_binomial pdf_normal pdf_pareto pdf_poisson pdf_rank_sum pdf_rayleigh pdf_signed_rank pdf_student_t pdf_weibull pearson_skewness permanent permut permutation permutations petersen_graph petrov pickapart picture_equalp picturep piechart planar_embedding playback plog plot2d plot3d plotdf plsquares pochhammer poisdiff poisexpt poisint poismap poisplus poissimp poissubst poistimes poistrim polarform polartorect poly_add poly_buchberger poly_buchberger_criterion poly_colon_ideal poly_content polydecomp poly_depends_p poly_elimination_ideal poly_exact_divide poly_expand poly_expt poly_gcd poly_grobner poly_grobner_equal poly_grobner_member poly_grobner_subsetp poly_ideal_intersection poly_ideal_polysaturation poly_ideal_polysaturation1 poly_ideal_saturation poly_ideal_saturation1 poly_lcm poly_minimization polymod poly_multiply polynome2ele polynomialp poly_normal_form poly_normalize poly_normalize_list poly_polysaturation_extension poly_primitive_part poly_pseudo_divide poly_reduced_grobner poly_reduction poly_saturation_extension poly_s_polynomial poly_subtract polytocompanion potential power_mod powers powerseries powerset prev_prime primep print printf print_graph printpois printprops prodrac product properties propvars psi ptriangularize pui pui2comp pui2ele pui2polynome pui_direct puireduc put qput qrange quad_qag quad_qagi quad_qags quad_qawc quad_qawf quad_qawo quad_qaws quantile quantile_bernoulli quantile_beta quantile_binomial quantile_cauchy quantile_chi2 quantile_continuous_uniform quantile_discrete_uniform quantile_exp quantile_f quantile_gamma quantile_geometric quantile_gumbel quantile_hypergeometric quantile_laplace quantile_logistic quantile_lognormal quantile_negative_binomial quantile_normal quantile_pareto quantile_poisson quantile_rayleigh quantile_student_t quantile_weibull quartile_skewness quit qunit quotient radcan radius random random_bernoulli random_beta random_binomial random_cauchy random_chi2 random_continuous_uniform random_digraph random_discrete_uniform random_exp random_f random_gamma random_geometric random_graph random_graph1 random_gumbel random_hypergeometric random_laplace random_logistic random_lognormal random_negative_binomial random_network random_normal random_pareto random_permutation random_poisson random_rayleigh random_regular_graph random_student_t random_tournament random_tree random_weibull range rank rat ratcoef ratdenom ratdiff ratdisrep ratexpand rational rationalize ratnumer ratnump ratp ratsimp ratsubst ratvars ratweight read read_hashed_array readline read_lisp_array read_list read_matrix read_maxima_array read_nested_list readonly read_xpm realpart realroots rearray rectform recttopolar rediff reduce_consts reduce_order region_boundaries rem remainder remarray rembox remcomps remcon remcoord remfun remfunction remlet remove remove_edge remove_vertex rempart remrule remsym remvalue rename reset residue resolvante resolvante_alternee1 resolvante_bipartite resolvante_diedrale resolvante_klein resolvante_klein3 resolvante_produit_sym resolvante_unitaire resolvante_vierer rest resultant return reveal reverse revert revert2 rgb2level rhs ricci riemann rinvariant risch rk rncombine romberg room rootscontract row rowop rowswap rreduce run_testsuite save scalarp scaled_bessel_i scaled_bessel_i0 scaled_bessel_i1 scalefactors scanmap scatterplot schur2comp sconcat scopy scsimp scurvature sdowncase sec sech second sequal sequalignore setdifference set_edge_weight setelmx setequalp setify setp set_partitions set_plot_option set_random_state setunits setup_autoload set_up_dot_simplifications set_vertex_label seventh sexplode sf shortest_path show showcomps showratvars sign signum similaritytransform simple_linear_regression simplify_sum simplode simpmetderiv simtran sin sinh sinsert sinvertcase sixth skewness skewness_bernoulli skewness_beta skewness_binomial skewness_chi2 skewness_continuous_uniform skewness_discrete_uniform skewness_exp skewness_f skewness_gamma skewness_geometric skewness_gumbel skewness_hypergeometric skewness_laplace skewness_logistic skewness_lognormal skewness_negative_binomial skewness_normal skewness_pareto skewness_poisson skewness_rayleigh skewness_student_t skewness_weibull slength smake smismatch solve solve_rec solve_rec_rat some somrac sort sparse6_decode sparse6_encode sparse6_export sparse6_import specint spherical_bessel_j spherical_bessel_y spherical_hankel1 spherical_hankel2 spherical_harmonic splice split sposition sprint sqfr sqrt sqrtdenest sremove sremovefirst sreverse ssearch ssort sstatus ssubst ssubstfirst staircase status std std1 std_bernoulli std_beta std_binomial std_chi2 std_continuous_uniform std_discrete_uniform std_exp std_f std_gamma std_geometric std_gumbel std_hypergeometric std_laplace std_logistic std_lognormal std_negative_binomial std_normal std_pareto std_poisson std_rayleigh std_student_t std_weibull stirling stirling1 stirling2 strim striml strimr string stringout stringp strong_components sublis sublist sublist_indices submatrix subsample subset subsetp subst substinpart substpart substring subvar subvarp sum sumcontract summand_to_rec supcase supcontext symbolp symmdifference symmetricp system take_channel take_inference tan tanh taylor taylorinfo taylorp taylor_simplifier taytorat tcl_output tcontract tellrat tellsimp tellsimpafter tentex tenth test_mean test_means_difference test_normality test_rank_sum test_sign test_signed_rank test_variance test_variance_ratio tex texput %th third throw time timedate timer timer_info tldefint tlimit todd_coxeter toeplitz tokens to_lisp topological_sort totaldisrep totalfourier totient tpartpol trace tracematrix trace_options translate translate_file transpose tree_reduce treillis treinat triangularize trigexpand trigrat trigreduce trigsimp trunc tr_warnings_get ueivects uforget ultraspherical underlying_graph undiff union unique uniteigenvectors unit_step unitvector unknown unorder unsum untellrat untimer untrace uppercasep uricci uriemann uvect vandermonde_matrix var var1 var_bernoulli var_beta var_binomial var_chi2 var_continuous_uniform var_discrete_uniform var_exp var_f var_gamma var_geometric var_gumbel var_hypergeometric var_laplace var_logistic var_lognormal var_negative_binomial var_normal var_pareto var_poisson var_rayleigh var_student_t var_weibull vectorpotential vectorsimp verbify vers vertex_coloring vertex_degree vertex_distance vertex_eccentricity vertex_in_degree vertex_out_degree vertices vertices_to_cycle vertices_to_path weyl wheel_graph with_stdout write_data writefile wronskian xgraph_curves xreduce xthru Zeilberger zeroequiv zerofor zeromatrix zeromatrixp zeta zlange"@@ -72,18 +69,18 @@ regex_'5b'2d'2b'5d'3f'5cd'2b'5bBbDdEeSs'5d'5b'2d'2b'5d'3f'5cd'2b = compileRegex "[-+]?\\d+[BbDdEeSs][-+]?\\d+" regex_'5b'2d'2b'5d'3f'5cd'2b = compileRegex "[-+]?\\d+" -defaultAttributes = [("Normal Text",NormalTok),("String",StringTok),("Comment",NormalTok)]+defaultAttributes = [(("Maxima","Normal Text"),NormalTok),(("Maxima","String"),StringTok),(("Maxima","Comment"),NormalTok)] -parseRules "Normal Text" =+parseRules ("Maxima","Normal Text") = (((pKeyword " \n\t.():!+,-<=>&*/;?[]^{|}~\\@#" list_MaximaFunction >>= withAttribute FunctionTok)) <|> ((pKeyword " \n\t.():!+,-<=>&*/;?[]^{|}~\\@#" list_MaximaVariable >>= withAttribute NormalTok)) <|> ((pKeyword " \n\t.():!+,-<=>&*/;?[]^{|}~\\@#" list_MaximaKeyword >>= withAttribute KeywordTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Maxima","String")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute NormalTok) >>~ pushContext "Comment")+ ((pDetect2Chars False '/' '*' >>= withAttribute NormalTok) >>~ pushContext ("Maxima","Comment")) <|> ((pRegExpr regex_'5ba'2dzA'2dZ'5f'5d'5ba'2dzA'2dZ0'2d9'25'5f'5d'2a >>= withAttribute NormalTok)) <|>@@ -97,16 +94,15 @@ <|> ((pDetectChar False '\'' >>= withAttribute NormalTok))) -parseRules "String" =+parseRules ("Maxima","String") = ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) -parseRules "Comment" =+parseRules ("Maxima","Comment") = (((pKeyword " \n\t.():!+,-<=>&*/;?[]^{|}~\\@#" list_SpecialComment >>= withAttribute NormalTok)) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pDetect2Chars False '*' '/' >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "" = parseRules "Normal Text" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Metafont.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,36 +25,38 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Metapost/Metafont" }- context <- currentContext <|> (pushContext "Normal Text" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Metapost/Metafont",["Normal Text"])], synStLanguage = "Metapost/Metafont", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Metapost/Metafont","Normal Text")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal Text" -> return ()- "string" -> return ()- "TeXMode" -> return ()- "ContrSeq" -> (popContext) >> pEndLine- "ToEndOfLine" -> (popContext) >> pEndLine- "Verb" -> (popContext >> popContext) >> pEndLine- "VerbEnd" -> (popContext >> popContext >> popContext) >> pEndLine- "MathMode" -> return ()- "MathContrSeq" -> (popContext) >> pEndLine- "Comment" -> (popContext) >> pEndLine+ ("Metapost/Metafont","Normal Text") -> return ()+ ("Metapost/Metafont","string") -> return ()+ ("Metapost/Metafont","TeXMode") -> return ()+ ("Metapost/Metafont","ContrSeq") -> (popContext) >> pEndLine+ ("Metapost/Metafont","ToEndOfLine") -> (popContext) >> pEndLine+ ("Metapost/Metafont","Verb") -> (popContext >> popContext) >> pEndLine+ ("Metapost/Metafont","VerbEnd") -> (popContext >> popContext >> popContext) >> pEndLine+ ("Metapost/Metafont","MathMode") -> return ()+ ("Metapost/Metafont","MathContrSeq") -> (popContext) >> pEndLine+ ("Metapost/Metafont","Comment") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -64,10 +65,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_mfBoolExp = Set.fromList $ words $ "true false known unknown odd charexists not and or" list_mfNumExp = Set.fromList $ words $ "normaldeviate length ascii oct hex angle turningnumber totalweight directiontime xpart ypart xxpart xypart yxpart yypart sqrt sind cosd mlog mexp floor uniformdeviate abs div dotprod max min mod ceiling" list_mfInternal = Set.fromList $ words $ "tracingtitles tracingequations tracingcapsules tracingchoices tracingspecs tracingpens tracingcommands tracingrestores tracingmacros tracingedges tracingoutput tracingonline tracingstats pausing showstopping fontmaking proofing turningcheck warningcheck smoothing autorounding granularity fillin year month day time charcode charext charwd charht chardp charic chardx chardy designsize hppp vppp xoffset yoffset boundarychar"@@ -113,9 +110,9 @@ regex_'5ba'2dzA'2dZ'5d'2b'5c'2a'3f = compileRegex "[a-zA-Z]+\\*?" regex_'28FIXME'7cTODO'29'3a'3f = compileRegex "(FIXME|TODO):?" -defaultAttributes = [("Normal Text",NormalTok),("string",StringTok),("TeXMode",NormalTok),("ContrSeq",NormalTok),("ToEndOfLine",NormalTok),("Verb",NormalTok),("VerbEnd",NormalTok),("MathMode",NormalTok),("MathContrSeq",NormalTok),("Comment",CommentTok)]+defaultAttributes = [(("Metapost/Metafont","Normal Text"),NormalTok),(("Metapost/Metafont","string"),StringTok),(("Metapost/Metafont","TeXMode"),NormalTok),(("Metapost/Metafont","ContrSeq"),NormalTok),(("Metapost/Metafont","ToEndOfLine"),NormalTok),(("Metapost/Metafont","Verb"),NormalTok),(("Metapost/Metafont","VerbEnd"),NormalTok),(("Metapost/Metafont","MathMode"),NormalTok),(("Metapost/Metafont","MathContrSeq"),NormalTok),(("Metapost/Metafont","Comment"),CommentTok)] -parseRules "Normal Text" =+parseRules ("Metapost/Metafont","Normal Text") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_mfBoolExp >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_mfNumExp >>= withAttribute FunctionTok))@@ -150,9 +147,9 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_mpMacro >>= withAttribute KeywordTok)) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("Metapost/Metafont","Comment")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "string")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Metapost/Metafont","string")) <|> ((pRegExpr regex_'28'5c'2b'7c'5c'2d'7c'5c'2a'7c'5c'2f'7c'5c'3d'7c'5c'3a'5c'3d'29 >>= withAttribute KeywordTok)) <|>@@ -182,7 +179,7 @@ <|> ((pDetectChar False '$' >>= withAttribute KeywordTok)) <|>- ((pRegExpr regex_'5cb'28verbatimtex'7cbtex'29'5cb >>= withAttribute KeywordTok) >>~ pushContext "TeXMode")+ ((pRegExpr regex_'5cb'28verbatimtex'7cbtex'29'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Metapost/Metafont","TeXMode")) <|> ((pRegExpr regex_'5cbbegin'28group'7cfig'7cchar'29'5cb >>= withAttribute KeywordTok)) <|>@@ -204,7 +201,7 @@ <|> ((pRegExpr regex_'5cbendfor'5cb >>= withAttribute KeywordTok))) -parseRules "string" =+parseRules ("Metapost/Metafont","string") = (((pDetectIdentifier >>= withAttribute StringTok)) <|> ((pDetect2Chars False '\\' '"' >>= withAttribute StringTok))@@ -213,19 +210,19 @@ <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "TeXMode" =- (((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext "ContrSeq")+parseRules ("Metapost/Metafont","TeXMode") =+ (((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext ("Metapost/Metafont","ContrSeq")) <|>- ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ pushContext "MathMode")+ ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ pushContext ("Metapost/Metafont","MathMode")) <|>- ((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext "MathMode")+ ((pString False "\\(" >>= withAttribute NormalTok) >>~ pushContext ("Metapost/Metafont","MathMode")) <|> ((pRegExpr regex_'5cbetex'5cb >>= withAttribute KeywordTok) >>~ (popContext))) -parseRules "ContrSeq" =- (((pString False "verb*" >>= withAttribute NormalTok) >>~ pushContext "Verb")+parseRules ("Metapost/Metafont","ContrSeq") =+ (((pString False "verb*" >>= withAttribute NormalTok) >>~ pushContext ("Metapost/Metafont","Verb")) <|>- ((pRegExpr regex_verb'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext "Verb")+ ((pRegExpr regex_verb'28'3f'3d'5b'5ea'2dzA'2dZ'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("Metapost/Metafont","Verb")) <|> ((pDetectChar False '\215' >>= withAttribute NormalTok)) <|>@@ -233,23 +230,23 @@ <|> ((pRegExpr regex_'5b'5ea'2dzA'2dZ'5d >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "ToEndOfLine" =+parseRules ("Metapost/Metafont","ToEndOfLine") = pzero -parseRules "Verb" =- ((pRegExprDynamic "(.)" >>= withAttribute NormalTok) >>~ pushContext "VerbEnd")+parseRules ("Metapost/Metafont","Verb") =+ ((pRegExprDynamic "(.)" >>= withAttribute NormalTok) >>~ pushContext ("Metapost/Metafont","VerbEnd")) -parseRules "VerbEnd" =+parseRules ("Metapost/Metafont","VerbEnd") = (((pString True "%1" >>= withAttribute NormalTok) >>~ (popContext >> popContext >> popContext)) <|> ((pDetectChar False '\215' >>= withAttribute NormalTok)) <|> ((pRegExprDynamic "[^%1\\xd7]*" >>= withAttribute NormalTok))) -parseRules "MathMode" =+parseRules ("Metapost/Metafont","MathMode") = (((pString False "$$" >>= withAttribute AlertTok)) <|>- ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext "MathContrSeq")+ ((pDetectChar False '\\' >>= withAttribute NormalTok) >>~ pushContext ("Metapost/Metafont","MathContrSeq")) <|> ((pDetectChar False '$' >>= withAttribute NormalTok) >>~ (popContext)) <|>@@ -257,18 +254,17 @@ <|> ((pDetect2Chars False '\\' ']' >>= withAttribute AlertTok))) -parseRules "MathContrSeq" =+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))) -parseRules "Comment" =+parseRules ("Metapost/Metafont","Comment") = (((pRegExpr regex_'28FIXME'7cTODO'29'3a'3f >>= withAttribute AlertTok)) <|> ((pDetectChar False '\215' >>= withAttribute NormalTok))) -parseRules "" = parseRules "Normal Text" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Mips.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,28 +25,30 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "MIPS Assembler" }- context <- currentContext <|> (pushContext "normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("MIPS Assembler",["normal"])], synStLanguage = "MIPS Assembler", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("MIPS Assembler","normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "normal" -> return ()- "string" -> return ()+ ("MIPS Assembler","normal") -> return ()+ ("MIPS Assembler","string") -> return () _ -> return () withAttribute attr txt = do@@ -56,10 +57,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_type = Set.fromList $ words $ ".align .ascii .asciiz .byte .double .extern .float .globl .half .sdata .set .space .word" list_section = Set.fromList $ words $ ".data .kdata .ktext .text" list_hardware = Set.fromList $ words $ "abs.d abs.s add add.d add.s addi addiu addu and andi bc0f bc0t bc1f bc1t bc2f bc2t bc3f bc3t beq bgez bgezal bgtz blez bltz bltzal bne break c.eq.d c.eq.s c.seq.s c.seq.d c.ueq.s c.ueq.d c.olt.d c.olt.s c.ole.d c.ole.s c.ult.d c.ult.s c.ule.d c.ule.s c.le.d c.le.s c.lt.d c.lt.s c.un.s c.un.d cvt.d.s cvt.d.w cvt.s.d cvt.s.w cvt.w.d cvt.w.s div.d div.s j jal jalr jr lb lbu lh lhu lui lw lwc0 lwc1 lwc2 lwc3 lwl lwr mfc0 mfc1 mfc2 mfc3 mfhi mflo mtc0 mtc1 mtc2 mtc3 mthi mtlo mul.d mul.s mult multu nor or ori rfe sb sh sw swcl swl swr sll sllv slt slti sltiu sra srav srl srlv sub sub.d sub.s subu sw swc0 swc1 swc2 swc3 swl swr syscall xor xori"@@ -74,9 +71,9 @@ regex_'5b'5cw'5f'5c'2e'5d'2b'3a = compileRegex "[\\w_\\.]+:" regex_'5c'5c'2e = compileRegex "\\\\." -defaultAttributes = [("normal",NormalTok),("string",StringTok)]+defaultAttributes = [(("MIPS Assembler","normal"),NormalTok),(("MIPS Assembler","string"),StringTok)] -parseRules "normal" =+parseRules ("MIPS Assembler","normal") = (((pKeyword " \n\t():!+,-<=>%&*/;?[]^{|}~\\" list_hardware >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t():!+,-<=>%&*/;?[]^{|}~\\" list_pseudo >>= withAttribute FunctionTok))@@ -99,7 +96,7 @@ <|> ((pFirstNonSpace >> pRegExpr regex_'5b'5cw'5f'5c'2e'5d'2b'3a >>= withAttribute OtherTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "string")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("MIPS Assembler","string")) <|> ((pFloat >>= withAttribute FloatTok)) <|>@@ -109,11 +106,10 @@ <|> ((pInt >>= withAttribute DecValTok))) -parseRules "string" =+parseRules ("MIPS Assembler","string") = (((pRegExpr regex_'5c'5c'2e >>= withAttribute CharTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "" = parseRules "normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Modula2.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,32 +25,34 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Modula-2" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Modula-2",["Normal"])], synStLanguage = "Modula-2", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Modula-2","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "String1" -> (popContext) >> pEndLine- "String2" -> (popContext) >> pEndLine- "Comment2" -> return ()- "Comment3" -> (popContext) >> pEndLine- "Prep1" -> return ()+ ("Modula-2","Normal") -> return ()+ ("Modula-2","String1") -> (popContext) >> pEndLine+ ("Modula-2","String2") -> (popContext) >> pEndLine+ ("Modula-2","Comment2") -> return ()+ ("Modula-2","Comment3") -> (popContext) >> pEndLine+ ("Modula-2","Prep1") -> return () _ -> return () withAttribute attr txt = do@@ -60,18 +61,14 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_directives = Set.fromList $ words $ "ASSEMBLER ALLOCATE DEALLOCATE SIZE Write WriteString WriteCard WriteLn WriteBf WriteInt WriteReal WriteLongReal Read ReadString ReadCard ReadInt ReadReal ReadLongReal Open Close OpenInput OpenOutput Accessible Erase EOF Done EmptyString Assign Append Length StrEq Copy Concat pos Delete Insert compare CAPS PutBf GetArgs GetEnv ResetClock UserTime SystemTime GetChar GetInt GetCard GetString GetReal GetLongReal PutChar PutInt PutCard PutString PutReal PutLongReal PutLn" list_keywords = Set.fromList $ words $ "AND ARRAY ASM BEGIN CASE CONST DIV DO ELSE ELSIF END FOR IF IMPLEMENTATION IN SET INCL EXCL ABS BITSET CAP CHR DEC HALT HIGH INC MAX MIN ODD ORD PROC TRUNC VAL MOD NIL NOT OF OR PROCEDURE MODULE DEFINITION RECORD REPEAT THEN TO TYPE UNTIL LOOP VAR WHILE WITH EXIT FALSE TRUE BY FROM IMPORT EXPORT QUALIFIED RETURN NEWPROCESS TRANSFER IOTRANSFER FOREIGN" list_types = Set.fromList $ words $ "INTEGER CARDINAL SHORTINT SHORTCARD LONGINT LONGREAL CHAR BOOLEAN POINTER ADDRESS ADR REAL File" -defaultAttributes = [("Normal",NormalTok),("String1",StringTok),("String2",StringTok),("Comment2",CommentTok),("Comment3",CommentTok),("Prep1",OtherTok)]+defaultAttributes = [(("Modula-2","Normal"),NormalTok),(("Modula-2","String1"),StringTok),(("Modula-2","String2"),StringTok),(("Modula-2","Comment2"),CommentTok),(("Modula-2","Comment3"),CommentTok),(("Modula-2","Prep1"),OtherTok)] -parseRules "Normal" =+parseRules ("Modula-2","Normal") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_directives >>= withAttribute OtherTok))@@ -82,29 +79,28 @@ <|> ((pInt >>= withAttribute DecValTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String1")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Modula-2","String1")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "String2")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Modula-2","String2")) <|>- ((pString False "(*$" >>= withAttribute OtherTok) >>~ pushContext "Prep1")+ ((pString False "(*$" >>= withAttribute OtherTok) >>~ pushContext ("Modula-2","Prep1")) <|>- ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext "Comment2"))+ ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("Modula-2","Comment2"))) -parseRules "String1" =+parseRules ("Modula-2","String1") = ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) -parseRules "String2" =+parseRules ("Modula-2","String2") = ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)) -parseRules "Comment2" =+parseRules ("Modula-2","Comment2") = ((pDetect2Chars False '*' ')' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "Comment3" =+parseRules ("Modula-2","Comment3") = pzero -parseRules "Prep1" =- ((pString False "$*)" >>= withAttribute OtherTok) >>~ pushContext "Prep1")+parseRules ("Modula-2","Prep1") =+ ((pString False "$*)" >>= withAttribute OtherTok) >>~ pushContext ("Modula-2","Prep1")) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Modula3.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,30 +25,32 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Modula-3" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Modula-3",["Normal"])], synStLanguage = "Modula-3", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Modula-3","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "String1" -> (popContext) >> pEndLine- "Comment2" -> return ()- "Prep1" -> return ()+ ("Modula-3","Normal") -> return ()+ ("Modula-3","String1") -> (popContext) >> pEndLine+ ("Modula-3","Comment2") -> return ()+ ("Modula-3","Prep1") -> return () _ -> return () withAttribute attr txt = do@@ -58,10 +59,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "ANY ARRAY AS BEGIN BITS BRANDED BY CASE CONST DO ELSE ELSIF END EVAL EXCEPT EXCEPTION EXIT EXPORTS FINALLY FOR FROM GENERIC IF IMPORT INTERFACE LOCK LOOP METHODS MODULE OBJECT OF OVERRIDES PROCEDURE RAISE RAISES READONLY RECORD REF REPEAT RETURN REVEAL ROOT SET THEN TO TRY TYPE TYPECASE UNSAFE UNTIL UNTRACED VALUE VAR WHILE WITH" list_operators = Set.fromList $ words $ "AND DIV IN MOD NOT OR + < # = ; .. : - > { } | := <: * <= ( ) ^ , => / >= [ ] . &" list_types = Set.fromList $ words $ "ADDRESS BOOLEAN CARDINAL CHAR EXTENDED INTEGER LONGREAL MUTEX NULL REAL REFANY T TEXT"@@ -77,9 +74,9 @@ regex_'5cb'28'5b'5c'2b'7c'5c'2d'5d'7b0'2c1'7d'5b0'2d9'5d'7b1'2c'7d'7c'28'5b2'2d9'5d'7c1'5b0'2d6'5d'29'5c'5f'5b0'2d9A'2dFa'2df'5d'7b1'2c'7d'29'5cb = compileRegex "\\b([\\+|\\-]{0,1}[0-9]{1,}|([2-9]|1[0-6])\\_[0-9A-Fa-f]{1,})\\b" regex_'5c'27'28'2e'7c'5c'5c'5bntrf'5c'5c'27'22'5d'7c'5c'5c'5b0'2d7'5d'7b3'7d'29'5c'27 = compileRegex "\\'(.|\\\\[ntrf\\\\'\"]|\\\\[0-7]{3})\\'" -defaultAttributes = [("Normal",NormalTok),("String1",StringTok),("Comment2",CommentTok),("Prep1",OtherTok)]+defaultAttributes = [(("Modula-3","Normal"),NormalTok),(("Modula-3","String1"),StringTok),(("Modula-3","Comment2"),CommentTok),(("Modula-3","Prep1"),OtherTok)] -parseRules "Normal" =+parseRules ("Modula-3","Normal") = (((pRegExpr regex_PROCEDURE'5b'5cs'5d'2e'2a'5c'28 >>= withAttribute KeywordTok)) <|> ((pRegExpr regex_END'5cs'2a'5bA'2dZa'2dz'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'5c'3b >>= withAttribute KeywordTok))@@ -104,25 +101,24 @@ <|> ((pRegExpr regex_'5cb'28'5b'5c'2b'7c'5c'2d'5d'7b0'2c1'7d'5b0'2d9'5d'7b1'2c'7d'7c'28'5b2'2d9'5d'7c1'5b0'2d6'5d'29'5c'5f'5b0'2d9A'2dFa'2df'5d'7b1'2c'7d'29'5cb >>= withAttribute BaseNTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String1")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Modula-3","String1")) <|> ((pRegExpr regex_'5c'27'28'2e'7c'5c'5c'5bntrf'5c'5c'27'22'5d'7c'5c'5c'5b0'2d7'5d'7b3'7d'29'5c'27 >>= withAttribute CharTok)) <|>- ((pDetect2Chars False '<' '*' >>= withAttribute OtherTok) >>~ pushContext "Prep1")+ ((pDetect2Chars False '<' '*' >>= withAttribute OtherTok) >>~ pushContext ("Modula-3","Prep1")) <|>- ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext "Comment2"))+ ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("Modula-3","Comment2"))) -parseRules "String1" =+parseRules ("Modula-3","String1") = ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) -parseRules "Comment2" =- (((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext "Comment2")+parseRules ("Modula-3","Comment2") =+ (((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("Modula-3","Comment2")) <|> ((pDetect2Chars False '*' ')' >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Prep1" =+parseRules ("Modula-3","Prep1") = ((pDetect2Chars False '*' '>' >>= withAttribute OtherTok) >>~ (popContext)) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Monobasic.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,29 +25,31 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "MonoBasic" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("MonoBasic",["Normal"])], synStLanguage = "MonoBasic", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("MonoBasic","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "String" -> (popContext) >> pEndLine- "Comment" -> (popContext) >> pEndLine+ ("MonoBasic","Normal") -> return ()+ ("MonoBasic","String") -> (popContext) >> pEndLine+ ("MonoBasic","Comment") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -57,10 +58,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "option explicit strict imports inherits as new dim redim private friend public const readonly writeonly default shared shadows protected overloads overrides notoverridable notinheritable mustinherit mustoverride mybase myclass me delegate catch finaly when throw to step then else true false nothing call byval byref optional paramarray return declare withevents event raiseevent addhandler and or not xor andalso orelse goto on error resume" list_types = Set.fromList $ words $ "boolean char string integer long double object exception date datetime int16 int32 int64 paramarray timespan byte decimal intptr single guid" @@ -106,16 +103,16 @@ regex_'23If'2e'2a'24 = compileRegex "#If.*$" regex_'23End'2eIf'2e'2a'24 = compileRegex "#End.If.*$" -defaultAttributes = [("Normal",NormalTok),("String",StringTok),("Comment",CommentTok)]+defaultAttributes = [(("MonoBasic","Normal"),NormalTok),(("MonoBasic","String"),StringTok),(("MonoBasic","Comment"),CommentTok)] -parseRules "Normal" =+parseRules ("MonoBasic","Normal") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_types >>= withAttribute DataTypeTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("MonoBasic","String")) <|>- ((pDetectChar False '\'' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '\'' >>= withAttribute CommentTok) >>~ pushContext ("MonoBasic","Comment")) <|> ((pRegExpr regex_'5cb'28Namespace'29'28'5b'5cs'5d'7c'24'29 >>= withAttribute KeywordTok)) <|>@@ -199,16 +196,15 @@ <|> ((pRegExpr regex_'23End'2eIf'2e'2a'24 >>= withAttribute OtherTok))) -parseRules "String" =+parseRules ("MonoBasic","String") = (((pLineContinue >>= withAttribute StringTok) >>~ (popContext)) <|> ((pHlCStringChar >>= withAttribute NormalTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Comment" =+parseRules ("MonoBasic","Comment") = pzero -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Nasm.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,30 +25,32 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Intel x86 (NASM)" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Intel x86 (NASM)",["Normal"])], synStLanguage = "Intel x86 (NASM)", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Intel x86 (NASM)","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "Comment" -> (popContext) >> pEndLine- "Preprocessor" -> (popContext) >> pEndLine- "String" -> (popContext) >> pEndLine+ ("Intel x86 (NASM)","Normal") -> return ()+ ("Intel x86 (NASM)","Comment") -> (popContext) >> pEndLine+ ("Intel x86 (NASM)","Preprocessor") -> (popContext) >> pEndLine+ ("Intel x86 (NASM)","String") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -58,10 +59,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_registers = Set.fromList $ words $ "eax ax ah al ebx bx bh bl ecx cx ch cl edx dx dh dl ebp bp esi si edi di esp sp cs ds es fs gs ss cr0 cr2 cr3 cr4 dr0 dr1 dr2 dr3 dr6 dr7 st mm0 mm1 mm2 mm3 mm4 mm5 mm6 mm7 xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7" list_instructions = Set.fromList $ words $ "aaa aad aam aas adc add addpd addps addsd addss addsubpd addsubps and andnpd andnps andpd andps arpl bound bsf bsr bswap bt btc btr bts call cbw cwde cwd cdq cdqe cqo clc cld clgi cli clts clflush cmc cmova cmovae cmovb cmovbe cmovc cmove cmovg cmovge cmovl cmovle cmovna cmovnae cmovnb cmovnbe cmovnc cmovne cmovng cmovnge cmovnl cmovnle cmovno cmovnp cmovns cmovnz cmovo cmovp cmovpe cmovpo cmovs cmovz cmp cmpeqpd cmpeqps cmpeqsd cmpeqss cmplepd cmpleps cmplesd cmpless cmpltpd cmpltps cmpltsd cmpltss cmpneqpd cmpneqps cmpneqsd cmpneqss cmpnlepd cmpnleps cmpnlesd cmpnless cmpnltpd cmpnltps cmpnltsd cmpnltss cmpordpd cmpordps cmpordsd cmpordss cmppd cmpps cmps cmpsb cmpsd cmpss cmpsw cmpunordpd cmpunordps cmpunordsd cmpunordss cmpxchg cmpxchg486 cmpxchg8b cmpxchg16b comisd comiss cpuid cvtdq2pd cvtdq2ps cvtpd2dq cvtpd2pi cvtpd2ps cvtpi2pd cvtpi2ps cvtps2dq cvtps2pd cvtps2pi cvtsd2si cvtsd2ss cvtsi2sd cvtsi2ss cvtss2sd cvtss2si cvttpd2dq cvttpd2pi cvttps2dq cvttps2pi cvttsd2si cvttss2si daa das dec div divpd divps divsd divss emms enter f2xm1 fabs fadd faddp fbld fbstp fchs fclex fnclex fcmovb fcmovbe fcmove fcmovnb fcmovnbe fcmovne fcmovnu fcmovu fcom fcomp fcompp fcomi fcomip fcos fdecstp fdisi feni fdiv fdivr fdivp fdivrp femms ffree ffreep fiadd ficom ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisttp fisub fisubr fld fld1 fldl2e fldl2t fldlg2 fldln2 fldcw fldenv fldpi fldz fmul fmulp fndisi fneni fninit fnop fnsave fnstcw fnstenv fnstsw fnwait fpatan fptan fprem fprem1 frndint frstor fsave fscale fsetpm fsin fsincos fsqrt fst fstp fstcw fstenv fstsw fsub fsubr fsubp fsubrp ftst fucom fucomp fucompp fucomi fucomip fwait fxam fxch fxrstor fxsave fxtract fyl2x fyl2xp1 haddpd haddps hlt hsubpd hsubps ibts idiv imul in inc ins insb insd insw int int1 int3 into invd invlpg invlpga iret iretd iretq iretw ja jae jb jbe jc je jg jge jl jle jna jnae jnb jnbe jnc jne jng jnge jnl jnle jno jnp jns jnz jo jp jpe jpo js jz jcxz jecxz jrcxz jmp lahf lar lddqu ldmxcsr lds les lea leave lfence lfs lgdt lgs lidt lldt lmsw loadall loadall286 lods lodsb lodsd lodsq lodsw loop loope loopne loopnz loopz lsl lss ltr maskmovdqu maskmovq maxpd maxps maxsd maxss mfence minpd minps minsd minss monitor mov movapd movaps movd movddup movdq2q movdqa movdqu movhlps movhpd movhps movlhps movlpd movlps movmskpd movmskps movntdq movnti movntpd movntps movntq movq movq2dq movs movsb movsd movshdup movsldup movsq movss movsx movsxd movsw movupd movups movzx mul mulpd mulps mulsd mulss mwait neg nop not or orpd orps out outs outsb outsw outsd packssdw packsswb packuswb paddb paddd paddq paddsb paddsw paddusb paddusw paddw pand pandn pause pavgb pavgusb pavgw pcmpeqb pcmpeqw pcmpeqd pcmpgtb pcmpgtw pcmpgtd pdistib pextrw pf2id pf2iw pfacc pfadd pfcmpeq pfcmpge pfcmpgt pfmax pfmin pfmul pfnacc pfpnacc pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pfsub pfsubr pi2fd pi2fw pinsrw pmachriw pmaddwd pmagw pmaxsw pmaxub pminsw pminub pmovmskb pmulhrw pmulhuw pmulhw pmullw pmuludq pmvgezb pmvlzb pmvnzb pmvzb pop popa popaw popad popf popfw popfd popfq por prefetch prefetchnta prefetcht0 prefetcht1 prefetcht2 prefetchw psadbw pshufd pshufhw pshuflw pshufw pslld pslldq psllq psllw psrad psraw psrld psrldq psrlq psrlw psubb psubd psubq psubsb psubsiw psubsw psubusb psubusw psubw pswapd punpckhbw punpckhdq punpckhqdq punpckhwd punpcklbw punpckldq punpcklqdq punpcklwd push pusha pushad pushaw pushf pushfd pushfq pushfw pxor rcl rcr rcpps rcpss rdmsr rdpmc rdshr rdtsc rdtscp ret retf retn rol ror rsdc rsldt rsm rsqrtps rsqrtss rsts sahf sal sar salc sbb scas scasb scasd scasq scasw seta setae setb setbe setc sete setg setge setl setle setna setnae setnb setnbe setnc setne setng setnge setnl setnle setno setnp setns setnz seto setp setpe setpo sets setz sfence sgdt shl shld shr shrd shufpd shufps sidt skinit sldt smi smint smintold smsw sqrtpd sqrtps sqrtsd sqrtss stc std stgi sti stmxcsr stos stosb stosd stosq stosw str sub subpd subps subsd subss svdc svldt svts swapgs syscall sysenter sysexit sysret test ucomisd ucomiss ud0 ud1 ud2 umov unpckhpd unpckhps unpcklpd unpcklps verr verw vmload vmmcall vmrun vmsave wait wbinvd wrmsr wrshr xadd xbts xchg xlat xlatb xor xorpd xorps" list_Data = Set.fromList $ words $ "times equ db dw dd dq dt resb resw resd resq rest incbin byte word dword qword short ptr"@@ -73,9 +70,9 @@ regex_'28'5e'7c'5b_'5ct'2c'5d'2b'29'28'28'5c'24'7c0x'29'7b1'7d'5b0'2d9'5d'2b'5ba'2df0'2d9'5d'2a'7c'5b0'2d9'5d'2b'5ba'2df0'2d9'5d'2ah'29'28'5b_'5ct'2c'5d'2b'7c'24'29 = compileRegex "(^|[ \\t,]+)((\\$|0x){1}[0-9]+[a-f0-9]*|[0-9]+[a-f0-9]*h)([ \\t,]+|$)" regex_'28'5e'7c'5b_'5ct'2c'5d'2b'29'28'5b0'2d7'5d'2b'28q'7co'29'7c'5b01'5d'2bb'29'28'5b_'5ct'2c'5d'2b'7c'24'29 = compileRegex "(^|[ \\t,]+)([0-7]+(q|o)|[01]+b)([ \\t,]+|$)" -defaultAttributes = [("Normal",NormalTok),("Comment",CommentTok),("Preprocessor",OtherTok),("String",StringTok)]+defaultAttributes = [(("Intel x86 (NASM)","Normal"),NormalTok),(("Intel x86 (NASM)","Comment"),CommentTok),(("Intel x86 (NASM)","Preprocessor"),OtherTok),(("Intel x86 (NASM)","String"),StringTok)] -parseRules "Normal" =+parseRules ("Intel x86 (NASM)","Normal") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_registers >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_Data >>= withAttribute DataTypeTok))@@ -84,11 +81,11 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_NASM_Keywords >>= withAttribute KeywordTok)) <|>- ((pDetectChar False ';' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False ';' >>= withAttribute CommentTok) >>~ pushContext ("Intel x86 (NASM)","Comment")) <|>- ((pDetectChar False '%' >>= withAttribute OtherTok) >>~ pushContext "Preprocessor")+ ((pDetectChar False '%' >>= withAttribute OtherTok) >>~ pushContext ("Intel x86 (NASM)","Preprocessor")) <|>- ((pAnyChar "\"'" >>= withAttribute StringTok) >>~ pushContext "String")+ ((pAnyChar "\"'" >>= withAttribute StringTok) >>~ pushContext ("Intel x86 (NASM)","String")) <|> ((pColumn 0 >> pRegExpr regex_'5cs'2a'5bA'2dZa'2dz0'2d9'5f'2e'24'5d'2b'3a >>= withAttribute FunctionTok)) <|>@@ -112,15 +109,14 @@ <|> ((pHlCChar >>= withAttribute CharTok))) -parseRules "Comment" =+parseRules ("Intel x86 (NASM)","Comment") = pzero -parseRules "Preprocessor" =+parseRules ("Intel x86 (NASM)","Preprocessor") = pzero -parseRules "String" =+parseRules ("Intel x86 (NASM)","String") = ((pAnyChar "\"'" >>= withAttribute StringTok) >>~ (popContext)) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Noweb.hs view
@@ -9,7 +9,6 @@ import qualified Text.Highlighting.Kate.Syntax.Html import qualified Text.Highlighting.Kate.Syntax.Cpp import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,30 +26,32 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "noweb" }- context <- currentContext <|> (pushContext "RawDocumentation" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("noweb",["RawDocumentation"])], synStLanguage = "noweb", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("noweb","RawDocumentation")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "RawDocumentation" -> return ()- "CodeQuote" -> return ()- "CodeSection" -> return ()- "SectionNames" -> return ()+ ("noweb","RawDocumentation") -> return ()+ ("noweb","CodeQuote") -> return ()+ ("noweb","CodeSection") -> return ()+ ("noweb","SectionNames") -> return () _ -> return () withAttribute attr txt = do@@ -59,11 +60,7 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'3c'3c'2e'2a'3e'3e'3d'24 = compileRegex "<<.*>>=$" regex_'5c'5d'5c'5d'28'3f'21'5c'5d'29 = compileRegex "\\]\\](?!\\])" regex_'40'24 = compileRegex "@$"@@ -71,42 +68,43 @@ regex_'40'3c'3c = compileRegex "@<<" regex_'3c'3c'2e'2a'5b'5e'40'5d'3e'3e'28'3f'21'3d'29 = compileRegex "<<.*[^@]>>(?!=)" -defaultAttributes = [("RawDocumentation",NormalTok),("CodeQuote",NormalTok),("CodeSection",NormalTok),("SectionNames",NormalTok)]+defaultAttributes = [(("noweb","RawDocumentation"),NormalTok),(("noweb","CodeQuote"),NormalTok),(("noweb","CodeSection"),NormalTok),(("noweb","SectionNames"),NormalTok)] -parseRules "RawDocumentation" =- (((pColumn 0 >> pRegExpr regex_'3c'3c'2e'2a'3e'3e'3d'24 >>= withAttribute RegionMarkerTok) >>~ pushContext "CodeSection")+parseRules ("noweb","RawDocumentation") =+ (((pColumn 0 >> pRegExpr regex_'3c'3c'2e'2a'3e'3e'3d'24 >>= withAttribute RegionMarkerTok) >>~ pushContext ("noweb","CodeSection")) <|> ((pDetect2Chars False '@' '[' >>= withAttribute NormalTok)) <|>- ((pDetect2Chars False '[' '[' >>= withAttribute RegionMarkerTok) >>~ pushContext "CodeQuote")+ ((pDetect2Chars False '[' '[' >>= withAttribute RegionMarkerTok) >>~ pushContext ("noweb","CodeQuote")) <|> ((Text.Highlighting.Kate.Syntax.Html.parseExpression))) -parseRules "CodeQuote" =+parseRules ("noweb","CodeQuote") = (((pDetect2Chars False '@' ']' >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5c'5d'5c'5d'28'3f'21'5c'5d'29 >>= withAttribute RegionMarkerTok) >>~ (popContext)) <|>- ((parseRules "SectionNames"))+ ((parseRules ("noweb","SectionNames"))) <|> ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))) -parseRules "CodeSection" =- (((pColumn 0 >> pRegExpr regex_'40'24 >>= withAttribute RegionMarkerTok) >>~ pushContext "RawDocumentation")+parseRules ("noweb","CodeSection") =+ (((pColumn 0 >> pRegExpr regex_'40'24 >>= withAttribute RegionMarkerTok) >>~ pushContext ("noweb","RawDocumentation")) <|>- ((pColumn 0 >> pRegExpr regex_'40'28'3f'3d'5b'5cs'25'5d'29 >>= withAttribute RegionMarkerTok) >>~ pushContext "RawDocumentation")+ ((pColumn 0 >> pRegExpr regex_'40'28'3f'3d'5b'5cs'25'5d'29 >>= withAttribute RegionMarkerTok) >>~ pushContext ("noweb","RawDocumentation")) <|>- ((pColumn 0 >> lookAhead (pRegExpr regex_'3c'3c'2e'2a'3e'3e'3d'24) >> pushContext "RawDocumentation" >> currentContext >>= parseRules))+ ((pColumn 0 >> lookAhead (pRegExpr regex_'3c'3c'2e'2a'3e'3e'3d'24) >> pushContext ("noweb","RawDocumentation") >> currentContext >>= parseRules)) <|>- ((parseRules "SectionNames"))+ ((parseRules ("noweb","SectionNames"))) <|> ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))) -parseRules "SectionNames" =+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))) -parseRules "" = parseRules "RawDocumentation"+parseRules ("HTML", _) = Text.Highlighting.Kate.Syntax.Html.parseExpression+parseRules ("C++", _) = Text.Highlighting.Kate.Syntax.Cpp.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Objectivec.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Doxygen import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,32 +26,34 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Objective-C" }- context <- currentContext <|> (pushContext "Default" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Objective-C",["Default"])], synStLanguage = "Objective-C", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Objective-C","Default")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Default" -> return ()- "String" -> (popContext) >> pEndLine- "SingleLineComment" -> (popContext) >> pEndLine- "MultiLineComment" -> return ()- "Preprocessor" -> pushContext "Default" >> return ()- "MultiLineCommentPrep" -> return ()+ ("Objective-C","Default") -> return ()+ ("Objective-C","String") -> (popContext) >> pEndLine+ ("Objective-C","SingleLineComment") -> (popContext) >> pEndLine+ ("Objective-C","MultiLineComment") -> return ()+ ("Objective-C","Preprocessor") -> pushContext ("Objective-C","Default") >> return ()+ ("Objective-C","MultiLineCommentPrep") -> return () _ -> return () withAttribute attr txt = do@@ -61,18 +62,14 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "break case continue default do else enum extern for goto if return sizeof struct switch typedef union while @class @defs @encode @end @implementation @interface @private @protected @protocol @public @selector self super" list_types = Set.fromList $ words $ "auto char const double float int long register short signed static unsigned void volatile" regex_'23 = compileRegex "#" -defaultAttributes = [("Default",NormalTok),("String",StringTok),("SingleLineComment",CommentTok),("MultiLineComment",CommentTok),("Preprocessor",OtherTok),("MultiLineCommentPrep",CommentTok)]+defaultAttributes = [(("Objective-C","Default"),NormalTok),(("Objective-C","String"),StringTok),(("Objective-C","SingleLineComment"),CommentTok),(("Objective-C","MultiLineComment"),CommentTok),(("Objective-C","Preprocessor"),OtherTok),(("Objective-C","MultiLineCommentPrep"),CommentTok)] -parseRules "Default" =+parseRules ("Objective-C","Default") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_types >>= withAttribute DataTypeTok))@@ -105,32 +102,32 @@ <|> ((pHlCChar >>= withAttribute CharTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Objective-C","String")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "SingleLineComment")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C","SingleLineComment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "MultiLineComment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C","MultiLineComment")) <|> ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok)) <|>- ((pColumn 0 >> pRegExpr regex_'23 >>= withAttribute OtherTok) >>~ pushContext "Preprocessor")+ ((pColumn 0 >> pRegExpr regex_'23 >>= withAttribute OtherTok) >>~ pushContext ("Objective-C","Preprocessor")) <|>- ((pDetect2Chars False '@' '"' >>= withAttribute StringTok) >>~ pushContext "String"))+ ((pDetect2Chars False '@' '"' >>= withAttribute StringTok) >>~ pushContext ("Objective-C","String"))) -parseRules "String" =+parseRules ("Objective-C","String") = (((pLineContinue >>= withAttribute StringTok)) <|> ((pHlCStringChar >>= withAttribute CharTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "SingleLineComment" =+parseRules ("Objective-C","SingleLineComment") = pzero -parseRules "MultiLineComment" =+parseRules ("Objective-C","MultiLineComment") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "Preprocessor" =+parseRules ("Objective-C","Preprocessor") = (((pLineContinue >>= withAttribute OtherTok)) <|> ((pRangeDetect '"' '"' >>= withAttribute OtherTok))@@ -139,13 +136,13 @@ <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression >>= ((withAttribute OtherTok) . snd))) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "SingleLineComment")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C","SingleLineComment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "MultiLineCommentPrep"))+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C","MultiLineCommentPrep"))) -parseRules "MultiLineCommentPrep" =+parseRules ("Objective-C","MultiLineCommentPrep") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext)) -parseRules "" = parseRules "Default"+parseRules ("Doxygen", _) = Text.Highlighting.Kate.Syntax.Doxygen.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Objectivecpp.hs view
@@ -9,7 +9,6 @@ import qualified Text.Highlighting.Kate.Syntax.Doxygen import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -28,39 +27,41 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Objective-C++" }- context <- currentContext <|> (pushContext "Default" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Objective-C++",["Default"])], synStLanguage = "Objective-C++", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Objective-C++","Default")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Default" -> return ()- "String" -> (popContext) >> pEndLine- "SingleLineComment" -> (popContext) >> pEndLine- "MultiLineComment" -> return ()- "Preprocessor" -> pushContext "Default" >> return ()- "MultiLineCommentPrep" -> return ()- "Region Marker" -> (popContext) >> pEndLine- "Commentar 1" -> (popContext) >> pEndLine- "Commentar 2" -> return ()- "Preprocessor" -> (popContext) >> pEndLine- "Define" -> (popContext) >> pEndLine- "Outscoped" -> return ()- "Outscoped intern" -> return ()+ ("Objective-C++","Default") -> return ()+ ("Objective-C++","String") -> (popContext) >> pEndLine+ ("Objective-C++","SingleLineComment") -> (popContext) >> pEndLine+ ("Objective-C++","MultiLineComment") -> return ()+ ("Objective-C++","Preprocessor") -> pushContext ("Objective-C++","Default") >> return ()+ ("Objective-C++","MultiLineCommentPrep") -> return ()+ ("Objective-C++","Region Marker") -> (popContext) >> pEndLine+ ("Objective-C++","Commentar 1") -> (popContext) >> pEndLine+ ("Objective-C++","Commentar 2") -> return ()+ ("Objective-C++","Preprocessor") -> (popContext) >> pEndLine+ ("Objective-C++","Define") -> (popContext) >> pEndLine+ ("Objective-C++","Outscoped") -> return ()+ ("Objective-C++","Outscoped intern") -> return () _ -> return () withAttribute attr txt = do@@ -69,10 +70,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "break case continue default do else enum extern for goto if return sizeof struct switch typedef union while @class @defs @encode @end @implementation @interface @private @protected @protocol @public @selector self super asm catch class const_cast delete dynamic_cast explicit export false friend inline namespace new operator private protected public qobject_cast reinterpret_cast static_cast template this throw true try typeid type_info typename using virtual and and_eq bad_cast bad_typeid bitand bitor compl not not_eq or or_eq xor xor_eq" list_extensions = Set.fromList $ words $ "K_DCOP SLOT SIGNAL Q_CLASSINFO Q_ENUMS Q_EXPORT Q_OBJECT Q_OVERRIDE Q_PROPERTY Q_SETS Q_SIGNALS Q_SLOTS Q_FOREACH Q_DECLARE_FLAGS Q_INIT_RESOURCE Q_CLEANUP_RESOURCE Q_GLOBAL_STATIC Q_GLOBAL_STATIC_WITH_ARGS Q_DECLARE_INTERFACE Q_DECLARE_TYPEINFO Q_DECLARE_SHARED Q_DECLARE_FLAGS Q_DECLARE_OPERATORS_FOR_FLAGS Q_FOREVER Q_DECLARE_PRIVATE Q_DECLARE_PUBLIC Q_D Q_Q Q_DISABLE_COPY Q_INTERFACES Q_FLAGS Q_SCRIPTABLE Q_INVOKABLE Q_GADGET Q_ARG Q_RETURN_ARG Q_ASSERT Q_ASSERT_X TRUE FALSE connect disconnect emit signals slots foreach forever" list_types = Set.fromList $ words $ "auto char const double float int long register short signed static unsigned void volatile bool mutable uchar uint int8_t int16_t int32_t int64_t uint8_t uint16_t uint32_t uint64_t wchar_t"@@ -85,18 +82,18 @@ regex_'23'5cs'2a'28endif'7celse'7celif'29 = compileRegex "#\\s*(endif|else|elif)" regex_'23'5cs'2aendif = compileRegex "#\\s*endif" -defaultAttributes = [("Default",NormalTok),("String",StringTok),("SingleLineComment",CommentTok),("MultiLineComment",CommentTok),("Preprocessor",OtherTok),("MultiLineCommentPrep",CommentTok),("Region Marker",RegionMarkerTok),("Commentar 1",CommentTok),("Commentar 2",CommentTok),("Preprocessor",OtherTok),("Define",OtherTok),("Outscoped",CommentTok),("Outscoped intern",CommentTok)]+defaultAttributes = [(("Objective-C++","Default"),NormalTok),(("Objective-C++","String"),StringTok),(("Objective-C++","SingleLineComment"),CommentTok),(("Objective-C++","MultiLineComment"),CommentTok),(("Objective-C++","Preprocessor"),OtherTok),(("Objective-C++","MultiLineCommentPrep"),CommentTok),(("Objective-C++","Region Marker"),RegionMarkerTok),(("Objective-C++","Commentar 1"),CommentTok),(("Objective-C++","Commentar 2"),CommentTok),(("Objective-C++","Preprocessor"),OtherTok),(("Objective-C++","Define"),OtherTok),(("Objective-C++","Outscoped"),CommentTok),(("Objective-C++","Outscoped intern"),CommentTok)] -parseRules "Default" =+parseRules ("Objective-C++","Default") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'5cs'2b0 >>= withAttribute OtherTok) >>~ pushContext "Outscoped")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'5cs'2b0 >>= withAttribute OtherTok) >>~ pushContext ("Objective-C++","Outscoped")) <|>- ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute OtherTok) >>~ pushContext "Preprocessor")+ ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute OtherTok) >>~ pushContext ("Objective-C++","Preprocessor")) <|>- ((pFirstNonSpace >> pString False "//BEGIN" >>= withAttribute RegionMarkerTok) >>~ pushContext "Region Marker")+ ((pFirstNonSpace >> pString False "//BEGIN" >>= withAttribute RegionMarkerTok) >>~ pushContext ("Objective-C++","Region Marker")) <|>- ((pFirstNonSpace >> pString False "//END" >>= withAttribute RegionMarkerTok) >>~ pushContext "Region Marker")+ ((pFirstNonSpace >> pString False "//END" >>= withAttribute RegionMarkerTok) >>~ pushContext ("Objective-C++","Region Marker")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|>@@ -132,23 +129,23 @@ <|> ((pHlCChar >>= withAttribute CharTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Objective-C++","String")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "SingleLineComment")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","SingleLineComment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "MultiLineComment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","MultiLineComment")) <|>- ((pColumn 0 >> pRegExpr regex_'23 >>= withAttribute OtherTok) >>~ pushContext "Preprocessor")+ ((pColumn 0 >> pRegExpr regex_'23 >>= withAttribute OtherTok) >>~ pushContext ("Objective-C++","Preprocessor")) <|>- ((pDetect2Chars False '@' '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetect2Chars False '@' '"' >>= withAttribute StringTok) >>~ pushContext ("Objective-C++","String")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_extensions >>= withAttribute KeywordTok)) <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression)) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","Commentar 2")) <|> ((pDetectChar False '{' >>= withAttribute NormalTok)) <|>@@ -156,20 +153,20 @@ <|> ((pAnyChar ":!%&()+,-/.*<=>?[]{|}~^;" >>= withAttribute NormalTok))) -parseRules "String" =+parseRules ("Objective-C++","String") = (((pLineContinue >>= withAttribute StringTok)) <|> ((pHlCStringChar >>= withAttribute CharTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "SingleLineComment" =+parseRules ("Objective-C++","SingleLineComment") = pzero -parseRules "MultiLineComment" =+parseRules ("Objective-C++","MultiLineComment") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "Preprocessor" =+parseRules ("Objective-C++","Preprocessor") = (((pLineContinue >>= withAttribute OtherTok)) <|> ((pRangeDetect '"' '"' >>= withAttribute OtherTok))@@ -178,28 +175,28 @@ <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression >>= ((withAttribute OtherTok) . snd))) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "SingleLineComment")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","SingleLineComment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "MultiLineCommentPrep"))+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","MultiLineCommentPrep"))) -parseRules "MultiLineCommentPrep" =+parseRules ("Objective-C++","MultiLineCommentPrep") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext >> popContext)) <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "Region Marker" =+parseRules ("Objective-C++","Region Marker") = pzero -parseRules "Commentar 1" =+parseRules ("Objective-C++","Commentar 1") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "Commentar 2" =+parseRules ("Objective-C++","Commentar 2") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))@@ -208,10 +205,10 @@ <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "Preprocessor" =+parseRules ("Objective-C++","Preprocessor") = (((pLineContinue >>= withAttribute OtherTok)) <|>- ((pRegExpr regex_define'2e'2a'28'28'3f'3d'5c'5c'29'29 >>= withAttribute OtherTok) >>~ pushContext "Define")+ ((pRegExpr regex_define'2e'2a'28'28'3f'3d'5c'5c'29'29 >>= withAttribute OtherTok) >>~ pushContext ("Objective-C++","Define")) <|> ((pRegExpr regex_define'2e'2a >>= withAttribute OtherTok)) <|>@@ -221,51 +218,52 @@ <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression >>= ((withAttribute OtherTok) . snd))) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "MultiLineCommentPrep"))+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","MultiLineCommentPrep"))) -parseRules "Define" =+parseRules ("Objective-C++","Define") = ((pLineContinue >>= withAttribute OtherTok)) -parseRules "Outscoped" =+parseRules ("Objective-C++","Outscoped") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetectIdentifier >>= withAttribute CommentTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Objective-C++","String")) <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression >>= ((withAttribute CommentTok) . snd))) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","Commentar 2")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext "Outscoped intern")+ ((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))) -parseRules "Outscoped intern" =+parseRules ("Objective-C++","Outscoped intern") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetectIdentifier >>= withAttribute CommentTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Objective-C++","String")) <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression >>= ((withAttribute CommentTok) . snd))) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","Commentar 2")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext "Outscoped intern")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext ("Objective-C++","Outscoped intern")) <|> ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "" = parseRules "Default"+parseRules ("Doxygen", _) = Text.Highlighting.Kate.Syntax.Doxygen.parseExpression+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Ocaml.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,36 +25,38 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Objective Caml" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Objective Caml",["Normal"])], synStLanguage = "Objective Caml", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Objective Caml","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "Multiline Comment" -> return ()- "String Constant" -> return ()- "Block" -> return ()- "Sig" -> return ()- "Struct" -> return ()- "Object" -> return ()- "ModuleEnv" -> return ()- "ModuleEnv2" -> return ()- "Camlp4 Quotation Constant" -> return ()+ ("Objective Caml","Normal") -> return ()+ ("Objective Caml","Multiline Comment") -> return ()+ ("Objective Caml","String Constant") -> return ()+ ("Objective Caml","Block") -> return ()+ ("Objective Caml","Sig") -> return ()+ ("Objective Caml","Struct") -> return ()+ ("Objective Caml","Object") -> return ()+ ("Objective Caml","ModuleEnv") -> return ()+ ("Objective Caml","ModuleEnv2") -> return ()+ ("Objective Caml","Camlp4 Quotation Constant") -> return () _ -> return () withAttribute attr txt = do@@ -64,10 +65,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_revised_syntax_keywords = Set.fromList $ words $ "declare value where" list_keywords = Set.fromList $ words $ "and as assert asr class closed constraint downto else exception external false for fun function functor if in inherit initializer land lazy let lor lsl lsr lxor match method mod mutable new of or parser private rec then to true try type val virtual when while with" list_core_types = Set.fromList $ words $ "exn lazy_t format unit int real char string ref array bool list option"@@ -98,10 +95,10 @@ regex_'5c'5c'28'5c'5c'7c'3e'3e'7c'3c'3c'29 = compileRegex "\\\\(\\\\|>>|<<)" 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 = compileRegex "\\\\<:[A-Za-z\\0300-\\0326\\0330-\\0366\\0370-\\0377_][A-Za-z\\0300-\\0326\\0330-\\0366\\0370-\\03770-9_']*<" -defaultAttributes = [("Normal",NormalTok),("Multiline Comment",CommentTok),("String Constant",StringTok),("Block",NormalTok),("Sig",NormalTok),("Struct",NormalTok),("Object",NormalTok),("ModuleEnv",NormalTok),("ModuleEnv2",NormalTok),("Camlp4 Quotation Constant",StringTok)]+defaultAttributes = [(("Objective Caml","Normal"),NormalTok),(("Objective Caml","Multiline Comment"),CommentTok),(("Objective Caml","String Constant"),StringTok),(("Objective Caml","Block"),NormalTok),(("Objective Caml","Sig"),NormalTok),(("Objective Caml","Struct"),NormalTok),(("Objective Caml","Object"),NormalTok),(("Objective Caml","ModuleEnv"),NormalTok),(("Objective Caml","ModuleEnv2"),NormalTok),(("Objective Caml","Camlp4 Quotation Constant"),StringTok)] -parseRules "Normal" =- (((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext "Multiline Comment")+parseRules ("Objective Caml","Normal") =+ (((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective Caml","Multiline Comment")) <|> ((pDetectChar False '(' >>= withAttribute NormalTok)) <|>@@ -123,31 +120,31 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_done >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_module'5fenvironment >>= withAttribute OtherTok) >>~ pushContext "ModuleEnv")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_module'5fenvironment >>= withAttribute OtherTok) >>~ pushContext ("Objective Caml","ModuleEnv")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_begin >>= withAttribute KeywordTok) >>~ pushContext "Block")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_begin >>= withAttribute KeywordTok) >>~ pushContext ("Objective Caml","Block")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_object >>= withAttribute KeywordTok) >>~ pushContext "Object")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_object >>= withAttribute KeywordTok) >>~ pushContext ("Objective Caml","Object")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_sig >>= withAttribute KeywordTok) >>~ pushContext "Sig")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_sig >>= withAttribute KeywordTok) >>~ pushContext ("Objective Caml","Sig")) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_struct >>= withAttribute KeywordTok) >>~ pushContext "Struct")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_struct >>= withAttribute KeywordTok) >>~ pushContext ("Objective Caml","Struct")) <|> ((pRegExpr regex_'60'5cs'2a'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 >>= withAttribute DataTypeTok)) <|>- ((lookAhead (pRegExpr regex_'5bA'2dZ'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a'5cs'2a'5c'2e) >> pushContext "ModuleEnv2" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'5bA'2dZ'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a'5cs'2a'5c'2e) >> pushContext ("Objective Caml","ModuleEnv2") >> currentContext >>= parseRules)) <|> ((pRegExpr regex_'5bA'2dZ'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a >>= withAttribute DataTypeTok)) <|> ((pFirstNonSpace >> pRegExpr regex_'23'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'2e'2a'24 >>= withAttribute OtherTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String Constant")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Objective Caml","String Constant")) <|> ((pRegExpr regex_'27'28'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'7c'5b'5e'27'5d'29'27 >>= withAttribute CharTok)) <|>- ((pDetect2Chars False '<' '<' >>= withAttribute StringTok) >>~ pushContext "Camlp4 Quotation Constant")+ ((pDetect2Chars False '<' '<' >>= withAttribute StringTok) >>~ pushContext ("Objective Caml","Camlp4 Quotation Constant")) <|>- ((pRegExpr regex_'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 StringTok) >>~ pushContext "Camlp4 Quotation Constant")+ ((pRegExpr regex_'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 StringTok) >>~ pushContext ("Objective Caml","Camlp4 Quotation Constant")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|>@@ -167,65 +164,64 @@ <|> ((pRegExpr regex_'2d'3f'5b0'2d9'5d'5b0'2d9'5f'5d'2a >>= withAttribute DecValTok))) -parseRules "Multiline Comment" =+parseRules ("Objective Caml","Multiline Comment") = (((pDetect2Chars False '*' ')' >>= withAttribute CommentTok) >>~ (popContext)) <|>- ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext "Multiline Comment"))+ ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("Objective Caml","Multiline Comment"))) -parseRules "String Constant" =+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))) -parseRules "Block" =+parseRules ("Objective Caml","Block") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "Normal")))+ ((parseRules ("Objective Caml","Normal")))) -parseRules "Sig" =+parseRules ("Objective Caml","Sig") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "Normal")))+ ((parseRules ("Objective Caml","Normal")))) -parseRules "Struct" =+parseRules ("Objective Caml","Struct") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "Normal")))+ ((parseRules ("Objective Caml","Normal")))) -parseRules "Object" =+parseRules ("Objective Caml","Object") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_end >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "Normal")))+ ((parseRules ("Objective Caml","Normal")))) -parseRules "ModuleEnv" =+parseRules ("Objective Caml","ModuleEnv") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((lookAhead (pRegExpr regex_'5bA'2dZ'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a'5cs'2a'5c'2e) >> pushContext "ModuleEnv2" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'5bA'2dZ'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a'5cs'2a'5c'2e) >> pushContext ("Objective Caml","ModuleEnv2") >> currentContext >>= parseRules)) <|> ((pRegExpr regex_'5bA'2dZ'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a >>= withAttribute NormalTok) >>~ (popContext)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "ModuleEnv2" =+parseRules ("Objective Caml","ModuleEnv2") = (((pRegExpr regex_'5bA'2dZ'5d'5bA'2dZa'2dz'5c0300'2d'5c0326'5c0330'2d'5c0366'5c0370'2d'5c03770'2d9'5f'27'5d'2a >>= withAttribute NormalTok)) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pString False "." >>= withAttribute KeywordTok) >>~ (popContext))) -parseRules "Camlp4 Quotation Constant" =+parseRules ("Objective Caml","Camlp4 Quotation Constant") = (((pDetect2Chars False '>' '>' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((pDetect2Chars False '<' '<' >>= withAttribute StringTok) >>~ pushContext "Camlp4 Quotation Constant")+ ((pDetect2Chars False '<' '<' >>= withAttribute StringTok) >>~ pushContext ("Objective Caml","Camlp4 Quotation Constant")) <|>- ((pRegExpr regex_'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 StringTok) >>~ pushContext "Camlp4 Quotation Constant")+ ((pRegExpr regex_'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 StringTok) >>~ pushContext ("Objective Caml","Camlp4 Quotation Constant")) <|> ((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))) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Octave.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,28 +25,30 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Octave" }- context <- currentContext <|> (pushContext "_normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Octave",["_normal"])], synStLanguage = "Octave", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Octave","_normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "_normal" -> return ()- "_adjoint" -> (popContext) >> pEndLine+ ("Octave","_normal") -> return ()+ ("Octave","_adjoint") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -56,10 +57,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "all_va_args break case continue else elseif end_unwind_protect global gplot gsplot otherwise persistent replot return static until unwind_protect unwind_protect_cleanup varargin varargout" list_builtin = Set.fromList $ words $ "argv e eps false F_DUPFD F_GETFD F_GETFL filesep F_SETFD F_SETFL i I inf Inf j J NA nan NaN O_APPEND O_ASYNC O_CREAT OCTAVE_HOME OCTAVE_VERSION O_EXCL O_NONBLOCK O_RDONLY O_RDWR O_SYNC O_TRUNC O_WRONLY pi program_invocation_name program_name P_tmpdir realmax realmin SEEK_CUR SEEK_END SEEK_SET SIG stderr stdin stdout true ans automatic_replot beep_on_error completion_append_char crash_dumps_octave_core current_script_file_name debug_on_error debug_on_interrupt debug_on_warning debug_symtab_lookups DEFAULT_EXEC_PATH DEFAULT_LOADPATH default_save_format echo_executing_commands EDITOR EXEC_PATH FFTW_WISDOM_PROGRAM fixed_point_format gnuplot_binary gnuplot_command_axes gnuplot_command_end gnuplot_command_plot gnuplot_command_replot gnuplot_command_splot gnuplot_command_title gnuplot_command_using gnuplot_command_with gnuplot_has_frames history_file history_size ignore_function_time_stamp IMAGEPATH INFO_FILE INFO_PROGRAM __kluge_procbuf_delay__ LOADPATH MAKEINFO_PROGRAM max_recursion_depth octave_core_file_format octave_core_file_limit octave_core_file_name output_max_field_width output_precision page_output_immediately PAGER page_screen_output print_answer_id_name print_empty_dimensions print_rhs_assign_val PS1 PS2 PS4 save_header_format_string save_precision saving_history sighup_dumps_octave_core sigterm_dumps_octave_core silent_functions split_long_rows string_fill_char struct_levels_to_print suppress_verbose_help_message variables_can_hide_functions warn_assign_as_truth_value warn_divide_by_zero warn_empty_list_elements warn_fortran_indexing warn_function_name_clash warn_future_time_stamp warn_imag_to_real warn_matlab_incompatible warn_missing_semicolon warn_neg_dim_as_zero warn_num_to_str warn_precedence_change warn_reload_forces_clear warn_resize_on_range_error warn_separator_insert warn_single_quote_string warn_str_to_num warn_undefined_return_values warn_variable_switch_label whos_line_format" list_commands = Set.fromList $ words $ "casesen cd chdir clear dbclear dbstatus dbstop dbtype dbwhere diary echo edit_history __end__ format gset gshow help history hold iskeyword isvarname load ls mark_as_command mislocked mlock more munlock run_history save set show type unmark_command which who whos"@@ -94,9 +91,9 @@ regex_'28'5cd'2b'28'5c'2e'5cd'2b'29'3f'7c'5c'2e'5cd'2b'29'28'5beE'5d'5b'2b'2d'5d'3f'5cd'2b'29'3f'5bij'5d'3f = compileRegex "(\\d+(\\.\\d+)?|\\.\\d+)([eE][+-]?\\d+)?[ij]?" regex_'27'2b = compileRegex "'+" -defaultAttributes = [("_normal",NormalTok),("_adjoint",NormalTok)]+defaultAttributes = [(("Octave","_normal"),NormalTok),(("Octave","_adjoint"),NormalTok)] -parseRules "_normal" =+parseRules ("Octave","_normal") = (((pRegExpr regex_'5cb'28for'29'5cb >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5cb'28endfor'29'5cb >>= withAttribute NormalTok))@@ -127,13 +124,13 @@ <|> ((pRegExpr regex_'5cb'28end'29'5cb >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'5ba'2dzA'2dZ'5d'5cw'2a'28'3f'3d'27'29 >>= withAttribute NormalTok) >>~ pushContext "_adjoint")+ ((pRegExpr regex_'5ba'2dzA'2dZ'5d'5cw'2a'28'3f'3d'27'29 >>= withAttribute NormalTok) >>~ pushContext ("Octave","_adjoint")) <|>- ((pRegExpr regex_'28'5cd'2b'28'5c'2e'5cd'2b'29'3f'7c'5c'2e'5cd'2b'29'28'5beE'5d'5b'2b'2d'5d'3f'5cd'2b'29'3f'5bij'5d'3f'28'3f'3d'27'29 >>= withAttribute FloatTok) >>~ pushContext "_adjoint")+ ((pRegExpr regex_'28'5cd'2b'28'5c'2e'5cd'2b'29'3f'7c'5c'2e'5cd'2b'29'28'5beE'5d'5b'2b'2d'5d'3f'5cd'2b'29'3f'5bij'5d'3f'28'3f'3d'27'29 >>= withAttribute FloatTok) >>~ pushContext ("Octave","_adjoint")) <|>- ((pRegExpr regex_'5b'5c'29'5c'5d'7d'5d'28'3f'3d'27'29 >>= withAttribute NormalTok) >>~ pushContext "_adjoint")+ ((pRegExpr regex_'5b'5c'29'5c'5d'7d'5d'28'3f'3d'27'29 >>= withAttribute NormalTok) >>~ pushContext ("Octave","_adjoint")) <|>- ((pRegExpr regex_'5c'2e'27'28'3f'3d'27'29 >>= withAttribute NormalTok) >>~ pushContext "_adjoint")+ ((pRegExpr regex_'5c'2e'27'28'3f'3d'27'29 >>= withAttribute NormalTok) >>~ pushContext ("Octave","_adjoint")) <|> ((pRegExpr regex_'27'28'5b'5e'27'5c'5c'5d'7c'27'27'7c'5c'5c'27'7c'5c'5c'5b'5e'27'5d'29'2a'27'28'3f'3d'5b'5e'27'5d'7c'24'29 >>= withAttribute StringTok)) <|>@@ -197,9 +194,8 @@ <|> ((pAnyChar "!\"%(*+,/;=>[]|~#&)-:<>\\^" >>= withAttribute NormalTok))) -parseRules "_adjoint" =+parseRules ("Octave","_adjoint") = ((pRegExpr regex_'27'2b >>= withAttribute NormalTok) >>~ (popContext)) -parseRules "" = parseRules "_normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Pascal.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,36 +25,38 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Pascal" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Pascal",["Normal"])], synStLanguage = "Pascal", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Pascal","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "CharNum" -> (popContext) >> pEndLine- "HexCharNum" -> (popContext) >> pEndLine- "Hex" -> (popContext) >> pEndLine- "String" -> (popContext) >> pEndLine- "Prep1" -> (popContext) >> pEndLine- "Prep2" -> (popContext) >> pEndLine- "Comment1" -> return ()- "Comment2" -> return ()- "Comment3" -> (popContext) >> pEndLine+ ("Pascal","Normal") -> return ()+ ("Pascal","CharNum") -> (popContext) >> pEndLine+ ("Pascal","HexCharNum") -> (popContext) >> pEndLine+ ("Pascal","Hex") -> (popContext) >> pEndLine+ ("Pascal","String") -> (popContext) >> pEndLine+ ("Pascal","Prep1") -> (popContext) >> pEndLine+ ("Pascal","Prep2") -> (popContext) >> pEndLine+ ("Pascal","Comment1") -> return ()+ ("Pascal","Comment2") -> return ()+ ("Pascal","Comment3") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -64,10 +65,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "and array asm case const div do downto else file for function goto if in label mod nil not of operator or packed procedure program record repeat set then to type unit until uses var while with xor at automated break continue dispinterface dispose exit false finalization initialization library new published resourcestring self true" list_ISO'2fDelphi_Extended = Set.fromList $ words $ "abstract as bindable constructor destructor except export finally import implementation inherited inline interface is module on only otherwise override private property protected public read qualified raise restricted shl shr threadvar try virtual write" list_types = Set.fromList $ words $ "integer cardinal shortint smallint longint int64 byte word longword dword qword char ansichar widechar boolean bytebool wordbool longbool single double extended comp currency real real48 string shortstring ansistring widestring pointer variant file text"@@ -79,9 +76,9 @@ regex_'5b'5e0'2d9'5d = compileRegex "[^0-9]" regex_'5b'5ea'2dfA'2dF0'2d9'5d = compileRegex "[^a-fA-F0-9]" -defaultAttributes = [("Normal",NormalTok),("CharNum",StringTok),("HexCharNum",BaseNTok),("Hex",BaseNTok),("String",StringTok),("Prep1",OtherTok),("Prep2",OtherTok),("Comment1",CommentTok),("Comment2",CommentTok),("Comment3",CommentTok)]+defaultAttributes = [(("Pascal","Normal"),NormalTok),(("Pascal","CharNum"),StringTok),(("Pascal","HexCharNum"),BaseNTok),(("Pascal","Hex"),BaseNTok),(("Pascal","String"),StringTok),(("Pascal","Prep1"),OtherTok),(("Pascal","Prep2"),OtherTok),(("Pascal","Comment1"),CommentTok),(("Pascal","Comment2"),CommentTok),(("Pascal","Comment3"),CommentTok)] -parseRules "Normal" =+parseRules ("Pascal","Normal") = (((pRegExpr regex_'5cb'28begin'7ccase'7crecord'29'28'3f'3d'28'5c'7b'5b'5e'7d'5d'2a'28'5c'7d'7c'24'29'7c'5c'28'5c'2a'2e'2a'28'5c'2a'5c'29'7c'24'29'29'2a'28'5b'5cs'5d'7c'24'7c'2f'2f'29'29 >>= withAttribute KeywordTok)) <|> ((pRegExpr regex_'5cb'28'28object'7cclass'29'28'3f'3d'28'5c'28'2e'2a'5c'29'29'3f'28'5c'7b'5b'5e'7d'5d'2a'28'5c'7d'7c'24'29'7c'5c'28'5c'2a'2e'2a'28'5c'2a'5c'29'7c'24'29'29'2a'3b'3f'28'5b'5cs'5d'7c'24'7c'2f'2f'29'29'7ctry'28'3f'3d'28'5c'7b'5b'5e'7d'5d'2a'28'5c'7d'7c'24'29'7c'5c'28'5c'2a'2e'2a'28'5c'2a'5c'29'7c'24'29'29'2a'28'5b'5cs'5d'7c'24'7c'2f'2f'29'29'29 >>= withAttribute KeywordTok))@@ -98,55 +95,54 @@ <|> ((pInt >>= withAttribute DecValTok)) <|>- ((pDetectChar False '$' >>= withAttribute BaseNTok) >>~ pushContext "Hex")+ ((pDetectChar False '$' >>= withAttribute BaseNTok) >>~ pushContext ("Pascal","Hex")) <|>- ((pDetectChar False '#' >>= withAttribute StringTok) >>~ pushContext "CharNum")+ ((pDetectChar False '#' >>= withAttribute StringTok) >>~ pushContext ("Pascal","CharNum")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Pascal","String")) <|>- ((pString False "(*$" >>= withAttribute OtherTok) >>~ pushContext "Prep1")+ ((pString False "(*$" >>= withAttribute OtherTok) >>~ pushContext ("Pascal","Prep1")) <|>- ((pDetect2Chars False '{' '$' >>= withAttribute OtherTok) >>~ pushContext "Prep2")+ ((pDetect2Chars False '{' '$' >>= withAttribute OtherTok) >>~ pushContext ("Pascal","Prep2")) <|>- ((pDetectChar False '{' >>= withAttribute CommentTok) >>~ pushContext "Comment1")+ ((pDetectChar False '{' >>= withAttribute CommentTok) >>~ pushContext ("Pascal","Comment1")) <|>- ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext "Comment2")+ ((pDetect2Chars False '(' '*' >>= withAttribute CommentTok) >>~ pushContext ("Pascal","Comment2")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Comment3"))+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Pascal","Comment3"))) -parseRules "CharNum" =- (((pDetectChar False '$' >>= withAttribute BaseNTok) >>~ pushContext "HexCharNum")+parseRules ("Pascal","CharNum") =+ (((pDetectChar False '$' >>= withAttribute BaseNTok) >>~ pushContext ("Pascal","HexCharNum")) <|> ((pRegExpr regex_'5b'5e0'2d9'5d >>= withAttribute StringTok) >>~ (popContext))) -parseRules "HexCharNum" =+parseRules ("Pascal","HexCharNum") = ((pRegExpr regex_'5b'5ea'2dfA'2dF0'2d9'5d >>= withAttribute BaseNTok) >>~ (popContext >> popContext)) -parseRules "Hex" =+parseRules ("Pascal","Hex") = ((pRegExpr regex_'5b'5ea'2dfA'2dF0'2d9'5d >>= withAttribute BaseNTok) >>~ (popContext)) -parseRules "String" =+parseRules ("Pascal","String") = ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)) -parseRules "Prep1" =+parseRules ("Pascal","Prep1") = ((pDetect2Chars False '*' ')' >>= withAttribute OtherTok) >>~ (popContext)) -parseRules "Prep2" =+parseRules ("Pascal","Prep2") = ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext)) -parseRules "Comment1" =+parseRules ("Pascal","Comment1") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_attention >>= withAttribute AlertTok)) <|> ((pDetectChar False '}' >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Comment2" =+parseRules ("Pascal","Comment2") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_attention >>= withAttribute AlertTok)) <|> ((pDetect2Chars False '*' ')' >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Comment3" =+parseRules ("Pascal","Comment3") = ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_attention >>= withAttribute AlertTok)) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Perl.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,91 +26,93 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Perl" }- context <- currentContext <|> (pushContext "normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Perl",["normal"])], synStLanguage = "Perl", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Perl","normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "normal" -> return ()- "find_quoted" -> return ()- "find_qqx" -> return ()- "find_qw" -> return ()- "ipstring_internal" -> return ()- "ip_string" -> return ()- "ip_string_2" -> return ()- "ip_string_3" -> return ()- "ip_string_4" -> return ()- "ip_string_5" -> return ()- "ip_string_6" -> return ()- "string" -> return ()- "string_2" -> return ()- "string_3" -> return ()- "string_4" -> return ()- "string_5" -> return ()- "string_6" -> return ()- "find_subst" -> return ()- "subst_curlybrace_pattern" -> return ()- "subst_curlybrace_middle" -> return ()- "subst_curlybrace_replace" -> return ()- "subst_curlybrace_replace_recursive" -> return ()- "subst_paren_pattern" -> return ()- "subst_paren_replace" -> return ()- "subst_bracket_pattern" -> return ()- "subst_bracket_replace" -> return ()- "subst_slash_pattern" -> return ()- "subst_slash_replace" -> return ()- "subst_sq_pattern" -> return ()- "subst_sq_replace" -> return ()- "tr" -> (popContext) >> pEndLine- "find_pattern" -> return ()- "pattern_slash" -> return ()- "pattern" -> return ()- "pattern_brace" -> return ()- "pattern_bracket" -> return ()- "pattern_paren" -> return ()- "pattern_sq" -> return ()- "regex_pattern_internal_rules_1" -> return ()- "regex_pattern_internal_rules_2" -> return ()- "regex_pattern_internal" -> return ()- "regex_pattern_internal_ip" -> return ()- "pat_ext" -> return ()- "pat_char_class" -> return ()- "find_variable" -> (popContext) >> pEndLine- "find_variable_unsafe" -> (popContext) >> pEndLine- "var_detect" -> (popContext >> popContext) >> pEndLine- "var_detect_unsafe" -> (popContext >> popContext) >> pEndLine- "var_detect_rules" -> (popContext >> popContext) >> pEndLine- "quote_word" -> return ()- "quote_word_paren" -> return ()- "quote_word_brace" -> return ()- "quote_word_bracket" -> return ()- "find_here_document" -> (popContext) >> pEndLine- "here_document" -> return ()- "here_document_dumb" -> return ()- "data_handle" -> return ()- "end_handle" -> return ()- "Backticked" -> return ()- "slash_safe_escape" -> (popContext) >> pEndLine- "package_qualified_blank" -> return ()- "sub_name_def" -> (popContext) >> pEndLine- "sub_arg_definition" -> return ()- "pod" -> return ()- "comment" -> (popContext) >> pEndLine+ ("Perl","normal") -> return ()+ ("Perl","find_quoted") -> return ()+ ("Perl","find_qqx") -> return ()+ ("Perl","find_qw") -> return ()+ ("Perl","ipstring_internal") -> return ()+ ("Perl","ip_string") -> return ()+ ("Perl","ip_string_2") -> return ()+ ("Perl","ip_string_3") -> return ()+ ("Perl","ip_string_4") -> return ()+ ("Perl","ip_string_5") -> return ()+ ("Perl","ip_string_6") -> return ()+ ("Perl","string") -> return ()+ ("Perl","string_2") -> return ()+ ("Perl","string_3") -> return ()+ ("Perl","string_4") -> return ()+ ("Perl","string_5") -> return ()+ ("Perl","string_6") -> return ()+ ("Perl","find_subst") -> return ()+ ("Perl","subst_curlybrace_pattern") -> return ()+ ("Perl","subst_curlybrace_middle") -> return ()+ ("Perl","subst_curlybrace_replace") -> return ()+ ("Perl","subst_curlybrace_replace_recursive") -> return ()+ ("Perl","subst_paren_pattern") -> return ()+ ("Perl","subst_paren_replace") -> return ()+ ("Perl","subst_bracket_pattern") -> return ()+ ("Perl","subst_bracket_replace") -> return ()+ ("Perl","subst_slash_pattern") -> return ()+ ("Perl","subst_slash_replace") -> return ()+ ("Perl","subst_sq_pattern") -> return ()+ ("Perl","subst_sq_replace") -> return ()+ ("Perl","tr") -> (popContext) >> pEndLine+ ("Perl","find_pattern") -> return ()+ ("Perl","pattern_slash") -> return ()+ ("Perl","pattern") -> return ()+ ("Perl","pattern_brace") -> return ()+ ("Perl","pattern_bracket") -> return ()+ ("Perl","pattern_paren") -> return ()+ ("Perl","pattern_sq") -> return ()+ ("Perl","regex_pattern_internal_rules_1") -> return ()+ ("Perl","regex_pattern_internal_rules_2") -> return ()+ ("Perl","regex_pattern_internal") -> return ()+ ("Perl","regex_pattern_internal_ip") -> return ()+ ("Perl","pat_ext") -> return ()+ ("Perl","pat_char_class") -> return ()+ ("Perl","find_variable") -> (popContext) >> pEndLine+ ("Perl","find_variable_unsafe") -> (popContext) >> pEndLine+ ("Perl","var_detect") -> (popContext >> popContext) >> pEndLine+ ("Perl","var_detect_unsafe") -> (popContext >> popContext) >> pEndLine+ ("Perl","var_detect_rules") -> (popContext >> popContext) >> pEndLine+ ("Perl","quote_word") -> return ()+ ("Perl","quote_word_paren") -> return ()+ ("Perl","quote_word_brace") -> return ()+ ("Perl","quote_word_bracket") -> return ()+ ("Perl","find_here_document") -> (popContext) >> pEndLine+ ("Perl","here_document") -> return ()+ ("Perl","here_document_dumb") -> return ()+ ("Perl","data_handle") -> return ()+ ("Perl","end_handle") -> return ()+ ("Perl","Backticked") -> return ()+ ("Perl","slash_safe_escape") -> (popContext) >> pEndLine+ ("Perl","package_qualified_blank") -> return ()+ ("Perl","sub_name_def") -> (popContext) >> pEndLine+ ("Perl","sub_arg_definition") -> return ()+ ("Perl","pod") -> return ()+ ("Perl","comment") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -120,10 +121,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "if unless else elsif while until for each foreach next last break continue return use no require my our local BEGIN END require package sub do __END__ __DATA__ __FILE__ __LINE__ __PACKAGE__" list_operators = Set.fromList $ words $ "= != ~= += -= *= /= **= |= ||= //= &= &&= ?= + - * % || // && | & < << > >> ^ -> => . , ; :: \\ and or not eq ne lt gt le ge cmp" list_functions = Set.fromList $ words $ "abs accept alarm atan2 bind binmode bless caller chdir chmod chomp chop chown chr chroot close closedir connect cos crypt dbmclose dbmopen defined delete die dump endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exists exit exp fcntl fileno flock fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt glob gmtime goto grep hex import index int ioctl join keys kill last lc lcfirst length link listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd oct open opendir ord pack package pipe pop pos print printf prototype push quotemeta rand read readdir readline readlink recv redo ref rename reset return reverse rewinddir rindex rmdir scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat study sub substr symlink syscall sysread sysseek system syswrite tell telldir tie time times truncate uc ucfirst umask undef unlink unpack unshift untie utime values vec wait waitpid wantarray warn write"@@ -207,16 +204,16 @@ regex_'5cs'2a'5c'28 = compileRegex "\\s*\\(" regex_'5c'3dcut'2e'2a'24 = compileRegex "\\=cut.*$" -defaultAttributes = [("normal",NormalTok),("find_quoted",NormalTok),("find_qqx",NormalTok),("find_qw",NormalTok),("ipstring_internal",StringTok),("ip_string",StringTok),("ip_string_2",StringTok),("ip_string_3",StringTok),("ip_string_4",StringTok),("ip_string_5",StringTok),("ip_string_6",StringTok),("string",StringTok),("string_2",StringTok),("string_3",StringTok),("string_4",StringTok),("string_5",StringTok),("string_6",StringTok),("find_subst",NormalTok),("subst_curlybrace_pattern",OtherTok),("subst_curlybrace_middle",NormalTok),("subst_curlybrace_replace",StringTok),("subst_curlybrace_replace_recursive",StringTok),("subst_paren_pattern",OtherTok),("subst_paren_replace",StringTok),("subst_bracket_pattern",OtherTok),("subst_bracket_replace",StringTok),("subst_slash_pattern",OtherTok),("subst_slash_replace",StringTok),("subst_sq_pattern",OtherTok),("subst_sq_replace",StringTok),("tr",OtherTok),("find_pattern",OtherTok),("pattern_slash",OtherTok),("pattern",OtherTok),("pattern_brace",OtherTok),("pattern_bracket",OtherTok),("pattern_paren",OtherTok),("pattern_sq",OtherTok),("regex_pattern_internal_rules_1",NormalTok),("regex_pattern_internal_rules_2",NormalTok),("regex_pattern_internal",OtherTok),("regex_pattern_internal_ip",OtherTok),("pat_ext",CharTok),("pat_char_class",BaseNTok),("find_variable",DataTypeTok),("find_variable_unsafe",DataTypeTok),("var_detect",DataTypeTok),("var_detect_unsafe",DataTypeTok),("var_detect_rules",DataTypeTok),("quote_word",NormalTok),("quote_word_paren",NormalTok),("quote_word_brace",NormalTok),("quote_word_bracket",NormalTok),("find_here_document",NormalTok),("here_document",StringTok),("here_document_dumb",NormalTok),("data_handle",NormalTok),("end_handle",CommentTok),("Backticked",StringTok),("slash_safe_escape",NormalTok),("package_qualified_blank",NormalTok),("sub_name_def",NormalTok),("sub_arg_definition",NormalTok),("pod",CommentTok),("comment",CommentTok)]+defaultAttributes = [(("Perl","normal"),NormalTok),(("Perl","find_quoted"),NormalTok),(("Perl","find_qqx"),NormalTok),(("Perl","find_qw"),NormalTok),(("Perl","ipstring_internal"),StringTok),(("Perl","ip_string"),StringTok),(("Perl","ip_string_2"),StringTok),(("Perl","ip_string_3"),StringTok),(("Perl","ip_string_4"),StringTok),(("Perl","ip_string_5"),StringTok),(("Perl","ip_string_6"),StringTok),(("Perl","string"),StringTok),(("Perl","string_2"),StringTok),(("Perl","string_3"),StringTok),(("Perl","string_4"),StringTok),(("Perl","string_5"),StringTok),(("Perl","string_6"),StringTok),(("Perl","find_subst"),NormalTok),(("Perl","subst_curlybrace_pattern"),OtherTok),(("Perl","subst_curlybrace_middle"),NormalTok),(("Perl","subst_curlybrace_replace"),StringTok),(("Perl","subst_curlybrace_replace_recursive"),StringTok),(("Perl","subst_paren_pattern"),OtherTok),(("Perl","subst_paren_replace"),StringTok),(("Perl","subst_bracket_pattern"),OtherTok),(("Perl","subst_bracket_replace"),StringTok),(("Perl","subst_slash_pattern"),OtherTok),(("Perl","subst_slash_replace"),StringTok),(("Perl","subst_sq_pattern"),OtherTok),(("Perl","subst_sq_replace"),StringTok),(("Perl","tr"),OtherTok),(("Perl","find_pattern"),OtherTok),(("Perl","pattern_slash"),OtherTok),(("Perl","pattern"),OtherTok),(("Perl","pattern_brace"),OtherTok),(("Perl","pattern_bracket"),OtherTok),(("Perl","pattern_paren"),OtherTok),(("Perl","pattern_sq"),OtherTok),(("Perl","regex_pattern_internal_rules_1"),NormalTok),(("Perl","regex_pattern_internal_rules_2"),NormalTok),(("Perl","regex_pattern_internal"),OtherTok),(("Perl","regex_pattern_internal_ip"),OtherTok),(("Perl","pat_ext"),CharTok),(("Perl","pat_char_class"),BaseNTok),(("Perl","find_variable"),DataTypeTok),(("Perl","find_variable_unsafe"),DataTypeTok),(("Perl","var_detect"),DataTypeTok),(("Perl","var_detect_unsafe"),DataTypeTok),(("Perl","var_detect_rules"),DataTypeTok),(("Perl","quote_word"),NormalTok),(("Perl","quote_word_paren"),NormalTok),(("Perl","quote_word_brace"),NormalTok),(("Perl","quote_word_bracket"),NormalTok),(("Perl","find_here_document"),NormalTok),(("Perl","here_document"),StringTok),(("Perl","here_document_dumb"),NormalTok),(("Perl","data_handle"),NormalTok),(("Perl","end_handle"),CommentTok),(("Perl","Backticked"),StringTok),(("Perl","slash_safe_escape"),NormalTok),(("Perl","package_qualified_blank"),NormalTok),(("Perl","sub_name_def"),NormalTok),(("Perl","sub_arg_definition"),NormalTok),(("Perl","pod"),CommentTok),(("Perl","comment"),CommentTok)] -parseRules "normal" =+parseRules ("Perl","normal") = (((pColumn 0 >> pRegExpr regex_'23'21'5c'2f'2e'2a >>= withAttribute KeywordTok)) <|>- ((pFirstNonSpace >> pString False "__DATA__" >>= withAttribute KeywordTok) >>~ pushContext "data_handle")+ ((pFirstNonSpace >> pString False "__DATA__" >>= withAttribute KeywordTok) >>~ pushContext ("Perl","data_handle")) <|> ((pFirstNonSpace >> pString False "__END__" >>= withAttribute KeywordTok)) <|>- ((pRegExpr regex_'5cbsub'5cs'2b >>= withAttribute KeywordTok) >>~ pushContext "sub_name_def")+ ((pRegExpr regex_'5cbsub'5cs'2b >>= withAttribute KeywordTok) >>~ pushContext ("Perl","sub_name_def")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|>@@ -226,57 +223,57 @@ <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_pragmas >>= withAttribute KeywordTok)) <|>- ((pColumn 0 >> pRegExpr regex_'5c'3d'28'3f'3ahead'5b1'2d6'5d'7cover'7cback'7citem'7cfor'7cbegin'7cend'7cpod'29'28'5cs'7c'24'29 >>= withAttribute CommentTok) >>~ pushContext "pod")+ ((pColumn 0 >> pRegExpr regex_'5c'3d'28'3f'3ahead'5b1'2d6'5d'7cover'7cback'7citem'7cfor'7cbegin'7cend'7cpod'29'28'5cs'7c'24'29 >>= withAttribute CommentTok) >>~ pushContext ("Perl","pod")) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("Perl","comment")) <|>- ((pHlCOct >>= withAttribute BaseNTok) >>~ pushContext "slash_safe_escape")+ ((pHlCOct >>= withAttribute BaseNTok) >>~ pushContext ("Perl","slash_safe_escape")) <|>- ((pHlCHex >>= withAttribute BaseNTok) >>~ pushContext "slash_safe_escape")+ ((pHlCHex >>= withAttribute BaseNTok) >>~ pushContext ("Perl","slash_safe_escape")) <|>- ((pFloat >>= withAttribute FloatTok) >>~ pushContext "slash_safe_escape")+ ((pFloat >>= withAttribute FloatTok) >>~ pushContext ("Perl","slash_safe_escape")) <|>- ((pInt >>= withAttribute DecValTok) >>~ pushContext "slash_safe_escape")+ ((pInt >>= withAttribute DecValTok) >>~ pushContext ("Perl","slash_safe_escape")) <|> ((pRegExpr regex_'5c'5c'28'5b'22'27'5d'29'5b'5e'5c1'5d >>= withAttribute NormalTok)) <|> ((pDetect2Chars False '&' '\'' >>= withAttribute NormalTok)) <|>- ((pDetectChar False '"' >>= withAttribute KeywordTok) >>~ pushContext "ip_string")+ ((pDetectChar False '"' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","ip_string")) <|>- ((pDetectChar False '\'' >>= withAttribute KeywordTok) >>~ pushContext "string")+ ((pDetectChar False '\'' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","string")) <|>- ((pDetectChar False '`' >>= withAttribute KeywordTok) >>~ pushContext "Backticked")+ ((pDetectChar False '`' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","Backticked")) <|>- ((lookAhead (pRegExpr regex_'28'3f'3a'5b'24'40'5d'5cS'7c'25'5b'5cw'7b'5d'7c'5c'2a'5b'5e'5cd'5c'2a'7b'5c'24'40'25'3d'28'5d'29) >> pushContext "find_variable" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'28'3f'3a'5b'24'40'5d'5cS'7c'25'5b'5cw'7b'5d'7c'5c'2a'5b'5e'5cd'5c'2a'7b'5c'24'40'25'3d'28'5d'29) >> pushContext ("Perl","find_variable") >> currentContext >>= parseRules)) <|> ((pRegExpr regex_'3c'5bA'2dZ0'2d9'5f'5d'2b'3e >>= withAttribute KeywordTok)) <|>- ((pRegExpr regex_'5cs'2a'3c'3c'28'3f'3d'5cw'2b'7c'5cs'2a'5b'22'27'5d'29 >>= withAttribute KeywordTok) >>~ pushContext "find_here_document")+ ((pRegExpr regex_'5cs'2a'3c'3c'28'3f'3d'5cw'2b'7c'5cs'2a'5b'22'27'5d'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","find_here_document")) <|> ((pRegExpr regex_'5cs'2a'5c'7d'5cs'2a'2f'7b1'2c2'7d >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5cs'2a'5b'29'5c'5d'5d'5cs'2a'2f'7b1'2c2'7d >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'5cw'2b'3a'3a >>= withAttribute FunctionTok) >>~ pushContext "sub_name_def")+ ((pRegExpr regex_'5cw'2b'3a'3a >>= withAttribute FunctionTok) >>~ pushContext ("Perl","sub_name_def")) <|> ((pRegExpr regex_'5cw'2b'5b'3d'5d >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'5cbq'28'3f'3d'5bqwx'5d'3f'5cs'2a'5b'5e'5cw'5cs'5d'29 >>= withAttribute KeywordTok) >>~ pushContext "find_quoted")+ ((pRegExpr regex_'5cbq'28'3f'3d'5bqwx'5d'3f'5cs'2a'5b'5e'5cw'5cs'5d'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","find_quoted")) <|>- ((pRegExpr regex_'5cbs'28'3f'3d'5cs'2a'5b'5e'5cw'5cs'5c'5d'7d'29'5d'29 >>= withAttribute KeywordTok) >>~ pushContext "find_subst")+ ((pRegExpr regex_'5cbs'28'3f'3d'5cs'2a'5b'5e'5cw'5cs'5c'5d'7d'29'5d'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","find_subst")) <|>- ((pRegExpr regex_'5cb'28'3f'3atr'7cy'29'5cs'2a'28'3f'3d'5b'5e'5cw'5cs'5c'5d'7d'29'5d'29 >>= withAttribute KeywordTok) >>~ pushContext "tr")+ ((pRegExpr regex_'5cb'28'3f'3atr'7cy'29'5cs'2a'28'3f'3d'5b'5e'5cw'5cs'5c'5d'7d'29'5d'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","tr")) <|>- ((pRegExpr regex_'5cb'28'3f'3am'7cqr'29'28'3f'3d'5cs'2a'5b'5e'5cw'5cs'5c'5d'7d'29'5d'29 >>= withAttribute KeywordTok) >>~ pushContext "find_pattern")+ ((pRegExpr regex_'5cb'28'3f'3am'7cqr'29'28'3f'3d'5cs'2a'5b'5e'5cw'5cs'5c'5d'7d'29'5d'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","find_pattern")) <|> ((pRegExpr regex_'5b'5cw'5f'5d'2b'5cs'2a'2f >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'5b'3c'3e'22'27'3a'5d'2f >>= withAttribute NormalTok)) <|>- ((pDetectChar False '/' >>= withAttribute KeywordTok) >>~ pushContext "pattern_slash")+ ((pDetectChar False '/' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","pattern_slash")) <|> ((pRegExpr regex_'2d'5brwxoRWXOeszfdlpSbctugkTBMAC'5d >>= withAttribute KeywordTok)) <|>@@ -284,99 +281,99 @@ <|> ((pDetectChar False '}' >>= withAttribute NormalTok))) -parseRules "find_quoted" =- (((pRegExpr regex_x'5cs'2a'28'27'29 >>= withAttribute KeywordTok) >>~ pushContext "string_6")+parseRules ("Perl","find_quoted") =+ (((pRegExpr regex_x'5cs'2a'28'27'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","string_6")) <|>- ((pAnyChar "qx" >>= withAttribute KeywordTok) >>~ pushContext "find_qqx")+ ((pAnyChar "qx" >>= withAttribute KeywordTok) >>~ pushContext ("Perl","find_qqx")) <|>- ((pDetectChar False 'w' >>= withAttribute KeywordTok) >>~ pushContext "find_qw")+ ((pDetectChar False 'w' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","find_qw")) <|>- ((pDetectChar False '(' >>= withAttribute KeywordTok) >>~ pushContext "string_2")+ ((pDetectChar False '(' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","string_2")) <|>- ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext "string_3")+ ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","string_3")) <|>- ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext "string_4")+ ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","string_4")) <|>- ((pDetectChar False '<' >>= withAttribute KeywordTok) >>~ pushContext "string_5")+ ((pDetectChar False '<' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","string_5")) <|>- ((pRegExpr regex_'28'5b'5ea'2dzA'2dZ0'2d9'5f'5cs'5b'5c'5d'7b'7d'28'29'5d'29 >>= withAttribute KeywordTok) >>~ pushContext "string_6")+ ((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))) -parseRules "find_qqx" =- (((pDetectChar False '(' >>= withAttribute KeywordTok) >>~ pushContext "ip_string_2")+parseRules ("Perl","find_qqx") =+ (((pDetectChar False '(' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","ip_string_2")) <|>- ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext "ip_string_3")+ ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","ip_string_3")) <|>- ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext "ip_string_4")+ ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","ip_string_4")) <|>- ((pDetectChar False '<' >>= withAttribute KeywordTok) >>~ pushContext "ip_string_5")+ ((pDetectChar False '<' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","ip_string_5")) <|>- ((pRegExpr regex_'28'5b'5ea'2dzA'2dZ0'2d9'5f'5cs'5b'5c'5d'7b'7d'28'29'5d'29 >>= withAttribute KeywordTok) >>~ pushContext "ip_string_6")+ ((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))) -parseRules "find_qw" =- (((pDetectChar False '(' >>= withAttribute KeywordTok) >>~ pushContext "quote_word_paren")+parseRules ("Perl","find_qw") =+ (((pDetectChar False '(' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","quote_word_paren")) <|>- ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext "quote_word_brace")+ ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","quote_word_brace")) <|>- ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext "quote_word_bracket")+ ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","quote_word_bracket")) <|>- ((pRegExpr regex_'28'5b'5ea'2dzA'2dZ0'2d9'5f'5cs'5b'5c'5d'7b'7d'28'29'5d'29 >>= withAttribute KeywordTok) >>~ pushContext "quote_word")+ ((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))) -parseRules "ipstring_internal" =+parseRules ("Perl","ipstring_internal") = (((pDetectIdentifier >>= withAttribute StringTok)) <|> ((pRegExpr regex_'5c'5c'5bUuLlEtnaefr'5d >>= withAttribute CharTok)) <|> ((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 "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))) -parseRules "ip_string" =+parseRules ("Perl","ip_string") = (((pDetectChar False '"' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "ipstring_internal")))+ ((parseRules ("Perl","ipstring_internal")))) -parseRules "ip_string_2" =+parseRules ("Perl","ip_string_2") = (((pRangeDetect '(' ')' >>= withAttribute StringTok)) <|> ((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)) <|>- ((parseRules "ipstring_internal")))+ ((parseRules ("Perl","ipstring_internal")))) -parseRules "ip_string_3" =+parseRules ("Perl","ip_string_3") = (((pRangeDetect '{' '}' >>= withAttribute StringTok)) <|> ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)) <|>- ((parseRules "ipstring_internal")))+ ((parseRules ("Perl","ipstring_internal")))) -parseRules "ip_string_4" =+parseRules ("Perl","ip_string_4") = (((pRangeDetect '[' ']' >>= withAttribute StringTok)) <|> ((pDetectChar False ']' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)) <|>- ((parseRules "ipstring_internal")))+ ((parseRules ("Perl","ipstring_internal")))) -parseRules "ip_string_5" =+parseRules ("Perl","ip_string_5") = (((pRangeDetect '<' '>' >>= withAttribute StringTok)) <|> ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)) <|>- ((parseRules "ipstring_internal")))+ ((parseRules ("Perl","ipstring_internal")))) -parseRules "ip_string_6" =+parseRules ("Perl","ip_string_6") = (((pRegExprDynamic "\\%1" >>= withAttribute StringTok)) <|> ((pDetectChar True '1' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)) <|>- ((parseRules "ipstring_internal")))+ ((parseRules ("Perl","ipstring_internal")))) -parseRules "string" =+parseRules ("Perl","string") = (((pDetectIdentifier >>= withAttribute StringTok)) <|> ((pDetect2Chars False '\\' '\'' >>= withAttribute CharTok))@@ -385,7 +382,7 @@ <|> ((pDetectChar False '\'' >>= withAttribute KeywordTok) >>~ (popContext))) -parseRules "string_2" =+parseRules ("Perl","string_2") = (((pDetectIdentifier >>= withAttribute StringTok)) <|> ((pDetect2Chars False '\\' ')' >>= withAttribute CharTok))@@ -396,7 +393,7 @@ <|> ((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))) -parseRules "string_3" =+parseRules ("Perl","string_3") = (((pDetectIdentifier >>= withAttribute StringTok)) <|> ((pDetect2Chars False '\\' '}' >>= withAttribute CharTok))@@ -407,7 +404,7 @@ <|> ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))) -parseRules "string_4" =+parseRules ("Perl","string_4") = (((pDetectIdentifier >>= withAttribute StringTok)) <|> ((pDetect2Chars False '\\' ']' >>= withAttribute CharTok))@@ -418,7 +415,7 @@ <|> ((pDetectChar False ']' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))) -parseRules "string_5" =+parseRules ("Perl","string_5") = (((pDetectIdentifier >>= withAttribute StringTok)) <|> ((pDetect2Chars False '\\' '<' >>= withAttribute CharTok))@@ -431,7 +428,7 @@ <|> ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))) -parseRules "string_6" =+parseRules ("Perl","string_6") = (((pDetectIdentifier >>= withAttribute StringTok)) <|> ((pDetect2Chars False '\\' '\\' >>= withAttribute CharTok))@@ -440,96 +437,96 @@ <|> ((pDetectChar True '1' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))) -parseRules "find_subst" =+parseRules ("Perl","find_subst") = (((pRegExpr regex_'5cs'2b'23'2e'2a >>= withAttribute CommentTok)) <|>- ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext "subst_curlybrace_pattern")+ ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_curlybrace_pattern")) <|>- ((pDetectChar False '(' >>= withAttribute KeywordTok) >>~ pushContext "subst_paren_pattern")+ ((pDetectChar False '(' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_paren_pattern")) <|>- ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext "subst_bracket_pattern")+ ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_bracket_pattern")) <|>- ((pDetectChar False '\'' >>= withAttribute KeywordTok) >>~ pushContext "subst_sq_pattern")+ ((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 "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"))) -parseRules "subst_curlybrace_pattern" =+parseRules ("Perl","subst_curlybrace_pattern") = (((pRegExpr regex_'5cs'2b'23'2e'2a'24 >>= withAttribute CommentTok)) <|>- ((parseRules "regex_pattern_internal_ip"))+ ((parseRules ("Perl","regex_pattern_internal_ip"))) <|>- ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ pushContext "subst_curlybrace_middle"))+ ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_curlybrace_middle"))) -parseRules "subst_curlybrace_middle" =+parseRules ("Perl","subst_curlybrace_middle") = (((pRegExpr regex_'23'2e'2a'24 >>= withAttribute CommentTok)) <|>- ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext "subst_curlybrace_replace"))+ ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_curlybrace_replace"))) -parseRules "subst_curlybrace_replace" =- (((parseRules "ipstring_internal"))+parseRules ("Perl","subst_curlybrace_replace") =+ (((parseRules ("Perl","ipstring_internal"))) <|>- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "subst_curlybrace_replace_recursive")+ ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("Perl","subst_curlybrace_replace_recursive")) <|> ((pRegExpr regex_'5c'7d'5bcegimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext >> popContext))) -parseRules "subst_curlybrace_replace_recursive" =- (((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "subst_curlybrace_replace_recursive")+parseRules ("Perl","subst_curlybrace_replace_recursive") =+ (((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Perl","subst_curlybrace_replace_recursive")) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "ipstring_internal")))+ ((parseRules ("Perl","ipstring_internal")))) -parseRules "subst_paren_pattern" =+parseRules ("Perl","subst_paren_pattern") = (((pRegExpr regex_'5cs'2b'23'2e'2a'24 >>= withAttribute CommentTok)) <|>- ((parseRules "regex_pattern_internal_ip"))+ ((parseRules ("Perl","regex_pattern_internal_ip"))) <|>- ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ pushContext "subst_paren_replace"))+ ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_paren_replace"))) -parseRules "subst_paren_replace" =- (((parseRules "ipstring_internal"))+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))) -parseRules "subst_bracket_pattern" =+parseRules ("Perl","subst_bracket_pattern") = (((pRegExpr regex_'5cs'2b'23'2e'2a'24 >>= withAttribute CommentTok)) <|>- ((parseRules "regex_pattern_internal_ip"))+ ((parseRules ("Perl","regex_pattern_internal_ip"))) <|>- ((pDetectChar False ']' >>= withAttribute KeywordTok) >>~ pushContext "subst_bracket_replace"))+ ((pDetectChar False ']' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_bracket_replace"))) -parseRules "subst_bracket_replace" =- (((parseRules "ipstring_internal"))+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))) -parseRules "subst_slash_pattern" =+parseRules ("Perl","subst_slash_pattern") = (((pRegExprDynamic "\\$(?=%1)" >>= withAttribute CharTok)) <|>- ((pRegExprDynamic "(%1)" >>= withAttribute KeywordTok) >>~ pushContext "subst_slash_replace")+ ((pRegExprDynamic "(%1)" >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_slash_replace")) <|>- ((parseRules "regex_pattern_internal_ip")))+ ((parseRules ("Perl","regex_pattern_internal_ip")))) -parseRules "subst_slash_replace" =+parseRules ("Perl","subst_slash_replace") = (((pRegExprDynamic "%1[cegimosx]*" >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)) <|>- ((parseRules "ipstring_internal")))+ ((parseRules ("Perl","ipstring_internal")))) -parseRules "subst_sq_pattern" =+parseRules ("Perl","subst_sq_pattern") = (((pRegExpr regex_'5cs'2b'23'2e'2a'24 >>= withAttribute CommentTok)) <|>- ((parseRules "regex_pattern_internal"))+ ((parseRules ("Perl","regex_pattern_internal"))) <|>- ((pDetectChar False '\'' >>= withAttribute KeywordTok) >>~ pushContext "subst_sq_replace"))+ ((pDetectChar False '\'' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","subst_sq_replace"))) -parseRules "subst_sq_replace" =+parseRules ("Perl","subst_sq_replace") = ((pRegExpr regex_'27'5bcegimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)) -parseRules "tr" =+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)) <|> ((pRegExpr regex_'7b'5b'5e'7d'5d'2a'5c'7d'5cs'2a'5c'7b'5b'5e'7d'5d'2a'5c'7d >>= withAttribute OtherTok) >>~ (popContext))@@ -540,56 +537,56 @@ <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "find_pattern" =+parseRules ("Perl","find_pattern") = (((pRegExpr regex_'5cs'2b'23'2e'2a >>= withAttribute CommentTok)) <|>- ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext "pattern_brace")+ ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","pattern_brace")) <|>- ((pDetectChar False '(' >>= withAttribute KeywordTok) >>~ pushContext "pattern_paren")+ ((pDetectChar False '(' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","pattern_paren")) <|>- ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext "pattern_bracket")+ ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","pattern_bracket")) <|>- ((pDetectChar False '\'' >>= withAttribute KeywordTok) >>~ pushContext "pattern_sq")+ ((pDetectChar False '\'' >>= withAttribute KeywordTok) >>~ pushContext ("Perl","pattern_sq")) <|>- ((pRegExpr regex_'28'5b'5e'5cw'5cs'5d'29 >>= withAttribute KeywordTok) >>~ pushContext "pattern"))+ ((pRegExpr regex_'28'5b'5e'5cw'5cs'5d'29 >>= withAttribute KeywordTok) >>~ pushContext ("Perl","pattern"))) -parseRules "pattern_slash" =+parseRules ("Perl","pattern_slash") = (((pRegExpr regex_'5c'24'28'3f'3d'2f'29 >>= withAttribute CharTok)) <|>- ((parseRules "regex_pattern_internal_ip"))+ ((parseRules ("Perl","regex_pattern_internal_ip"))) <|> ((pRegExpr regex_'2f'5bcgimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext))) -parseRules "pattern" =+parseRules ("Perl","pattern") = (((pRegExprDynamic "\\$(?=%1)" >>= withAttribute CharTok)) <|> ((pRegExprDynamic "%1[cgimosx]*" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((parseRules "regex_pattern_internal_ip"))+ ((parseRules ("Perl","regex_pattern_internal_ip"))) <|> ((pRegExprDynamic "\\$(?=\\%1)" >>= withAttribute CharTok))) -parseRules "pattern_brace" =+parseRules ("Perl","pattern_brace") = (((pRegExpr regex_'5c'7d'5bcgimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((parseRules "regex_pattern_internal_ip")))+ ((parseRules ("Perl","regex_pattern_internal_ip")))) -parseRules "pattern_bracket" =+parseRules ("Perl","pattern_bracket") = (((pRegExpr regex_'5c'5d'5bcgimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((parseRules "regex_pattern_internal_ip")))+ ((parseRules ("Perl","regex_pattern_internal_ip")))) -parseRules "pattern_paren" =+parseRules ("Perl","pattern_paren") = (((pRegExpr regex_'5c'29'5bcgimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((parseRules "regex_pattern_internal_ip")))+ ((parseRules ("Perl","regex_pattern_internal_ip")))) -parseRules "pattern_sq" =+parseRules ("Perl","pattern_sq") = (((pRegExpr regex_'27'5bcgimosx'5d'2a >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((parseRules "regex_pattern_internal")))+ ((parseRules ("Perl","regex_pattern_internal")))) -parseRules "regex_pattern_internal_rules_1" =+parseRules ("Perl","regex_pattern_internal_rules_1") = (((pFirstNonSpace >> pRegExpr regex_'23'2e'2a'24 >>= withAttribute CommentTok)) <|> ((pRegExpr regex_'5c'5c'5banDdSsWw'5d >>= withAttribute BaseNTok))@@ -600,10 +597,10 @@ <|> ((pRegExpr regex_'5c'5c'2e >>= withAttribute OtherTok))) -parseRules "regex_pattern_internal_rules_2" =- (((pDetect2Chars False '(' '?' >>= withAttribute CharTok) >>~ pushContext "pat_ext")+parseRules ("Perl","regex_pattern_internal_rules_2") =+ (((pDetect2Chars False '(' '?' >>= withAttribute CharTok) >>~ pushContext ("Perl","pat_ext")) <|>- ((pDetectChar False '[' >>= withAttribute CharTok) >>~ pushContext "pat_char_class")+ ((pDetectChar False '[' >>= withAttribute CharTok) >>~ pushContext ("Perl","pat_char_class")) <|> ((pRegExpr regex_'5b'28'29'3f'5c'5e'2a'2b'7c'5d >>= withAttribute CharTok)) <|>@@ -613,26 +610,26 @@ <|> ((pRegExpr regex_'5cs'7b3'2c'7d'23'2e'2a'24 >>= withAttribute CommentTok))) -parseRules "regex_pattern_internal" =- (((parseRules "regex_pattern_internal_rules_1"))+parseRules ("Perl","regex_pattern_internal") =+ (((parseRules ("Perl","regex_pattern_internal_rules_1"))) <|>- ((parseRules "regex_pattern_internal_rules_2")))+ ((parseRules ("Perl","regex_pattern_internal_rules_2")))) -parseRules "regex_pattern_internal_ip" =- (((parseRules "regex_pattern_internal_rules_1"))+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 "find_variable_unsafe" >> currentContext >>= parseRules))+ ((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 "regex_pattern_internal_rules_2")))+ ((parseRules ("Perl","regex_pattern_internal_rules_2")))) -parseRules "pat_ext" =+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))) -parseRules "pat_char_class" =+parseRules ("Perl","pat_char_class") = (((pDetectChar False '^' >>= withAttribute CharTok)) <|> ((pDetect2Chars False '\\' '\\' >>= withAttribute BaseNTok))@@ -643,26 +640,26 @@ <|> ((pDetectChar False ']' >>= withAttribute CharTok) >>~ (popContext))) -parseRules "find_variable" =- (((pRegExpr regex_'5c'24'5b0'2d9'5d'2b >>= withAttribute DataTypeTok) >>~ pushContext "var_detect")+parseRules ("Perl","find_variable") =+ (((pRegExpr regex_'5c'24'5b0'2d9'5d'2b >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect")) <|>- ((pRegExpr regex_'5b'40'5c'24'5d'28'3f'3a'5b'5c'2b'5c'2d'5f'5d'5cB'7cARGV'5cb'7cINC'5cb'29 >>= withAttribute DataTypeTok) >>~ pushContext "var_detect")+ ((pRegExpr regex_'5b'40'5c'24'5d'28'3f'3a'5b'5c'2b'5c'2d'5f'5d'5cB'7cARGV'5cb'7cINC'5cb'29 >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect")) <|>- ((pRegExpr regex_'5b'25'5c'24'5d'28'3f'3aINC'5cb'7cENV'5cb'7cSIG'5cb'29 >>= withAttribute DataTypeTok) >>~ pushContext "var_detect")+ ((pRegExpr regex_'5b'25'5c'24'5d'28'3f'3aINC'5cb'7cENV'5cb'7cSIG'5cb'29 >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect")) <|>- ((pRegExpr regex_'5c'24'5c'24'5b'5c'24'5cw'5f'5d >>= withAttribute DataTypeTok) >>~ pushContext "var_detect")+ ((pRegExpr regex_'5c'24'5c'24'5b'5c'24'5cw'5f'5d >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect")) <|>- ((pRegExpr regex_'5c'24'5b'23'5f'5d'5b'5cw'5f'5d >>= withAttribute DataTypeTok) >>~ pushContext "var_detect")+ ((pRegExpr regex_'5c'24'5b'23'5f'5d'5b'5cw'5f'5d >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect")) <|>- ((pRegExpr regex_'5c'24'2b'3a'3a >>= withAttribute DataTypeTok) >>~ pushContext "var_detect")+ ((pRegExpr regex_'5c'24'2b'3a'3a >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect")) <|>- ((pRegExpr regex_'5c'24'5b'5ea'2dzA'2dZ0'2d9'5cs'7b'5d'5bA'2dZ'5d'3f >>= withAttribute DataTypeTok) >>~ pushContext "var_detect")+ ((pRegExpr regex_'5c'24'5b'5ea'2dzA'2dZ0'2d9'5cs'7b'5d'5bA'2dZ'5d'3f >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect")) <|>- ((pRegExpr regex_'5b'5c'24'40'25'5d'5c'7b'5b'5cw'5f'5d'2b'5c'7d >>= withAttribute DataTypeTok) >>~ pushContext "var_detect")+ ((pRegExpr regex_'5b'5c'24'40'25'5d'5c'7b'5b'5cw'5f'5d'2b'5c'7d >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect")) <|>- ((pAnyChar "$@%" >>= withAttribute DataTypeTok) >>~ pushContext "var_detect")+ ((pAnyChar "$@%" >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect")) <|>- ((pRegExpr regex_'5c'2a'5ba'2dzA'2dZ'5f'5d'2b >>= withAttribute DataTypeTok) >>~ pushContext "var_detect")+ ((pRegExpr regex_'5c'2a'5ba'2dzA'2dZ'5f'5d'2b >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect")) <|> ((pRegExpr regex_'5c'2a'5b'5ea'2dzA'2dZ0'2d9'5cs'7b'5d'5bA'2dZ'5d'3f >>= withAttribute DataTypeTok)) <|>@@ -670,44 +667,44 @@ <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "find_variable_unsafe" =- (((pRegExpr regex_'5c'24'5b0'2d9'5d'2b >>= withAttribute DataTypeTok) >>~ pushContext "var_detect_unsafe")+parseRules ("Perl","find_variable_unsafe") =+ (((pRegExpr regex_'5c'24'5b0'2d9'5d'2b >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect_unsafe")) <|>- ((pRegExpr regex_'5b'40'5c'24'5d'28'3f'3a'5b'5c'2b'5c'2d'5f'5d'5cB'7cARGV'5cb'7cINC'5cb'29 >>= withAttribute DataTypeTok) >>~ pushContext "var_detect_unsafe")+ ((pRegExpr regex_'5b'40'5c'24'5d'28'3f'3a'5b'5c'2b'5c'2d'5f'5d'5cB'7cARGV'5cb'7cINC'5cb'29 >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect_unsafe")) <|>- ((pRegExpr regex_'5b'25'5c'24'5d'28'3f'3aINC'5cb'7cENV'5cb'7cSIG'5cb'29 >>= withAttribute DataTypeTok) >>~ pushContext "var_detect_unsafe")+ ((pRegExpr regex_'5b'25'5c'24'5d'28'3f'3aINC'5cb'7cENV'5cb'7cSIG'5cb'29 >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect_unsafe")) <|>- ((pRegExpr regex_'5c'24'5c'24'5b'5c'24'5cw'5f'5d >>= withAttribute DataTypeTok) >>~ pushContext "var_detect_unsafe")+ ((pRegExpr regex_'5c'24'5c'24'5b'5c'24'5cw'5f'5d >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect_unsafe")) <|>- ((pRegExpr regex_'5c'24'5b'23'5f'5d'5b'5cw'5f'5d >>= withAttribute DataTypeTok) >>~ pushContext "var_detect_unsafe")+ ((pRegExpr regex_'5c'24'5b'23'5f'5d'5b'5cw'5f'5d >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect_unsafe")) <|>- ((pRegExpr regex_'5c'24'2b'3a'3a >>= withAttribute DataTypeTok) >>~ pushContext "var_detect_unsafe")+ ((pRegExpr regex_'5c'24'2b'3a'3a >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect_unsafe")) <|> ((pRegExpr regex_'5c'24'5b'5ea'2dzA'2dZ0'2d9'5cs'7b'5d'5bA'2dZ'5d'3f >>= withAttribute DataTypeTok)) <|>- ((pRegExpr regex_'5b'5c'24'40'25'5d'5c'7b'5b'5cw'5f'5d'2b'5c'7d >>= withAttribute DataTypeTok) >>~ pushContext "var_detect_unsafe")+ ((pRegExpr regex_'5b'5c'24'40'25'5d'5c'7b'5b'5cw'5f'5d'2b'5c'7d >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect_unsafe")) <|>- ((pRegExpr regex_'5b'5c'24'40'25'5d >>= withAttribute DataTypeTok) >>~ pushContext "var_detect_unsafe")+ ((pRegExpr regex_'5b'5c'24'40'25'5d >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect_unsafe")) <|>- ((pRegExpr regex_'5c'2a'5cw'2b >>= withAttribute DataTypeTok) >>~ pushContext "var_detect_unsafe")+ ((pRegExpr regex_'5c'2a'5cw'2b >>= withAttribute DataTypeTok) >>~ pushContext ("Perl","var_detect_unsafe")) <|> ((pAnyChar "$@%*" >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "var_detect" =- (((parseRules "var_detect_rules"))+parseRules ("Perl","var_detect") =+ (((parseRules ("Perl","var_detect_rules"))) <|>- ((parseRules "slash_safe_escape"))+ ((parseRules ("Perl","slash_safe_escape"))) <|> ((popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "var_detect_unsafe" =- (((parseRules "var_detect_rules"))+parseRules ("Perl","var_detect_unsafe") =+ (((parseRules ("Perl","var_detect_rules"))) <|> ((popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "var_detect_rules" =+parseRules ("Perl","var_detect_rules") = (((pRegExpr regex_'5b'5cw'5f'5d'2b >>= withAttribute DataTypeTok)) <|> ((pDetect2Chars False ':' ':' >>= withAttribute NormalTok))@@ -720,7 +717,7 @@ <|> ((pDetect2Chars False '-' '-' >>= withAttribute NormalTok))) -parseRules "quote_word" =+parseRules ("Perl","quote_word") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pDetectIdentifier >>= withAttribute NormalTok))@@ -729,7 +726,7 @@ <|> ((pDetectChar True '1' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))) -parseRules "quote_word_paren" =+parseRules ("Perl","quote_word_paren") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pDetectIdentifier >>= withAttribute NormalTok))@@ -738,7 +735,7 @@ <|> ((pDetectChar False ')' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))) -parseRules "quote_word_brace" =+parseRules ("Perl","quote_word_brace") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pDetectIdentifier >>= withAttribute NormalTok))@@ -747,7 +744,7 @@ <|> ((pDetectChar False '}' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))) -parseRules "quote_word_bracket" =+parseRules ("Perl","quote_word_bracket") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pDetectIdentifier >>= withAttribute NormalTok))@@ -756,47 +753,47 @@ <|> ((pDetectChar False ']' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext))) -parseRules "find_here_document" =- (((pRegExpr regex_'28'5cw'2b'29'5cs'2a'3b'3f >>= withAttribute KeywordTok) >>~ pushContext "here_document")+parseRules ("Perl","find_here_document") =+ (((pRegExpr regex_'28'5cw'2b'29'5cs'2a'3b'3f >>= withAttribute KeywordTok) >>~ pushContext ("Perl","here_document")) <|>- ((pRegExpr regex_'5cs'2a'22'28'5b'5e'22'5d'2b'29'22'5cs'2a'3b'3f >>= withAttribute KeywordTok) >>~ pushContext "here_document")+ ((pRegExpr regex_'5cs'2a'22'28'5b'5e'22'5d'2b'29'22'5cs'2a'3b'3f >>= withAttribute KeywordTok) >>~ pushContext ("Perl","here_document")) <|>- ((pRegExpr regex_'5cs'2a'60'28'5b'5e'60'5d'2b'29'60'5cs'2a'3b'3f >>= withAttribute KeywordTok) >>~ pushContext "here_document")+ ((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 "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"))) -parseRules "here_document" =+parseRules ("Perl","here_document") = (((pDetectSpaces >>= withAttribute StringTok)) <|> ((pColumn 0 >> pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((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 "here_document")+ ((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 "ipstring_internal")))+ ((parseRules ("Perl","ipstring_internal")))) -parseRules "here_document_dumb" =+parseRules ("Perl","here_document_dumb") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pColumn 0 >> pRegExprDynamic "%1" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|> ((pDetectIdentifier >>= withAttribute NormalTok))) -parseRules "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 "pod")+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 "normal"))+ ((pFirstNonSpace >> pString False "__END__" >>= withAttribute KeywordTok) >>~ pushContext ("Perl","normal"))) -parseRules "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 "pod")+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 "data_handle"))+ ((pFirstNonSpace >> pString False "__DATA__" >>= withAttribute KeywordTok) >>~ pushContext ("Perl","data_handle"))) -parseRules "Backticked" =- (((parseRules "ipstring_internal"))+parseRules ("Perl","Backticked") =+ (((parseRules ("Perl","ipstring_internal"))) <|> ((pDetectChar False '`' >>= withAttribute KeywordTok) >>~ (popContext))) -parseRules "slash_safe_escape" =+parseRules ("Perl","slash_safe_escape") = (((pRegExpr regex_'5cs'2a'5c'7d'5cs'2a'2f'7b1'2c2'7d >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pRegExpr regex_'5cs'2a'5b'29'5c'5d'5d'3f'5cs'2a'2f'7b1'2c2'7d >>= withAttribute NormalTok) >>~ (popContext))@@ -805,30 +802,30 @@ <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "package_qualified_blank" =+parseRules ("Perl","package_qualified_blank") = ((pRegExpr regex_'5b'5cw'5f'5d'2b >>= withAttribute NormalTok) >>~ (popContext)) -parseRules "sub_name_def" =+parseRules ("Perl","sub_name_def") = (((pRegExpr regex_'5cw'2b >>= withAttribute FunctionTok)) <|>- ((lookAhead (pRegExpr regex_'5c'24'5cS) >> pushContext "find_variable" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'5c'24'5cS) >> pushContext ("Perl","find_variable") >> currentContext >>= parseRules)) <|>- ((pRegExpr regex_'5cs'2a'5c'28 >>= withAttribute NormalTok) >>~ pushContext "sub_arg_definition")+ ((pRegExpr regex_'5cs'2a'5c'28 >>= withAttribute NormalTok) >>~ pushContext ("Perl","sub_arg_definition")) <|> ((pDetect2Chars False ':' ':' >>= withAttribute NormalTok)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "sub_arg_definition" =+parseRules ("Perl","sub_arg_definition") = (((pAnyChar "*$@%" >>= withAttribute DataTypeTok)) <|> ((pAnyChar "&\\[];" >>= withAttribute NormalTok)) <|>- ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ pushContext "slash_safe_escape")+ ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ pushContext ("Perl","slash_safe_escape")) <|> ((popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "pod" =+parseRules ("Perl","pod") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pDetectIdentifier >>= withAttribute CommentTok))@@ -837,13 +834,13 @@ <|> ((pColumn 0 >> pRegExpr regex_'5c'3dcut'2e'2a'24 >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "comment" =+parseRules ("Perl","comment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "" = parseRules "normal"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Php.hs view
@@ -13,7 +13,6 @@ import qualified Text.Highlighting.Kate.Syntax.SqlMysql import qualified Text.Highlighting.Kate.Syntax.Javascript import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -32,42 +31,44 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "PHP/PHP" }- context <- currentContext <|> (pushContext "start" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("PHP/PHP",["start"])], synStLanguage = "PHP/PHP", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("PHP/PHP","start")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "start" -> return ()- "phpsource" -> return ()- "ternary" -> return ()- "case" -> return ()- "onelinecomment" -> (popContext) >> pEndLine- "twolinecomment" -> return ()- "doublebackquotestringcommon" -> return ()- "backquotestring" -> return ()- "doublequotestring" -> return ()- "singlequotestring" -> return ()- "htmlheredoc" -> return ()- "cssheredoc" -> return ()- "mysqlheredoc" -> return ()- "javascriptheredoc" -> return ()- "heredoc" -> return ()- "commonheredoc" -> return ()+ ("PHP/PHP","start") -> return ()+ ("PHP/PHP","phpsource") -> return ()+ ("PHP/PHP","ternary") -> return ()+ ("PHP/PHP","case") -> return ()+ ("PHP/PHP","onelinecomment") -> (popContext) >> pEndLine+ ("PHP/PHP","twolinecomment") -> return ()+ ("PHP/PHP","doublebackquotestringcommon") -> return ()+ ("PHP/PHP","backquotestring") -> return ()+ ("PHP/PHP","doublequotestring") -> return ()+ ("PHP/PHP","singlequotestring") -> return ()+ ("PHP/PHP","htmlheredoc") -> return ()+ ("PHP/PHP","cssheredoc") -> return ()+ ("PHP/PHP","mysqlheredoc") -> return ()+ ("PHP/PHP","javascriptheredoc") -> return ()+ ("PHP/PHP","heredoc") -> return ()+ ("PHP/PHP","commonheredoc") -> return () _ -> return () withAttribute attr txt = do@@ -76,10 +77,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_control_structures = Set.fromList $ words $ "as case default if else elseif while do for foreach break continue switch declare return require include require_once include_once endif endwhile endfor endforeach endswitch" list_keywords = Set.fromList $ words $ "abstract catch class clone const exception extends final function global implements instanceof interface new self static parent private protected public throw try and or xor var namespace use" list_constants = Set.fromList $ words $ "__line__ __file__ __dir__ __function__ __class__ __method__ __namespace__ __compiler_halt_offset__ abday_1 abday_2 abday_3 abday_4 abday_5 abday_6 abday_7 abmon_1 abmon_10 abmon_11 abmon_12 abmon_2 abmon_3 abmon_4 abmon_5 abmon_6 abmon_7 abmon_8 abmon_9 af_inet af_inet6 af_unix alt_digits am_str assert_active assert_bail assert_callback assert_quiet_eval assert_warning cal_dow_dayno cal_dow_long cal_dow_short cal_easter_always_gregorian cal_easter_always_julian cal_easter_default cal_easter_roman cal_french cal_gregorian cal_jewish cal_jewish_add_alafim cal_jewish_add_alafim_geresh cal_jewish_add_gereshayim cal_julian cal_month_french cal_month_gregorian_long cal_month_gregorian_short cal_month_jewish cal_month_julian_long cal_month_julian_short cal_num_cals case_lower case_upper char_max cit_call_tostring cit_catch_get_child cl_expunge codeset connection_aborted connection_normal connection_timeout count_normal count_recursive cp_move cp_uid credits_all credits_docs credits_fullpage credits_general credits_group credits_modules credits_qa credits_sapi crncystr crypt_blowfish crypt_ext_des crypt_md5 crypt_salt_length crypt_std_des curlauth_any curlauth_anysafe curlauth_basic curlauth_digest curlauth_gssnegotiate curlauth_ntlm curlclosepolicy_callback curlclosepolicy_least_recently_used curlclosepolicy_least_traffic curlclosepolicy_oldest curlclosepolicy_slowest curle_aborted_by_callback curle_bad_calling_order curle_bad_content_encoding curle_bad_function_argument curle_bad_password_entered curle_couldnt_connect curle_couldnt_resolve_host curle_couldnt_resolve_proxy curle_failed_init curle_file_couldnt_read_file curle_ftp_access_denied curle_ftp_bad_download_resume curle_ftp_cant_get_host curle_ftp_cant_reconnect curle_ftp_couldnt_get_size curle_ftp_couldnt_retr_file curle_ftp_couldnt_set_ascii curle_ftp_couldnt_set_binary curle_ftp_couldnt_stor_file curle_ftp_couldnt_use_rest curle_ftp_port_failed curle_ftp_quote_error curle_ftp_user_password_incorrect curle_ftp_weird_227_format curle_ftp_weird_pass_reply curle_ftp_weird_pasv_reply curle_ftp_weird_server_reply curle_ftp_weird_user_reply curle_ftp_write_error curle_function_not_found curle_got_nothing curle_http_not_found curle_http_port_failed curle_http_post_error curle_http_range_error curle_ldap_cannot_bind curle_ldap_search_failed curle_library_not_found curle_malformat_user curle_obsolete curle_ok curle_operation_timeouted curle_out_of_memory curle_partial_file curle_read_error curle_recv_error curle_send_error curle_share_in_use curle_ssl_cacert curle_ssl_certproblem curle_ssl_cipher curle_ssl_connect_error curle_ssl_engine_notfound curle_ssl_engine_setfailed curle_ssl_peer_certificate curle_telnet_option_syntax curle_too_many_redirects curle_unknown_telnet_option curle_unsupported_protocol curle_url_malformat curle_url_malformat_user curle_write_error curlinfo_connect_time curlinfo_content_length_download curlinfo_content_length_upload curlinfo_content_type curlinfo_effective_url curlinfo_filetime curlinfo_header_out curlinfo_header_size curlinfo_http_code curlinfo_namelookup_time curlinfo_pretransfer_time curlinfo_redirect_count curlinfo_redirect_time curlinfo_request_size curlinfo_size_download curlinfo_size_upload curlinfo_speed_download curlinfo_speed_upload curlinfo_ssl_verifyresult curlinfo_starttransfer_time curlinfo_total_time curlmsg_done curlm_bad_easy_handle curlm_bad_handle curlm_call_multi_perform curlm_internal_error curlm_ok curlm_out_of_memory curlopt_binarytransfer curlopt_buffersize curlopt_cainfo curlopt_capath curlopt_closepolicy curlopt_connecttimeout curlopt_cookie curlopt_cookiefile curlopt_cookiejar curlopt_crlf curlopt_customrequest curlopt_dns_cache_timeout curlopt_dns_use_global_cache curlopt_egdsocket curlopt_encoding curlopt_failonerror curlopt_file curlopt_filetime curlopt_followlocation curlopt_forbid_reuse curlopt_fresh_connect curlopt_ftpappend curlopt_ftpascii curlopt_ftplistonly curlopt_ftpport curlopt_ftp_use_eprt curlopt_ftp_use_epsv curlopt_header curlopt_headerfunction curlopt_http200aliases curlopt_httpauth curlopt_httpget curlopt_httpheader curlopt_httpproxytunnel curlopt_http_version curlopt_infile curlopt_infilesize curlopt_interface curlopt_krb4level curlopt_low_speed_limit curlopt_low_speed_time curlopt_maxconnects curlopt_maxredirs curlopt_mute curlopt_netrc curlopt_nobody curlopt_noprogress curlopt_nosignal curlopt_passwdfunction curlopt_port curlopt_post curlopt_postfields curlopt_postquote curlopt_proxy curlopt_proxyauth curlopt_proxyport curlopt_proxytype curlopt_proxyuserpwd curlopt_put curlopt_quote curlopt_random_file curlopt_range curlopt_readdata curlopt_readfunction curlopt_referer curlopt_resume_from curlopt_returntransfer curlopt_sslcert curlopt_sslcertpasswd curlopt_sslcerttype curlopt_sslengine curlopt_sslengine_default curlopt_sslkey curlopt_sslkeypasswd curlopt_sslkeytype curlopt_sslversion curlopt_ssl_cipher_list curlopt_ssl_verifyhost curlopt_ssl_verifypeer curlopt_stderr curlopt_timecondition curlopt_timeout curlopt_timevalue curlopt_transfertext curlopt_unrestricted_auth curlopt_upload curlopt_url curlopt_useragent curlopt_userpwd curlopt_verbose curlopt_writefunction curlopt_writeheader curlproxy_http curlproxy_socks5 curlversion_now curl_http_version_1_0 curl_http_version_1_1 curl_http_version_none curl_netrc_ignored curl_netrc_optional curl_netrc_required curl_timecond_ifmodsince curl_timecond_ifunmodsince curl_timecond_lastmod curl_version_ipv6 curl_version_kerberos4 curl_version_libz curl_version_ssl c_explicit_abstract c_final c_implicit_abstract date_atom date_cookie date_iso8601 date_rfc1036 date_rfc1123 date_rfc2822 date_rfc3339 date_rfc822 date_rfc850 date_rss date_w3c day_1 day_2 day_3 day_4 day_5 day_6 day_7 dbx_cmp_asc dbx_cmp_desc dbx_cmp_native dbx_cmp_number dbx_cmp_text dbx_colnames_lowercase dbx_colnames_unchanged dbx_colnames_uppercase dbx_fbsql dbx_mssql dbx_mysql dbx_oci8 dbx_odbc dbx_persistent dbx_pgsql dbx_result_assoc dbx_result_index dbx_result_info dbx_result_unbuffered dbx_sqlite dbx_sybasect default_include_path directory_separator dns_a dns_aaaa dns_all dns_any dns_cname dns_hinfo dns_mx dns_naptr dns_ns dns_ptr dns_soa dns_srv dns_txt domstring_size_err dom_hierarchy_request_err dom_index_size_err dom_inuse_attribute_err dom_invalid_access_err dom_invalid_character_err dom_invalid_modification_err dom_invalid_state_err dom_namespace_err dom_not_found_err dom_not_supported_err dom_no_data_allowed_err dom_no_modification_allowed_err dom_php_err dom_syntax_err dom_validation_err dom_wrong_document_err d_fmt d_t_fmt enc7bit enc8bit encbase64 encbinary encother encquotedprintable ent_compat ent_noquotes ent_quotes era era_d_fmt era_d_t_fmt era_t_fmt exif_use_mbstring extr_if_exists extr_overwrite extr_prefix_all extr_prefix_if_exists extr_prefix_invalid extr_prefix_same extr_refs extr_skip e_all e_compile_error e_compile_warning e_core_error e_core_warning e_deprecated e_error e_notice e_parse e_recoverable_error e_strict e_user_deprecated e_user_error e_user_notice e_user_warning e_warning false famacknowledge famchanged famcreated famdeleted famendexist famexists fammoved famstartexecuting famstopexecuting file_append file_ignore_new_lines file_no_default_context file_skip_empty_lines file_use_include_path fnm_casefold fnm_noescape fnm_pathname fnm_period force_deflate force_gzip ftp_ascii ftp_autoresume ftp_autoseek ftp_binary ftp_failed ftp_finished ftp_image ftp_moredata ftp_text ftp_timeout_sec ft_internal ft_not ft_peek ft_prefetchtext ft_uid f_dupfd f_getfd f_getfl f_getlk f_getown f_rdlck f_setfl f_setlk f_setlkw f_setown f_unlck f_wrlck gd_bundled glob_brace glob_mark glob_nocheck glob_noescape glob_nosort glob_onlydir gmp_round_minusinf gmp_round_plusinf gmp_round_zero hash_hmac html_entities html_specialchars iconv_impl iconv_mime_decode_continue_on_error iconv_mime_decode_strict iconv_version imagetype_bmp imagetype_gif imagetype_iff imagetype_jb2 imagetype_jp2 imagetype_jpc imagetype_jpeg imagetype_jpeg2000 imagetype_jpx imagetype_png imagetype_psd imagetype_swf imagetype_tiff_ii imagetype_tiff_mm imagetype_wbmp imagetype_xbm imap_closetimeout imap_opentimeout imap_readtimeout imap_writetimeout img_arc_chord img_arc_edged img_arc_nofill img_arc_pie img_arc_rounded img_color_brushed img_color_styled img_color_styledbrushed img_color_tiled img_color_transparent img_effect_alphablend img_effect_normal img_effect_overlay img_effect_replace img_filter_brightness img_filter_colorize img_filter_contrast img_filter_edgedetect img_filter_emboss img_filter_gaussian_blur img_filter_grayscale img_filter_mean_removal img_filter_negate img_filter_selective_blur img_filter_smooth img_gd2_compressed img_gd2_raw img_gif img_jpeg img_jpg img_png img_wbmp img_xpm inf info_all info_configuration info_credits info_environment info_general info_license info_modules info_variables ini_all ini_perdir ini_system ini_user latt_haschildren latt_hasnochildren latt_marked latt_noinferiors latt_noselect latt_referral latt_unmarked lc_all lc_collate lc_ctype lc_messages lc_monetary lc_numeric lc_time ldap_deref_always ldap_deref_finding ldap_deref_never ldap_deref_searching ldap_opt_client_controls ldap_opt_debug_level ldap_opt_deref ldap_opt_error_number ldap_opt_error_string ldap_opt_host_name ldap_opt_matched_dn ldap_opt_protocol_version ldap_opt_referrals ldap_opt_restart ldap_opt_server_controls ldap_opt_sizelimit ldap_opt_timelimit libxml_compact libxml_dotted_version libxml_dtdattr libxml_dtdload libxml_dtdvalid libxml_err_error libxml_err_fatal libxml_err_none libxml_err_warning libxml_noblanks libxml_nocdata libxml_noemptytag libxml_noent libxml_noerror libxml_nonet libxml_nowarning libxml_noxmldecl libxml_nsclean libxml_version libxml_xinclude lock_ex lock_nb lock_sh lock_un log_alert log_auth log_authpriv log_cons log_crit log_cron log_daemon log_debug log_emerg log_err log_info log_kern log_local0 log_local1 log_local2 log_local3 log_local4 log_local5 log_local6 log_local7 log_lpr log_mail log_ndelay log_news log_notice log_nowait log_odelay log_perror log_pid log_syslog log_user log_uucp log_warning mb_case_lower mb_case_title mb_case_upper mb_overload_mail mb_overload_regex mb_overload_string mcrypt_3des mcrypt_arcfour mcrypt_arcfour_iv mcrypt_blowfish mcrypt_blowfish_compat mcrypt_cast_128 mcrypt_cast_256 mcrypt_crypt mcrypt_decrypt mcrypt_des mcrypt_dev_random mcrypt_dev_urandom mcrypt_encrypt mcrypt_enigna mcrypt_gost mcrypt_idea mcrypt_loki97 mcrypt_mars mcrypt_mode_cbc mcrypt_mode_cfb mcrypt_mode_ecb mcrypt_mode_nofb mcrypt_mode_ofb mcrypt_mode_stream mcrypt_panama mcrypt_rand mcrypt_rc2 mcrypt_rc6 mcrypt_rijndael_128 mcrypt_rijndael_192 mcrypt_rijndael_256 mcrypt_safer128 mcrypt_safer64 mcrypt_saferplus mcrypt_serpent mcrypt_skipjack mcrypt_threeway mcrypt_tripledes mcrypt_twofish mcrypt_wake mcrypt_xtea mhash_adler32 mhash_crc32 mhash_crc32b mhash_gost mhash_haval128 mhash_haval160 mhash_haval192 mhash_haval224 mhash_haval256 mhash_md2 mhash_md4 mhash_md5 mhash_ripemd128 mhash_ripemd160 mhash_ripemd256 mhash_ripemd320 mhash_sha1 mhash_sha224 mhash_sha256 mhash_sha384 mhash_sha512 mhash_snefru128 mhash_snefru256 mhash_tiger mhash_tiger128 mhash_tiger160 mhash_whirlpool mon_1 mon_10 mon_11 mon_12 mon_2 mon_3 mon_4 mon_5 mon_6 mon_7 mon_8 mon_9 msg_dontroute msg_except msg_ipc_nowait msg_noerror msg_oob msg_peek msg_waitall mysqli_assoc mysqli_auto_increment_flag mysqli_blob_flag mysqli_both mysqli_client_compress mysqli_client_found_rows mysqli_client_ignore_space mysqli_client_interactive mysqli_client_no_schema mysqli_client_ssl mysqli_group_flag mysqli_init_command mysqli_multiple_key_flag mysqli_not_null_flag mysqli_no_data mysqli_num mysqli_num_flag mysqli_opt_connect_timeout mysqli_opt_local_infile mysqli_part_key_flag mysqli_pri_key_flag mysqli_read_default_file mysqli_read_default_group mysqli_report_all mysqli_report_error mysqli_report_index mysqli_report_off mysqli_report_strict mysqli_rpl_admin mysqli_rpl_master mysqli_rpl_slave mysqli_set_flag mysqli_stmt_attr_update_max_length mysqli_store_result mysqli_timestamp_flag mysqli_type_blob mysqli_type_char mysqli_type_date mysqli_type_datetime mysqli_type_decimal mysqli_type_double mysqli_type_enum mysqli_type_float mysqli_type_geometry mysqli_type_int24 mysqli_type_interval mysqli_type_long mysqli_type_longlong mysqli_type_long_blob mysqli_type_medium_blob mysqli_type_newdate mysqli_type_null mysqli_type_set mysqli_type_short mysqli_type_string mysqli_type_time mysqli_type_timestamp mysqli_type_tiny mysqli_type_tiny_blob mysqli_type_var_string mysqli_type_year mysqli_unique_key_flag mysqli_unsigned_flag mysqli_use_result mysqli_zerofill_flag mysql_assoc mysql_both mysql_client_compress mysql_client_ignore_space mysql_client_interactive mysql_client_ssl mysql_num m_1_pi m_2_pi m_2_sqrtpi m_abstract m_e m_final m_ln10 m_ln2 m_log10e m_log2e m_pi m_pi_2 m_pi_4 m_private m_protected m_public m_sqrt1_2 m_sqrt2 m_static nan ncurses_all_mouse_events ncurses_a_altcharset ncurses_a_blink ncurses_a_bold ncurses_a_chartext ncurses_a_dim ncurses_a_invis ncurses_a_normal ncurses_a_protect ncurses_a_reverse ncurses_a_standout ncurses_a_underline ncurses_button1_clicked ncurses_button1_double_clicked ncurses_button1_pressed ncurses_button1_released ncurses_button1_triple_clicked ncurses_button2_clicked ncurses_button2_double_clicked ncurses_button2_pressed ncurses_button2_released ncurses_button2_triple_clicked ncurses_button3_clicked ncurses_button3_double_clicked ncurses_button3_pressed ncurses_button3_released ncurses_button3_triple_clicked ncurses_button4_clicked ncurses_button4_double_clicked ncurses_button4_pressed ncurses_button4_released ncurses_button4_triple_clicked ncurses_button_alt ncurses_button_ctrl ncurses_button_shift ncurses_color_black ncurses_color_blue ncurses_color_cyan ncurses_color_green ncurses_color_magenta ncurses_color_red ncurses_color_white ncurses_color_yellow ncurses_key_a1 ncurses_key_a3 ncurses_key_b2 ncurses_key_backspace ncurses_key_beg ncurses_key_btab ncurses_key_c1 ncurses_key_c3 ncurses_key_cancel ncurses_key_catab ncurses_key_clear ncurses_key_close ncurses_key_command ncurses_key_copy ncurses_key_create ncurses_key_ctab ncurses_key_dc ncurses_key_dl ncurses_key_down ncurses_key_eic ncurses_key_end ncurses_key_enter ncurses_key_eol ncurses_key_eos ncurses_key_exit ncurses_key_f0 ncurses_key_f1 ncurses_key_f10 ncurses_key_f11 ncurses_key_f12 ncurses_key_f2 ncurses_key_f3 ncurses_key_f4 ncurses_key_f5 ncurses_key_f6 ncurses_key_f7 ncurses_key_f8 ncurses_key_f9 ncurses_key_find ncurses_key_help ncurses_key_ic ncurses_key_il ncurses_key_left ncurses_key_ll ncurses_key_mark ncurses_key_message ncurses_key_mouse ncurses_key_move ncurses_key_next ncurses_key_npage ncurses_key_open ncurses_key_options ncurses_key_ppage ncurses_key_previous ncurses_key_print ncurses_key_redo ncurses_key_reference ncurses_key_refresh ncurses_key_replace ncurses_key_reset ncurses_key_resize ncurses_key_restart ncurses_key_resume ncurses_key_right ncurses_key_save ncurses_key_sbeg ncurses_key_scancel ncurses_key_scommand ncurses_key_scopy ncurses_key_screate ncurses_key_sdc ncurses_key_sdl ncurses_key_select ncurses_key_send ncurses_key_seol ncurses_key_sexit ncurses_key_sf ncurses_key_sfind ncurses_key_shelp ncurses_key_shome ncurses_key_sic ncurses_key_sleft ncurses_key_smessage ncurses_key_smove ncurses_key_snext ncurses_key_soptions ncurses_key_sprevious ncurses_key_sprint ncurses_key_sr ncurses_key_sredo ncurses_key_sreplace ncurses_key_sreset ncurses_key_sright ncurses_key_srsume ncurses_key_ssave ncurses_key_ssuspend ncurses_key_stab ncurses_key_sundo ncurses_key_suspend ncurses_key_undo ncurses_key_up ncurses_report_mouse_position nil noexpr null oci_assoc oci_both oci_b_bfile oci_b_bin oci_b_blob oci_b_cfilee oci_b_clob oci_b_cursor oci_b_int oci_b_nty oci_b_num oci_b_rowid oci_commit_on_success oci_cred_ext oci_default oci_describe_only oci_dtype_file oci_dtype_lob oci_dtype_rowid oci_fetchstatement_by_column oci_fetchstatement_by_row oci_lob_buffer_free oci_no_auto_commit oci_num oci_return_lobs oci_return_nulls oci_seek_cur oci_seek_end oci_seek_set oci_sysdba oci_sysoper oci_temp_blob oci_temp_clob odbc_binmode_convert odbc_binmode_passthru odbc_binmode_return odbc_type openssl_algo_md2 openssl_algo_md4 openssl_algo_md5 openssl_algo_sha1 openssl_cipher_3des openssl_cipher_des openssl_cipher_rc2_128 openssl_cipher_rc2_40 openssl_cipher_rc2_64 openssl_keytype_dh openssl_keytype_dsa openssl_keytype_rsa openssl_no_padding openssl_pkcs1_oaep_padding openssl_pkcs1_padding openssl_sslv23_padding op_anonymous op_debug op_expunge op_halfopen op_prototype op_readonly op_secure op_shortcache op_silent o_append o_async o_creat o_excl o_ndelay o_noctty o_nonblock o_rdonly o_rdwr o_sync o_trunc o_wronly pathinfo_basename pathinfo_dirname pathinfo_extension pathinfo_filename path_separator pear_extension_dir pear_install_dir pgsql_assoc pgsql_bad_response pgsql_both pgsql_command_ok pgsql_connection_bad pgsql_connection_ok pgsql_connect_force_new pgsql_conv_force_null pgsql_conv_ignore_default pgsql_conv_ignore_not_null pgsql_copy_in pgsql_copy_out pgsql_dml_async pgsql_dml_exec pgsql_dml_no_conv pgsql_dml_string pgsql_empty_query pgsql_fatal_error pgsql_nonfatal_error pgsql_num pgsql_seek_cur pgsql_seek_end pgsql_seek_set pgsql_status_long pgsql_status_string pgsql_tuples_ok php_binary_read php_bindir php_config_file_path php_config_file_scan_dir php_datadir php_eol php_extension_dir php_libdir php_localstatedir php_normal_read php_os php_output_handler_cont php_output_handler_end php_output_handler_start php_prefix php_sapi php_shlib_suffix php_sysconfdir php_url_fragment php_url_host php_url_pass php_url_path php_url_port php_url_query php_url_scheme php_url_user php_version pkcs7_binary pkcs7_detached pkcs7_noattr pkcs7_nocerts pkcs7_nochain pkcs7_nointern pkcs7_nosigs pkcs7_noverify pkcs7_text pm_str preg_grep_invert preg_offset_capture preg_pattern_order preg_set_order preg_split_delim_capture preg_split_no_empty preg_split_offset_capture prio_pgrp prio_process prio_user psfs_err_fatal psfs_feed_me psfs_flag_flush_close psfs_flag_flush_inc psfs_flag_normal psfs_pass_on p_private p_protected p_public p_static radixchar rit_child_first rit_leaves_only rit_self_first sa_all sa_messages sa_recent sa_uidnext sa_uidvalidity sa_unseen seek_cur seek_end seek_set se_free se_noprefetch se_uid sigabrt sigalrm sigbaby sigbus sigchld sigcld sigcont sigfpe sighup sigill sigint sigio sigiot sigkill sigpipe sigpoll sigprof sigpwr sigquit sigsegv sigstkflt sigstop sigsys sigterm sigtrap sigtstp sigttin sigttou sigurg sigusr1 sigusr2 sigvtalrm sigwinch sigxcpu sigxfsz sig_dfl sig_err sig_ign snmp_bit_str snmp_counter snmp_counter64 snmp_integer snmp_ipaddress snmp_null snmp_object_id snmp_octet_str snmp_opaque snmp_timeticks snmp_uinteger snmp_unsigned snmp_value_library snmp_value_object snmp_value_plain soap_1_1 soap_1_2 soap_actor_next soap_actor_none soap_actor_unlimatereceiver soap_compression_accept soap_compression_deflate soap_compression_gzip soap_document soap_encoded soap_enc_array soap_enc_object soap_functions_all soap_literal soap_persistence_request soap_persistence_session soap_rpc socket_e2big socket_eacces socket_eaddrinuse socket_eaddrnotavail socket_eadv socket_eafnosupport socket_eagain socket_ealready socket_ebade socket_ebadf socket_ebadfd socket_ebadmsg socket_ebadr socket_ebadrqc socket_ebadslt socket_ebusy socket_echrng socket_ecomm socket_econnaborted socket_econnrefused socket_econnreset socket_edestaddrreq socket_edquot socket_eexist socket_efault socket_ehostdown socket_ehostunreach socket_eidrm socket_einprogress socket_eintr socket_einval socket_eio socket_eisconn socket_eisdir socket_eisnam socket_el2hlt socket_el2nsync socket_el3hlt socket_el3rst socket_elnrng socket_eloop socket_emediumtype socket_emfile socket_emlink socket_emsgsize socket_emultihop socket_enametoolong socket_enetdown socket_enetreset socket_enetunreach socket_enfile socket_enoano socket_enobufs socket_enocsi socket_enodata socket_enodev socket_enoent socket_enolck socket_enolink socket_enomedium socket_enomem socket_enomsg socket_enonet socket_enoprotoopt socket_enospc socket_enosr socket_enostr socket_enosys socket_enotblk socket_enotconn socket_enotdir socket_enotempty socket_enotsock socket_enotty socket_enotuniq socket_enxio socket_eopnotsupp socket_eperm socket_epfnosupport socket_epipe socket_eproto socket_eprotonosupport socket_eprototype socket_eremchg socket_eremote socket_eremoteio socket_erestart socket_erofs socket_eshutdown socket_esocktnosupport socket_espipe socket_esrmnt socket_estrpipe socket_etime socket_etimedout socket_etoomanyrefs socket_eunatch socket_eusers socket_ewouldblock socket_exdev socket_exfull sock_dgram sock_raw sock_rdm sock_seqpacket sock_stream sol_socket sol_tcp sol_udp somaxconn sortarrival sortcc sortdate sortfrom sortsize sortsubject sortto sort_asc sort_desc sort_locale_string sort_numeric sort_regular sort_string so_broadcast so_debug so_dontroute so_error so_free so_keepalive so_linger so_noserver so_oobinline so_rcvbuf so_rcvlowat so_rcvtimeo so_reuseaddr so_sndbuf so_sndlowat so_sndtimeo so_type sqlite3_assoc sqlite3_blob sqlite3_both sqlite3_float sqlite3_integer sqlite3_null sqlite3_num sqlite3_open_create sqlite3_open_readonly sqlite3_open_readwrite sqlite3_text sqlite_abort sqlite_assoc sqlite_auth sqlite_both sqlite_busy sqlite_cantopen sqlite_constraint sqlite_corrupt sqlite_done sqlite_empty sqlite_error sqlite_format sqlite_full sqlite_internal sqlite_interrupt sqlite_ioerr sqlite_locked sqlite_mismatch sqlite_misuse sqlite_nolfs sqlite_nomem sqlite_notfound sqlite_num sqlite_ok sqlite_perm sqlite_protocol sqlite_readonly sqlite_row sqlite_schema sqlite_toobig sqlt_afc sqlt_avc sqlt_bdouble sqlt_bfilee sqlt_bfloat sqlt_bin sqlt_blob sqlt_cfilee sqlt_chr sqlt_clob sqlt_flt sqlt_int sqlt_lbi sqlt_lng sqlt_lvc sqlt_nty sqlt_num sqlt_odt sqlt_rdd sqlt_rset sqlt_str sqlt_uin sqlt_vcs sql_bigint sql_binary sql_bit sql_char sql_concurrency sql_concur_lock sql_concur_read_only sql_concur_rowver sql_concur_values sql_cursor_dynamic sql_cursor_forward_only sql_cursor_keyset_driven sql_cursor_static sql_cursor_type sql_cur_use_driver sql_cur_use_if_needed sql_cur_use_odbc sql_date sql_decimal sql_double sql_fetch_first sql_fetch_next sql_float sql_integer sql_keyset_size sql_longvarbinary sql_longvarchar sql_numeric sql_odbc_cursors sql_real sql_smallint sql_time sql_timestamp sql_tinyint sql_varbinary sql_varchar stderr stdin stdout stream_client_async_connect stream_client_connect stream_client_persistent stream_enforce_safe_mode stream_filter_all stream_filter_read stream_filter_write stream_ignore_url stream_mkdir_recursive stream_must_seek stream_notify_auth_required stream_notify_auth_result stream_notify_completed stream_notify_connect stream_notify_failure stream_notify_file_size_is stream_notify_mime_type_is stream_notify_progress stream_notify_redirected stream_notify_resolve stream_notify_severity_err stream_notify_severity_info stream_notify_severity_warn stream_oob stream_peek stream_report_errors stream_server_bind stream_server_listen stream_url_stat_link stream_url_stat_quiet stream_use_path str_pad_both str_pad_left str_pad_right st_set st_silent st_uid sunfuncs_ret_double sunfuncs_ret_string sunfuncs_ret_timestamp s_irgrp s_iroth s_irusr s_irwxg s_irwxo s_irwxu s_iwgrp s_iwoth s_iwusr s_ixgrp s_ixoth s_ixusr thousep true typeapplication typeaudio typeimage typemessage typemodel typemultipart typeother typetext typevideo t_abstract t_and_equal t_array t_array_cast t_as t_bad_character t_boolean_and t_boolean_or t_bool_cast t_break t_case t_catch t_character t_class t_class_c t_clone t_close_tag t_comment t_concat_equal t_const t_constant_encapsed_string t_continue t_curly_open t_dec t_declare t_default t_div_equal t_dnumber t_do t_doc_comment t_dollar_open_curly_braces t_double_arrow t_double_cast t_double_colon t_echo t_else t_elseif t_empty t_encapsed_and_whitespace t_enddeclare t_endfor t_endforeach t_endif t_endswitch t_endwhile t_end_heredoc t_eval t_exit t_extends t_file t_final t_fmt t_fmt_ampm t_for t_foreach t_function t_func_c t_global t_if t_implements t_inc t_include t_include_once t_inline_html t_instanceof t_interface t_int_cast t_isset t_is_equal t_is_greater_or_equal t_is_identical t_is_not_equal t_is_not_identical t_is_smaller_or_equal t_line t_list t_lnumber t_logical_and t_logical_or t_logical_xor t_method_c t_minus_equal t_mod_equal t_mul_equal t_new t_num_string t_object_cast t_object_operator t_open_tag t_open_tag_with_echo t_or_equal t_paamayim_nekudotayim t_plus_equal t_print t_private t_protected t_public t_require t_require_once t_return t_sl t_sl_equal t_sr t_sr_equal t_start_heredoc t_static t_string t_string_cast t_string_varname t_switch t_throw t_try t_unset t_unset_cast t_use t_var t_variable t_while t_whitespace t_xor_equal unknown_type upload_err_cant_write upload_err_form_size upload_err_ini_size upload_err_no_file upload_err_no_tmp_dir upload_err_ok upload_err_partial wnohang wuntraced x509_purpose_any x509_purpose_crl_sign x509_purpose_ns_ssl_server x509_purpose_smime_encrypt x509_purpose_smime_sign x509_purpose_ssl_client x509_purpose_ssl_server xml_attribute_cdata xml_attribute_decl_node xml_attribute_entity xml_attribute_enumeration xml_attribute_id xml_attribute_idref xml_attribute_idrefs xml_attribute_nmtoken xml_attribute_nmtokens xml_attribute_node xml_attribute_notation xml_cdata_section_node xml_comment_node xml_document_frag_node xml_document_node xml_document_type_node xml_dtd_node xml_element_decl_node xml_element_node xml_entity_decl_node xml_entity_node xml_entity_ref_node xml_error_async_entity xml_error_attribute_external_entity_ref xml_error_bad_char_ref xml_error_binary_entity_ref xml_error_duplicate_attribute xml_error_external_entity_handling xml_error_incorrect_encoding xml_error_invalid_token xml_error_junk_after_doc_element xml_error_misplaced_xml_pi xml_error_none xml_error_no_elements xml_error_no_memory xml_error_param_entity_ref xml_error_partial_char xml_error_recursive_entity_ref xml_error_syntax xml_error_tag_mismatch xml_error_unclosed_cdata_section xml_error_unclosed_token xml_error_undefined_entity xml_error_unknown_encoding xml_html_document_node xml_local_namespace xml_namespace_decl_node xml_notation_node xml_option_case_folding xml_option_skip_tagstart xml_option_skip_white xml_option_target_encoding xml_pi_node xml_sax_impl xml_text_node xsd_1999_namespace xsd_1999_timeinstant xsd_anytype xsd_anyuri xsd_base64binary xsd_boolean xsd_byte xsd_date xsd_datetime xsd_decimal xsd_double xsd_duration xsd_entities xsd_entity xsd_float xsd_gday xsd_gmonth xsd_gmonthday xsd_gyear xsd_gyearmonth xsd_hexbinary xsd_id xsd_idref xsd_idrefs xsd_int xsd_integer xsd_language xsd_long xsd_name xsd_namespace xsd_ncname xsd_negativeinteger xsd_nmtoken xsd_nmtokens xsd_nonnegativeinteger xsd_nonpositiveinteger xsd_normalizedstring xsd_notation xsd_positiveinteger xsd_qname xsd_short xsd_string xsd_time xsd_token xsd_unsignedbyte xsd_unsignedint xsd_unsignedlong xsd_unsignedshort xsl_clone_always xsl_clone_auto xsl_clone_never yesexpr yperr_badargs yperr_baddb yperr_busy yperr_domain yperr_key yperr_map yperr_nodom yperr_nomore yperr_pmap yperr_resrc yperr_rpc yperr_vers yperr_ypbind yperr_yperr yperr_ypserv zend_thread_safe false null true"@@ -108,21 +105,21 @@ 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 = compileRegex "\\{\\$[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(\\[([0-9]*|\"[^\"]*\"|\\$[a-zA-Z]*)|'[^']*'|\\])*(->[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(\\[[a-zA-Z0-9_]*\\])*(\\[([0-9]*|\"[a-zA-Z_]*\")|'[a-zA-Z_]*'|\\])*)*\\}" 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 = compileRegex "\\{\\$[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(\\[([0-9]*|\"[a-zA-Z_]*\")|'[a-zA-Z_]*'|\\])*(->[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(\\[[a-zA-Z0-9_]*\\])*(\\[([0-9]*|\"[a-zA-Z_]*\")|'[a-zA-Z_]*'|\\])*)*\\}" -defaultAttributes = [("start",NormalTok),("phpsource",NormalTok),("ternary",NormalTok),("case",NormalTok),("onelinecomment",CommentTok),("twolinecomment",CommentTok),("doublebackquotestringcommon",StringTok),("backquotestring",StringTok),("doublequotestring",StringTok),("singlequotestring",StringTok),("htmlheredoc",NormalTok),("cssheredoc",NormalTok),("mysqlheredoc",NormalTok),("javascriptheredoc",NormalTok),("heredoc",StringTok),("commonheredoc",StringTok)]+defaultAttributes = [(("PHP/PHP","start"),NormalTok),(("PHP/PHP","phpsource"),NormalTok),(("PHP/PHP","ternary"),NormalTok),(("PHP/PHP","case"),NormalTok),(("PHP/PHP","onelinecomment"),CommentTok),(("PHP/PHP","twolinecomment"),CommentTok),(("PHP/PHP","doublebackquotestringcommon"),StringTok),(("PHP/PHP","backquotestring"),StringTok),(("PHP/PHP","doublequotestring"),StringTok),(("PHP/PHP","singlequotestring"),StringTok),(("PHP/PHP","htmlheredoc"),NormalTok),(("PHP/PHP","cssheredoc"),NormalTok),(("PHP/PHP","mysqlheredoc"),NormalTok),(("PHP/PHP","javascriptheredoc"),NormalTok),(("PHP/PHP","heredoc"),StringTok),(("PHP/PHP","commonheredoc"),StringTok)] -parseRules "start" =- (((pRegExpr regex_'3c'5c'3f'28'3f'3a'3d'7cphp'29'3f >>= withAttribute KeywordTok) >>~ pushContext "phpsource")+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))) -parseRules "phpsource" =+parseRules ("PHP/PHP","phpsource") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((lookAhead (pString False "?>") >> (popContext) >> currentContext >>= parseRules)) <|>- ((pDetectChar False '?' >>= withAttribute OtherTok) >>~ pushContext "ternary")+ ((pDetectChar False '?' >>= withAttribute OtherTok) >>~ pushContext ("PHP/PHP","ternary")) <|>- ((pRegExpr regex_'28case'7cdefault'29'28'5cs'7c'3a'7c'24'29 >>= withAttribute KeywordTok) >>~ pushContext "case")+ ((pRegExpr regex_'28case'7cdefault'29'28'5cs'7c'3a'7c'24'29 >>= withAttribute KeywordTok) >>~ pushContext ("PHP/PHP","case")) <|> ((pDetect2Chars False ':' ':' >>= withAttribute NormalTok)) <|>@@ -130,13 +127,13 @@ <|> ((pRegExpr regex_endif'7cendwhile'7cendfor'7cendforeach'7cendswitch >>= withAttribute KeywordTok)) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "onelinecomment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("PHP/PHP","onelinecomment")) <|> ((Text.Highlighting.Kate.Syntax.Doxygen.parseExpression)) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "onelinecomment")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("PHP/PHP","onelinecomment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "twolinecomment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("PHP/PHP","twolinecomment")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\@" list_deprecated >>= withAttribute ErrorTok)) <|>@@ -160,21 +157,21 @@ <|> ((pDetectIdentifier >>= withAttribute NormalTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "doublequotestring")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("PHP/PHP","doublequotestring")) <|>- ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext "backquotestring")+ ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext ("PHP/PHP","backquotestring")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "singlequotestring")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("PHP/PHP","singlequotestring")) <|>- ((pRegExpr regex_'3c'3c'3c'28'28EO'29'3fHTML'29'5cb >>= withAttribute KeywordTok) >>~ pushContext "htmlheredoc")+ ((pRegExpr regex_'3c'3c'3c'28'28EO'29'3fHTML'29'5cb >>= withAttribute KeywordTok) >>~ pushContext ("PHP/PHP","htmlheredoc")) <|>- ((pRegExpr regex_'3c'3c'3c'28'28EO'29'3fCSS'29'5cb >>= withAttribute KeywordTok) >>~ pushContext "cssheredoc")+ ((pRegExpr regex_'3c'3c'3c'28'28EO'29'3fCSS'29'5cb >>= withAttribute KeywordTok) >>~ pushContext ("PHP/PHP","cssheredoc")) <|>- ((pRegExpr regex_'3c'3c'3c'28'28EO'29'3fJAVASCRIPT'29'5cb >>= withAttribute KeywordTok) >>~ pushContext "javascriptheredoc")+ ((pRegExpr regex_'3c'3c'3c'28'28EO'29'3fJAVASCRIPT'29'5cb >>= withAttribute KeywordTok) >>~ pushContext ("PHP/PHP","javascriptheredoc")) <|>- ((pRegExpr regex_'3c'3c'3c'28'28EO'29'3fMYSQL'29'5cb >>= withAttribute KeywordTok) >>~ pushContext "mysqlheredoc")+ ((pRegExpr regex_'3c'3c'3c'28'28EO'29'3fMYSQL'29'5cb >>= withAttribute KeywordTok) >>~ pushContext ("PHP/PHP","mysqlheredoc")) <|>- ((pRegExpr regex_'3c'3c'3c'28'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'29 >>= withAttribute KeywordTok) >>~ pushContext "heredoc")+ ((pRegExpr regex_'3c'3c'3c'28'5bA'2dZa'2dz'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a'29 >>= withAttribute KeywordTok) >>~ pushContext ("PHP/PHP","heredoc")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\@" list_special'2dvariables >>= withAttribute KeywordTok)) <|>@@ -196,27 +193,27 @@ <|> ((pAnyChar ";(),[]" >>= withAttribute OtherTok))) -parseRules "ternary" =+parseRules ("PHP/PHP","ternary") = (((pDetect2Chars False ':' ':' >>= withAttribute NormalTok)) <|> ((pDetectChar False ':' >>= withAttribute OtherTok) >>~ (popContext)) <|>- ((parseRules "phpsource")))+ ((parseRules ("PHP/PHP","phpsource")))) -parseRules "case" =- ((parseRules "ternary"))+parseRules ("PHP/PHP","case") =+ ((parseRules ("PHP/PHP","ternary"))) -parseRules "onelinecomment" =+parseRules ("PHP/PHP","onelinecomment") = (((lookAhead (pString False "?>") >> (popContext) >> currentContext >>= parseRules)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "twolinecomment" =+parseRules ("PHP/PHP","twolinecomment") = (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "doublebackquotestringcommon" =+parseRules ("PHP/PHP","doublebackquotestringcommon") = (((pDetect2Chars False '\\' '\\' >>= withAttribute KeywordTok)) <|> ((pDetect2Chars False '\\' 'n' >>= withAttribute KeywordTok))@@ -241,67 +238,72 @@ <|> ((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))) -parseRules "backquotestring" =- (((parseRules "doublebackquotestringcommon"))+parseRules ("PHP/PHP","backquotestring") =+ (((parseRules ("PHP/PHP","doublebackquotestringcommon"))) <|> ((pDetect2Chars False '\\' '`' >>= withAttribute KeywordTok)) <|> ((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "doublequotestring" =- (((parseRules "doublebackquotestringcommon"))+parseRules ("PHP/PHP","doublequotestring") =+ (((parseRules ("PHP/PHP","doublebackquotestringcommon"))) <|> ((pDetect2Chars False '\\' '"' >>= withAttribute KeywordTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "singlequotestring" =+parseRules ("PHP/PHP","singlequotestring") = (((pDetect2Chars False '\\' '\'' >>= withAttribute KeywordTok)) <|> ((pDetect2Chars False '\\' '\\' >>= withAttribute KeywordTok)) <|> ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "htmlheredoc" =+parseRules ("PHP/PHP","htmlheredoc") = (((pColumn 0 >> pRegExprDynamic "%1;?$" >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "commonheredoc"))+ ((parseRules ("PHP/PHP","commonheredoc"))) <|> ((Text.Highlighting.Kate.Syntax.Html.parseExpression))) -parseRules "cssheredoc" =+parseRules ("PHP/PHP","cssheredoc") = (((pColumn 0 >> pRegExprDynamic "%1;?$" >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "commonheredoc"))+ ((parseRules ("PHP/PHP","commonheredoc"))) <|> ((Text.Highlighting.Kate.Syntax.Css.parseExpression))) -parseRules "mysqlheredoc" =+parseRules ("PHP/PHP","mysqlheredoc") = (((pColumn 0 >> pRegExprDynamic "%1;?$" >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "commonheredoc"))+ ((parseRules ("PHP/PHP","commonheredoc"))) <|> ((Text.Highlighting.Kate.Syntax.SqlMysql.parseExpression))) -parseRules "javascriptheredoc" =+parseRules ("PHP/PHP","javascriptheredoc") = (((pColumn 0 >> pRegExprDynamic "%1;?$" >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "commonheredoc"))+ ((parseRules ("PHP/PHP","commonheredoc"))) <|> ((Text.Highlighting.Kate.Syntax.Javascript.parseExpression))) -parseRules "heredoc" =+parseRules ("PHP/PHP","heredoc") = (((pColumn 0 >> pRegExprDynamic "%1;?$" >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "commonheredoc")))+ ((parseRules ("PHP/PHP","commonheredoc")))) -parseRules "commonheredoc" =+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))) -parseRules "" = parseRules "start"+parseRules ("Doxygen", _) = Text.Highlighting.Kate.Syntax.Doxygen.parseExpression+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression+parseRules ("HTML", _) = Text.Highlighting.Kate.Syntax.Html.parseExpression+parseRules ("CSS", _) = Text.Highlighting.Kate.Syntax.Css.parseExpression+parseRules ("SQL (MySQL)", _) = Text.Highlighting.Kate.Syntax.SqlMysql.parseExpression+parseRules ("JavaScript", _) = Text.Highlighting.Kate.Syntax.Javascript.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Pike.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,33 +25,35 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Pike" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Pike",["Normal"])], synStLanguage = "Pike", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Pike","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "String" -> (popContext) >> pEndLine- "Line Comment" -> (popContext) >> pEndLine- "Block Comment" -> return ()- "Preprocessor" -> (popContext) >> pEndLine- "Outscoped" -> return ()- "Outscoped intern" -> return ()+ ("Pike","Normal") -> return ()+ ("Pike","String") -> (popContext) >> pEndLine+ ("Pike","Line Comment") -> (popContext) >> pEndLine+ ("Pike","Block Comment") -> return ()+ ("Pike","Preprocessor") -> (popContext) >> pEndLine+ ("Pike","Outscoped") -> return ()+ ("Pike","Outscoped intern") -> return () _ -> return () withAttribute attr txt = do@@ -61,10 +62,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "break case class continue default do else for foreach if return switch while" list_types = Set.fromList $ words $ "array float function int mapping mixed multiset> object program static string void" list_builtins = Set.fromList $ words $ "catch gauge sscanf typeof"@@ -78,9 +75,9 @@ regex_'23'5cs'2a'28endif'7celif'7celse'29 = compileRegex "#\\s*(endif|elif|else)" regex_'23'5cs'2aendif = compileRegex "#\\s*endif" -defaultAttributes = [("Normal",NormalTok),("String",StringTok),("Line Comment",CommentTok),("Block Comment",CommentTok),("Preprocessor",OtherTok),("Outscoped",CommentTok),("Outscoped intern",CommentTok)]+defaultAttributes = [(("Pike","Normal"),NormalTok),(("Pike","String"),StringTok),(("Pike","Line Comment"),CommentTok),(("Pike","Block Comment"),CommentTok),(("Pike","Preprocessor"),OtherTok),(("Pike","Outscoped"),CommentTok),(("Pike","Outscoped intern"),CommentTok)] -parseRules "Normal" =+parseRules ("Pike","Normal") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_types >>= withAttribute DataTypeTok))@@ -105,19 +102,19 @@ <|> ((pDetectChar False '}' >>= withAttribute NormalTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Pike","String")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Line Comment")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Pike","Line Comment")) <|>- ((pDetect2Chars False '#' '!' >>= withAttribute CommentTok) >>~ pushContext "Line Comment")+ ((pDetect2Chars False '#' '!' >>= withAttribute CommentTok) >>~ pushContext ("Pike","Line Comment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Block Comment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Pike","Block Comment")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'5cs'2b0 >>= withAttribute OtherTok) >>~ pushContext "Outscoped")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif'5cs'2b0 >>= withAttribute OtherTok) >>~ pushContext ("Pike","Outscoped")) <|>- ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute OtherTok) >>~ pushContext "Preprocessor"))+ ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute OtherTok) >>~ pushContext ("Pike","Preprocessor"))) -parseRules "String" =+parseRules ("Pike","String") = (((pRegExpr regex_'5c'5cd'5b0'2d9'5d'2b >>= withAttribute CharTok)) <|> ((pHlCStringChar >>= withAttribute CharTok))@@ -126,41 +123,40 @@ <|> ((pLineContinue >>= withAttribute StringTok))) -parseRules "Line Comment" =+parseRules ("Pike","Line Comment") = ((pRegExpr regex_'28FIXME'7cTODO'7cNOT'28IC'29'3fE'29'3a'3f >>= withAttribute AlertTok)) -parseRules "Block Comment" =+parseRules ("Pike","Block Comment") = (((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) <|> ((pRegExpr regex_'28FIXME'7cTODO'7cNOT'28IC'29'3fE'29'3a'3f >>= withAttribute AlertTok))) -parseRules "Preprocessor" =+parseRules ("Pike","Preprocessor") = (((pRangeDetect '"' '"' >>= withAttribute StringTok)) <|> ((pRangeDetect '<' '>' >>= withAttribute StringTok)) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Line Comment")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Pike","Line Comment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Block Comment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Pike","Block Comment")) <|> ((pLineContinue >>= withAttribute OtherTok))) -parseRules "Outscoped" =+parseRules ("Pike","Outscoped") = (((pRegExpr regex_'28FIXME'7cTODO'7cNOT'28IC'29'3fE'29'3a'3f >>= withAttribute AlertTok)) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Block Comment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Pike","Block Comment")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext "Outscoped intern")+ ((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))) -parseRules "Outscoped intern" =- (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Block Comment")+parseRules ("Pike","Outscoped intern") =+ (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Pike","Block Comment")) <|>- ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext "Outscoped intern")+ ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aif >>= withAttribute CommentTok) >>~ pushContext ("Pike","Outscoped intern")) <|> ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aendif >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Postscript.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,30 +25,32 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "PostScript" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("PostScript",["Normal"])], synStLanguage = "PostScript", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("PostScript","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "Comment" -> (popContext) >> pEndLine- "Header" -> (popContext) >> pEndLine- "String" -> return ()+ ("PostScript","Normal") -> return ()+ ("PostScript","Comment") -> (popContext) >> pEndLine+ ("PostScript","Header") -> (popContext) >> pEndLine+ ("PostScript","String") -> return () _ -> return () withAttribute attr txt = do@@ -58,40 +59,35 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "abs add aload anchorsearch and arc arcn arct arcto array ashow astore awidthshow begin bind bitshift ceiling charpath clear cleartomark clip clippath closepath concat concatmatrix copy count counttomark currentcmykcolor currentdash currentdict currentfile currentfont currentgray currentgstate currenthsbcolor currentlinecap currentlinejoin currentlinewidth currentmatrix currentpoint currentrgbcolor currentshared curveto cvi cvlit cvn cvr cvrs cvs cvx def defineusername dict div dtransform dup end eoclip eofill eoviewclip eq exch exec exit file fill findfont flattenpath floor flush flushfile for forall ge get getinterval grestore gsave gstate gt identmatrix idiv idtransform if ifelse image imagemask index ineofill infill initviewclip inueofill inufill invertmatrix itransform known le length lineto load loop lt makefont matrix maxlength mod moveto mul ne neg newpath not null or pathbbox pathforall pop print printobject put putinterval rcurveto read readhexstring readline readstring rectclip rectfill rectstroke rectviewclip repeat restore rlineto rmoveto roll rotate round save scale scalefont search selectfont setbbox setcachedevice setcachedevice2 setcharwidth setcmykcolor setdash setfont setgray setgstate sethsbcolor setlinecap setlinejoin setlinewidth setmatrix setrgbcolor setshared shareddict show showpage stop stopped store string stringwidth stroke strokepath sub systemdict token transform translate truncate type uappend ucache ueofill ufill undef upath userdict ustroke viewclip viewclippath where widthshow write writehexstring writeobject writestring wtranslation xor xshow xyshow yshow fontdirectory sharedfontdirectory courier courier-bold courier-boldoblique courier-oblique helvetica helvetica-bold helvetica-boldoblique helvetica-oblique symbol times-bold times-bolditalic times-italic times-roman execuserobject currentcolor currentcolorspace currentglobal execform filter findresource globaldict makepattern setcolor setcolorspace setglobal setpagedevice setpattern isolatin1encoding standardencoding atan banddevice bytesavailable cachestatus closefile colorimage condition copypage cos countdictstack countexecstack cshow currentblackgeneration currentcacheparams currentcolorscreen currentcolortransfer currentcontext currentflat currenthalftone currenthalftonephase currentmiterlimit currentobjectformat currentpacking currentscreen currentstrokeadjust currenttransfer currentundercolorremoval defaultmatrix definefont deletefile detach deviceinfo dictstack echo erasepage errordict execstack executeonly exp false filenameforall fileposition fork framedevice grestoreall handleerror initclip initgraphics initmatrix instroke inustroke join kshow ln lock log mark monitor noaccess notify nulldevice packedarray quit rand rcheck readonly realtime renamefile renderbands resetfile reversepath rootfont rrand run scheck setblackgeneration setcachelimit setcacheparams setcolorscreen setcolortransfer setfileposition setflat sethalftone sethalftonephase setmiterlimit setobjectformat setpacking setscreen setstrokeadjust settransfer setucacheparams setundercolorremoval sin sqrt srand stack status statusdict true ucachestatus undefinefont usertime ustrokepath version vmreclaim vmstatus wait wcheck xcheck yield defineuserobject undefineuserobject userobjects cleardictstack setvmthreshold currentcolorrendering currentdevparams currentoverprint currentpagedevice currentsystemparams currentuserparams defineresource findencoding gcheck glyphshow languagelevel product pstack resourceforall resourcestatus revision serialnumber setcolorrendering setdevparams setoverprint setsystemparams setuserparams startjob undefineresource globalfontdirectory ascii85decode ascii85encode asciihexdecode asciihexencode ccittfaxdecode ccittfaxencode dctdecode dctencode lzwdecode lzwencode nullencode runlengthdecode runlengthencode subfiledecode ciebaseda ciebasedabc devicecmyk devicegray devicergb indexed pattern separation ciebaseddef ciebaseddefg devicen" 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 = compileRegex "\\/{1,2}[^\\s\\(\\)\\{\\}\\[\\]%/]*" -defaultAttributes = [("Normal",NormalTok),("Comment",CommentTok),("Header",OtherTok),("String",StringTok)]+defaultAttributes = [(("PostScript","Normal"),NormalTok),(("PostScript","Comment"),CommentTok),(("PostScript","Header"),OtherTok),(("PostScript","String"),StringTok)] -parseRules "Normal" =+parseRules ("PostScript","Normal") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|>- ((pDetect2Chars False '%' '!' >>= withAttribute OtherTok) >>~ pushContext "Header")+ ((pDetect2Chars False '%' '!' >>= withAttribute OtherTok) >>~ pushContext ("PostScript","Header")) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("PostScript","Comment")) <|> ((pFloat >>= withAttribute FloatTok)) <|> ((pInt >>= withAttribute DecValTok)) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "String")+ ((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))) -parseRules "Comment" =+parseRules ("PostScript","Comment") = pzero -parseRules "Header" =+parseRules ("PostScript","Header") = pzero -parseRules "String" =+parseRules ("PostScript","String") = ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext)) -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Prolog.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,31 +25,33 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Prolog" }- context <- currentContext <|> (pushContext "normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Prolog",["normal"])], synStLanguage = "Prolog", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Prolog","normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "normal" -> return ()- "comment" -> (popContext) >> pEndLine- "string" -> return ()- "string2" -> return ()- "comment region" -> return ()+ ("Prolog","normal") -> return ()+ ("Prolog","comment") -> (popContext) >> pEndLine+ ("Prolog","string") -> return ()+ ("Prolog","string2") -> return ()+ ("Prolog","comment region") -> return () _ -> return () withAttribute attr txt = do@@ -59,10 +60,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywordl = Set.fromList $ words $ "abstract align as and class clauses constants database determ domains elsedef endclass enddef erroneous facts failure global goal if ifdef ifndef implement include language multi nocopy nondeterm object or procedure protected predicates reference single static struct this" list_keywordu = Set.fromList $ words $ "ABSTRACT ALIGN AS AND CLASS CLAUSES CONSTANTS DATABASE DETERM DOMAINS ELSEDEF ENDCLASS ENDDEF ERRONEOUS FACTS FAILURE GLOBAL GOAL IF IFDEF IFNDEF IMPLEMENT INCLUDE LANGUAGE MULTI NOCOPY NONDETERM OBJECT OR PROCEDURE PROTECTED PREDICATES REFERENCE SINGLE STATIC STRUCT THIS" list_special = Set.fromList $ words $ "assert asserta assertz bound chain_inserta chain_insertafter chain_insertz chain_terms consult db_btrees db_chains fail findall format free msgrecv msgsend nl not readterm ref_term retract retractall save term_bin term_replace term_str trap write writef"@@ -74,9 +71,9 @@ regex_'5bA'2dZ'5f'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a = compileRegex "[A-Z_][A-Za-z0-9_]*" regex_'5ba'2dz'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a = compileRegex "[a-z][A-Za-z0-9_]*" -defaultAttributes = [("normal",NormalTok),("comment",CommentTok),("string",StringTok),("string2",StringTok),("comment region",CommentTok)]+defaultAttributes = [(("Prolog","normal"),NormalTok),(("Prolog","comment"),CommentTok),(("Prolog","string"),StringTok),(("Prolog","string2"),StringTok),(("Prolog","comment region"),CommentTok)] -parseRules "normal" =+parseRules ("Prolog","normal") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywordl >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywordu >>= withAttribute KeywordTok))@@ -93,34 +90,33 @@ <|> ((pRegExpr regex_'5ba'2dz'5d'5bA'2dZa'2dz0'2d9'5f'5d'2a >>= withAttribute NormalTok)) <|>- ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext "comment")+ ((pDetectChar False '%' >>= withAttribute CommentTok) >>~ pushContext ("Prolog","comment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "comment region")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Prolog","comment region")) <|> ((pInt >>= withAttribute DecValTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "string")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Prolog","string")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "string2")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Prolog","string2")) <|> ((pAnyChar "~!^*()-+=[]|\\:;,./?&<>" >>= withAttribute NormalTok))) -parseRules "comment" =+parseRules ("Prolog","comment") = pzero -parseRules "string" =+parseRules ("Prolog","string") = (((pHlCStringChar >>= withAttribute StringTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "string2" =+parseRules ("Prolog","string2") = (((pHlCChar >>= withAttribute StringTok)) <|> ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "comment region" =+parseRules ("Prolog","comment region") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "" = parseRules "normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Python.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert_indent import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,43 +26,45 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Python" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Python",["Normal"])], synStLanguage = "Python", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Python","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "CheckForString" -> (popContext) >> pEndLine- "parenthesised" -> return ()- "Hash comment" -> (popContext) >> pEndLine- "Tripple A-comment" -> return ()- "Tripple Q-comment" -> return ()- "Single A-comment" -> return ()- "Single Q-comment" -> return ()- "stringformat" -> return ()- "Tripple A-string" -> return ()- "Raw Tripple A-string" -> return ()- "Tripple Q-string" -> return ()- "Raw Tripple Q-string" -> return ()- "Single A-string" -> return ()- "Single Q-string" -> return ()- "Raw A-string" -> return ()- "Raw Q-string" -> return ()+ ("Python","Normal") -> return ()+ ("Python","CheckForString") -> (popContext) >> pEndLine+ ("Python","parenthesised") -> return ()+ ("Python","Hash comment") -> (popContext) >> pEndLine+ ("Python","Tripple A-comment") -> return ()+ ("Python","Tripple Q-comment") -> return ()+ ("Python","Single A-comment") -> return ()+ ("Python","Single Q-comment") -> return ()+ ("Python","stringformat") -> return ()+ ("Python","Tripple A-string") -> return ()+ ("Python","Raw Tripple A-string") -> return ()+ ("Python","Tripple Q-string") -> return ()+ ("Python","Raw Tripple Q-string") -> return ()+ ("Python","Single A-string") -> return ()+ ("Python","Single Q-string") -> return ()+ ("Python","Raw A-string") -> return ()+ ("Python","Raw Q-string") -> return () _ -> return () withAttribute attr txt = do@@ -72,10 +73,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_prep = Set.fromList $ words $ "import from as" list_defs = Set.fromList $ words $ "class def del global lambda nonlocal" list_operators = Set.fromList $ words $ "and in is not or"@@ -94,10 +91,10 @@ regex_'40'5b'5fa'2dzA'2dZ'5d'5b'5c'2e'5fa'2dzA'2dZ0'2d9'5d'2a = compileRegex "@[_a-zA-Z][\\._a-zA-Z0-9]*" 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 = compileRegex "%((\\([a-zA-Z0-9_]+\\))?[#0\\- +]?([1-9][0-9]*|\\*)?(\\.([1-9][0-9]*|\\*))?[hlL]?[crsdiouxXeEfFgG%]|prog|default)" -defaultAttributes = [("Normal",NormalTok),("CheckForString",NormalTok),("parenthesised",NormalTok),("Hash comment",CommentTok),("Tripple A-comment",CommentTok),("Tripple Q-comment",CommentTok),("Single A-comment",CommentTok),("Single Q-comment",CommentTok),("stringformat",OtherTok),("Tripple A-string",StringTok),("Raw Tripple A-string",StringTok),("Tripple Q-string",StringTok),("Raw Tripple Q-string",StringTok),("Single A-string",StringTok),("Single Q-string",StringTok),("Raw A-string",StringTok),("Raw Q-string",StringTok)]+defaultAttributes = [(("Python","Normal"),NormalTok),(("Python","CheckForString"),NormalTok),(("Python","parenthesised"),NormalTok),(("Python","Hash comment"),CommentTok),(("Python","Tripple A-comment"),CommentTok),(("Python","Tripple Q-comment"),CommentTok),(("Python","Single A-comment"),CommentTok),(("Python","Single Q-comment"),CommentTok),(("Python","stringformat"),OtherTok),(("Python","Tripple A-string"),StringTok),(("Python","Raw Tripple A-string"),StringTok),(("Python","Tripple Q-string"),StringTok),(("Python","Raw Tripple Q-string"),StringTok),(("Python","Single A-string"),StringTok),(("Python","Single Q-string"),StringTok),(("Python","Raw A-string"),StringTok),(("Python","Raw Q-string"),StringTok)] -parseRules "Normal" =- (((pLineContinue >>= withAttribute NormalTok) >>~ pushContext "CheckForString")+parseRules ("Python","Normal") =+ (((pLineContinue >>= withAttribute NormalTok) >>~ pushContext ("Python","CheckForString")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\#'" list_prep >>= withAttribute CharTok)) <|>@@ -131,37 +128,37 @@ <|> (withChildren (pInt >>= withAttribute DecValTok) ((pString False "L" >>= withAttribute DecValTok))) <|>- ((pString False "r'''" >>= withAttribute StringTok) >>~ pushContext "Raw Tripple A-string")+ ((pString False "r'''" >>= withAttribute StringTok) >>~ pushContext ("Python","Raw Tripple A-string")) <|>- ((pString False "r\"\"\"" >>= withAttribute StringTok) >>~ pushContext "Raw Tripple Q-string")+ ((pString False "r\"\"\"" >>= withAttribute StringTok) >>~ pushContext ("Python","Raw Tripple Q-string")) <|>- ((pString False "r'" >>= withAttribute StringTok) >>~ pushContext "Raw A-string")+ ((pString False "r'" >>= withAttribute StringTok) >>~ pushContext ("Python","Raw A-string")) <|>- ((pString False "r\"" >>= withAttribute StringTok) >>~ pushContext "Raw Q-string")+ ((pString False "r\"" >>= withAttribute StringTok) >>~ pushContext ("Python","Raw Q-string")) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "Hash comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("Python","Hash comment")) <|>- ((pFirstNonSpace >> pRegExpr regex_u'3f'27'27'27 >>= withAttribute CommentTok) >>~ pushContext "Tripple A-comment")+ ((pFirstNonSpace >> pRegExpr regex_u'3f'27'27'27 >>= withAttribute CommentTok) >>~ pushContext ("Python","Tripple A-comment")) <|>- ((pFirstNonSpace >> pRegExpr regex_u'3f'22'22'22 >>= withAttribute CommentTok) >>~ pushContext "Tripple Q-comment")+ ((pFirstNonSpace >> pRegExpr regex_u'3f'22'22'22 >>= withAttribute CommentTok) >>~ pushContext ("Python","Tripple Q-comment")) <|>- ((pString False "'''" >>= withAttribute StringTok) >>~ pushContext "Tripple A-string")+ ((pString False "'''" >>= withAttribute StringTok) >>~ pushContext ("Python","Tripple A-string")) <|>- ((pString False "u'''" >>= withAttribute StringTok) >>~ pushContext "Tripple A-string")+ ((pString False "u'''" >>= withAttribute StringTok) >>~ pushContext ("Python","Tripple A-string")) <|>- ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ pushContext "Tripple Q-string")+ ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ pushContext ("Python","Tripple Q-string")) <|>- ((pString False "u\"\"\"" >>= withAttribute StringTok) >>~ pushContext "Tripple Q-string")+ ((pString False "u\"\"\"" >>= withAttribute StringTok) >>~ pushContext ("Python","Tripple Q-string")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Single A-string")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Python","Single A-string")) <|>- ((pDetect2Chars False 'u' '\'' >>= withAttribute StringTok) >>~ pushContext "Single A-string")+ ((pDetect2Chars False 'u' '\'' >>= withAttribute StringTok) >>~ pushContext ("Python","Single A-string")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Single Q-string")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Python","Single Q-string")) <|>- ((pDetect2Chars False 'u' '"' >>= withAttribute StringTok) >>~ pushContext "Single Q-string")+ ((pDetect2Chars False 'u' '"' >>= withAttribute StringTok) >>~ pushContext ("Python","Single Q-string")) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "parenthesised")+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Python","parenthesised")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>@@ -169,110 +166,110 @@ <|> ((pFirstNonSpace >> pRegExpr regex_'40'5b'5fa'2dzA'2dZ'5d'5b'5c'2e'5fa'2dzA'2dZ0'2d9'5d'2a >>= withAttribute OtherTok))) -parseRules "CheckForString" =+parseRules ("Python","CheckForString") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pString False "'''" >>= withAttribute StringTok) >>~ pushContext "Tripple A-string")+ ((pString False "'''" >>= withAttribute StringTok) >>~ pushContext ("Python","Tripple A-string")) <|>- ((pString False "u'''" >>= withAttribute StringTok) >>~ pushContext "Tripple A-string")+ ((pString False "u'''" >>= withAttribute StringTok) >>~ pushContext ("Python","Tripple A-string")) <|>- ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ pushContext "Tripple Q-string")+ ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ pushContext ("Python","Tripple Q-string")) <|>- ((pString False "u\"\"\"" >>= withAttribute StringTok) >>~ pushContext "Tripple Q-string")+ ((pString False "u\"\"\"" >>= withAttribute StringTok) >>~ pushContext ("Python","Tripple Q-string")) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "parenthesised" =- ((parseRules "Normal"))+parseRules ("Python","parenthesised") =+ ((parseRules ("Python","Normal"))) -parseRules "Hash comment" =+parseRules ("Python","Hash comment") = ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd))) -parseRules "Tripple A-comment" =+parseRules ("Python","Tripple A-comment") = (((pString False "'''" >>= withAttribute CommentTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "Tripple Q-comment" =+parseRules ("Python","Tripple Q-comment") = (((pHlCChar >>= withAttribute CommentTok)) <|> ((pString False "\"\"\"" >>= withAttribute CommentTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "Single A-comment" =+parseRules ("Python","Single A-comment") = (((pHlCStringChar >>= withAttribute CommentTok)) <|> ((pDetectChar False '\'' >>= withAttribute CommentTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "Single Q-comment" =+parseRules ("Python","Single Q-comment") = (((pHlCStringChar >>= withAttribute CommentTok)) <|> ((pDetectChar False '"' >>= withAttribute CommentTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "stringformat" =+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)) -parseRules "Tripple A-string" =+parseRules ("Python","Tripple A-string") = (((pHlCStringChar >>= withAttribute CharTok)) <|>- ((parseRules "stringformat"))+ ((parseRules ("Python","stringformat"))) <|> ((pString False "'''" >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Raw Tripple A-string" =+parseRules ("Python","Raw Tripple A-string") = (((pHlCStringChar >>= withAttribute StringTok)) <|>- ((parseRules "stringformat"))+ ((parseRules ("Python","stringformat"))) <|> ((pString False "'''" >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Tripple Q-string" =+parseRules ("Python","Tripple Q-string") = (((pHlCStringChar >>= withAttribute CharTok)) <|>- ((parseRules "stringformat"))+ ((parseRules ("Python","stringformat"))) <|> ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Raw Tripple Q-string" =+parseRules ("Python","Raw Tripple Q-string") = (((pHlCStringChar >>= withAttribute StringTok)) <|>- ((parseRules "stringformat"))+ ((parseRules ("Python","stringformat"))) <|> ((pString False "\"\"\"" >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Single A-string" =+parseRules ("Python","Single A-string") = (((pHlCStringChar >>= withAttribute CharTok)) <|>- ((parseRules "stringformat"))+ ((parseRules ("Python","stringformat"))) <|> ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Single Q-string" =+parseRules ("Python","Single Q-string") = (((pHlCStringChar >>= withAttribute CharTok)) <|>- ((parseRules "stringformat"))+ ((parseRules ("Python","stringformat"))) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Raw A-string" =+parseRules ("Python","Raw A-string") = (((pHlCStringChar >>= withAttribute StringTok)) <|>- ((parseRules "stringformat"))+ ((parseRules ("Python","stringformat"))) <|> ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Raw Q-string" =+parseRules ("Python","Raw Q-string") = (((pHlCStringChar >>= withAttribute StringTok)) <|>- ((parseRules "stringformat"))+ ((parseRules ("Python","stringformat"))) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "" = parseRules "Normal"+parseRules ("Alerts_indent", _) = Text.Highlighting.Kate.Syntax.Alert_indent.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/R.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,36 +25,38 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "R Script" }- context <- currentContext <|> (pushContext "level0" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("R Script",["level0"])], synStLanguage = "R Script", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("R Script","level0")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "level0" -> return ()- "ctx0" -> return ()- "parenthesis" -> return ()- "string" -> return ()- "string2" -> return ()- "backquotedsymbol" -> return ()- "operator_rhs" -> return ()- "Headline" -> (popContext) >> pEndLine- "Comment" -> (popContext) >> pEndLine- "CommonRules" -> return ()+ ("R Script","level0") -> return ()+ ("R Script","ctx0") -> return ()+ ("R Script","parenthesis") -> return ()+ ("R Script","string") -> return ()+ ("R Script","string2") -> return ()+ ("R Script","backquotedsymbol") -> return ()+ ("R Script","operator_rhs") -> return ()+ ("R Script","Headline") -> (popContext) >> pEndLine+ ("R Script","Comment") -> (popContext) >> pEndLine+ ("R Script","CommonRules") -> return () _ -> return () withAttribute attr txt = do@@ -64,10 +65,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_controls = Set.fromList $ words $ "for in next break while repeat if else switch function" list_words = Set.fromList $ words $ "TRUE FALSE NULL NA NA_integer_ NA_real_ NA_complex_ NA_character_ Inf NaN" @@ -82,52 +79,52 @@ regex_'28'5c'2b'7c'5c'2d'7c'5c'2a'7b1'2c2'7d'7c'2f'7c'3c'3d'3f'7c'3e'3d'3f'7c'3d'7b1'2c2'7d'7c'5c'21'3d'3f'7c'5c'7c'7b1'2c2'7d'7c'26'7b1'2c2'7d'7c'3a'7b1'2c3'7d'7c'5c'5e'7c'40'7c'5c'24'7c'7e'29 = compileRegex "(\\+|\\-|\\*{1,2}|/|<=?|>=?|={1,2}|\\!=?|\\|{1,2}|&{1,2}|:{1,3}|\\^|@|\\$|~)" regex_'25'5b'5e'25'5d'2a'25 = compileRegex "%[^%]*%" -defaultAttributes = [("level0",NormalTok),("ctx0",NormalTok),("parenthesis",NormalTok),("string",StringTok),("string2",StringTok),("backquotedsymbol",DataTypeTok),("operator_rhs",NormalTok),("Headline",NormalTok),("Comment",CommentTok),("CommonRules",NormalTok)]+defaultAttributes = [(("R Script","level0"),NormalTok),(("R Script","ctx0"),NormalTok),(("R Script","parenthesis"),NormalTok),(("R Script","string"),StringTok),(("R Script","string2"),StringTok),(("R Script","backquotedsymbol"),DataTypeTok),(("R Script","operator_rhs"),NormalTok),(("R Script","Headline"),NormalTok),(("R Script","Comment"),CommentTok),(("R Script","CommonRules"),NormalTok)] -parseRules "level0" =- (((parseRules "CommonRules"))+parseRules ("R Script","level0") =+ (((parseRules ("R Script","CommonRules"))) <|> ((pDetectChar False '}' >>= withAttribute ErrorTok)) <|> ((pDetectChar False ')' >>= withAttribute ErrorTok))) -parseRules "ctx0" =- (((parseRules "CommonRules"))+parseRules ("R Script","ctx0") =+ (((parseRules ("R Script","CommonRules"))) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pDetectChar False ')' >>= withAttribute ErrorTok))) -parseRules "parenthesis" =+parseRules ("R Script","parenthesis") = (((pLineContinue >>= withAttribute NormalTok)) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((pRegExpr regex_'5ba'2dzA'2dZ'5f'5c'2e'5d'5b0'2d9a'2dzA'2dZ'5f'5c'2e'5d'2a'5b'5cs'5d'2a'3d'28'3f'3d'28'5b'5e'3d'5d'7c'24'29'29 >>= withAttribute DataTypeTok)) <|>- ((parseRules "CommonRules"))+ ((parseRules ("R Script","CommonRules"))) <|> ((pDetectChar False '}' >>= withAttribute ErrorTok))) -parseRules "string" =+parseRules ("R Script","string") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) <|> ((pHlCStringChar >>= withAttribute CharTok))) -parseRules "string2" =+parseRules ("R Script","string2") = (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)) <|> ((pHlCStringChar >>= withAttribute CharTok))) -parseRules "backquotedsymbol" =+parseRules ("R Script","backquotedsymbol") = (((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext)) <|> ((pHlCStringChar >>= withAttribute CharTok))) -parseRules "operator_rhs" =- (((pString False "##" >>= withAttribute NormalTok) >>~ pushContext "Headline")+parseRules ("R Script","operator_rhs") =+ (((pString False "##" >>= withAttribute NormalTok) >>~ pushContext ("R Script","Headline")) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("R Script","Comment")) <|> ((pDetectChar False ' ' >>= withAttribute StringTok)) <|>@@ -135,18 +132,18 @@ <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "Headline" =+parseRules ("R Script","Headline") = pzero -parseRules "Comment" =+parseRules ("R Script","Comment") = pzero -parseRules "CommonRules" =- (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "string")+parseRules ("R Script","CommonRules") =+ (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("R Script","string")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "string2")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("R Script","string2")) <|>- ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext "backquotedsymbol")+ ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext ("R Script","backquotedsymbol")) <|> ((pKeyword " \n\t():!+,-<=>%&*/;?[]^{|}~\\$" list_controls >>= withAttribute NormalTok)) <|>@@ -160,28 +157,27 @@ <|> ((pRegExpr regex_'5c'2e'5ba'2dzA'2dZ'5f'5c'2e'5d'2b'5ba'2dzA'2dZ'5f'5c'2e0'2d9'5d'2a'28'3f'3d'5b'5cs'5d'2a'5b'28'5d'29 >>= withAttribute KeywordTok)) <|>- ((pRegExpr regex_'5c'28 >>= withAttribute NormalTok) >>~ pushContext "parenthesis")+ ((pRegExpr regex_'5c'28 >>= withAttribute NormalTok) >>~ pushContext ("R Script","parenthesis")) <|>- ((pString False "##" >>= withAttribute NormalTok) >>~ pushContext "Headline")+ ((pString False "##" >>= withAttribute NormalTok) >>~ pushContext ("R Script","Headline")) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("R Script","Comment")) <|>- ((pRegExpr regex_'5b'3c'5d'7b1'2c2'7d'5c'2d >>= withAttribute NormalTok) >>~ pushContext "operator_rhs")+ ((pRegExpr regex_'5b'3c'5d'7b1'2c2'7d'5c'2d >>= withAttribute NormalTok) >>~ pushContext ("R Script","operator_rhs")) <|>- ((pRegExpr regex_'5c'2d'5b'3e'5d'7b1'2c2'7d >>= withAttribute NormalTok) >>~ pushContext "operator_rhs")+ ((pRegExpr regex_'5c'2d'5b'3e'5d'7b1'2c2'7d >>= withAttribute NormalTok) >>~ pushContext ("R Script","operator_rhs")) <|>- ((pRegExpr regex_'3d'28'3f'21'3d'29 >>= withAttribute NormalTok) >>~ pushContext "operator_rhs")+ ((pRegExpr regex_'3d'28'3f'21'3d'29 >>= withAttribute NormalTok) >>~ pushContext ("R Script","operator_rhs")) <|>- ((pRegExpr regex_'28'5c'2b'7c'5c'2d'7c'5c'2a'7b1'2c2'7d'7c'2f'7c'3c'3d'3f'7c'3e'3d'3f'7c'3d'7b1'2c2'7d'7c'5c'21'3d'3f'7c'5c'7c'7b1'2c2'7d'7c'26'7b1'2c2'7d'7c'3a'7b1'2c3'7d'7c'5c'5e'7c'40'7c'5c'24'7c'7e'29 >>= withAttribute NormalTok) >>~ pushContext "operator_rhs")+ ((pRegExpr regex_'28'5c'2b'7c'5c'2d'7c'5c'2a'7b1'2c2'7d'7c'2f'7c'3c'3d'3f'7c'3e'3d'3f'7c'3d'7b1'2c2'7d'7c'5c'21'3d'3f'7c'5c'7c'7b1'2c2'7d'7c'26'7b1'2c2'7d'7c'3a'7b1'2c3'7d'7c'5c'5e'7c'40'7c'5c'24'7c'7e'29 >>= withAttribute NormalTok) >>~ pushContext ("R Script","operator_rhs")) <|>- ((pRegExpr regex_'25'5b'5e'25'5d'2a'25 >>= withAttribute NormalTok) >>~ pushContext "operator_rhs")+ ((pRegExpr regex_'25'5b'5e'25'5d'2a'25 >>= withAttribute NormalTok) >>~ pushContext ("R Script","operator_rhs")) <|>- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "ctx0")+ ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("R Script","ctx0")) <|> ((pDetectChar False '[' >>= withAttribute NormalTok)) <|> ((pDetectChar False ']' >>= withAttribute NormalTok))) -parseRules "" = parseRules "level0" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Relaxngcompact.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,31 +25,33 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "RelaxNG-Compact" }- context <- currentContext <|> (pushContext "Normal Text" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("RelaxNG-Compact",["Normal Text"])], synStLanguage = "RelaxNG-Compact", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("RelaxNG-Compact","Normal Text")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal Text" -> return ()- "Comments" -> (popContext) >> pEndLine- "String" -> return ()- "Node Names" -> (popContext) >> pEndLine- "Definitions" -> (popContext) >> pEndLine+ ("RelaxNG-Compact","Normal Text") -> return ()+ ("RelaxNG-Compact","Comments") -> (popContext) >> pEndLine+ ("RelaxNG-Compact","String") -> return ()+ ("RelaxNG-Compact","Node Names") -> (popContext) >> pEndLine+ ("RelaxNG-Compact","Definitions") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -59,43 +60,38 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_Keywords = Set.fromList $ words $ "default datatypes div empty external grammar include inherit list mixed namespace notAllowed parent start token" list_Node_Names = Set.fromList $ words $ "attribute element" list_Datatypes = Set.fromList $ words $ "string text xsd:anyURI xsd:base64Binary xsd:boolean xsd:byte xsd:date xsd:dateTime xsd:decimal xsd:double xsd:duration xsd:ENTITIES xsd:ENTITY xsd:float xsd:gDay xsd:gMonth xsd:gMonthDay xsd:gYear xsd:gYearMonth xsd:hexBinary xsd:ID xsd:IDREF xsd:IDREFS xsd:int xsd:integer xsd:language xsd:long xsd:Name xsd:NCName xsd:negativeInteger xsd:NMTOKEN xsd:NMTOKENS xsd:nonNegativeInteger xsd:nonPositiveInteger xsd:normalizedString xsd:NOTATION xsd:positiveInteger xsd:QName xsd:short xsd:string xsd:time xsd:token xsd:unsignedByte xsd:unsignedInt xsd:unsignedLong xsd:unsignedShort" regex_'5b'5cw'5c'2e'2d'5d'2b'5b'5cs'5d'2b'3d = compileRegex "[\\w\\.-]+[\\s]+=" -defaultAttributes = [("Normal Text",NormalTok),("Comments",CommentTok),("String",StringTok),("Node Names",OtherTok),("Definitions",FunctionTok)]+defaultAttributes = [(("RelaxNG-Compact","Normal Text"),NormalTok),(("RelaxNG-Compact","Comments"),CommentTok),(("RelaxNG-Compact","String"),StringTok),(("RelaxNG-Compact","Node Names"),OtherTok),(("RelaxNG-Compact","Definitions"),FunctionTok)] -parseRules "Normal Text" =- (((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "Comments")+parseRules ("RelaxNG-Compact","Normal Text") =+ (((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("RelaxNG-Compact","Comments")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("RelaxNG-Compact","String")) <|> ((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\" list_Keywords >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\" list_Node_Names >>= withAttribute KeywordTok) >>~ pushContext "Node Names")+ ((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\" list_Node_Names >>= withAttribute KeywordTok) >>~ pushContext ("RelaxNG-Compact","Node Names")) <|> ((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\" list_Datatypes >>= withAttribute DataTypeTok)) <|>- ((lookAhead (pRegExpr regex_'5b'5cw'5c'2e'2d'5d'2b'5b'5cs'5d'2b'3d) >> pushContext "Definitions" >> currentContext >>= parseRules)))+ ((lookAhead (pRegExpr regex_'5b'5cw'5c'2e'2d'5d'2b'5b'5cs'5d'2b'3d) >> pushContext ("RelaxNG-Compact","Definitions") >> currentContext >>= parseRules))) -parseRules "Comments" =+parseRules ("RelaxNG-Compact","Comments") = pzero -parseRules "String" =+parseRules ("RelaxNG-Compact","String") = ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) -parseRules "Node Names" =+parseRules ("RelaxNG-Compact","Node Names") = ((lookAhead (pDetectChar False '{') >> (popContext) >> currentContext >>= parseRules)) -parseRules "Definitions" =+parseRules ("RelaxNG-Compact","Definitions") = ((lookAhead (pDetectChar False '=') >> (popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "" = parseRules "Normal Text" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Rhtml.hs view
@@ -10,7 +10,6 @@ import qualified Text.Highlighting.Kate.Syntax.Css import qualified Text.Highlighting.Kate.Syntax.Javascript import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -29,126 +28,128 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Ruby/Rails/RHTML" }- context <- currentContext <|> (pushContext "Start" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Ruby/Rails/RHTML",["Start"])], synStLanguage = "Ruby/Rails/RHTML", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Ruby/Rails/RHTML","Start")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Start" -> return ()- "FindHTML" -> return ()- "FindEntityRefs" -> return ()- "FindPEntityRefs" -> return ()- "FindAttributes" -> return ()- "FindDTDRules" -> return ()- "Comment" -> return ()- "CDATA" -> return ()- "PI" -> return ()- "Doctype" -> return ()- "Doctype Internal Subset" -> return ()- "Doctype Markupdecl" -> return ()- "Doctype Markupdecl DQ" -> return ()- "Doctype Markupdecl SQ" -> return ()- "El Open" -> return ()- "El Close" -> return ()- "El Close 2" -> return ()- "El Close 3" -> return ()- "CSS" -> return ()- "CSS content" -> return ()- "JS" -> return ()- "JS content" -> return ()- "JS comment close" -> (popContext) >> pEndLine- "Value" -> return ()- "Value NQ" -> (popContext >> popContext) >> pEndLine- "Value DQ" -> return ()- "Value SQ" -> return ()- "rubysourceline" -> (popContext) >> pEndLine- "rubysource" -> return ()- "Line Continue" -> (popContext) >> pEndLine- "Quoted String" -> return ()- "Apostrophed String" -> return ()- "Command String" -> return ()- "Embedded documentation" -> return ()- "RegEx 1" -> return ()- "Subst" -> return ()- "Short Subst" -> (popContext) >> pEndLine- "Member Access" -> (popContext) >> pEndLine- "Comment Line" -> (popContext) >> pEndLine- "General Comment" -> (popContext) >> pEndLine- "RDoc Label" -> (popContext) >> pEndLine- "find_heredoc" -> (popContext) >> pEndLine- "find_indented_heredoc" -> (popContext) >> pEndLine- "indented_heredoc" -> return ()- "apostrophed_indented_heredoc" -> return ()- "normal_heredoc" -> return ()- "apostrophed_normal_heredoc" -> return ()- "heredoc_rules" -> return ()- "find_gdl_input" -> (popContext) >> pEndLine- "gdl_dq_string_1" -> return ()- "gdl_dq_string_1_nested" -> return ()- "gdl_dq_string_2" -> return ()- "gdl_dq_string_2_nested" -> return ()- "gdl_dq_string_3" -> return ()- "gdl_dq_string_3_nested" -> return ()- "gdl_dq_string_4" -> return ()- "gdl_dq_string_4_nested" -> return ()- "gdl_dq_string_5" -> return ()- "dq_string_rules" -> return ()- "gdl_token_array_1" -> return ()- "gdl_token_array_1_nested" -> return ()- "gdl_token_array_2" -> return ()- "gdl_token_array_2_nested" -> return ()- "gdl_token_array_3" -> return ()- "gdl_token_array_3_nested" -> return ()- "gdl_token_array_4" -> return ()- "gdl_token_array_4_nested" -> return ()- "gdl_token_array_5" -> return ()- "token_array_rules" -> return ()- "gdl_apostrophed_1" -> return ()- "gdl_apostrophed_1_nested" -> return ()- "gdl_apostrophed_2" -> return ()- "gdl_apostrophed_2_nested" -> return ()- "gdl_apostrophed_3" -> return ()- "gdl_apostrophed_3_nested" -> return ()- "gdl_apostrophed_4" -> return ()- "gdl_apostrophed_4_nested" -> return ()- "gdl_apostrophed_5" -> return ()- "apostrophed_rules" -> return ()- "gdl_shell_command_1" -> return ()- "gdl_shell_command_1_nested" -> return ()- "gdl_shell_command_2" -> return ()- "gdl_shell_command_2_nested" -> return ()- "gdl_shell_command_3" -> return ()- "gdl_shell_command_3_nested" -> return ()- "gdl_shell_command_4" -> return ()- "gdl_shell_command_4_nested" -> return ()- "gdl_shell_command_5" -> return ()- "shell_command_rules" -> return ()- "gdl_regexpr_1" -> return ()- "gdl_regexpr_1_nested" -> return ()- "gdl_regexpr_2" -> return ()- "gdl_regexpr_2_nested" -> return ()- "gdl_regexpr_3" -> return ()- "gdl_regexpr_3_nested" -> return ()- "gdl_regexpr_4" -> return ()- "gdl_regexpr_4_nested" -> return ()- "gdl_regexpr_5" -> return ()- "regexpr_rules" -> return ()- "DATA" -> return ()+ ("Ruby/Rails/RHTML","Start") -> return ()+ ("Ruby/Rails/RHTML","FindHTML") -> return ()+ ("Ruby/Rails/RHTML","FindEntityRefs") -> return ()+ ("Ruby/Rails/RHTML","FindPEntityRefs") -> return ()+ ("Ruby/Rails/RHTML","FindAttributes") -> return ()+ ("Ruby/Rails/RHTML","FindDTDRules") -> return ()+ ("Ruby/Rails/RHTML","Comment") -> return ()+ ("Ruby/Rails/RHTML","CDATA") -> return ()+ ("Ruby/Rails/RHTML","PI") -> return ()+ ("Ruby/Rails/RHTML","Doctype") -> return ()+ ("Ruby/Rails/RHTML","Doctype Internal Subset") -> return ()+ ("Ruby/Rails/RHTML","Doctype Markupdecl") -> return ()+ ("Ruby/Rails/RHTML","Doctype Markupdecl DQ") -> return ()+ ("Ruby/Rails/RHTML","Doctype Markupdecl SQ") -> return ()+ ("Ruby/Rails/RHTML","El Open") -> return ()+ ("Ruby/Rails/RHTML","El Close") -> return ()+ ("Ruby/Rails/RHTML","El Close 2") -> return ()+ ("Ruby/Rails/RHTML","El Close 3") -> return ()+ ("Ruby/Rails/RHTML","CSS") -> return ()+ ("Ruby/Rails/RHTML","CSS content") -> return ()+ ("Ruby/Rails/RHTML","JS") -> return ()+ ("Ruby/Rails/RHTML","JS content") -> return ()+ ("Ruby/Rails/RHTML","JS comment close") -> (popContext) >> pEndLine+ ("Ruby/Rails/RHTML","Value") -> return ()+ ("Ruby/Rails/RHTML","Value NQ") -> (popContext >> popContext) >> pEndLine+ ("Ruby/Rails/RHTML","Value DQ") -> return ()+ ("Ruby/Rails/RHTML","Value SQ") -> return ()+ ("Ruby/Rails/RHTML","rubysourceline") -> (popContext) >> pEndLine+ ("Ruby/Rails/RHTML","rubysource") -> return ()+ ("Ruby/Rails/RHTML","Line Continue") -> (popContext) >> pEndLine+ ("Ruby/Rails/RHTML","Quoted String") -> return ()+ ("Ruby/Rails/RHTML","Apostrophed String") -> return ()+ ("Ruby/Rails/RHTML","Command String") -> return ()+ ("Ruby/Rails/RHTML","Embedded documentation") -> return ()+ ("Ruby/Rails/RHTML","RegEx 1") -> return ()+ ("Ruby/Rails/RHTML","Subst") -> return ()+ ("Ruby/Rails/RHTML","Short Subst") -> (popContext) >> pEndLine+ ("Ruby/Rails/RHTML","Member Access") -> (popContext) >> pEndLine+ ("Ruby/Rails/RHTML","Comment Line") -> (popContext) >> pEndLine+ ("Ruby/Rails/RHTML","General Comment") -> (popContext) >> pEndLine+ ("Ruby/Rails/RHTML","RDoc Label") -> (popContext) >> pEndLine+ ("Ruby/Rails/RHTML","find_heredoc") -> (popContext) >> pEndLine+ ("Ruby/Rails/RHTML","find_indented_heredoc") -> (popContext) >> pEndLine+ ("Ruby/Rails/RHTML","indented_heredoc") -> return ()+ ("Ruby/Rails/RHTML","apostrophed_indented_heredoc") -> return ()+ ("Ruby/Rails/RHTML","normal_heredoc") -> return ()+ ("Ruby/Rails/RHTML","apostrophed_normal_heredoc") -> return ()+ ("Ruby/Rails/RHTML","heredoc_rules") -> return ()+ ("Ruby/Rails/RHTML","find_gdl_input") -> (popContext) >> pEndLine+ ("Ruby/Rails/RHTML","gdl_dq_string_1") -> return ()+ ("Ruby/Rails/RHTML","gdl_dq_string_1_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_dq_string_2") -> return ()+ ("Ruby/Rails/RHTML","gdl_dq_string_2_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_dq_string_3") -> return ()+ ("Ruby/Rails/RHTML","gdl_dq_string_3_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_dq_string_4") -> return ()+ ("Ruby/Rails/RHTML","gdl_dq_string_4_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_dq_string_5") -> return ()+ ("Ruby/Rails/RHTML","dq_string_rules") -> return ()+ ("Ruby/Rails/RHTML","gdl_token_array_1") -> return ()+ ("Ruby/Rails/RHTML","gdl_token_array_1_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_token_array_2") -> return ()+ ("Ruby/Rails/RHTML","gdl_token_array_2_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_token_array_3") -> return ()+ ("Ruby/Rails/RHTML","gdl_token_array_3_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_token_array_4") -> return ()+ ("Ruby/Rails/RHTML","gdl_token_array_4_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_token_array_5") -> return ()+ ("Ruby/Rails/RHTML","token_array_rules") -> return ()+ ("Ruby/Rails/RHTML","gdl_apostrophed_1") -> return ()+ ("Ruby/Rails/RHTML","gdl_apostrophed_1_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_apostrophed_2") -> return ()+ ("Ruby/Rails/RHTML","gdl_apostrophed_2_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_apostrophed_3") -> return ()+ ("Ruby/Rails/RHTML","gdl_apostrophed_3_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_apostrophed_4") -> return ()+ ("Ruby/Rails/RHTML","gdl_apostrophed_4_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_apostrophed_5") -> return ()+ ("Ruby/Rails/RHTML","apostrophed_rules") -> return ()+ ("Ruby/Rails/RHTML","gdl_shell_command_1") -> return ()+ ("Ruby/Rails/RHTML","gdl_shell_command_1_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_shell_command_2") -> return ()+ ("Ruby/Rails/RHTML","gdl_shell_command_2_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_shell_command_3") -> return ()+ ("Ruby/Rails/RHTML","gdl_shell_command_3_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_shell_command_4") -> return ()+ ("Ruby/Rails/RHTML","gdl_shell_command_4_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_shell_command_5") -> return ()+ ("Ruby/Rails/RHTML","shell_command_rules") -> return ()+ ("Ruby/Rails/RHTML","gdl_regexpr_1") -> return ()+ ("Ruby/Rails/RHTML","gdl_regexpr_1_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_regexpr_2") -> return ()+ ("Ruby/Rails/RHTML","gdl_regexpr_2_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_regexpr_3") -> return ()+ ("Ruby/Rails/RHTML","gdl_regexpr_3_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_regexpr_4") -> return ()+ ("Ruby/Rails/RHTML","gdl_regexpr_4_nested") -> return ()+ ("Ruby/Rails/RHTML","gdl_regexpr_5") -> return ()+ ("Ruby/Rails/RHTML","regexpr_rules") -> return ()+ ("Ruby/Rails/RHTML","DATA") -> return () _ -> return () withAttribute attr txt = do@@ -157,10 +158,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "BEGIN END and begin break case defined? do else elsif end ensure for if in include next not or redo rescue retry return then unless until when while yield" list_access'2dcontrol = Set.fromList $ words $ "private_class_method private protected public_class_method public" list_attribute'2ddefinitions = Set.fromList $ words $ "attr_reader attr_writer attr_accessor"@@ -287,75 +284,75 @@ regex_'5c'5d'5buiomxn'5d'2a = compileRegex "\\][uiomxn]*" regex_'3e'5buiomxn'5d'2a = compileRegex ">[uiomxn]*" -defaultAttributes = [("Start",NormalTok),("FindHTML",NormalTok),("FindEntityRefs",NormalTok),("FindPEntityRefs",NormalTok),("FindAttributes",NormalTok),("FindDTDRules",NormalTok),("Comment",CommentTok),("CDATA",NormalTok),("PI",NormalTok),("Doctype",NormalTok),("Doctype Internal Subset",NormalTok),("Doctype Markupdecl",NormalTok),("Doctype Markupdecl DQ",StringTok),("Doctype Markupdecl SQ",StringTok),("El Open",NormalTok),("El Close",NormalTok),("El Close 2",NormalTok),("El Close 3",NormalTok),("CSS",NormalTok),("CSS content",NormalTok),("JS",NormalTok),("JS content",NormalTok),("JS comment close",CommentTok),("Value",NormalTok),("Value NQ",NormalTok),("Value DQ",StringTok),("Value SQ",StringTok),("rubysourceline",NormalTok),("rubysource",NormalTok),("Line Continue",NormalTok),("Quoted String",StringTok),("Apostrophed String",StringTok),("Command String",StringTok),("Embedded documentation",CommentTok),("RegEx 1",OtherTok),("Subst",NormalTok),("Short Subst",OtherTok),("Member Access",NormalTok),("Comment Line",CommentTok),("General Comment",CommentTok),("RDoc Label",OtherTok),("find_heredoc",NormalTok),("find_indented_heredoc",NormalTok),("indented_heredoc",NormalTok),("apostrophed_indented_heredoc",NormalTok),("normal_heredoc",NormalTok),("apostrophed_normal_heredoc",NormalTok),("heredoc_rules",NormalTok),("find_gdl_input",NormalTok),("gdl_dq_string_1",StringTok),("gdl_dq_string_1_nested",StringTok),("gdl_dq_string_2",StringTok),("gdl_dq_string_2_nested",StringTok),("gdl_dq_string_3",StringTok),("gdl_dq_string_3_nested",StringTok),("gdl_dq_string_4",StringTok),("gdl_dq_string_4_nested",StringTok),("gdl_dq_string_5",StringTok),("dq_string_rules",StringTok),("gdl_token_array_1",StringTok),("gdl_token_array_1_nested",StringTok),("gdl_token_array_2",StringTok),("gdl_token_array_2_nested",StringTok),("gdl_token_array_3",StringTok),("gdl_token_array_3_nested",StringTok),("gdl_token_array_4",StringTok),("gdl_token_array_4_nested",StringTok),("gdl_token_array_5",StringTok),("token_array_rules",StringTok),("gdl_apostrophed_1",StringTok),("gdl_apostrophed_1_nested",StringTok),("gdl_apostrophed_2",StringTok),("gdl_apostrophed_2_nested",StringTok),("gdl_apostrophed_3",StringTok),("gdl_apostrophed_3_nested",StringTok),("gdl_apostrophed_4",StringTok),("gdl_apostrophed_4_nested",StringTok),("gdl_apostrophed_5",StringTok),("apostrophed_rules",StringTok),("gdl_shell_command_1",StringTok),("gdl_shell_command_1_nested",StringTok),("gdl_shell_command_2",StringTok),("gdl_shell_command_2_nested",StringTok),("gdl_shell_command_3",StringTok),("gdl_shell_command_3_nested",StringTok),("gdl_shell_command_4",StringTok),("gdl_shell_command_4_nested",StringTok),("gdl_shell_command_5",StringTok),("shell_command_rules",StringTok),("gdl_regexpr_1",OtherTok),("gdl_regexpr_1_nested",OtherTok),("gdl_regexpr_2",OtherTok),("gdl_regexpr_2_nested",OtherTok),("gdl_regexpr_3",OtherTok),("gdl_regexpr_3_nested",OtherTok),("gdl_regexpr_4",OtherTok),("gdl_regexpr_4_nested",OtherTok),("gdl_regexpr_5",OtherTok),("regexpr_rules",OtherTok),("DATA",NormalTok)]+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 "Start" =- ((parseRules "FindHTML"))+parseRules ("Ruby/Rails/RHTML","Start") =+ ((parseRules ("Ruby/Rails/RHTML","FindHTML"))) -parseRules "FindHTML" =+parseRules ("Ruby/Rails/RHTML","FindHTML") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pDetectIdentifier >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+ ((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource")) <|>- ((pString False "%" >>= withAttribute KeywordTok) >>~ pushContext "rubysourceline")+ ((pString False "%" >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysourceline")) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("Ruby/Rails/RHTML","Comment")) <|>- ((pString False "<![CDATA[" >>= withAttribute BaseNTok) >>~ pushContext "CDATA")+ ((pString False "<![CDATA[" >>= withAttribute BaseNTok) >>~ pushContext ("Ruby/Rails/RHTML","CDATA")) <|>- ((pRegExpr regex_'3c'21DOCTYPE'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext "Doctype")+ ((pRegExpr regex_'3c'21DOCTYPE'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby/Rails/RHTML","Doctype")) <|>- ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "PI")+ ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","PI")) <|>- ((pRegExpr regex_'3cstyle'5cb >>= withAttribute KeywordTok) >>~ pushContext "CSS")+ ((pRegExpr regex_'3cstyle'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","CSS")) <|>- ((pRegExpr regex_'3cscript'5cb >>= withAttribute KeywordTok) >>~ pushContext "JS")+ ((pRegExpr regex_'3cscript'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","JS")) <|>- ((pRegExpr regex_'3cpre'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3cpre'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","El Open")) <|>- ((pRegExpr regex_'3cdiv'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3cdiv'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","El Open")) <|>- ((pRegExpr regex_'3ctable'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3ctable'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","El Open")) <|>- ((pRegExpr regex_'3c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "El Open")+ ((pRegExpr regex_'3c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","El Open")) <|>- ((pRegExpr regex_'3c'2fpre'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2fpre'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","El Close")) <|>- ((pRegExpr regex_'3c'2fdiv'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2fdiv'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","El Close")) <|>- ((pRegExpr regex_'3c'2ftable'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2ftable'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","El Close")) <|>- ((pRegExpr regex_'3c'2f'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "El Close")+ ((pRegExpr regex_'3c'2f'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","El Close")) <|>- ((parseRules "FindDTDRules"))+ ((parseRules ("Ruby/Rails/RHTML","FindDTDRules"))) <|>- ((parseRules "FindEntityRefs")))+ ((parseRules ("Ruby/Rails/RHTML","FindEntityRefs")))) -parseRules "FindEntityRefs" =+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))) -parseRules "FindPEntityRefs" =+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))) -parseRules "FindAttributes" =+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 "Value"))+ ((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Value"))) -parseRules "FindDTDRules" =- ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext "Doctype Markupdecl")+parseRules ("Ruby/Rails/RHTML","FindDTDRules") =+ ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby/Rails/RHTML","Doctype Markupdecl")) -parseRules "Comment" =+parseRules ("Ruby/Rails/RHTML","Comment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))@@ -366,7 +363,7 @@ <|> ((pRegExpr regex_'2d'28'2d'28'3f'21'2d'3e'29'29'2b >>= withAttribute ErrorTok))) -parseRules "CDATA" =+parseRules ("Ruby/Rails/RHTML","CDATA") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pDetectIdentifier >>= withAttribute NormalTok))@@ -375,136 +372,136 @@ <|> ((pString False "]]>" >>= withAttribute DecValTok))) -parseRules "PI" =+parseRules ("Ruby/Rails/RHTML","PI") = ((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext)) -parseRules "Doctype" =+parseRules ("Ruby/Rails/RHTML","Doctype") = (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext "Doctype Internal Subset"))+ ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby/Rails/RHTML","Doctype Internal Subset"))) -parseRules "Doctype Internal Subset" =+parseRules ("Ruby/Rails/RHTML","Doctype Internal Subset") = (((pDetectChar False ']' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((parseRules "FindDTDRules"))+ ((parseRules ("Ruby/Rails/RHTML","FindDTDRules"))) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("Ruby/Rails/RHTML","Comment")) <|>- ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "PI")+ ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","PI")) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("Ruby/Rails/RHTML","FindPEntityRefs")))) -parseRules "Doctype Markupdecl" =+parseRules ("Ruby/Rails/RHTML","Doctype Markupdecl") = (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Doctype Markupdecl DQ")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","Doctype Markupdecl DQ")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Doctype Markupdecl SQ"))+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","Doctype Markupdecl SQ"))) -parseRules "Doctype Markupdecl DQ" =- (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+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 "FindPEntityRefs")))+ ((parseRules ("Ruby/Rails/RHTML","FindPEntityRefs")))) -parseRules "Doctype Markupdecl SQ" =- (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+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 "FindPEntityRefs")))+ ((parseRules ("Ruby/Rails/RHTML","FindPEntityRefs")))) -parseRules "El Open" =- (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+parseRules ("Ruby/Rails/RHTML","El Open") =+ (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource")) <|> ((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "FindAttributes"))+ ((parseRules ("Ruby/Rails/RHTML","FindAttributes"))) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "El Close" =- (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+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))) -parseRules "El Close 2" =- (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+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))) -parseRules "El Close 3" =- (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+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))) -parseRules "CSS" =- (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+parseRules ("Ruby/Rails/RHTML","CSS") =+ (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource")) <|> ((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext "CSS content")+ ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","CSS content")) <|>- ((parseRules "FindAttributes"))+ ((parseRules ("Ruby/Rails/RHTML","FindAttributes"))) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "CSS content" =- (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+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 "El Close 2")+ ((pRegExpr regex_'3c'2fstyle'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","El Close 2")) <|> ((Text.Highlighting.Kate.Syntax.Css.parseExpression))) -parseRules "JS" =- (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+parseRules ("Ruby/Rails/RHTML","JS") =+ (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource")) <|> ((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext "JS content")+ ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","JS content")) <|>- ((parseRules "FindAttributes"))+ ((parseRules ("Ruby/Rails/RHTML","FindAttributes"))) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "JS content" =- (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+parseRules ("Ruby/Rails/RHTML","JS content") =+ (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource")) <|>- ((pRegExpr regex_'3c'2fscript'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close 2")+ ((pRegExpr regex_'3c'2fscript'5cb >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","El Close 2")) <|>- ((pRegExpr regex_'2f'2f'28'3f'3d'2e'2a'3c'2fscript'5cb'29 >>= withAttribute CommentTok) >>~ pushContext "JS comment close")+ ((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))) -parseRules "JS comment close" =- (((pRegExpr regex_'3c'2fscript'5cb >>= withAttribute KeywordTok) >>~ pushContext "El Close 3")+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)))) -parseRules "Value" =- (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+parseRules ("Ruby/Rails/RHTML","Value") =+ (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Value DQ")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","Value DQ")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Value SQ")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","Value SQ")) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|>- (pushContext "Value NQ" >> currentContext >>= parseRules))+ (pushContext ("Ruby/Rails/RHTML","Value NQ") >> currentContext >>= parseRules)) -parseRules "Value NQ" =- (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+parseRules ("Ruby/Rails/RHTML","Value NQ") =+ (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource")) <|>- ((parseRules "FindEntityRefs"))+ ((parseRules ("Ruby/Rails/RHTML","FindEntityRefs"))) <|> ((pRegExpr regex_'2f'28'3f'21'3e'29 >>= withAttribute StringTok)) <|>@@ -512,29 +509,29 @@ <|> ((popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "Value DQ" =- (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+parseRules ("Ruby/Rails/RHTML","Value DQ") =+ (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","rubysource")) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext >> popContext)) <|>- ((parseRules "FindEntityRefs")))+ ((parseRules ("Ruby/Rails/RHTML","FindEntityRefs")))) -parseRules "Value SQ" =- (((pRegExpr regex_'3c'25'3d'3f >>= withAttribute KeywordTok) >>~ pushContext "rubysource")+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 "FindEntityRefs")))+ ((parseRules ("Ruby/Rails/RHTML","FindEntityRefs")))) -parseRules "rubysourceline" =- ((parseRules "rubysource"))+parseRules ("Ruby/Rails/RHTML","rubysourceline") =+ ((parseRules ("Ruby/Rails/RHTML","rubysource"))) -parseRules "rubysource" =- (((pLineContinue >>= withAttribute NormalTok) >>~ pushContext "Line Continue")+parseRules ("Ruby/Rails/RHTML","rubysource") =+ (((pLineContinue >>= withAttribute NormalTok) >>~ pushContext ("Ruby/Rails/RHTML","Line Continue")) <|> ((pRegExpr regex_'2d'3f'25'3e >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pColumn 0 >> pRegExpr regex_'5f'5fEND'5f'5f'24 >>= withAttribute KeywordTok) >>~ pushContext "DATA")+ ((pColumn 0 >> pRegExpr regex_'5f'5fEND'5f'5f'24 >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","DATA")) <|> ((pColumn 0 >> pRegExpr regex_'23'21'5c'2f'2e'2a >>= withAttribute KeywordTok)) <|>@@ -612,11 +609,11 @@ <|> ((pHlCChar >>= withAttribute CharTok)) <|>- ((pColumn 0 >> pString False "=begin" >>= withAttribute CommentTok) >>~ pushContext "Embedded documentation")+ ((pColumn 0 >> pString False "=begin" >>= withAttribute CommentTok) >>~ pushContext ("Ruby/Rails/RHTML","Embedded documentation")) <|>- ((pRegExpr regex_'5cs'2a'3c'3c'2d'28'3f'3d'5cw'2b'7c'5b'22'27'5d'29 >>= withAttribute CharTok) >>~ pushContext "find_indented_heredoc")+ ((pRegExpr regex_'5cs'2a'3c'3c'2d'28'3f'3d'5cw'2b'7c'5b'22'27'5d'29 >>= withAttribute CharTok) >>~ pushContext ("Ruby/Rails/RHTML","find_indented_heredoc")) <|>- ((pRegExpr regex_'5cs'2a'3c'3c'28'3f'3d'5cw'2b'7c'5b'22'27'5d'29 >>= withAttribute CharTok) >>~ pushContext "find_heredoc")+ ((pRegExpr regex_'5cs'2a'3c'3c'28'3f'3d'5cw'2b'7c'5b'22'27'5d'29 >>= withAttribute CharTok) >>~ pushContext ("Ruby/Rails/RHTML","find_heredoc")) <|> ((pDetectChar False '.' >>= withAttribute CharTok)) <|>@@ -634,15 +631,15 @@ <|> ((pString False "%=" >>= withAttribute CharTok)) <|>- ((pDetect2Chars False ':' ':' >>= withAttribute CharTok) >>~ pushContext "Member Access")+ ((pDetect2Chars False ':' ':' >>= withAttribute CharTok) >>~ pushContext ("Ruby/Rails/RHTML","Member Access")) <|> ((pRegExpr regex_'3a'5ba'2dzA'2dZ'5f'5d'5ba'2dzA'2dZ0'2d9'5f'5d'2a >>= withAttribute StringTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Quoted String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","Quoted String")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Apostrophed String")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","Apostrophed String")) <|>- ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext "Command String")+ ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","Command String")) <|> ((pString False "?#" >>= withAttribute NormalTok)) <|>@@ -650,9 +647,9 @@ <|> ((pColumn 0 >> pRegExpr regex_'23'5cs'2aEND'2e'2a'24 >>= withAttribute CommentTok)) <|>- ((pFirstNonSpace >> pRegExpr regex_'23 >>= withAttribute CommentTok) >>~ pushContext "Comment Line")+ ((pFirstNonSpace >> pRegExpr regex_'23 >>= withAttribute CommentTok) >>~ pushContext ("Ruby/Rails/RHTML","Comment Line")) <|>- ((pRegExpr regex_'5cs'23 >>= withAttribute CommentTok) >>~ pushContext "General Comment")+ ((pRegExpr regex_'5cs'23 >>= withAttribute CommentTok) >>~ pushContext ("Ruby/Rails/RHTML","General Comment")) <|> ((pRegExpr regex_'5b'5c'5b'5c'5d'5d'2b >>= withAttribute CharTok)) <|>@@ -664,73 +661,73 @@ <|> ((pRegExpr regex_'40'40'5ba'2dzA'2dZ'5f0'2d9'5d'2b >>= withAttribute OtherTok)) <|>- ((pDetectChar False '/' >>= withAttribute OtherTok) >>~ pushContext "RegEx 1")+ ((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 "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"))) -parseRules "Line Continue" =+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 "rubysource")))+ ((parseRules ("Ruby/Rails/RHTML","rubysource")))) -parseRules "Quoted String" =+parseRules ("Ruby/Rails/RHTML","Quoted String") = (((pString False "\\\\" >>= withAttribute StringTok)) <|> ((pRegExpr regex_'5c'5c'5c'22 >>= withAttribute StringTok)) <|>- ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext "Short Subst")+ ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Short Subst")) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext "Subst")+ ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst")) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Apostrophed String" =+parseRules ("Ruby/Rails/RHTML","Apostrophed String") = (((pString False "\\\\" >>= withAttribute StringTok)) <|> ((pRegExpr regex_'5c'5c'5c'27 >>= withAttribute StringTok)) <|> ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Command String" =+parseRules ("Ruby/Rails/RHTML","Command String") = (((pString False "\\\\" >>= withAttribute StringTok)) <|> ((pRegExpr regex_'5c'5c'5c'60 >>= withAttribute StringTok)) <|>- ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext "Short Subst")+ ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Short Subst")) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext "Subst")+ ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst")) <|> ((pHlCChar >>= withAttribute CharTok) >>~ (popContext)) <|> ((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Embedded documentation" =+parseRules ("Ruby/Rails/RHTML","Embedded documentation") = ((pColumn 0 >> pString False "=end" >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "RegEx 1" =+parseRules ("Ruby/Rails/RHTML","RegEx 1") = (((pRegExpr regex_'5c'5c'5c'2f >>= withAttribute OtherTok)) <|> ((pRegExpr regex_'5b'5e'5c'5c'5d'24 >>= withAttribute OtherTok) >>~ (popContext)) <|>- ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext "Short Subst")+ ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Short Subst")) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext "Subst")+ ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst")) <|> ((pRegExpr regex_'2f'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext))) -parseRules "Subst" =+parseRules ("Ruby/Rails/RHTML","Subst") = (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext)) <|>- ((parseRules "rubysource")))+ ((parseRules ("Ruby/Rails/RHTML","rubysource")))) -parseRules "Short Subst" =+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))) -parseRules "Member Access" =+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)) <|> ((pRegExpr regex_'5c'2e'3f'5b'5fa'2dz'5d'5cw'2a'28'5c'3f'7c'5c'21'29'3f >>= withAttribute NormalTok))@@ -755,486 +752,488 @@ <|> ((pRegExpr regex_'5cW >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "Comment Line" =- (((pRegExpr regex_'5cw'5c'3a'5c'3a'5cs >>= withAttribute CommentTok) >>~ pushContext "RDoc Label")+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))) -parseRules "General Comment" =+parseRules ("Ruby/Rails/RHTML","General Comment") = ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_attention >>= withAttribute DecValTok)) -parseRules "RDoc Label" =+parseRules ("Ruby/Rails/RHTML","RDoc Label") = pzero -parseRules "find_heredoc" =- (((pRegExpr regex_'27'28'5cw'2b'29'27 >>= withAttribute KeywordTok) >>~ pushContext "apostrophed_normal_heredoc")+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 "normal_heredoc"))+ ((pRegExpr regex_'22'3f'28'5cw'2b'29'22'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","normal_heredoc"))) -parseRules "find_indented_heredoc" =- (((pRegExpr regex_'27'28'5cw'2b'29'27 >>= withAttribute KeywordTok) >>~ pushContext "apostrophed_indented_heredoc")+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 "indented_heredoc"))+ ((pRegExpr regex_'22'3f'28'5cw'2b'29'22'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby/Rails/RHTML","indented_heredoc"))) -parseRules "indented_heredoc" =+parseRules ("Ruby/Rails/RHTML","indented_heredoc") = (((pFirstNonSpace >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((parseRules "heredoc_rules")))+ ((parseRules ("Ruby/Rails/RHTML","heredoc_rules")))) -parseRules "apostrophed_indented_heredoc" =+parseRules ("Ruby/Rails/RHTML","apostrophed_indented_heredoc") = ((pFirstNonSpace >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) -parseRules "normal_heredoc" =+parseRules ("Ruby/Rails/RHTML","normal_heredoc") = (((pColumn 0 >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((parseRules "heredoc_rules")))+ ((parseRules ("Ruby/Rails/RHTML","heredoc_rules")))) -parseRules "apostrophed_normal_heredoc" =+parseRules ("Ruby/Rails/RHTML","apostrophed_normal_heredoc") = ((pColumn 0 >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) -parseRules "heredoc_rules" =- (((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext "Short Subst")+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 "Subst"))+ ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst"))) -parseRules "find_gdl_input" =- (((pRegExpr regex_w'5c'28 >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_1")+parseRules ("Ruby/Rails/RHTML","find_gdl_input") =+ (((pRegExpr regex_w'5c'28 >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_1")) <|>- ((pRegExpr regex_w'5c'7b >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_2")+ ((pRegExpr regex_w'5c'7b >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_2")) <|>- ((pRegExpr regex_w'5c'5b >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_3")+ ((pRegExpr regex_w'5c'5b >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_3")) <|>- ((pRegExpr regex_w'3c >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_4")+ ((pRegExpr regex_w'3c >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_4")) <|>- ((pRegExpr regex_w'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_5")+ ((pRegExpr regex_w'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_5")) <|>- ((pRegExpr regex_q'5c'28 >>= withAttribute OtherTok) >>~ pushContext "gdl_apostrophed_1")+ ((pRegExpr regex_q'5c'28 >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_1")) <|>- ((pRegExpr regex_q'5c'7b >>= withAttribute OtherTok) >>~ pushContext "gdl_apostrophed_2")+ ((pRegExpr regex_q'5c'7b >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_2")) <|>- ((pRegExpr regex_q'5c'5b >>= withAttribute OtherTok) >>~ pushContext "gdl_apostrophed_3")+ ((pRegExpr regex_q'5c'5b >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_3")) <|>- ((pRegExpr regex_q'3c >>= withAttribute OtherTok) >>~ pushContext "gdl_apostrophed_4")+ ((pRegExpr regex_q'3c >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_4")) <|>- ((pRegExpr regex_q'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext "gdl_apostrophed_5")+ ((pRegExpr regex_q'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_5")) <|>- ((pRegExpr regex_x'5c'28 >>= withAttribute OtherTok) >>~ pushContext "gdl_shell_command_1")+ ((pRegExpr regex_x'5c'28 >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_1")) <|>- ((pRegExpr regex_x'5c'7b >>= withAttribute OtherTok) >>~ pushContext "gdl_shell_command_2")+ ((pRegExpr regex_x'5c'7b >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_2")) <|>- ((pRegExpr regex_x'5c'5b >>= withAttribute OtherTok) >>~ pushContext "gdl_shell_command_3")+ ((pRegExpr regex_x'5c'5b >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_3")) <|>- ((pRegExpr regex_x'3c >>= withAttribute OtherTok) >>~ pushContext "gdl_shell_command_4")+ ((pRegExpr regex_x'3c >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_4")) <|>- ((pRegExpr regex_x'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext "gdl_shell_command_5")+ ((pRegExpr regex_x'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_5")) <|>- ((pRegExpr regex_r'5c'28 >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_1")+ ((pRegExpr regex_r'5c'28 >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_1")) <|>- ((pRegExpr regex_r'5c'7b >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_2")+ ((pRegExpr regex_r'5c'7b >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_2")) <|>- ((pRegExpr regex_r'5c'5b >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_3")+ ((pRegExpr regex_r'5c'5b >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_3")) <|>- ((pRegExpr regex_r'3c >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_4")+ ((pRegExpr regex_r'3c >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_4")) <|>- ((pRegExpr regex_r'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_5")+ ((pRegExpr regex_r'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_5")) <|>- ((pRegExpr regex_Q'3f'5c'28 >>= withAttribute OtherTok) >>~ pushContext "gdl_dq_string_1")+ ((pRegExpr regex_Q'3f'5c'28 >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_1")) <|>- ((pRegExpr regex_Q'3f'5c'7b >>= withAttribute OtherTok) >>~ pushContext "gdl_dq_string_2")+ ((pRegExpr regex_Q'3f'5c'7b >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_2")) <|>- ((pRegExpr regex_Q'3f'5c'5b >>= withAttribute OtherTok) >>~ pushContext "gdl_dq_string_3")+ ((pRegExpr regex_Q'3f'5c'5b >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_3")) <|>- ((pRegExpr regex_Q'3f'3c >>= withAttribute OtherTok) >>~ pushContext "gdl_dq_string_4")+ ((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 "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"))) -parseRules "gdl_dq_string_1" =- (((parseRules "dq_string_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_dq_string_1") =+ (((parseRules ("Ruby/Rails/RHTML","dq_string_rules"))) <|> ((pDetect2Chars False '\\' ')' >>= withAttribute StringTok)) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_dq_string_1_nested" =- (((parseRules "dq_string_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_dq_string_1_nested") =+ (((parseRules ("Ruby/Rails/RHTML","dq_string_rules"))) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_dq_string_2" =- (((parseRules "dq_string_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_dq_string_2") =+ (((parseRules ("Ruby/Rails/RHTML","dq_string_rules"))) <|> ((pDetect2Chars False '\\' '}' >>= withAttribute StringTok)) <|> ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_2_nested"))+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_2_nested"))) -parseRules "gdl_dq_string_2_nested" =- (((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_2_nested")+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 "dq_string_rules")))+ ((parseRules ("Ruby/Rails/RHTML","dq_string_rules")))) -parseRules "gdl_dq_string_3" =- (((parseRules "dq_string_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_dq_string_3") =+ (((parseRules ("Ruby/Rails/RHTML","dq_string_rules"))) <|> ((pDetect2Chars False '\\' ']' >>= withAttribute StringTok)) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_3_nested")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_dq_string_3_nested" =- (((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_3_nested")+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 "dq_string_rules")))+ ((parseRules ("Ruby/Rails/RHTML","dq_string_rules")))) -parseRules "gdl_dq_string_4" =- (((parseRules "dq_string_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_dq_string_4") =+ (((parseRules ("Ruby/Rails/RHTML","dq_string_rules"))) <|> ((pDetect2Chars False '\\' '>' >>= withAttribute StringTok)) <|>- ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_4_nested")+ ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_dq_string_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_dq_string_4_nested" =- (((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_4_nested")+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 "dq_string_rules")))+ ((parseRules ("Ruby/Rails/RHTML","dq_string_rules")))) -parseRules "gdl_dq_string_5" =- (((parseRules "dq_string_rules"))+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))) -parseRules "dq_string_rules" =+parseRules ("Ruby/Rails/RHTML","dq_string_rules") = (((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok)) <|>- ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext "Short Subst")+ ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Short Subst")) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext "Subst"))+ ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst"))) -parseRules "gdl_token_array_1" =- (((parseRules "token_array_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_token_array_1") =+ (((parseRules ("Ruby/Rails/RHTML","token_array_rules"))) <|> ((pDetect2Chars False '\\' ')' >>= withAttribute StringTok)) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_token_array_1_nested" =- (((parseRules "token_array_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_token_array_1_nested") =+ (((parseRules ("Ruby/Rails/RHTML","token_array_rules"))) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_token_array_2" =- (((parseRules "token_array_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_token_array_2") =+ (((parseRules ("Ruby/Rails/RHTML","token_array_rules"))) <|> ((pDetect2Chars False '\\' '}' >>= withAttribute StringTok)) <|> ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_2_nested"))+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_2_nested"))) -parseRules "gdl_token_array_2_nested" =- (((parseRules "token_array_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_token_array_2_nested") =+ (((parseRules ("Ruby/Rails/RHTML","token_array_rules"))) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_2_nested")+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_2_nested")) <|> ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_token_array_3" =- (((parseRules "token_array_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_token_array_3") =+ (((parseRules ("Ruby/Rails/RHTML","token_array_rules"))) <|> ((pDetect2Chars False '\\' ']' >>= withAttribute StringTok)) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_3_nested")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_token_array_3_nested" =- (((parseRules "token_array_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_token_array_3_nested") =+ (((parseRules ("Ruby/Rails/RHTML","token_array_rules"))) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_3_nested")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_token_array_4" =- (((parseRules "token_array_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_token_array_4") =+ (((parseRules ("Ruby/Rails/RHTML","token_array_rules"))) <|> ((pDetect2Chars False '\\' '>' >>= withAttribute StringTok)) <|>- ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_4_nested")+ ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_token_array_4_nested" =- (((parseRules "token_array_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_token_array_4_nested") =+ (((parseRules ("Ruby/Rails/RHTML","token_array_rules"))) <|>- ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_4_nested")+ ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_token_array_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_token_array_5" =- (((parseRules "token_array_rules"))+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))) -parseRules "token_array_rules" =+parseRules ("Ruby/Rails/RHTML","token_array_rules") = ((pString False "\\\\" >>= withAttribute StringTok)) -parseRules "gdl_apostrophed_1" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_1") =+ (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules"))) <|> ((pDetect2Chars False '\\' ')' >>= withAttribute StringTok)) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_apostrophed_1_nested" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_1_nested") =+ (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules"))) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_apostrophed_2" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_2") =+ (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules"))) <|> ((pDetect2Chars False '\\' '}' >>= withAttribute StringTok)) <|> ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_2_nested"))+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_2_nested"))) -parseRules "gdl_apostrophed_2_nested" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_2_nested") =+ (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules"))) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_2_nested")+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_2_nested")) <|> ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_apostrophed_3" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_3") =+ (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules"))) <|> ((pDetect2Chars False '\\' ']' >>= withAttribute StringTok)) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_3_nested")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_apostrophed_3_nested" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_3_nested") =+ (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules"))) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_3_nested")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_apostrophed_4" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_4") =+ (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules"))) <|> ((pDetect2Chars False '\\' '>' >>= withAttribute StringTok)) <|>- ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_4_nested")+ ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_apostrophed_4_nested" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_4_nested") =+ (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules"))) <|>- ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_4_nested")+ ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_apostrophed_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_apostrophed_5" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_apostrophed_5") =+ (((parseRules ("Ruby/Rails/RHTML","apostrophed_rules"))) <|> ((pRegExprDynamic "\\\\%1" >>= withAttribute StringTok)) <|> ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "apostrophed_rules" =+parseRules ("Ruby/Rails/RHTML","apostrophed_rules") = ((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok)) -parseRules "gdl_shell_command_1" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_shell_command_1") =+ (((parseRules ("Ruby/Rails/RHTML","shell_command_rules"))) <|> ((pDetect2Chars False '\\' ')' >>= withAttribute StringTok)) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_shell_command_1_nested" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_shell_command_1_nested") =+ (((parseRules ("Ruby/Rails/RHTML","shell_command_rules"))) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_shell_command_2" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_shell_command_2") =+ (((parseRules ("Ruby/Rails/RHTML","shell_command_rules"))) <|> ((pDetect2Chars False '\\' '}' >>= withAttribute StringTok)) <|> ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_2_nested"))+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_2_nested"))) -parseRules "gdl_shell_command_2_nested" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_shell_command_2_nested") =+ (((parseRules ("Ruby/Rails/RHTML","shell_command_rules"))) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_2_nested")+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_2_nested")) <|> ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_shell_command_3" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_shell_command_3") =+ (((parseRules ("Ruby/Rails/RHTML","shell_command_rules"))) <|> ((pDetect2Chars False '\\' ']' >>= withAttribute StringTok)) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_3_nested")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_shell_command_3_nested" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_shell_command_3_nested") =+ (((parseRules ("Ruby/Rails/RHTML","shell_command_rules"))) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_3_nested")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_shell_command_4" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_shell_command_4") =+ (((parseRules ("Ruby/Rails/RHTML","shell_command_rules"))) <|> ((pDetect2Chars False '\\' '>' >>= withAttribute StringTok)) <|>- ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_4_nested")+ ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_shell_command_4_nested" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_shell_command_4_nested") =+ (((parseRules ("Ruby/Rails/RHTML","shell_command_rules"))) <|>- ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_4_nested")+ ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_shell_command_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_shell_command_5" =- (((parseRules "shell_command_rules"))+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))) -parseRules "shell_command_rules" =+parseRules ("Ruby/Rails/RHTML","shell_command_rules") = (((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok)) <|>- ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext "Short Subst")+ ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Short Subst")) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext "Subst"))+ ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst"))) -parseRules "gdl_regexpr_1" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_regexpr_1") =+ (((parseRules ("Ruby/Rails/RHTML","regexpr_rules"))) <|> ((pDetect2Chars False '\\' ')' >>= withAttribute OtherTok)) <|>- ((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_1_nested")+ ((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_1_nested")) <|> ((pRegExpr regex_'5c'29'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_regexpr_1_nested" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_regexpr_1_nested") =+ (((parseRules ("Ruby/Rails/RHTML","regexpr_rules"))) <|>- ((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_1_nested")+ ((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext))) -parseRules "gdl_regexpr_2" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_regexpr_2") =+ (((parseRules ("Ruby/Rails/RHTML","regexpr_rules"))) <|> ((pDetect2Chars False '\\' '}' >>= withAttribute OtherTok)) <|> ((pRegExpr regex_'5c'7d'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_2_nested"))+ ((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_2_nested"))) -parseRules "gdl_regexpr_2_nested" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_regexpr_2_nested") =+ (((parseRules ("Ruby/Rails/RHTML","regexpr_rules"))) <|>- ((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_2_nested")+ ((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_2_nested")) <|> ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext))) -parseRules "gdl_regexpr_3" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_regexpr_3") =+ (((parseRules ("Ruby/Rails/RHTML","regexpr_rules"))) <|> ((pDetect2Chars False '\\' ']' >>= withAttribute OtherTok)) <|>- ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_3_nested")+ ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_3_nested")) <|> ((pRegExpr regex_'5c'5d'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_regexpr_3_nested" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_regexpr_3_nested") =+ (((parseRules ("Ruby/Rails/RHTML","regexpr_rules"))) <|>- ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_3_nested")+ ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext))) -parseRules "gdl_regexpr_4" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_regexpr_4") =+ (((parseRules ("Ruby/Rails/RHTML","regexpr_rules"))) <|> ((pDetect2Chars False '\\' '>' >>= withAttribute OtherTok)) <|>- ((pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_4_nested")+ ((pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_4_nested")) <|> ((pRegExpr regex_'3e'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_regexpr_4_nested" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby/Rails/RHTML","gdl_regexpr_4_nested") =+ (((parseRules ("Ruby/Rails/RHTML","regexpr_rules"))) <|>- ((pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_4_nested")+ ((pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","gdl_regexpr_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext))) -parseRules "gdl_regexpr_5" =- (((parseRules "regexpr_rules"))+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))) -parseRules "regexpr_rules" =+parseRules ("Ruby/Rails/RHTML","regexpr_rules") = (((pDetect2Chars False '\\' '\\' >>= withAttribute OtherTok)) <|>- ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext "Short Subst")+ ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Short Subst")) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext "Subst"))+ ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby/Rails/RHTML","Subst"))) -parseRules "DATA" =+parseRules ("Ruby/Rails/RHTML","DATA") = pzero -parseRules "" = parseRules "Start"+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" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Ruby.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,105 +26,107 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Ruby" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Ruby",["Normal"])], synStLanguage = "Ruby", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Ruby","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "check_div_1" -> (popContext) >> pEndLine- "check_div_1_pop" -> (popContext >> popContext) >> pEndLine- "check_div_2" -> (popContext) >> pEndLine- "check_div_2_internal" -> (popContext >> popContext) >> pEndLine- "check_div_2_pop" -> (popContext >> popContext) >> pEndLine- "check_div_2_pop_internal" -> (popContext >> popContext >> popContext) >> pEndLine- "Line Continue" -> (popContext) >> pEndLine- "Find closing block brace" -> return ()- "Quoted String" -> return ()- "Apostrophed String" -> return ()- "Command String" -> return ()- "Embedded documentation" -> return ()- "RegEx 1" -> return ()- "Subst" -> return ()- "Short Subst" -> (popContext) >> pEndLine- "Member Access" -> (popContext) >> pEndLine- "Comment Line" -> (popContext) >> pEndLine- "General Comment" -> (popContext) >> pEndLine- "RDoc Label" -> (popContext) >> pEndLine- "find_heredoc" -> (popContext) >> pEndLine- "find_indented_heredoc" -> (popContext) >> pEndLine- "indented_heredoc" -> return ()- "apostrophed_indented_heredoc" -> return ()- "normal_heredoc" -> return ()- "apostrophed_normal_heredoc" -> return ()- "heredoc_rules" -> return ()- "find_gdl_input" -> (popContext) >> pEndLine- "gdl_dq_string_1" -> return ()- "gdl_dq_string_1_nested" -> return ()- "gdl_dq_string_2" -> return ()- "gdl_dq_string_2_nested" -> return ()- "gdl_dq_string_3" -> return ()- "gdl_dq_string_3_nested" -> return ()- "gdl_dq_string_4" -> return ()- "gdl_dq_string_4_nested" -> return ()- "gdl_dq_string_5" -> return ()- "dq_string_rules" -> return ()- "gdl_token_array_1" -> return ()- "gdl_token_array_1_nested" -> return ()- "gdl_token_array_2" -> return ()- "gdl_token_array_2_nested" -> return ()- "gdl_token_array_3" -> return ()- "gdl_token_array_3_nested" -> return ()- "gdl_token_array_4" -> return ()- "gdl_token_array_4_nested" -> return ()- "gdl_token_array_5" -> return ()- "token_array_rules" -> return ()- "gdl_apostrophed_1" -> return ()- "gdl_apostrophed_1_nested" -> return ()- "gdl_apostrophed_2" -> return ()- "gdl_apostrophed_2_nested" -> return ()- "gdl_apostrophed_3" -> return ()- "gdl_apostrophed_3_nested" -> return ()- "gdl_apostrophed_4" -> return ()- "gdl_apostrophed_4_nested" -> return ()- "gdl_apostrophed_5" -> return ()- "apostrophed_rules" -> return ()- "gdl_shell_command_1" -> return ()- "gdl_shell_command_1_nested" -> return ()- "gdl_shell_command_2" -> return ()- "gdl_shell_command_2_nested" -> return ()- "gdl_shell_command_3" -> return ()- "gdl_shell_command_3_nested" -> return ()- "gdl_shell_command_4" -> return ()- "gdl_shell_command_4_nested" -> return ()- "gdl_shell_command_5" -> return ()- "shell_command_rules" -> return ()- "gdl_regexpr_1" -> return ()- "gdl_regexpr_1_nested" -> return ()- "gdl_regexpr_2" -> return ()- "gdl_regexpr_2_nested" -> return ()- "gdl_regexpr_3" -> return ()- "gdl_regexpr_3_nested" -> return ()- "gdl_regexpr_4" -> return ()- "gdl_regexpr_4_nested" -> return ()- "gdl_regexpr_5" -> return ()- "regexpr_rules" -> return ()- "DATA" -> return ()+ ("Ruby","Normal") -> return ()+ ("Ruby","check_div_1") -> (popContext) >> pEndLine+ ("Ruby","check_div_1_pop") -> (popContext >> popContext) >> pEndLine+ ("Ruby","check_div_2") -> (popContext) >> pEndLine+ ("Ruby","check_div_2_internal") -> (popContext >> popContext) >> pEndLine+ ("Ruby","check_div_2_pop") -> (popContext >> popContext) >> pEndLine+ ("Ruby","check_div_2_pop_internal") -> (popContext >> popContext >> popContext) >> pEndLine+ ("Ruby","Line Continue") -> (popContext) >> pEndLine+ ("Ruby","Find closing block brace") -> return ()+ ("Ruby","Quoted String") -> return ()+ ("Ruby","Apostrophed String") -> return ()+ ("Ruby","Command String") -> return ()+ ("Ruby","Embedded documentation") -> return ()+ ("Ruby","RegEx 1") -> return ()+ ("Ruby","Subst") -> return ()+ ("Ruby","Short Subst") -> (popContext) >> pEndLine+ ("Ruby","Member Access") -> (popContext) >> pEndLine+ ("Ruby","Comment Line") -> (popContext) >> pEndLine+ ("Ruby","General Comment") -> (popContext) >> pEndLine+ ("Ruby","RDoc Label") -> (popContext) >> pEndLine+ ("Ruby","find_heredoc") -> (popContext) >> pEndLine+ ("Ruby","find_indented_heredoc") -> (popContext) >> pEndLine+ ("Ruby","indented_heredoc") -> return ()+ ("Ruby","apostrophed_indented_heredoc") -> return ()+ ("Ruby","normal_heredoc") -> return ()+ ("Ruby","apostrophed_normal_heredoc") -> return ()+ ("Ruby","heredoc_rules") -> return ()+ ("Ruby","find_gdl_input") -> (popContext) >> pEndLine+ ("Ruby","gdl_dq_string_1") -> return ()+ ("Ruby","gdl_dq_string_1_nested") -> return ()+ ("Ruby","gdl_dq_string_2") -> return ()+ ("Ruby","gdl_dq_string_2_nested") -> return ()+ ("Ruby","gdl_dq_string_3") -> return ()+ ("Ruby","gdl_dq_string_3_nested") -> return ()+ ("Ruby","gdl_dq_string_4") -> return ()+ ("Ruby","gdl_dq_string_4_nested") -> return ()+ ("Ruby","gdl_dq_string_5") -> return ()+ ("Ruby","dq_string_rules") -> return ()+ ("Ruby","gdl_token_array_1") -> return ()+ ("Ruby","gdl_token_array_1_nested") -> return ()+ ("Ruby","gdl_token_array_2") -> return ()+ ("Ruby","gdl_token_array_2_nested") -> return ()+ ("Ruby","gdl_token_array_3") -> return ()+ ("Ruby","gdl_token_array_3_nested") -> return ()+ ("Ruby","gdl_token_array_4") -> return ()+ ("Ruby","gdl_token_array_4_nested") -> return ()+ ("Ruby","gdl_token_array_5") -> return ()+ ("Ruby","token_array_rules") -> return ()+ ("Ruby","gdl_apostrophed_1") -> return ()+ ("Ruby","gdl_apostrophed_1_nested") -> return ()+ ("Ruby","gdl_apostrophed_2") -> return ()+ ("Ruby","gdl_apostrophed_2_nested") -> return ()+ ("Ruby","gdl_apostrophed_3") -> return ()+ ("Ruby","gdl_apostrophed_3_nested") -> return ()+ ("Ruby","gdl_apostrophed_4") -> return ()+ ("Ruby","gdl_apostrophed_4_nested") -> return ()+ ("Ruby","gdl_apostrophed_5") -> return ()+ ("Ruby","apostrophed_rules") -> return ()+ ("Ruby","gdl_shell_command_1") -> return ()+ ("Ruby","gdl_shell_command_1_nested") -> return ()+ ("Ruby","gdl_shell_command_2") -> return ()+ ("Ruby","gdl_shell_command_2_nested") -> return ()+ ("Ruby","gdl_shell_command_3") -> return ()+ ("Ruby","gdl_shell_command_3_nested") -> return ()+ ("Ruby","gdl_shell_command_4") -> return ()+ ("Ruby","gdl_shell_command_4_nested") -> return ()+ ("Ruby","gdl_shell_command_5") -> return ()+ ("Ruby","shell_command_rules") -> return ()+ ("Ruby","gdl_regexpr_1") -> return ()+ ("Ruby","gdl_regexpr_1_nested") -> return ()+ ("Ruby","gdl_regexpr_2") -> return ()+ ("Ruby","gdl_regexpr_2_nested") -> return ()+ ("Ruby","gdl_regexpr_3") -> return ()+ ("Ruby","gdl_regexpr_3_nested") -> return ()+ ("Ruby","gdl_regexpr_4") -> return ()+ ("Ruby","gdl_regexpr_4_nested") -> return ()+ ("Ruby","gdl_regexpr_5") -> return ()+ ("Ruby","regexpr_rules") -> return ()+ ("Ruby","DATA") -> return () _ -> return () withAttribute attr txt = do@@ -134,10 +135,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "BEGIN END and begin break case defined? do else elsif end ensure for if in include next not or redo rescue retry return then unless until when yield" list_access'2dcontrol = Set.fromList $ words $ "private_class_method private protected public_class_method public" list_attribute'2ddefinitions = Set.fromList $ words $ "attr_reader attr_writer attr_accessor"@@ -245,16 +242,16 @@ regex_'5c'5d'5buiomxn'5d'2a = compileRegex "\\][uiomxn]*" regex_'3e'5buiomxn'5d'2a = compileRegex ">[uiomxn]*" -defaultAttributes = [("Normal",NormalTok),("check_div_1",NormalTok),("check_div_1_pop",NormalTok),("check_div_2",NormalTok),("check_div_2_internal",NormalTok),("check_div_2_pop",NormalTok),("check_div_2_pop_internal",NormalTok),("Line Continue",NormalTok),("Find closing block brace",NormalTok),("Quoted String",StringTok),("Apostrophed String",StringTok),("Command String",StringTok),("Embedded documentation",CommentTok),("RegEx 1",OtherTok),("Subst",NormalTok),("Short Subst",OtherTok),("Member Access",NormalTok),("Comment Line",CommentTok),("General Comment",CommentTok),("RDoc Label",OtherTok),("find_heredoc",NormalTok),("find_indented_heredoc",NormalTok),("indented_heredoc",OtherTok),("apostrophed_indented_heredoc",OtherTok),("normal_heredoc",OtherTok),("apostrophed_normal_heredoc",OtherTok),("heredoc_rules",NormalTok),("find_gdl_input",NormalTok),("gdl_dq_string_1",StringTok),("gdl_dq_string_1_nested",StringTok),("gdl_dq_string_2",StringTok),("gdl_dq_string_2_nested",StringTok),("gdl_dq_string_3",StringTok),("gdl_dq_string_3_nested",StringTok),("gdl_dq_string_4",StringTok),("gdl_dq_string_4_nested",StringTok),("gdl_dq_string_5",StringTok),("dq_string_rules",StringTok),("gdl_token_array_1",StringTok),("gdl_token_array_1_nested",StringTok),("gdl_token_array_2",StringTok),("gdl_token_array_2_nested",StringTok),("gdl_token_array_3",StringTok),("gdl_token_array_3_nested",StringTok),("gdl_token_array_4",StringTok),("gdl_token_array_4_nested",StringTok),("gdl_token_array_5",StringTok),("token_array_rules",StringTok),("gdl_apostrophed_1",StringTok),("gdl_apostrophed_1_nested",StringTok),("gdl_apostrophed_2",StringTok),("gdl_apostrophed_2_nested",StringTok),("gdl_apostrophed_3",StringTok),("gdl_apostrophed_3_nested",StringTok),("gdl_apostrophed_4",StringTok),("gdl_apostrophed_4_nested",StringTok),("gdl_apostrophed_5",StringTok),("apostrophed_rules",StringTok),("gdl_shell_command_1",StringTok),("gdl_shell_command_1_nested",StringTok),("gdl_shell_command_2",StringTok),("gdl_shell_command_2_nested",StringTok),("gdl_shell_command_3",StringTok),("gdl_shell_command_3_nested",StringTok),("gdl_shell_command_4",StringTok),("gdl_shell_command_4_nested",StringTok),("gdl_shell_command_5",StringTok),("shell_command_rules",StringTok),("gdl_regexpr_1",OtherTok),("gdl_regexpr_1_nested",OtherTok),("gdl_regexpr_2",OtherTok),("gdl_regexpr_2_nested",OtherTok),("gdl_regexpr_3",OtherTok),("gdl_regexpr_3_nested",OtherTok),("gdl_regexpr_4",OtherTok),("gdl_regexpr_4_nested",OtherTok),("gdl_regexpr_5",OtherTok),("regexpr_rules",OtherTok),("DATA",NormalTok)]+defaultAttributes = [(("Ruby","Normal"),NormalTok),(("Ruby","check_div_1"),NormalTok),(("Ruby","check_div_1_pop"),NormalTok),(("Ruby","check_div_2"),NormalTok),(("Ruby","check_div_2_internal"),NormalTok),(("Ruby","check_div_2_pop"),NormalTok),(("Ruby","check_div_2_pop_internal"),NormalTok),(("Ruby","Line Continue"),NormalTok),(("Ruby","Find closing block brace"),NormalTok),(("Ruby","Quoted String"),StringTok),(("Ruby","Apostrophed String"),StringTok),(("Ruby","Command String"),StringTok),(("Ruby","Embedded documentation"),CommentTok),(("Ruby","RegEx 1"),OtherTok),(("Ruby","Subst"),NormalTok),(("Ruby","Short Subst"),OtherTok),(("Ruby","Member Access"),NormalTok),(("Ruby","Comment Line"),CommentTok),(("Ruby","General Comment"),CommentTok),(("Ruby","RDoc Label"),OtherTok),(("Ruby","find_heredoc"),NormalTok),(("Ruby","find_indented_heredoc"),NormalTok),(("Ruby","indented_heredoc"),OtherTok),(("Ruby","apostrophed_indented_heredoc"),OtherTok),(("Ruby","normal_heredoc"),OtherTok),(("Ruby","apostrophed_normal_heredoc"),OtherTok),(("Ruby","heredoc_rules"),NormalTok),(("Ruby","find_gdl_input"),NormalTok),(("Ruby","gdl_dq_string_1"),StringTok),(("Ruby","gdl_dq_string_1_nested"),StringTok),(("Ruby","gdl_dq_string_2"),StringTok),(("Ruby","gdl_dq_string_2_nested"),StringTok),(("Ruby","gdl_dq_string_3"),StringTok),(("Ruby","gdl_dq_string_3_nested"),StringTok),(("Ruby","gdl_dq_string_4"),StringTok),(("Ruby","gdl_dq_string_4_nested"),StringTok),(("Ruby","gdl_dq_string_5"),StringTok),(("Ruby","dq_string_rules"),StringTok),(("Ruby","gdl_token_array_1"),StringTok),(("Ruby","gdl_token_array_1_nested"),StringTok),(("Ruby","gdl_token_array_2"),StringTok),(("Ruby","gdl_token_array_2_nested"),StringTok),(("Ruby","gdl_token_array_3"),StringTok),(("Ruby","gdl_token_array_3_nested"),StringTok),(("Ruby","gdl_token_array_4"),StringTok),(("Ruby","gdl_token_array_4_nested"),StringTok),(("Ruby","gdl_token_array_5"),StringTok),(("Ruby","token_array_rules"),StringTok),(("Ruby","gdl_apostrophed_1"),StringTok),(("Ruby","gdl_apostrophed_1_nested"),StringTok),(("Ruby","gdl_apostrophed_2"),StringTok),(("Ruby","gdl_apostrophed_2_nested"),StringTok),(("Ruby","gdl_apostrophed_3"),StringTok),(("Ruby","gdl_apostrophed_3_nested"),StringTok),(("Ruby","gdl_apostrophed_4"),StringTok),(("Ruby","gdl_apostrophed_4_nested"),StringTok),(("Ruby","gdl_apostrophed_5"),StringTok),(("Ruby","apostrophed_rules"),StringTok),(("Ruby","gdl_shell_command_1"),StringTok),(("Ruby","gdl_shell_command_1_nested"),StringTok),(("Ruby","gdl_shell_command_2"),StringTok),(("Ruby","gdl_shell_command_2_nested"),StringTok),(("Ruby","gdl_shell_command_3"),StringTok),(("Ruby","gdl_shell_command_3_nested"),StringTok),(("Ruby","gdl_shell_command_4"),StringTok),(("Ruby","gdl_shell_command_4_nested"),StringTok),(("Ruby","gdl_shell_command_5"),StringTok),(("Ruby","shell_command_rules"),StringTok),(("Ruby","gdl_regexpr_1"),OtherTok),(("Ruby","gdl_regexpr_1_nested"),OtherTok),(("Ruby","gdl_regexpr_2"),OtherTok),(("Ruby","gdl_regexpr_2_nested"),OtherTok),(("Ruby","gdl_regexpr_3"),OtherTok),(("Ruby","gdl_regexpr_3_nested"),OtherTok),(("Ruby","gdl_regexpr_4"),OtherTok),(("Ruby","gdl_regexpr_4_nested"),OtherTok),(("Ruby","gdl_regexpr_5"),OtherTok),(("Ruby","regexpr_rules"),OtherTok),(("Ruby","DATA"),NormalTok)] -parseRules "Normal" =- (((pLineContinue >>= withAttribute NormalTok) >>~ pushContext "Line Continue")+parseRules ("Ruby","Normal") =+ (((pLineContinue >>= withAttribute NormalTok) >>~ pushContext ("Ruby","Line Continue")) <|>- ((pColumn 0 >> pRegExpr regex_'5f'5fEND'5f'5f'24 >>= withAttribute KeywordTok) >>~ pushContext "DATA")+ ((pColumn 0 >> pRegExpr regex_'5f'5fEND'5f'5f'24 >>= withAttribute KeywordTok) >>~ pushContext ("Ruby","DATA")) <|> ((pColumn 0 >> pRegExpr regex_'23'21'5c'2f'2e'2a >>= withAttribute KeywordTok)) <|>- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "Find closing block brace")+ ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("Ruby","Find closing block brace")) <|> ((pRegExpr regex_'28'5c'3d'7c'5c'28'7c'5c'5b'7c'5c'7b'29'5cs'2a'28if'7cunless'7cwhile'7cuntil'29'5cb >>= withAttribute KeywordTok)) <|>@@ -288,53 +285,53 @@ <|> ((pDetect2Chars False '.' '.' >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'5c'2e'5b'5fa'2dz'5d'5b'5fa'2dzA'2dZ0'2d9'5d'2a'28'5c'3f'7c'5c'21'7c'5cb'29 >>= withAttribute NormalTok) >>~ pushContext "check_div_2")+ ((pRegExpr regex_'5c'2e'5b'5fa'2dz'5d'5b'5fa'2dzA'2dZ0'2d9'5d'2a'28'5c'3f'7c'5c'21'7c'5cb'29 >>= withAttribute NormalTok) >>~ pushContext ("Ruby","check_div_2")) <|>- ((pRegExpr regex_'5cs'5c'3f'28'5c'5cM'5c'2d'29'3f'28'5c'5cC'5c'2d'29'3f'5c'5c'3f'5cS >>= withAttribute DecValTok) >>~ pushContext "check_div_1")+ ((pRegExpr regex_'5cs'5c'3f'28'5c'5cM'5c'2d'29'3f'28'5c'5cC'5c'2d'29'3f'5c'5c'3f'5cS >>= withAttribute DecValTok) >>~ pushContext ("Ruby","check_div_1")) <|> ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_attribute'2ddefinitions >>= withAttribute OtherTok) >>~ pushContext "check_div_2")+ ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_attribute'2ddefinitions >>= withAttribute OtherTok) >>~ pushContext ("Ruby","check_div_2")) <|>- ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_access'2dcontrol >>= withAttribute KeywordTok) >>~ pushContext "check_div_2")+ ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_access'2dcontrol >>= withAttribute KeywordTok) >>~ pushContext ("Ruby","check_div_2")) <|> ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_definitions >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_pseudo'2dvariables >>= withAttribute DecValTok) >>~ pushContext "check_div_1")+ ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_pseudo'2dvariables >>= withAttribute DecValTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_default'2dglobals >>= withAttribute DataTypeTok) >>~ pushContext "check_div_2")+ ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_default'2dglobals >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby","check_div_2")) <|>- ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_kernel'2dmethods >>= withAttribute NormalTok) >>~ pushContext "check_div_2")+ ((pKeyword " \n\t.():+,-<=>%&*/;[]^{|}~\\" list_kernel'2dmethods >>= withAttribute NormalTok) >>~ pushContext ("Ruby","check_div_2")) <|>- ((pRegExpr regex_'5c'24'5ba'2dzA'2dZ'5f0'2d9'5d'2b >>= withAttribute DataTypeTok) >>~ pushContext "check_div_1")+ ((pRegExpr regex_'5c'24'5ba'2dzA'2dZ'5f0'2d9'5d'2b >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pRegExpr regex_'5c'24'5c'2d'5ba'2dzA'2dz'5f'5d'5cb >>= withAttribute DataTypeTok) >>~ pushContext "check_div_1")+ ((pRegExpr regex_'5c'24'5c'2d'5ba'2dzA'2dz'5f'5d'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pRegExpr regex_'5c'24'5b'5cd'5f'2a'60'2b'40'3b'2c'2e'7e'3d'5c'21'5c'24'3a'3f'27'2f'5c'5c'5c'2d'5c'26'22'3e'3c'5d >>= withAttribute DataTypeTok) >>~ pushContext "check_div_1")+ ((pRegExpr regex_'5c'24'5b'5cd'5f'2a'60'2b'40'3b'2c'2e'7e'3d'5c'21'5c'24'3a'3f'27'2f'5c'5c'5c'2d'5c'26'22'3e'3c'5d >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pRegExpr regex_'5cb'5b'5fA'2dZ'5d'2b'5bA'2dZ'5f0'2d9'5d'2b'5cb >>= withAttribute DataTypeTok) >>~ pushContext "check_div_2")+ ((pRegExpr regex_'5cb'5b'5fA'2dZ'5d'2b'5bA'2dZ'5f0'2d9'5d'2b'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby","check_div_2")) <|>- ((pRegExpr regex_'5cb'5bA'2dZ'5d'2b'5f'2a'28'5b0'2d9'5d'7c'5ba'2dz'5d'29'5b'5fa'2dzA'2dZ0'2d9'5d'2a'5cb >>= withAttribute DataTypeTok) >>~ pushContext "check_div_2")+ ((pRegExpr regex_'5cb'5bA'2dZ'5d'2b'5f'2a'28'5b0'2d9'5d'7c'5ba'2dz'5d'29'5b'5fa'2dzA'2dZ0'2d9'5d'2a'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby","check_div_2")) <|>- ((pRegExpr regex_'5cb'5c'2d'3f0'5bxX'5d'5b'5f0'2d9a'2dfA'2dF'5d'2b >>= withAttribute BaseNTok) >>~ pushContext "check_div_1")+ ((pRegExpr regex_'5cb'5c'2d'3f0'5bxX'5d'5b'5f0'2d9a'2dfA'2dF'5d'2b >>= withAttribute BaseNTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pRegExpr regex_'5cb'5c'2d'3f0'5bbB'5d'5b'5f01'5d'2b >>= withAttribute BaseNTok) >>~ pushContext "check_div_1")+ ((pRegExpr regex_'5cb'5c'2d'3f0'5bbB'5d'5b'5f01'5d'2b >>= withAttribute BaseNTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pRegExpr regex_'5cb'5c'2d'3f0'5b1'2d7'5d'5b'5f0'2d7'5d'2a >>= withAttribute BaseNTok) >>~ pushContext "check_div_1")+ ((pRegExpr regex_'5cb'5c'2d'3f0'5b1'2d7'5d'5b'5f0'2d7'5d'2a >>= withAttribute BaseNTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pRegExpr regex_'5cb'5c'2d'3f'5b0'2d9'5d'5b0'2d9'5f'5d'2a'5c'2e'5b0'2d9'5d'5b0'2d9'5f'5d'2a'28'5beE'5d'5c'2d'3f'5b1'2d9'5d'5b0'2d9'5d'2a'28'5c'2e'5b0'2d9'5d'2a'29'3f'29'3f >>= withAttribute FloatTok) >>~ pushContext "check_div_1")+ ((pRegExpr regex_'5cb'5c'2d'3f'5b0'2d9'5d'5b0'2d9'5f'5d'2a'5c'2e'5b0'2d9'5d'5b0'2d9'5f'5d'2a'28'5beE'5d'5c'2d'3f'5b1'2d9'5d'5b0'2d9'5d'2a'28'5c'2e'5b0'2d9'5d'2a'29'3f'29'3f >>= withAttribute FloatTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pRegExpr regex_'5cb'5c'2d'3f'5b1'2d9'5d'5b0'2d9'5f'5d'2a'5cb >>= withAttribute DecValTok) >>~ pushContext "check_div_1")+ ((pRegExpr regex_'5cb'5c'2d'3f'5b1'2d9'5d'5b0'2d9'5f'5d'2a'5cb >>= withAttribute DecValTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pInt >>= withAttribute DecValTok) >>~ pushContext "check_div_1")+ ((pInt >>= withAttribute DecValTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pHlCChar >>= withAttribute CharTok) >>~ pushContext "check_div_1")+ ((pHlCChar >>= withAttribute CharTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pColumn 0 >> pRegExpr regex_'3dbegin'28'3f'3a'5cs'7c'24'29 >>= withAttribute CommentTok) >>~ pushContext "Embedded documentation")+ ((pColumn 0 >> pRegExpr regex_'3dbegin'28'3f'3a'5cs'7c'24'29 >>= withAttribute CommentTok) >>~ pushContext ("Ruby","Embedded documentation")) <|>- ((pRegExpr regex_'5cs'2a'3c'3c'2d'28'3f'3d'5cw'2b'7c'5b'22'27'5d'29 >>= withAttribute NormalTok) >>~ pushContext "find_indented_heredoc")+ ((pRegExpr regex_'5cs'2a'3c'3c'2d'28'3f'3d'5cw'2b'7c'5b'22'27'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("Ruby","find_indented_heredoc")) <|>- ((pRegExpr regex_'5cs'2a'3c'3c'28'3f'3d'5cw'2b'7c'5b'22'27'5d'29 >>= withAttribute NormalTok) >>~ pushContext "find_heredoc")+ ((pRegExpr regex_'5cs'2a'3c'3c'28'3f'3d'5cw'2b'7c'5b'22'27'5d'29 >>= withAttribute NormalTok) >>~ pushContext ("Ruby","find_heredoc")) <|> ((pDetectChar False '.' >>= withAttribute NormalTok)) <|>@@ -352,17 +349,17 @@ <|> ((pString False "%=" >>= withAttribute NormalTok)) <|>- ((pDetect2Chars False ':' ':' >>= withAttribute NormalTok) >>~ pushContext "Member Access")+ ((pDetect2Chars False ':' ':' >>= withAttribute NormalTok) >>~ pushContext ("Ruby","Member Access")) <|>- ((pRegExpr regex_'3a'28'40'7b1'2c2'7d'7c'5c'24'29'3f'5ba'2dzA'2dZ'5f'5d'5ba'2dzA'2dZ0'2d9'5f'5d'2a'5b'3d'3f'21'5d'3f >>= withAttribute StringTok) >>~ pushContext "check_div_1")+ ((pRegExpr regex_'3a'28'40'7b1'2c2'7d'7c'5c'24'29'3f'5ba'2dzA'2dZ'5f'5d'5ba'2dzA'2dZ0'2d9'5f'5d'2a'5b'3d'3f'21'5d'3f >>= withAttribute StringTok) >>~ pushContext ("Ruby","check_div_1")) <|> ((pRegExpr regex_'3a'5c'5b'5c'5d'3d'3f >>= withAttribute StringTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Quoted String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Ruby","Quoted String")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Apostrophed String")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Ruby","Apostrophed String")) <|>- ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext "Command String")+ ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext ("Ruby","Command String")) <|> ((pString False "?#" >>= withAttribute NormalTok)) <|>@@ -370,143 +367,143 @@ <|> ((pColumn 0 >> pRegExpr regex_'23'5cs'2aEND'2e'2a'24 >>= withAttribute CommentTok)) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "General Comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("Ruby","General Comment")) <|> ((pDetectChar False '[' >>= withAttribute NormalTok)) <|>- ((pDetectChar False ']' >>= withAttribute NormalTok) >>~ pushContext "check_div_1")+ ((pDetectChar False ']' >>= withAttribute NormalTok) >>~ pushContext ("Ruby","check_div_1")) <|> ((pDetectChar False '{' >>= withAttribute NormalTok)) <|>- ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext "check_div_1")+ ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pRegExpr regex_'40'5ba'2dzA'2dZ'5f0'2d9'5d'2b >>= withAttribute OtherTok) >>~ pushContext "check_div_1")+ ((pRegExpr regex_'40'5ba'2dzA'2dZ'5f0'2d9'5d'2b >>= withAttribute OtherTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pRegExpr regex_'40'40'5ba'2dzA'2dZ'5f0'2d9'5d'2b >>= withAttribute OtherTok) >>~ pushContext "check_div_1")+ ((pRegExpr regex_'40'40'5ba'2dzA'2dZ'5f0'2d9'5d'2b >>= withAttribute OtherTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pDetectChar False '/' >>= withAttribute OtherTok) >>~ pushContext "RegEx 1")+ ((pDetectChar False '/' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","RegEx 1")) <|>- ((pRegExpr regex_'5cs'2a'5b'25'5d'28'3f'3d'5bQqxwW'5d'3f'5b'5e'5cs'5d'29 >>= withAttribute OtherTok) >>~ pushContext "find_gdl_input")+ ((pRegExpr regex_'5cs'2a'5b'25'5d'28'3f'3d'5bQqxwW'5d'3f'5b'5e'5cs'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","find_gdl_input")) <|>- ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ pushContext "check_div_1")+ ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ pushContext ("Ruby","check_div_1")) <|>- ((pDetectIdentifier >>= withAttribute NormalTok) >>~ pushContext "check_div_2"))+ ((pDetectIdentifier >>= withAttribute NormalTok) >>~ pushContext ("Ruby","check_div_2"))) -parseRules "check_div_1" =+parseRules ("Ruby","check_div_1") = (((pRegExpr regex_'5cs'2a >>= withAttribute NormalTok)) <|> ((pAnyChar "/%" >>= withAttribute NormalTok) >>~ (popContext)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "check_div_1_pop" =+parseRules ("Ruby","check_div_1_pop") = (((pRegExpr regex_'5cs'2a >>= withAttribute NormalTok)) <|> ((pAnyChar "/%" >>= withAttribute NormalTok) >>~ (popContext >> popContext)) <|> ((popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "check_div_2" =+parseRules ("Ruby","check_div_2") = (((pAnyChar "/%" >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pRegExpr regex_'5cs'2b >>= withAttribute NormalTok) >>~ pushContext "check_div_2_internal")+ ((pRegExpr regex_'5cs'2b >>= withAttribute NormalTok) >>~ pushContext ("Ruby","check_div_2_internal")) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "check_div_2_internal" =+parseRules ("Ruby","check_div_2_internal") = (((pRegExpr regex_'5b'2f'25'5d'28'3f'3d'5cs'29 >>= withAttribute NormalTok) >>~ (popContext >> popContext)) <|> ((popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "check_div_2_pop" =+parseRules ("Ruby","check_div_2_pop") = (((pAnyChar "/%" >>= withAttribute NormalTok) >>~ (popContext >> popContext)) <|>- ((pRegExpr regex_'5cs'2b >>= withAttribute NormalTok) >>~ pushContext "check_div_2_pop_internal")+ ((pRegExpr regex_'5cs'2b >>= withAttribute NormalTok) >>~ pushContext ("Ruby","check_div_2_pop_internal")) <|> ((popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "check_div_2_pop_internal" =+parseRules ("Ruby","check_div_2_pop_internal") = (((pDetectChar False '%' >>= withAttribute NormalTok) >>~ (popContext >> popContext >> popContext)) <|> ((pRegExpr regex_'2f'28'3f'3d'5cs'29 >>= withAttribute NormalTok) >>~ (popContext >> popContext >> popContext)) <|> ((popContext >> popContext >> popContext) >> currentContext >>= parseRules)) -parseRules "Line Continue" =+parseRules ("Ruby","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 "Normal")))+ ((parseRules ("Ruby","Normal")))) -parseRules "Find closing block brace" =- (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext "check_div_1_pop")+parseRules ("Ruby","Find closing block brace") =+ (((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext ("Ruby","check_div_1_pop")) <|>- ((parseRules "Normal")))+ ((parseRules ("Ruby","Normal")))) -parseRules "Quoted String" =+parseRules ("Ruby","Quoted String") = (((pString False "\\\\" >>= withAttribute StringTok)) <|> ((pRegExpr regex_'5c'5c'5c'22 >>= withAttribute StringTok)) <|>- ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext "Short Subst")+ ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Short Subst")) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext "Subst")+ ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "check_div_1_pop"))+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Ruby","check_div_1_pop"))) -parseRules "Apostrophed String" =+parseRules ("Ruby","Apostrophed String") = (((pString False "\\\\" >>= withAttribute StringTok)) <|> ((pRegExpr regex_'5c'5c'5c'27 >>= withAttribute StringTok)) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "check_div_1_pop"))+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("Ruby","check_div_1_pop"))) -parseRules "Command String" =+parseRules ("Ruby","Command String") = (((pString False "\\\\" >>= withAttribute StringTok)) <|> ((pRegExpr regex_'5c'5c'5c'60 >>= withAttribute StringTok)) <|>- ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext "Short Subst")+ ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Short Subst")) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext "Subst")+ ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst")) <|>- ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext "check_div_1_pop"))+ ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext ("Ruby","check_div_1_pop"))) -parseRules "Embedded documentation" =+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)))) -parseRules "RegEx 1" =+parseRules ("Ruby","RegEx 1") = (((pRegExpr regex_'5c'5c'5c'2f >>= withAttribute OtherTok)) <|>- ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext "Short Subst")+ ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Short Subst")) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext "Subst")+ ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst")) <|>- ((pRegExpr regex_'2f'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ pushContext "check_div_1_pop"))+ ((pRegExpr regex_'2f'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ pushContext ("Ruby","check_div_1_pop"))) -parseRules "Subst" =+parseRules ("Ruby","Subst") = (((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext)) <|>- ((parseRules "Normal")))+ ((parseRules ("Ruby","Normal")))) -parseRules "Short Subst" =+parseRules ("Ruby","Short Subst") = (((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok)) <|> ((pRegExpr regex_'5cw'28'3f'21'5cw'29 >>= withAttribute OtherTok) >>~ (popContext))) -parseRules "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 "check_div_2_pop")+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")) <|> ((pRegExpr regex_'5c'2e'3f'5b'5fa'2dz'5d'5cw'2a'28'5c'3f'7c'5c'21'29'3f >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'5bA'2dZ'5d'2b'5f'2a'28'5cd'7c'5ba'2dz'5d'29'5cw'2a'28'3f'3d'5b'5e'5cw'5cd'5c'2e'5c'3a'5d'29 >>= withAttribute DataTypeTok) >>~ pushContext "check_div_2_pop")+ ((pRegExpr regex_'5bA'2dZ'5d'2b'5f'2a'28'5cd'7c'5ba'2dz'5d'29'5cw'2a'28'3f'3d'5b'5e'5cw'5cd'5c'2e'5c'3a'5d'29 >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby","check_div_2_pop")) <|> ((pRegExpr regex_'5bA'2dZ'5d'2b'5f'2a'28'5b0'2d9'5d'7c'5ba'2dz'5d'29'5cw'2a >>= withAttribute DataTypeTok)) <|>- ((pRegExpr regex_'5b'5fA'2dZ'5d'5b'5fA'2dZ0'2d9'5d'2a'28'3f'3d'5b'5e'5cw'5cd'5c'2e'5c'3a'5d'29 >>= withAttribute DataTypeTok) >>~ pushContext "check_div_2_pop")+ ((pRegExpr regex_'5b'5fA'2dZ'5d'5b'5fA'2dZ0'2d9'5d'2a'28'3f'3d'5b'5e'5cw'5cd'5c'2e'5c'3a'5d'29 >>= withAttribute DataTypeTok) >>~ pushContext ("Ruby","check_div_2_pop")) <|> ((pRegExpr regex_'5b'5fA'2dZ'5d'5b'5fA'2dZ0'2d9'5d'2a >>= withAttribute DataTypeTok)) <|>@@ -522,494 +519,494 @@ <|> ((pRegExpr regex_'5cW >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "Comment Line" =- (((pRegExpr regex_'5cw'5c'3a'5c'3a'5cs >>= withAttribute CommentTok) >>~ pushContext "RDoc Label")+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)))) -parseRules "General Comment" =+parseRules ("Ruby","General Comment") = ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) -parseRules "RDoc Label" =+parseRules ("Ruby","RDoc Label") = pzero -parseRules "find_heredoc" =- (((pRegExpr regex_'27'28'5cw'2b'29'27 >>= withAttribute KeywordTok) >>~ pushContext "apostrophed_normal_heredoc")+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 "normal_heredoc"))+ ((pRegExpr regex_'22'3f'28'5cw'2b'29'22'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby","normal_heredoc"))) -parseRules "find_indented_heredoc" =- (((pRegExpr regex_'27'28'5cw'2b'29'27 >>= withAttribute KeywordTok) >>~ pushContext "apostrophed_indented_heredoc")+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 "indented_heredoc"))+ ((pRegExpr regex_'22'3f'28'5cw'2b'29'22'3f >>= withAttribute KeywordTok) >>~ pushContext ("Ruby","indented_heredoc"))) -parseRules "indented_heredoc" =+parseRules ("Ruby","indented_heredoc") = (((pFirstNonSpace >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((parseRules "heredoc_rules")))+ ((parseRules ("Ruby","heredoc_rules")))) -parseRules "apostrophed_indented_heredoc" =+parseRules ("Ruby","apostrophed_indented_heredoc") = ((pFirstNonSpace >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) -parseRules "normal_heredoc" =+parseRules ("Ruby","normal_heredoc") = (((pColumn 0 >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((parseRules "heredoc_rules")))+ ((parseRules ("Ruby","heredoc_rules")))) -parseRules "apostrophed_normal_heredoc" =+parseRules ("Ruby","apostrophed_normal_heredoc") = ((pColumn 0 >> pRegExprDynamic "%1$" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) -parseRules "heredoc_rules" =- (((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext "Short Subst")+parseRules ("Ruby","heredoc_rules") =+ (((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Short Subst")) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext "Subst"))+ ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst"))) -parseRules "find_gdl_input" =- (((pRegExpr regex_w'5c'28 >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_1")+parseRules ("Ruby","find_gdl_input") =+ (((pRegExpr regex_w'5c'28 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_token_array_1")) <|>- ((pRegExpr regex_w'5c'7b >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_2")+ ((pRegExpr regex_w'5c'7b >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_token_array_2")) <|>- ((pRegExpr regex_w'5c'5b >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_3")+ ((pRegExpr regex_w'5c'5b >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_token_array_3")) <|>- ((pRegExpr regex_w'3c >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_4")+ ((pRegExpr regex_w'3c >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_token_array_4")) <|>- ((pRegExpr regex_w'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_5")+ ((pRegExpr regex_w'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_token_array_5")) <|>- ((pRegExpr regex_W'5c'28 >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_1")+ ((pRegExpr regex_W'5c'28 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_token_array_1")) <|>- ((pRegExpr regex_W'5c'7b >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_2")+ ((pRegExpr regex_W'5c'7b >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_token_array_2")) <|>- ((pRegExpr regex_W'5c'5b >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_3")+ ((pRegExpr regex_W'5c'5b >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_token_array_3")) <|>- ((pRegExpr regex_W'3c >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_4")+ ((pRegExpr regex_W'3c >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_token_array_4")) <|>- ((pRegExpr regex_W'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext "gdl_token_array_5")+ ((pRegExpr regex_W'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_token_array_5")) <|>- ((pRegExpr regex_q'5c'28 >>= withAttribute OtherTok) >>~ pushContext "gdl_apostrophed_1")+ ((pRegExpr regex_q'5c'28 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_apostrophed_1")) <|>- ((pRegExpr regex_q'5c'7b >>= withAttribute OtherTok) >>~ pushContext "gdl_apostrophed_2")+ ((pRegExpr regex_q'5c'7b >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_apostrophed_2")) <|>- ((pRegExpr regex_q'5c'5b >>= withAttribute OtherTok) >>~ pushContext "gdl_apostrophed_3")+ ((pRegExpr regex_q'5c'5b >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_apostrophed_3")) <|>- ((pRegExpr regex_q'3c >>= withAttribute OtherTok) >>~ pushContext "gdl_apostrophed_4")+ ((pRegExpr regex_q'3c >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_apostrophed_4")) <|>- ((pRegExpr regex_q'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext "gdl_apostrophed_5")+ ((pRegExpr regex_q'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_apostrophed_5")) <|>- ((pRegExpr regex_x'5c'28 >>= withAttribute OtherTok) >>~ pushContext "gdl_shell_command_1")+ ((pRegExpr regex_x'5c'28 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_shell_command_1")) <|>- ((pRegExpr regex_x'5c'7b >>= withAttribute OtherTok) >>~ pushContext "gdl_shell_command_2")+ ((pRegExpr regex_x'5c'7b >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_shell_command_2")) <|>- ((pRegExpr regex_x'5c'5b >>= withAttribute OtherTok) >>~ pushContext "gdl_shell_command_3")+ ((pRegExpr regex_x'5c'5b >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_shell_command_3")) <|>- ((pRegExpr regex_x'3c >>= withAttribute OtherTok) >>~ pushContext "gdl_shell_command_4")+ ((pRegExpr regex_x'3c >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_shell_command_4")) <|>- ((pRegExpr regex_x'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext "gdl_shell_command_5")+ ((pRegExpr regex_x'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_shell_command_5")) <|>- ((pRegExpr regex_r'5c'28 >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_1")+ ((pRegExpr regex_r'5c'28 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_1")) <|>- ((pRegExpr regex_r'5c'7b >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_2")+ ((pRegExpr regex_r'5c'7b >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_2")) <|>- ((pRegExpr regex_r'5c'5b >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_3")+ ((pRegExpr regex_r'5c'5b >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_3")) <|>- ((pRegExpr regex_r'3c >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_4")+ ((pRegExpr regex_r'3c >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_4")) <|>- ((pRegExpr regex_r'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_5")+ ((pRegExpr regex_r'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_5")) <|>- ((pRegExpr regex_Q'3f'5c'28 >>= withAttribute OtherTok) >>~ pushContext "gdl_dq_string_1")+ ((pRegExpr regex_Q'3f'5c'28 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_dq_string_1")) <|>- ((pRegExpr regex_Q'3f'5c'7b >>= withAttribute OtherTok) >>~ pushContext "gdl_dq_string_2")+ ((pRegExpr regex_Q'3f'5c'7b >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_dq_string_2")) <|>- ((pRegExpr regex_Q'3f'5c'5b >>= withAttribute OtherTok) >>~ pushContext "gdl_dq_string_3")+ ((pRegExpr regex_Q'3f'5c'5b >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_dq_string_3")) <|>- ((pRegExpr regex_Q'3f'3c >>= withAttribute OtherTok) >>~ pushContext "gdl_dq_string_4")+ ((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 "gdl_dq_string_5"))+ ((pRegExpr regex_Q'3f'28'5b'5e'5cs'5cw'5d'29 >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_dq_string_5"))) -parseRules "gdl_dq_string_1" =- (((parseRules "dq_string_rules"))+parseRules ("Ruby","gdl_dq_string_1") =+ (((parseRules ("Ruby","dq_string_rules"))) <|> ((pDetect2Chars False '\\' ')' >>= withAttribute StringTok)) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_dq_string_1_nested" =- (((parseRules "dq_string_rules"))+parseRules ("Ruby","gdl_dq_string_1_nested") =+ (((parseRules ("Ruby","dq_string_rules"))) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_dq_string_2" =- (((parseRules "dq_string_rules"))+parseRules ("Ruby","gdl_dq_string_2") =+ (((parseRules ("Ruby","dq_string_rules"))) <|> ((pDetect2Chars False '\\' '}' >>= withAttribute StringTok)) <|> ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_2_nested"))+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_2_nested"))) -parseRules "gdl_dq_string_2_nested" =- (((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_2_nested")+parseRules ("Ruby","gdl_dq_string_2_nested") =+ (((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_2_nested")) <|> ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "dq_string_rules")))+ ((parseRules ("Ruby","dq_string_rules")))) -parseRules "gdl_dq_string_3" =- (((parseRules "dq_string_rules"))+parseRules ("Ruby","gdl_dq_string_3") =+ (((parseRules ("Ruby","dq_string_rules"))) <|> ((pDetect2Chars False '\\' ']' >>= withAttribute StringTok)) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_3_nested")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_dq_string_3_nested" =- (((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_3_nested")+parseRules ("Ruby","gdl_dq_string_3_nested") =+ (((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "dq_string_rules")))+ ((parseRules ("Ruby","dq_string_rules")))) -parseRules "gdl_dq_string_4" =- (((parseRules "dq_string_rules"))+parseRules ("Ruby","gdl_dq_string_4") =+ (((parseRules ("Ruby","dq_string_rules"))) <|> ((pDetect2Chars False '\\' '>' >>= withAttribute StringTok)) <|>- ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_4_nested")+ ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_dq_string_4_nested" =- (((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_dq_string_4_nested")+parseRules ("Ruby","gdl_dq_string_4_nested") =+ (((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_dq_string_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "dq_string_rules")))+ ((parseRules ("Ruby","dq_string_rules")))) -parseRules "gdl_dq_string_5" =- (((parseRules "dq_string_rules"))+parseRules ("Ruby","gdl_dq_string_5") =+ (((parseRules ("Ruby","dq_string_rules"))) <|> ((pRegExprDynamic "\\\\%1" >>= withAttribute StringTok)) <|> ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "dq_string_rules" =+parseRules ("Ruby","dq_string_rules") = (((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok)) <|>- ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext "Short Subst")+ ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Short Subst")) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext "Subst"))+ ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst"))) -parseRules "gdl_token_array_1" =- (((parseRules "token_array_rules"))+parseRules ("Ruby","gdl_token_array_1") =+ (((parseRules ("Ruby","token_array_rules"))) <|> ((pDetect2Chars False '\\' ')' >>= withAttribute StringTok)) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_token_array_1_nested" =- (((parseRules "token_array_rules"))+parseRules ("Ruby","gdl_token_array_1_nested") =+ (((parseRules ("Ruby","token_array_rules"))) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_token_array_2" =- (((parseRules "token_array_rules"))+parseRules ("Ruby","gdl_token_array_2") =+ (((parseRules ("Ruby","token_array_rules"))) <|> ((pDetect2Chars False '\\' '}' >>= withAttribute StringTok)) <|> ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_2_nested"))+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_2_nested"))) -parseRules "gdl_token_array_2_nested" =- (((parseRules "token_array_rules"))+parseRules ("Ruby","gdl_token_array_2_nested") =+ (((parseRules ("Ruby","token_array_rules"))) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_2_nested")+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_2_nested")) <|> ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_token_array_3" =- (((parseRules "token_array_rules"))+parseRules ("Ruby","gdl_token_array_3") =+ (((parseRules ("Ruby","token_array_rules"))) <|> ((pDetect2Chars False '\\' ']' >>= withAttribute StringTok)) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_3_nested")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_token_array_3_nested" =- (((parseRules "token_array_rules"))+parseRules ("Ruby","gdl_token_array_3_nested") =+ (((parseRules ("Ruby","token_array_rules"))) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_3_nested")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_token_array_4" =- (((parseRules "token_array_rules"))+parseRules ("Ruby","gdl_token_array_4") =+ (((parseRules ("Ruby","token_array_rules"))) <|> ((pDetect2Chars False '\\' '>' >>= withAttribute StringTok)) <|>- ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_4_nested")+ ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_token_array_4_nested" =- (((parseRules "token_array_rules"))+parseRules ("Ruby","gdl_token_array_4_nested") =+ (((parseRules ("Ruby","token_array_rules"))) <|>- ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_token_array_4_nested")+ ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_token_array_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_token_array_5" =- (((parseRules "token_array_rules"))+parseRules ("Ruby","gdl_token_array_5") =+ (((parseRules ("Ruby","token_array_rules"))) <|> ((pRegExprDynamic "\\\\%1" >>= withAttribute StringTok)) <|> ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "token_array_rules" =+parseRules ("Ruby","token_array_rules") = ((pString False "\\\\" >>= withAttribute StringTok)) -parseRules "gdl_apostrophed_1" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby","gdl_apostrophed_1") =+ (((parseRules ("Ruby","apostrophed_rules"))) <|> ((pDetect2Chars False '\\' ')' >>= withAttribute StringTok)) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_apostrophed_1_nested" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby","gdl_apostrophed_1_nested") =+ (((parseRules ("Ruby","apostrophed_rules"))) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_apostrophed_2" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby","gdl_apostrophed_2") =+ (((parseRules ("Ruby","apostrophed_rules"))) <|> ((pDetect2Chars False '\\' '}' >>= withAttribute StringTok)) <|> ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_2_nested"))+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_2_nested"))) -parseRules "gdl_apostrophed_2_nested" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby","gdl_apostrophed_2_nested") =+ (((parseRules ("Ruby","apostrophed_rules"))) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_2_nested")+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_2_nested")) <|> ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_apostrophed_3" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby","gdl_apostrophed_3") =+ (((parseRules ("Ruby","apostrophed_rules"))) <|> ((pDetect2Chars False '\\' ']' >>= withAttribute StringTok)) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_3_nested")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_apostrophed_3_nested" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby","gdl_apostrophed_3_nested") =+ (((parseRules ("Ruby","apostrophed_rules"))) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_3_nested")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_apostrophed_4" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby","gdl_apostrophed_4") =+ (((parseRules ("Ruby","apostrophed_rules"))) <|> ((pDetect2Chars False '\\' '>' >>= withAttribute StringTok)) <|>- ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_4_nested")+ ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_apostrophed_4_nested" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby","gdl_apostrophed_4_nested") =+ (((parseRules ("Ruby","apostrophed_rules"))) <|>- ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_apostrophed_4_nested")+ ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_apostrophed_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_apostrophed_5" =- (((parseRules "apostrophed_rules"))+parseRules ("Ruby","gdl_apostrophed_5") =+ (((parseRules ("Ruby","apostrophed_rules"))) <|> ((pRegExprDynamic "\\\\%1" >>= withAttribute StringTok)) <|> ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "apostrophed_rules" =+parseRules ("Ruby","apostrophed_rules") = ((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok)) -parseRules "gdl_shell_command_1" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby","gdl_shell_command_1") =+ (((parseRules ("Ruby","shell_command_rules"))) <|> ((pDetect2Chars False '\\' ')' >>= withAttribute StringTok)) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_shell_command_1_nested" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby","gdl_shell_command_1_nested") =+ (((parseRules ("Ruby","shell_command_rules"))) <|>- ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_1_nested")+ ((pDetectChar False '(' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_shell_command_2" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby","gdl_shell_command_2") =+ (((parseRules ("Ruby","shell_command_rules"))) <|> ((pDetect2Chars False '\\' '}' >>= withAttribute StringTok)) <|> ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_2_nested"))+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_2_nested"))) -parseRules "gdl_shell_command_2_nested" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby","gdl_shell_command_2_nested") =+ (((parseRules ("Ruby","shell_command_rules"))) <|>- ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_2_nested")+ ((pDetectChar False '{' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_2_nested")) <|> ((pDetectChar False '}' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_shell_command_3" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby","gdl_shell_command_3") =+ (((parseRules ("Ruby","shell_command_rules"))) <|> ((pDetect2Chars False '\\' ']' >>= withAttribute StringTok)) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_3_nested")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_shell_command_3_nested" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby","gdl_shell_command_3_nested") =+ (((parseRules ("Ruby","shell_command_rules"))) <|>- ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_3_nested")+ ((pDetectChar False '[' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_shell_command_4" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby","gdl_shell_command_4") =+ (((parseRules ("Ruby","shell_command_rules"))) <|> ((pDetect2Chars False '\\' '>' >>= withAttribute StringTok)) <|>- ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_4_nested")+ ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_shell_command_4_nested" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby","gdl_shell_command_4_nested") =+ (((parseRules ("Ruby","shell_command_rules"))) <|>- ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext "gdl_shell_command_4_nested")+ ((pDetectChar False '<' >>= withAttribute StringTok) >>~ pushContext ("Ruby","gdl_shell_command_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "gdl_shell_command_5" =- (((parseRules "shell_command_rules"))+parseRules ("Ruby","gdl_shell_command_5") =+ (((parseRules ("Ruby","shell_command_rules"))) <|> ((pRegExprDynamic "\\\\%1" >>= withAttribute StringTok)) <|> ((pRegExprDynamic "\\s*%1" >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "shell_command_rules" =+parseRules ("Ruby","shell_command_rules") = (((pDetect2Chars False '\\' '\\' >>= withAttribute StringTok)) <|>- ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext "Short Subst")+ ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Short Subst")) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext "Subst"))+ ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst"))) -parseRules "gdl_regexpr_1" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby","gdl_regexpr_1") =+ (((parseRules ("Ruby","regexpr_rules"))) <|> ((pDetect2Chars False '\\' ')' >>= withAttribute OtherTok)) <|>- ((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_1_nested")+ ((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_1_nested")) <|> ((pRegExpr regex_'5c'29'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_regexpr_1_nested" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby","gdl_regexpr_1_nested") =+ (((parseRules ("Ruby","regexpr_rules"))) <|>- ((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_1_nested")+ ((pDetectChar False '(' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_1_nested")) <|> ((pDetectChar False ')' >>= withAttribute OtherTok) >>~ (popContext))) -parseRules "gdl_regexpr_2" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby","gdl_regexpr_2") =+ (((parseRules ("Ruby","regexpr_rules"))) <|> ((pDetect2Chars False '\\' '}' >>= withAttribute OtherTok)) <|> ((pRegExpr regex_'5c'7d'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_2_nested"))+ ((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_2_nested"))) -parseRules "gdl_regexpr_2_nested" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby","gdl_regexpr_2_nested") =+ (((parseRules ("Ruby","regexpr_rules"))) <|>- ((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_2_nested")+ ((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_2_nested")) <|> ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext))) -parseRules "gdl_regexpr_3" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby","gdl_regexpr_3") =+ (((parseRules ("Ruby","regexpr_rules"))) <|> ((pDetect2Chars False '\\' ']' >>= withAttribute OtherTok)) <|>- ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_3_nested")+ ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_3_nested")) <|> ((pRegExpr regex_'5c'5d'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_regexpr_3_nested" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby","gdl_regexpr_3_nested") =+ (((parseRules ("Ruby","regexpr_rules"))) <|>- ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_3_nested")+ ((pDetectChar False '[' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_3_nested")) <|> ((pDetectChar False ']' >>= withAttribute OtherTok) >>~ (popContext))) -parseRules "gdl_regexpr_4" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby","gdl_regexpr_4") =+ (((parseRules ("Ruby","regexpr_rules"))) <|> ((pDetect2Chars False '\\' '>' >>= withAttribute OtherTok)) <|>- ((pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_4_nested")+ ((pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_4_nested")) <|> ((pRegExpr regex_'3e'5buiomxn'5d'2a >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "gdl_regexpr_4_nested" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby","gdl_regexpr_4_nested") =+ (((parseRules ("Ruby","regexpr_rules"))) <|>- ((pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext "gdl_regexpr_4_nested")+ ((pDetectChar False '<' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","gdl_regexpr_4_nested")) <|> ((pDetectChar False '>' >>= withAttribute OtherTok) >>~ (popContext))) -parseRules "gdl_regexpr_5" =- (((parseRules "regexpr_rules"))+parseRules ("Ruby","gdl_regexpr_5") =+ (((parseRules ("Ruby","regexpr_rules"))) <|> ((pRegExprDynamic "\\\\%1" >>= withAttribute OtherTok)) <|> ((pRegExprDynamic "\\s*%1[uiomxn]*" >>= withAttribute OtherTok) >>~ (popContext >> popContext))) -parseRules "regexpr_rules" =+parseRules ("Ruby","regexpr_rules") = (((pDetect2Chars False '\\' '\\' >>= withAttribute OtherTok)) <|>- ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext "Short Subst")+ ((pRegExpr regex_'23'40'7b1'2c2'7d >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Short Subst")) <|>- ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext "Subst"))+ ((pDetect2Chars False '#' '{' >>= withAttribute OtherTok) >>~ pushContext ("Ruby","Subst"))) -parseRules "DATA" =+parseRules ("Ruby","DATA") = pzero -parseRules "" = parseRules "Normal"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Scala.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Javadoc import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,33 +26,35 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Scala" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Scala",["Normal"])], synStLanguage = "Scala", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Scala","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "String" -> (popContext) >> pEndLine- "Printf" -> (popContext) >> pEndLine- "PrintfString" -> (popContext) >> pEndLine- "Member" -> (popContext) >> pEndLine- "Commentar 1" -> (popContext) >> pEndLine- "Commentar 2" -> return ()+ ("Scala","Normal") -> return ()+ ("Scala","String") -> (popContext) >> pEndLine+ ("Scala","Printf") -> (popContext) >> pEndLine+ ("Scala","PrintfString") -> (popContext) >> pEndLine+ ("Scala","Member") -> (popContext) >> pEndLine+ ("Scala","Commentar 1") -> (popContext) >> pEndLine+ ("Scala","Commentar 2") -> return () _ -> return () withAttribute attr txt = do@@ -62,10 +63,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_scala2 = Set.fromList $ words $ "Actor ActorProxy ActorTask ActorThread AllRef Any AnyRef Application AppliedType Array ArrayBuffer Attribute BoxedArray BoxedBooleanArray BoxedByteArray BoxedCharArray Buffer BufferedIterator Char Console Enumeration Fluid Function IScheduler ImmutableMapAdaptor ImmutableSetAdaptor Int Iterable List ListBuffer None Option Ordered Pair PartialFunction Pid Predef PriorityQueue PriorityQueueProxy Reaction Ref Responder RichInt RichString Rule RuleTransformer Script Seq SerialVersionUID Some Stream Symbol TcpService TcpServiceWorker Triple Unit Value WorkerThread serializable transient volatile" list_java15 = Set.fromList $ words $ "ACTIVE ACTIVITY_COMPLETED ACTIVITY_REQUIRED ARG_IN ARG_INOUT ARG_OUT AWTError AWTEvent AWTEventListener AWTEventListenerProxy AWTEventMulticaster AWTException AWTKeyStroke AWTPermission AbstractAction AbstractBorder AbstractButton AbstractCellEditor AbstractCollection AbstractColorChooserPanel AbstractDocument AbstractDocument.AttributeContext AbstractDocument.Content AbstractDocument.ElementEdit AbstractExecutorService AbstractInterruptibleChannel AbstractLayoutCache AbstractLayoutCache.NodeDimensions AbstractList AbstractListModel AbstractMap AbstractMethodError AbstractPreferences AbstractQueue AbstractQueuedSynchronizer AbstractSelectableChannel AbstractSelectionKey AbstractSelector AbstractSequentialList AbstractSet AbstractSpinnerModel AbstractTableModel AbstractUndoableEdit AbstractWriter AccessControlContext AccessControlException AccessController AccessException Accessible AccessibleAction AccessibleAttributeSequence AccessibleBundle AccessibleComponent AccessibleContext AccessibleEditableText AccessibleExtendedComponent AccessibleExtendedTable AccessibleExtendedText AccessibleHyperlink AccessibleHypertext AccessibleIcon AccessibleKeyBinding AccessibleObject AccessibleRelation AccessibleRelationSet AccessibleResourceBundle AccessibleRole AccessibleSelection AccessibleState AccessibleStateSet AccessibleStreamable AccessibleTable AccessibleTableModelChange AccessibleText AccessibleTextSequence AccessibleValue AccountException AccountExpiredException AccountLockedException AccountNotFoundException Acl AclEntry AclNotFoundException Action ActionEvent ActionListener ActionMap ActionMapUIResource Activatable ActivateFailedException ActivationDesc ActivationException ActivationGroup ActivationGroupDesc ActivationGroupDesc.CommandEnvironment ActivationGroupID ActivationGroup_Stub ActivationID ActivationInstantiator ActivationMonitor ActivationSystem Activator ActiveEvent ActivityCompletedException ActivityRequiredException AdapterActivator AdapterActivatorOperations AdapterAlreadyExists AdapterAlreadyExistsHelper AdapterInactive AdapterInactiveHelper AdapterManagerIdHelper AdapterNameHelper AdapterNonExistent AdapterNonExistentHelper AdapterStateHelper AddressHelper Adjustable AdjustmentEvent AdjustmentListener Adler32 AffineTransform AffineTransformOp AlgorithmParameterGenerator AlgorithmParameterGeneratorSpi AlgorithmParameterSpec AlgorithmParameters AlgorithmParametersSpi AllPermission AlphaComposite AlreadyBound AlreadyBoundException AlreadyBoundHelper AlreadyBoundHolder AlreadyConnectedException AncestorEvent AncestorListener AnnotatedElement Annotation Annotation AnnotationFormatError AnnotationTypeMismatchException Any AnyHolder AnySeqHelper AnySeqHelper AnySeqHolder AppConfigurationEntry AppConfigurationEntry.LoginModuleControlFlag Appendable Applet AppletContext AppletInitializer AppletStub ApplicationException Arc2D Arc2D.Double Arc2D.Float Area AreaAveragingScaleFilter ArithmeticException Array Array ArrayBlockingQueue ArrayIndexOutOfBoundsException ArrayList ArrayStoreException ArrayType Arrays AssertionError AsyncBoxView AsynchronousCloseException AtomicBoolean AtomicInteger AtomicIntegerArray AtomicIntegerFieldUpdater AtomicLong AtomicLongArray AtomicLongFieldUpdater AtomicMarkableReference AtomicReference AtomicReferenceArray AtomicReferenceFieldUpdater AtomicStampedReference Attr Attribute Attribute Attribute AttributeChangeNotification AttributeChangeNotificationFilter AttributeException AttributeInUseException AttributeList AttributeList AttributeList AttributeListImpl AttributeModificationException AttributeNotFoundException AttributeSet AttributeSet AttributeSet.CharacterAttribute AttributeSet.ColorAttribute AttributeSet.FontAttribute AttributeSet.ParagraphAttribute AttributeSetUtilities AttributeValueExp AttributedCharacterIterator AttributedCharacterIterator.Attribute AttributedString Attributes Attributes Attributes Attributes.Name Attributes2 Attributes2Impl AttributesImpl AudioClip AudioFileFormat AudioFileFormat.Type AudioFileReader AudioFileWriter AudioFormat AudioFormat.Encoding AudioInputStream AudioPermission AudioSystem AuthPermission AuthProvider AuthenticationException AuthenticationException AuthenticationNotSupportedException Authenticator Authenticator.RequestorType AuthorizeCallback Autoscroll BAD_CONTEXT BAD_INV_ORDER BAD_OPERATION BAD_PARAM BAD_POLICY BAD_POLICY_TYPE BAD_POLICY_VALUE BAD_QOS BAD_TYPECODE BMPImageWriteParam BackingStoreException BadAttributeValueExpException BadBinaryOpValueExpException BadKind BadLocationException BadPaddingException BadStringOperationException BandCombineOp BandedSampleModel BaseRowSet BasicArrowButton BasicAttribute BasicAttributes BasicBorders BasicBorders.ButtonBorder BasicBorders.FieldBorder BasicBorders.MarginBorder BasicBorders.MenuBarBorder BasicBorders.RadioButtonBorder BasicBorders.RolloverButtonBorder BasicBorders.SplitPaneBorder BasicBorders.ToggleButtonBorder BasicButtonListener BasicButtonUI BasicCheckBoxMenuItemUI BasicCheckBoxUI BasicColorChooserUI BasicComboBoxEditor BasicComboBoxEditor.UIResource BasicComboBoxRenderer BasicComboBoxRenderer.UIResource BasicComboBoxUI BasicComboPopup BasicControl BasicDesktopIconUI BasicDesktopPaneUI BasicDirectoryModel BasicEditorPaneUI BasicFileChooserUI BasicFormattedTextFieldUI BasicGraphicsUtils BasicHTML BasicIconFactory BasicInternalFrameTitlePane BasicInternalFrameUI BasicLabelUI BasicListUI BasicLookAndFeel BasicMenuBarUI BasicMenuItemUI BasicMenuUI BasicOptionPaneUI BasicOptionPaneUI.ButtonAreaLayout BasicPanelUI BasicPasswordFieldUI BasicPermission BasicPopupMenuSeparatorUI BasicPopupMenuUI BasicProgressBarUI BasicRadioButtonMenuItemUI BasicRadioButtonUI BasicRootPaneUI BasicScrollBarUI BasicScrollPaneUI BasicSeparatorUI BasicSliderUI BasicSpinnerUI BasicSplitPaneDivider BasicSplitPaneUI BasicStroke BasicTabbedPaneUI BasicTableHeaderUI BasicTableUI BasicTextAreaUI BasicTextFieldUI BasicTextPaneUI BasicTextUI BasicTextUI.BasicCaret BasicTextUI.BasicHighlighter BasicToggleButtonUI BasicToolBarSeparatorUI BasicToolBarUI BasicToolTipUI BasicTreeUI BasicViewportUI BatchUpdateException BeanContext BeanContextChild BeanContextChildComponentProxy BeanContextChildSupport BeanContextContainerProxy BeanContextEvent BeanContextMembershipEvent BeanContextMembershipListener BeanContextProxy BeanContextServiceAvailableEvent BeanContextServiceProvider BeanContextServiceProviderBeanInfo BeanContextServiceRevokedEvent BeanContextServiceRevokedListener BeanContextServices BeanContextServicesListener BeanContextServicesSupport BeanContextServicesSupport.BCSSServiceProvider BeanContextSupport BeanContextSupport.BCSIterator BeanDescriptor BeanInfo Beans BevelBorder Bidi BigDecimal BigInteger BinaryRefAddr BindException Binding Binding BindingHelper BindingHolder BindingIterator BindingIteratorHelper BindingIteratorHolder BindingIteratorOperations BindingIteratorPOA BindingListHelper BindingListHolder BindingType BindingTypeHelper BindingTypeHolder BitSet Blob BlockView BlockingQueue Book Boolean BooleanControl BooleanControl.Type BooleanHolder BooleanSeqHelper BooleanSeqHolder Border BorderFactory BorderLayout BorderUIResource BorderUIResource.BevelBorderUIResource BorderUIResource.CompoundBorderUIResource BorderUIResource.EmptyBorderUIResource BorderUIResource.EtchedBorderUIResource BorderUIResource.LineBorderUIResource BorderUIResource.MatteBorderUIResource BorderUIResource.TitledBorderUIResource BoundedRangeModel Bounds Bounds Box Box.Filler BoxLayout BoxView BoxedValueHelper BreakIterator BrokenBarrierException Buffer BufferCapabilities BufferCapabilities.FlipContents BufferOverflowException BufferStrategy BufferUnderflowException BufferedImage BufferedImageFilter BufferedImageOp BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter Button ButtonGroup ButtonModel ButtonUI Byte ByteArrayInputStream ByteArrayOutputStream ByteBuffer ByteChannel ByteHolder ByteLookupTable ByteOrder CDATASection CMMException CODESET_INCOMPATIBLE COMM_FAILURE CRC32 CRL CRLException CRLSelector CSS CSS.Attribute CTX_RESTRICT_SCOPE CacheRequest CacheResponse CachedRowSet Calendar Callable CallableStatement Callback CallbackHandler CancelablePrintJob CancellationException CancelledKeyException CannotProceed CannotProceedException CannotProceedHelper CannotProceedHolder CannotRedoException CannotUndoException Canvas CardLayout Caret CaretEvent CaretListener CellEditor CellEditorListener CellRendererPane CertPath CertPath.CertPathRep CertPathBuilder CertPathBuilderException CertPathBuilderResult CertPathBuilderSpi CertPathParameters CertPathTrustManagerParameters CertPathValidator CertPathValidatorException CertPathValidatorResult CertPathValidatorSpi CertSelector CertStore CertStoreException CertStoreParameters CertStoreSpi Certificate Certificate Certificate Certificate.CertificateRep CertificateEncodingException CertificateEncodingException CertificateException CertificateException CertificateExpiredException CertificateExpiredException CertificateFactory CertificateFactorySpi CertificateNotYetValidException CertificateNotYetValidException CertificateParsingException CertificateParsingException ChangeEvent ChangeListener ChangedCharSetException Channel ChannelBinding Channels CharArrayReader CharArrayWriter CharBuffer CharConversionException CharHolder CharSeqHelper CharSeqHolder CharSequence Character Character.Subset Character.UnicodeBlock CharacterCodingException CharacterData CharacterIterator Charset CharsetDecoder CharsetEncoder CharsetProvider Checkbox CheckboxGroup CheckboxMenuItem CheckedInputStream CheckedOutputStream Checksum Choice ChoiceCallback ChoiceFormat Chromaticity Cipher CipherInputStream CipherOutputStream CipherSpi Class ClassCastException ClassCircularityError ClassDefinition ClassDesc ClassFileTransformer ClassFormatError ClassLoader ClassLoaderRepository ClassLoadingMXBean ClassNotFoundException ClientRequestInfo ClientRequestInfoOperations ClientRequestInterceptor ClientRequestInterceptorOperations Clip Clipboard ClipboardOwner Clob CloneNotSupportedException Cloneable Closeable ClosedByInterruptException ClosedChannelException ClosedSelectorException CodeSets CodeSigner CodeSource Codec CodecFactory CodecFactoryHelper CodecFactoryOperations CodecOperations CoderMalfunctionError CoderResult CodingErrorAction CollationElementIterator CollationKey Collator Collection CollectionCertStoreParameters Collections Color ColorChooserComponentFactory ColorChooserUI ColorConvertOp ColorModel ColorSelectionModel ColorSpace ColorSupported ColorType ColorUIResource ComboBoxEditor ComboBoxModel ComboBoxUI ComboPopup Comment CommunicationException Comparable Comparator CompilationMXBean Compiler CompletionService CompletionStatus CompletionStatusHelper Component ComponentAdapter ComponentColorModel ComponentEvent ComponentIdHelper ComponentInputMap ComponentInputMapUIResource ComponentListener ComponentOrientation ComponentSampleModel ComponentUI ComponentView Composite CompositeContext CompositeData CompositeDataSupport CompositeName CompositeType CompositeView CompoundBorder CompoundControl CompoundControl.Type CompoundEdit CompoundName Compression ConcurrentHashMap ConcurrentLinkedQueue ConcurrentMap ConcurrentModificationException Condition Configuration ConfigurationException ConfirmationCallback ConnectException ConnectException ConnectIOException Connection ConnectionEvent ConnectionEventListener ConnectionPendingException ConnectionPoolDataSource ConsoleHandler Constructor Container ContainerAdapter ContainerEvent ContainerListener ContainerOrderFocusTraversalPolicy ContentHandler ContentHandler ContentHandlerFactory ContentModel Context Context ContextList ContextNotEmptyException ContextualRenderedImageFactory Control Control Control.Type ControlFactory ControllerEventListener ConvolveOp CookieHandler CookieHolder Copies CopiesSupported CopyOnWriteArrayList CopyOnWriteArraySet CountDownLatch CounterMonitor CounterMonitorMBean CredentialException CredentialExpiredException CredentialNotFoundException CropImageFilter CubicCurve2D CubicCurve2D.Double CubicCurve2D.Float Currency Current Current Current CurrentHelper CurrentHelper CurrentHelper CurrentHolder CurrentOperations CurrentOperations CurrentOperations Cursor CustomMarshal CustomValue Customizer CyclicBarrier DATA_CONVERSION DESKeySpec DESedeKeySpec DGC DHGenParameterSpec DHKey DHParameterSpec DHPrivateKey DHPrivateKeySpec DHPublicKey DHPublicKeySpec DISCARDING DOMConfiguration DOMError DOMErrorHandler DOMException DOMImplementation DOMImplementationLS DOMImplementationList DOMImplementationRegistry DOMImplementationSource DOMLocator DOMLocator DOMResult DOMSource DOMStringList DSAKey DSAKeyPairGenerator DSAParameterSpec DSAParams DSAPrivateKey DSAPrivateKeySpec DSAPublicKey DSAPublicKeySpec DTD DTDConstants DTDHandler DataBuffer DataBufferByte DataBufferDouble DataBufferFloat DataBufferInt DataBufferShort DataBufferUShort DataFlavor DataFormatException DataInput DataInputStream DataInputStream DataLine DataLine.Info DataOutput DataOutputStream DataOutputStream DataSource DataTruncation DatabaseMetaData DatagramChannel DatagramPacket DatagramSocket DatagramSocketImpl DatagramSocketImplFactory DatatypeConfigurationException DatatypeConstants DatatypeConstants.Field DatatypeFactory Date Date DateFormat DateFormat.Field DateFormatSymbols DateFormatter DateTimeAtCompleted DateTimeAtCreation DateTimeAtProcessing DateTimeSyntax DebugGraphics DecimalFormat DecimalFormatSymbols DeclHandler DefaultBoundedRangeModel DefaultButtonModel DefaultCaret DefaultCellEditor DefaultColorSelectionModel DefaultComboBoxModel DefaultDesktopManager DefaultEditorKit DefaultEditorKit.BeepAction DefaultEditorKit.CopyAction DefaultEditorKit.CutAction DefaultEditorKit.DefaultKeyTypedAction DefaultEditorKit.InsertBreakAction DefaultEditorKit.InsertContentAction DefaultEditorKit.InsertTabAction DefaultEditorKit.PasteAction DefaultFocusManager DefaultFocusTraversalPolicy DefaultFormatter DefaultFormatterFactory DefaultHandler DefaultHandler2 DefaultHighlighter DefaultHighlighter.DefaultHighlightPainter DefaultKeyboardFocusManager DefaultListCellRenderer DefaultListCellRenderer.UIResource DefaultListModel DefaultListSelectionModel DefaultLoaderRepository DefaultLoaderRepository DefaultMenuLayout DefaultMetalTheme DefaultMutableTreeNode DefaultPersistenceDelegate DefaultSingleSelectionModel DefaultStyledDocument DefaultStyledDocument.AttributeUndoableEdit DefaultStyledDocument.ElementSpec DefaultTableCellRenderer DefaultTableCellRenderer.UIResource DefaultTableColumnModel DefaultTableModel DefaultTextUI DefaultTreeCellEditor DefaultTreeCellRenderer DefaultTreeModel DefaultTreeSelectionModel DefinitionKind DefinitionKindHelper Deflater DeflaterOutputStream DelayQueue Delayed Delegate Delegate Delegate DelegationPermission Deprecated Descriptor DescriptorAccess DescriptorSupport DesignMode DesktopIconUI DesktopManager DesktopPaneUI Destination DestroyFailedException Destroyable Dialog Dictionary DigestException DigestInputStream DigestOutputStream Dimension Dimension2D DimensionUIResource DirContext DirObjectFactory DirStateFactory DirStateFactory.Result DirectColorModel DirectoryManager DisplayMode DnDConstants Doc DocAttribute DocAttributeSet DocFlavor DocFlavor.BYTE_ARRAY DocFlavor.CHAR_ARRAY DocFlavor.INPUT_STREAM DocFlavor.READER DocFlavor.SERVICE_FORMATTED DocFlavor.STRING DocFlavor.URL DocPrintJob Document Document DocumentBuilder DocumentBuilderFactory DocumentEvent DocumentEvent.ElementChange DocumentEvent.EventType DocumentFilter DocumentFilter.FilterBypass DocumentFragment DocumentHandler DocumentListener DocumentName DocumentParser DocumentType Documented DomainCombiner DomainManager DomainManagerOperations Double DoubleBuffer DoubleHolder DoubleSeqHelper DoubleSeqHolder DragGestureEvent DragGestureListener DragGestureRecognizer DragSource DragSourceAdapter DragSourceContext DragSourceDragEvent DragSourceDropEvent DragSourceEvent DragSourceListener DragSourceMotionListener Driver DriverManager DriverPropertyInfo DropTarget DropTarget.DropTargetAutoScroller DropTargetAdapter DropTargetContext DropTargetDragEvent DropTargetDropEvent DropTargetEvent DropTargetListener DuplicateFormatFlagsException DuplicateName DuplicateNameHelper Duration DynAny DynAny DynAnyFactory DynAnyFactoryHelper DynAnyFactoryOperations DynAnyHelper DynAnyOperations DynAnySeqHelper DynArray DynArray DynArrayHelper DynArrayOperations DynEnum DynEnum DynEnumHelper DynEnumOperations DynFixed DynFixed DynFixedHelper DynFixedOperations DynSequence DynSequence DynSequenceHelper DynSequenceOperations DynStruct DynStruct DynStructHelper DynStructOperations DynUnion DynUnion DynUnionHelper DynUnionOperations DynValue DynValue DynValueBox DynValueBoxOperations DynValueCommon DynValueCommonOperations DynValueHelper DynValueOperations DynamicImplementation DynamicImplementation DynamicMBean ECField ECFieldF2m ECFieldFp ECGenParameterSpec ECKey ECParameterSpec ECPoint ECPrivateKey ECPrivateKeySpec ECPublicKey ECPublicKeySpec ENCODING_CDR_ENCAPS EOFException EditorKit Element Element Element ElementIterator ElementType Ellipse2D Ellipse2D.Double Ellipse2D.Float EllipticCurve EmptyBorder EmptyStackException EncodedKeySpec Encoder Encoding EncryptedPrivateKeyInfo Entity Entity EntityReference EntityResolver EntityResolver2 Enum EnumConstantNotPresentException EnumControl EnumControl.Type EnumMap EnumSet EnumSyntax Enumeration Environment Error ErrorHandler ErrorListener ErrorManager EtchedBorder Event EventContext EventDirContext EventHandler EventListener EventListenerList EventListenerProxy EventObject EventQueue EventSetDescriptor Exception ExceptionDetailMessage ExceptionInInitializerError ExceptionList ExceptionListener Exchanger ExecutionException Executor ExecutorCompletionService ExecutorService Executors ExemptionMechanism ExemptionMechanismException ExemptionMechanismSpi ExpandVetoException ExportException Expression ExtendedRequest ExtendedResponse Externalizable FREE_MEM FactoryConfigurationError FailedLoginException FeatureDescriptor Fidelity Field FieldNameHelper FieldNameHelper FieldPosition FieldView File FileCacheImageInputStream FileCacheImageOutputStream FileChannel FileChannel.MapMode FileChooserUI FileDescriptor FileDialog FileFilter FileFilter FileHandler FileImageInputStream FileImageOutputStream FileInputStream FileLock FileLockInterruptionException FileNameMap FileNotFoundException FileOutputStream FilePermission FileReader FileSystemView FileView FileWriter FilenameFilter Filter FilterInputStream FilterOutputStream FilterReader FilterWriter FilteredImageSource FilteredRowSet Finishings FixedHeightLayoutCache FixedHolder FlatteningPathIterator FlavorEvent FlavorException FlavorListener FlavorMap FlavorTable Float FloatBuffer FloatControl FloatControl.Type FloatHolder FloatSeqHelper FloatSeqHolder FlowLayout FlowView FlowView.FlowStrategy Flushable FocusAdapter FocusEvent FocusListener FocusManager FocusTraversalPolicy Font FontFormatException FontMetrics FontRenderContext FontUIResource FormSubmitEvent FormSubmitEvent.MethodType FormView Format Format.Field FormatConversionProvider FormatFlagsConversionMismatchException FormatMismatch FormatMismatchHelper Formattable FormattableFlags Formatter Formatter FormatterClosedException ForwardRequest ForwardRequest ForwardRequestHelper ForwardRequestHelper Frame Future FutureTask GSSContext GSSCredential GSSException GSSManager GSSName GZIPInputStream GZIPOutputStream GapContent GarbageCollectorMXBean GatheringByteChannel GaugeMonitor GaugeMonitorMBean GeneralPath GeneralSecurityException GenericArrayType GenericDeclaration GenericSignatureFormatError GlyphJustificationInfo GlyphMetrics GlyphVector GlyphView GlyphView.GlyphPainter GradientPaint GraphicAttribute Graphics Graphics2D GraphicsConfigTemplate GraphicsConfiguration GraphicsDevice GraphicsEnvironment GrayFilter GregorianCalendar GridBagConstraints GridBagLayout GridLayout Group Guard GuardedObject HOLDING HTML HTML.Attribute HTML.Tag HTML.UnknownTag HTMLDocument HTMLDocument.Iterator HTMLEditorKit HTMLEditorKit.HTMLFactory HTMLEditorKit.HTMLTextAction HTMLEditorKit.InsertHTMLTextAction HTMLEditorKit.LinkController HTMLEditorKit.Parser HTMLEditorKit.ParserCallback HTMLFrameHyperlinkEvent HTMLWriter Handler HandlerBase HandshakeCompletedEvent HandshakeCompletedListener HasControls HashAttributeSet HashDocAttributeSet HashMap HashPrintJobAttributeSet HashPrintRequestAttributeSet HashPrintServiceAttributeSet HashSet Hashtable HeadlessException HierarchyBoundsAdapter HierarchyBoundsListener HierarchyEvent HierarchyListener Highlighter Highlighter.Highlight Highlighter.HighlightPainter HostnameVerifier HttpRetryException HttpURLConnection HttpsURLConnection HyperlinkEvent HyperlinkEvent.EventType HyperlinkListener ICC_ColorSpace ICC_Profile ICC_ProfileGray ICC_ProfileRGB IDLEntity IDLType IDLTypeHelper IDLTypeOperations ID_ASSIGNMENT_POLICY_ID ID_UNIQUENESS_POLICY_ID IIOByteBuffer IIOException IIOImage IIOInvalidTreeException IIOMetadata IIOMetadataController IIOMetadataFormat IIOMetadataFormatImpl IIOMetadataNode IIOParam IIOParamController IIOReadProgressListener IIOReadUpdateListener IIOReadWarningListener IIORegistry IIOServiceProvider IIOWriteProgressListener IIOWriteWarningListener IMPLICIT_ACTIVATION_POLICY_ID IMP_LIMIT INACTIVE INITIALIZE INTERNAL INTF_REPOS INVALID_ACTIVITY INVALID_TRANSACTION INV_FLAG INV_IDENT INV_OBJREF INV_POLICY IOException IOR IORHelper IORHolder IORInfo IORInfoOperations IORInterceptor IORInterceptorOperations IORInterceptor_3_0 IORInterceptor_3_0Helper IORInterceptor_3_0Holder IORInterceptor_3_0Operations IRObject IRObjectOperations Icon IconUIResource IconView IdAssignmentPolicy IdAssignmentPolicyOperations IdAssignmentPolicyValue IdUniquenessPolicy IdUniquenessPolicyOperations IdUniquenessPolicyValue IdentifierHelper Identity IdentityHashMap IdentityScope IllegalAccessError IllegalAccessException IllegalArgumentException IllegalBlockSizeException IllegalBlockingModeException IllegalCharsetNameException IllegalClassFormatException IllegalComponentStateException IllegalFormatCodePointException IllegalFormatConversionException IllegalFormatException IllegalFormatFlagsException IllegalFormatPrecisionException IllegalFormatWidthException IllegalMonitorStateException IllegalPathStateException IllegalSelectorException IllegalStateException IllegalThreadStateException Image ImageCapabilities ImageConsumer ImageFilter ImageGraphicAttribute ImageIO ImageIcon ImageInputStream ImageInputStreamImpl ImageInputStreamSpi ImageObserver ImageOutputStream ImageOutputStreamImpl ImageOutputStreamSpi ImageProducer ImageReadParam ImageReader ImageReaderSpi ImageReaderWriterSpi ImageTranscoder ImageTranscoderSpi ImageTypeSpecifier ImageView ImageWriteParam ImageWriter ImageWriterSpi ImagingOpException ImplicitActivationPolicy ImplicitActivationPolicyOperations ImplicitActivationPolicyValue IncompatibleClassChangeError IncompleteAnnotationException InconsistentTypeCode InconsistentTypeCode InconsistentTypeCodeHelper IndexColorModel IndexOutOfBoundsException IndexedPropertyChangeEvent IndexedPropertyDescriptor IndirectionException Inet4Address Inet6Address InetAddress InetSocketAddress Inflater InflaterInputStream InheritableThreadLocal Inherited InitialContext InitialContextFactory InitialContextFactoryBuilder InitialDirContext InitialLdapContext InlineView InputContext InputEvent InputMap InputMapUIResource InputMethod InputMethodContext InputMethodDescriptor InputMethodEvent InputMethodHighlight InputMethodListener InputMethodRequests InputMismatchException InputSource InputStream InputStream InputStream InputStreamReader InputSubset InputVerifier Insets InsetsUIResource InstanceAlreadyExistsException InstanceNotFoundException InstantiationError InstantiationException Instrument Instrumentation InsufficientResourcesException IntBuffer IntHolder Integer IntegerSyntax Interceptor InterceptorOperations InternalError InternalFrameAdapter InternalFrameEvent InternalFrameFocusTraversalPolicy InternalFrameListener InternalFrameUI InternationalFormatter InterruptedException InterruptedIOException InterruptedNamingException InterruptibleChannel IntrospectionException IntrospectionException Introspector Invalid InvalidActivityException InvalidAddress InvalidAddressHelper InvalidAddressHolder InvalidAlgorithmParameterException InvalidApplicationException InvalidAttributeIdentifierException InvalidAttributeValueException InvalidAttributeValueException InvalidAttributesException InvalidClassException InvalidDnDOperationException InvalidKeyException InvalidKeyException InvalidKeySpecException InvalidMarkException InvalidMidiDataException InvalidName InvalidName InvalidName InvalidNameException InvalidNameHelper InvalidNameHelper InvalidNameHolder InvalidObjectException InvalidOpenTypeException InvalidParameterException InvalidParameterSpecException InvalidPolicy InvalidPolicyHelper InvalidPreferencesFormatException InvalidPropertiesFormatException InvalidRelationIdException InvalidRelationServiceException InvalidRelationTypeException InvalidRoleInfoException InvalidRoleValueException InvalidSearchControlsException InvalidSearchFilterException InvalidSeq InvalidSlot InvalidSlotHelper InvalidTargetObjectTypeException InvalidTransactionException InvalidTypeForEncoding InvalidTypeForEncodingHelper InvalidValue InvalidValue InvalidValueHelper InvocationEvent InvocationHandler InvocationTargetException InvokeHandler IstringHelper ItemEvent ItemListener ItemSelectable Iterable Iterator IvParameterSpec JApplet JButton JCheckBox JCheckBoxMenuItem JColorChooser JComboBox JComboBox.KeySelectionManager JComponent JDesktopPane JDialog JEditorPane JFileChooser JFormattedTextField JFormattedTextField.AbstractFormatter JFormattedTextField.AbstractFormatterFactory JFrame JInternalFrame JInternalFrame.JDesktopIcon JLabel JLayeredPane JList JMException JMRuntimeException JMXAuthenticator JMXConnectionNotification JMXConnector JMXConnectorFactory JMXConnectorProvider JMXConnectorServer JMXConnectorServerFactory JMXConnectorServerMBean JMXConnectorServerProvider JMXPrincipal JMXProviderException JMXServerErrorException JMXServiceURL JMenu JMenuBar JMenuItem JOptionPane JPEGHuffmanTable JPEGImageReadParam JPEGImageWriteParam JPEGQTable JPanel JPasswordField JPopupMenu JPopupMenu.Separator JProgressBar JRadioButton JRadioButtonMenuItem JRootPane JScrollBar JScrollPane JSeparator JSlider JSpinner JSpinner.DateEditor JSpinner.DefaultEditor JSpinner.ListEditor JSpinner.NumberEditor JSplitPane JTabbedPane JTable JTable.PrintMode JTableHeader JTextArea JTextComponent JTextComponent.KeyBinding JTextField JTextPane JToggleButton JToggleButton.ToggleButtonModel JToolBar JToolBar.Separator JToolTip JTree JTree.DynamicUtilTreeNode JTree.EmptySelectionModel JViewport JWindow JarEntry JarException JarFile JarInputStream JarOutputStream JarURLConnection JdbcRowSet JobAttributes JobAttributes.DefaultSelectionType JobAttributes.DestinationType JobAttributes.DialogType JobAttributes.MultipleDocumentHandlingType JobAttributes.SidesType JobHoldUntil JobImpressions JobImpressionsCompleted JobImpressionsSupported JobKOctets JobKOctetsProcessed JobKOctetsSupported JobMediaSheets JobMediaSheetsCompleted JobMediaSheetsSupported JobMessageFromOperator JobName JobOriginatingUserName JobPriority JobPrioritySupported JobSheets JobState JobStateReason JobStateReasons JoinRowSet Joinable KerberosKey KerberosPrincipal KerberosTicket Kernel Key KeyAdapter KeyAgreement KeyAgreementSpi KeyAlreadyExistsException KeyEvent KeyEventDispatcher KeyEventPostProcessor KeyException KeyFactory KeyFactorySpi KeyGenerator KeyGeneratorSpi KeyListener KeyManagementException KeyManager KeyManagerFactory KeyManagerFactorySpi KeyPair KeyPairGenerator KeyPairGeneratorSpi KeyRep KeyRep.Type KeySpec KeyStore KeyStore.Builder KeyStore.CallbackHandlerProtection KeyStore.Entry KeyStore.LoadStoreParameter KeyStore.PasswordProtection KeyStore.PrivateKeyEntry KeyStore.ProtectionParameter KeyStore.SecretKeyEntry KeyStore.TrustedCertificateEntry KeyStoreBuilderParameters KeyStoreException KeyStoreSpi KeyStroke KeyboardFocusManager Keymap LDAPCertStoreParameters LIFESPAN_POLICY_ID LOCATION_FORWARD LSException LSInput LSLoadEvent LSOutput LSParser LSParserFilter LSProgressEvent LSResourceResolver LSSerializer LSSerializerFilter Label LabelUI LabelView LanguageCallback LastOwnerException LayeredHighlighter LayeredHighlighter.LayerPainter LayoutFocusTraversalPolicy LayoutManager LayoutManager2 LayoutQueue LdapContext LdapName LdapReferralException Lease Level LexicalHandler LifespanPolicy LifespanPolicyOperations LifespanPolicyValue LimitExceededException Line Line.Info Line2D Line2D.Double Line2D.Float LineBorder LineBreakMeasurer LineEvent LineEvent.Type LineListener LineMetrics LineNumberInputStream LineNumberReader LineUnavailableException LinkException LinkLoopException LinkRef LinkageError LinkedBlockingQueue LinkedHashMap LinkedHashSet LinkedList List List ListCellRenderer ListDataEvent ListDataListener ListIterator ListModel ListResourceBundle ListSelectionEvent ListSelectionListener ListSelectionModel ListUI ListView ListenerNotFoundException LoaderHandler LocalObject Locale LocateRegistry Locator Locator2 Locator2Impl LocatorImpl Lock LockSupport LogManager LogRecord LogStream Logger LoggingMXBean LoggingPermission LoginContext LoginException LoginModule Long LongBuffer LongHolder LongLongSeqHelper LongLongSeqHolder LongSeqHelper LongSeqHolder LookAndFeel LookupOp LookupTable MARSHAL MBeanAttributeInfo MBeanConstructorInfo MBeanException MBeanFeatureInfo MBeanInfo MBeanNotificationInfo MBeanOperationInfo MBeanParameterInfo MBeanPermission MBeanRegistration MBeanRegistrationException MBeanServer MBeanServerBuilder MBeanServerConnection MBeanServerDelegate MBeanServerDelegateMBean MBeanServerFactory MBeanServerForwarder MBeanServerInvocationHandler MBeanServerNotification MBeanServerNotificationFilter MBeanServerPermission MBeanTrustPermission MGF1ParameterSpec MLet MLetMBean Mac MacSpi MalformedInputException MalformedLinkException MalformedObjectNameException MalformedParameterizedTypeException MalformedURLException ManageReferralControl ManagementFactory ManagementPermission ManagerFactoryParameters Manifest Map Map.Entry MappedByteBuffer MarshalException MarshalledObject MaskFormatter MatchResult Matcher Math MathContext MatteBorder Media MediaName MediaPrintableArea MediaSize MediaSize.Engineering MediaSize.ISO MediaSize.JIS MediaSize.NA MediaSize.Other MediaSizeName MediaTracker MediaTray Member MemoryCacheImageInputStream MemoryCacheImageOutputStream MemoryHandler MemoryImageSource MemoryMXBean MemoryManagerMXBean MemoryNotificationInfo MemoryPoolMXBean MemoryType MemoryUsage Menu MenuBar MenuBarUI MenuComponent MenuContainer MenuDragMouseEvent MenuDragMouseListener MenuElement MenuEvent MenuItem MenuItemUI MenuKeyEvent MenuKeyListener MenuListener MenuSelectionManager MenuShortcut MessageDigest MessageDigestSpi MessageFormat MessageFormat.Field MessageProp MetaEventListener MetaMessage MetalBorders MetalBorders.ButtonBorder MetalBorders.Flush3DBorder MetalBorders.InternalFrameBorder MetalBorders.MenuBarBorder MetalBorders.MenuItemBorder MetalBorders.OptionDialogBorder MetalBorders.PaletteBorder MetalBorders.PopupMenuBorder MetalBorders.RolloverButtonBorder MetalBorders.ScrollPaneBorder MetalBorders.TableHeaderBorder MetalBorders.TextFieldBorder MetalBorders.ToggleButtonBorder MetalBorders.ToolBarBorder MetalButtonUI MetalCheckBoxIcon MetalCheckBoxUI MetalComboBoxButton MetalComboBoxEditor MetalComboBoxEditor.UIResource MetalComboBoxIcon MetalComboBoxUI MetalDesktopIconUI MetalFileChooserUI MetalIconFactory MetalIconFactory.FileIcon16 MetalIconFactory.FolderIcon16 MetalIconFactory.PaletteCloseIcon MetalIconFactory.TreeControlIcon MetalIconFactory.TreeFolderIcon MetalIconFactory.TreeLeafIcon MetalInternalFrameTitlePane MetalInternalFrameUI MetalLabelUI MetalLookAndFeel MetalMenuBarUI MetalPopupMenuSeparatorUI MetalProgressBarUI MetalRadioButtonUI MetalRootPaneUI MetalScrollBarUI MetalScrollButton MetalScrollPaneUI MetalSeparatorUI MetalSliderUI MetalSplitPaneUI MetalTabbedPaneUI MetalTextFieldUI MetalTheme MetalToggleButtonUI MetalToolBarUI MetalToolTipUI MetalTreeUI Method MethodDescriptor MidiChannel MidiDevice MidiDevice.Info MidiDeviceProvider MidiEvent MidiFileFormat MidiFileReader MidiFileWriter MidiMessage MidiSystem MidiUnavailableException MimeTypeParseException MinimalHTMLWriter MissingFormatArgumentException MissingFormatWidthException MissingResourceException Mixer Mixer.Info MixerProvider ModelMBean ModelMBeanAttributeInfo ModelMBeanConstructorInfo ModelMBeanInfo ModelMBeanInfoSupport ModelMBeanNotificationBroadcaster ModelMBeanNotificationInfo ModelMBeanOperationInfo ModificationItem Modifier Monitor MonitorMBean MonitorNotification MonitorSettingException MouseAdapter MouseDragGestureRecognizer MouseEvent MouseInfo MouseInputAdapter MouseInputListener MouseListener MouseMotionAdapter MouseMotionListener MouseWheelEvent MouseWheelListener MultiButtonUI MultiColorChooserUI MultiComboBoxUI MultiDesktopIconUI MultiDesktopPaneUI MultiDoc MultiDocPrintJob MultiDocPrintService MultiFileChooserUI MultiInternalFrameUI MultiLabelUI MultiListUI MultiLookAndFeel MultiMenuBarUI MultiMenuItemUI MultiOptionPaneUI MultiPanelUI MultiPixelPackedSampleModel MultiPopupMenuUI MultiProgressBarUI MultiRootPaneUI MultiScrollBarUI MultiScrollPaneUI MultiSeparatorUI MultiSliderUI MultiSpinnerUI MultiSplitPaneUI MultiTabbedPaneUI MultiTableHeaderUI MultiTableUI MultiTextUI MultiToolBarUI MultiToolTipUI MultiTreeUI MultiViewportUI MulticastSocket MultipleComponentProfileHelper MultipleComponentProfileHolder MultipleDocumentHandling MultipleMaster MutableAttributeSet MutableComboBoxModel MutableTreeNode NON_EXISTENT NO_IMPLEMENT NO_MEMORY NO_PERMISSION NO_RESOURCES NO_RESPONSE NVList Name NameAlreadyBoundException NameCallback NameClassPair NameComponent NameComponentHelper NameComponentHolder NameDynAnyPair NameDynAnyPairHelper NameDynAnyPairSeqHelper NameHelper NameHolder NameList NameNotFoundException NameParser NameValuePair NameValuePair NameValuePairHelper NameValuePairHelper NameValuePairSeqHelper NamedNodeMap NamedValue NamespaceChangeListener NamespaceContext NamespaceSupport Naming NamingContext NamingContextExt NamingContextExtHelper NamingContextExtHolder NamingContextExtOperations NamingContextExtPOA NamingContextHelper NamingContextHolder NamingContextOperations NamingContextPOA NamingEnumeration NamingEvent NamingException NamingExceptionEvent NamingListener NamingManager NamingSecurityException NavigationFilter NavigationFilter.FilterBypass NegativeArraySizeException NetPermission NetworkInterface NoClassDefFoundError NoConnectionPendingException NoContext NoContextHelper NoInitialContextException NoPermissionException NoRouteToHostException NoServant NoServantHelper NoSuchAlgorithmException NoSuchAttributeException NoSuchElementException NoSuchFieldError NoSuchFieldException NoSuchMethodError NoSuchMethodException NoSuchObjectException NoSuchPaddingException NoSuchProviderException Node NodeChangeEvent NodeChangeListener NodeList NonReadableChannelException NonWritableChannelException NoninvertibleTransformException NotActiveException NotBoundException NotCompliantMBeanException NotContextException NotEmpty NotEmptyHelper NotEmptyHolder NotFound NotFoundHelper NotFoundHolder NotFoundReason NotFoundReasonHelper NotFoundReasonHolder NotOwnerException NotSerializableException NotYetBoundException NotYetConnectedException Notation Notification NotificationBroadcaster NotificationBroadcasterSupport NotificationEmitter NotificationFilter NotificationFilterSupport NotificationListener NotificationResult NullCipher NullPointerException Number NumberFormat NumberFormat.Field NumberFormatException NumberFormatter NumberOfDocuments NumberOfInterveningJobs NumberUp NumberUpSupported NumericShaper OAEPParameterSpec OBJECT_NOT_EXIST OBJ_ADAPTER OMGVMCID ORB ORB ORBIdHelper ORBInitInfo ORBInitInfoOperations ORBInitializer ORBInitializerOperations ObjID Object Object ObjectAlreadyActive ObjectAlreadyActiveHelper ObjectChangeListener ObjectFactory ObjectFactoryBuilder ObjectHelper ObjectHolder ObjectIdHelper ObjectIdHelper ObjectImpl ObjectImpl ObjectInput ObjectInputStream ObjectInputStream.GetField ObjectInputValidation ObjectInstance ObjectName ObjectNotActive ObjectNotActiveHelper ObjectOutput ObjectOutputStream ObjectOutputStream.PutField ObjectReferenceFactory ObjectReferenceFactoryHelper ObjectReferenceFactoryHolder ObjectReferenceTemplate ObjectReferenceTemplateHelper ObjectReferenceTemplateHolder ObjectReferenceTemplateSeqHelper ObjectReferenceTemplateSeqHolder ObjectStreamClass ObjectStreamConstants ObjectStreamException ObjectStreamField ObjectView Observable Observer OceanTheme OctetSeqHelper OctetSeqHolder Oid OpenDataException OpenMBeanAttributeInfo OpenMBeanAttributeInfoSupport OpenMBeanConstructorInfo OpenMBeanConstructorInfoSupport OpenMBeanInfo OpenMBeanInfoSupport OpenMBeanOperationInfo OpenMBeanOperationInfoSupport OpenMBeanParameterInfo OpenMBeanParameterInfoSupport OpenType OpenType OperatingSystemMXBean Operation OperationNotSupportedException OperationsException Option OptionPaneUI OptionalDataException OrientationRequested OutOfMemoryError OutputDeviceAssigned OutputKeys OutputStream OutputStream OutputStream OutputStreamWriter OverlappingFileLockException OverlayLayout Override Owner PBEKey PBEKeySpec PBEParameterSpec PDLOverrideSupported PERSIST_STORE PKCS8EncodedKeySpec PKIXBuilderParameters PKIXCertPathBuilderResult PKIXCertPathChecker PKIXCertPathValidatorResult PKIXParameters POA POAHelper POAManager POAManagerOperations POAOperations PRIVATE_MEMBER PSSParameterSpec PSource PSource.PSpecified PUBLIC_MEMBER Pack200 Pack200.Packer Pack200.Unpacker Package PackedColorModel PageAttributes PageAttributes.ColorType PageAttributes.MediaType PageAttributes.OrientationRequestedType PageAttributes.OriginType PageAttributes.PrintQualityType PageFormat PageRanges Pageable PagedResultsControl PagedResultsResponseControl PagesPerMinute PagesPerMinuteColor Paint PaintContext PaintEvent Panel PanelUI Paper ParagraphView ParagraphView Parameter ParameterBlock ParameterDescriptor ParameterMetaData ParameterMode ParameterModeHelper ParameterModeHolder ParameterizedType ParseException ParsePosition Parser Parser ParserAdapter ParserConfigurationException ParserDelegator ParserFactory PartialResultException PasswordAuthentication PasswordCallback PasswordView Patch PathIterator Pattern PatternSyntaxException Permission Permission PermissionCollection Permissions PersistenceDelegate PersistentMBean PhantomReference Pipe Pipe.SinkChannel Pipe.SourceChannel PipedInputStream PipedOutputStream PipedReader PipedWriter PixelGrabber PixelInterleavedSampleModel PlainDocument PlainView Point Point2D Point2D.Double Point2D.Float PointerInfo Policy Policy Policy PolicyError PolicyErrorCodeHelper PolicyErrorHelper PolicyErrorHolder PolicyFactory PolicyFactoryOperations PolicyHelper PolicyHolder PolicyListHelper PolicyListHolder PolicyNode PolicyOperations PolicyQualifierInfo PolicyTypeHelper Polygon PooledConnection Popup PopupFactory PopupMenu PopupMenuEvent PopupMenuListener PopupMenuUI Port Port.Info PortUnreachableException PortableRemoteObject PortableRemoteObjectDelegate Position Position.Bias Predicate PreferenceChangeEvent PreferenceChangeListener Preferences PreferencesFactory PreparedStatement PresentationDirection Principal Principal PrincipalHolder PrintEvent PrintException PrintGraphics PrintJob PrintJobAdapter PrintJobAttribute PrintJobAttributeEvent PrintJobAttributeListener PrintJobAttributeSet PrintJobEvent PrintJobListener PrintQuality PrintRequestAttribute PrintRequestAttributeSet PrintService PrintServiceAttribute PrintServiceAttributeEvent PrintServiceAttributeListener PrintServiceAttributeSet PrintServiceLookup PrintStream PrintWriter Printable PrinterAbortException PrinterException PrinterGraphics PrinterIOException PrinterInfo PrinterIsAcceptingJobs PrinterJob PrinterLocation PrinterMakeAndModel PrinterMessageFromOperator PrinterMoreInfo PrinterMoreInfoManufacturer PrinterName PrinterResolution PrinterState PrinterStateReason PrinterStateReasons PrinterURI PriorityBlockingQueue PriorityQueue PrivateClassLoader PrivateCredentialPermission PrivateKey PrivateMLet PrivilegedAction PrivilegedActionException PrivilegedExceptionAction Process ProcessBuilder ProcessingInstruction ProfileDataException ProfileIdHelper ProgressBarUI ProgressMonitor ProgressMonitorInputStream Properties PropertyChangeEvent PropertyChangeListener PropertyChangeListenerProxy PropertyChangeSupport PropertyDescriptor PropertyEditor PropertyEditorManager PropertyEditorSupport PropertyPermission PropertyResourceBundle PropertyVetoException ProtectionDomain ProtocolException Provider Provider.Service ProviderException Proxy Proxy Proxy.Type ProxySelector PublicKey PushbackInputStream PushbackReader QName QuadCurve2D QuadCurve2D.Double QuadCurve2D.Float Query QueryEval QueryExp Queue QueuedJobCount RC2ParameterSpec RC5ParameterSpec REBIND REQUEST_PROCESSING_POLICY_ID RGBImageFilter RMIClassLoader RMIClassLoaderSpi RMIClientSocketFactory RMIConnection RMIConnectionImpl RMIConnectionImpl_Stub RMIConnector RMIConnectorServer RMICustomMaxStreamFormat RMIFailureHandler RMIIIOPServerImpl RMIJRMPServerImpl RMISecurityException RMISecurityManager RMIServer RMIServerImpl RMIServerImpl_Stub RMIServerSocketFactory RMISocketFactory RSAKey RSAKeyGenParameterSpec RSAMultiPrimePrivateCrtKey RSAMultiPrimePrivateCrtKeySpec RSAOtherPrimeInfo RSAPrivateCrtKey RSAPrivateCrtKeySpec RSAPrivateKey RSAPrivateKeySpec RSAPublicKey RSAPublicKeySpec RTFEditorKit Random RandomAccess RandomAccessFile Raster RasterFormatException RasterOp Rdn ReadOnlyBufferException ReadWriteLock Readable ReadableByteChannel Reader RealmCallback RealmChoiceCallback Receiver Rectangle Rectangle2D Rectangle2D.Double Rectangle2D.Float RectangularShape ReentrantLock ReentrantReadWriteLock ReentrantReadWriteLock.ReadLock ReentrantReadWriteLock.WriteLock Ref RefAddr Reference Reference ReferenceQueue ReferenceUriSchemesSupported Referenceable ReferralException ReflectPermission ReflectionException RefreshFailedException Refreshable Region RegisterableService Registry RegistryHandler RejectedExecutionException RejectedExecutionHandler Relation RelationException RelationNotFoundException RelationNotification RelationService RelationServiceMBean RelationServiceNotRegisteredException RelationSupport RelationSupportMBean RelationType RelationTypeNotFoundException RelationTypeSupport RemarshalException Remote RemoteCall RemoteException RemoteObject RemoteObjectInvocationHandler RemoteRef RemoteServer RemoteStub RenderContext RenderableImage RenderableImageOp RenderableImageProducer RenderedImage RenderedImageFactory Renderer RenderingHints RenderingHints.Key RepaintManager ReplicateScaleFilter RepositoryIdHelper Request RequestInfo RequestInfoOperations RequestProcessingPolicy RequestProcessingPolicyOperations RequestProcessingPolicyValue RequestingUserName RequiredModelMBean RescaleOp ResolutionSyntax ResolveResult Resolver ResourceBundle ResponseCache ResponseHandler Result ResultSet ResultSetMetaData Retention RetentionPolicy ReverbType Robot Role RoleInfo RoleInfoNotFoundException RoleList RoleNotFoundException RoleResult RoleStatus RoleUnresolved RoleUnresolvedList RootPaneContainer RootPaneUI RoundRectangle2D RoundRectangle2D.Double RoundRectangle2D.Float RoundingMode RowMapper RowSet RowSetEvent RowSetInternal RowSetListener RowSetMetaData RowSetMetaDataImpl RowSetReader RowSetWarning RowSetWriter RuleBasedCollator RunTime RunTimeOperations Runnable Runtime RuntimeErrorException RuntimeException RuntimeMBeanException RuntimeMXBean RuntimeOperationsException RuntimePermission SAXException SAXNotRecognizedException SAXNotSupportedException SAXParseException SAXParser SAXParserFactory SAXResult SAXSource SAXTransformerFactory SERVANT_RETENTION_POLICY_ID SQLData SQLException SQLInput SQLInputImpl SQLOutput SQLOutputImpl SQLPermission SQLWarning SSLContext SSLContextSpi SSLEngine SSLEngineResult SSLEngineResult.HandshakeStatus SSLEngineResult.Status SSLException SSLHandshakeException SSLKeyException SSLPeerUnverifiedException SSLPermission SSLProtocolException SSLServerSocket SSLServerSocketFactory SSLSession SSLSessionBindingEvent SSLSessionBindingListener SSLSessionContext SSLSocket SSLSocketFactory SUCCESSFUL SYNC_WITH_TRANSPORT SYSTEM_EXCEPTION SampleModel Sasl SaslClient SaslClientFactory SaslException SaslServer SaslServerFactory Savepoint Scanner ScatteringByteChannel ScheduledExecutorService ScheduledFuture ScheduledThreadPoolExecutor Schema SchemaFactory SchemaFactoryLoader SchemaViolationException ScrollBarUI ScrollPane ScrollPaneAdjustable ScrollPaneConstants ScrollPaneLayout ScrollPaneLayout.UIResource ScrollPaneUI Scrollable Scrollbar SealedObject SearchControls SearchResult SecretKey SecretKeyFactory SecretKeyFactorySpi SecretKeySpec SecureCacheResponse SecureClassLoader SecureRandom SecureRandomSpi Security SecurityException SecurityManager SecurityPermission Segment SelectableChannel SelectionKey Selector SelectorProvider Semaphore SeparatorUI Sequence SequenceInputStream Sequencer Sequencer.SyncMode SerialArray SerialBlob SerialClob SerialDatalink SerialException SerialJavaObject SerialRef SerialStruct Serializable SerializablePermission Servant ServantActivator ServantActivatorHelper ServantActivatorOperations ServantActivatorPOA ServantAlreadyActive ServantAlreadyActiveHelper ServantLocator ServantLocatorHelper ServantLocatorOperations ServantLocatorPOA ServantManager ServantManagerOperations ServantNotActive ServantNotActiveHelper ServantObject ServantRetentionPolicy ServantRetentionPolicyOperations ServantRetentionPolicyValue ServerCloneException ServerError ServerException ServerIdHelper ServerNotActiveException ServerRef ServerRequest ServerRequestInfo ServerRequestInfoOperations ServerRequestInterceptor ServerRequestInterceptorOperations ServerRuntimeException ServerSocket ServerSocketChannel ServerSocketFactory ServiceContext ServiceContextHelper ServiceContextHolder ServiceContextListHelper ServiceContextListHolder ServiceDetail ServiceDetailHelper ServiceIdHelper ServiceInformation ServiceInformationHelper ServiceInformationHolder ServiceNotFoundException ServicePermission ServiceRegistry ServiceRegistry.Filter ServiceUI ServiceUIFactory ServiceUnavailableException Set SetOfIntegerSyntax SetOverrideType SetOverrideTypeHelper Severity Shape ShapeGraphicAttribute SheetCollate Short ShortBuffer ShortBufferException ShortHolder ShortLookupTable ShortMessage ShortSeqHelper ShortSeqHolder Sides Signature SignatureException SignatureSpi SignedObject Signer SimpleAttributeSet SimpleBeanInfo SimpleDateFormat SimpleDoc SimpleFormatter SimpleTimeZone SimpleType SinglePixelPackedSampleModel SingleSelectionModel Size2DSyntax SizeLimitExceededException SizeRequirements SizeSequence Skeleton SkeletonMismatchException SkeletonNotFoundException SliderUI Socket SocketAddress SocketChannel SocketException SocketFactory SocketHandler SocketImpl SocketImplFactory SocketOptions SocketPermission SocketSecurityException SocketTimeoutException SoftBevelBorder SoftReference SortControl SortKey SortResponseControl SortedMap SortedSet SortingFocusTraversalPolicy Soundbank SoundbankReader SoundbankResource Source SourceDataLine SourceLocator SpinnerDateModel SpinnerListModel SpinnerModel SpinnerNumberModel SpinnerUI SplitPaneUI Spring SpringLayout SpringLayout.Constraints SslRMIClientSocketFactory SslRMIServerSocketFactory Stack StackOverflowError StackTraceElement StandardMBean StartTlsRequest StartTlsResponse State StateEdit StateEditable StateFactory Statement Statement StreamCorruptedException StreamHandler StreamPrintService StreamPrintServiceFactory StreamResult StreamSource StreamTokenizer Streamable StreamableValue StrictMath String StringBuffer StringBufferInputStream StringBuilder StringCharacterIterator StringContent StringHolder StringIndexOutOfBoundsException StringMonitor StringMonitorMBean StringNameHelper StringReader StringRefAddr StringSelection StringSeqHelper StringSeqHolder StringTokenizer StringValueExp StringValueHelper StringWriter Stroke Struct StructMember StructMemberHelper Stub StubDelegate StubNotFoundException Style StyleConstants StyleConstants.CharacterConstants StyleConstants.ColorConstants StyleConstants.FontConstants StyleConstants.ParagraphConstants StyleContext StyleSheet StyleSheet.BoxPainter StyleSheet.ListPainter StyledDocument StyledEditorKit StyledEditorKit.AlignmentAction StyledEditorKit.BoldAction StyledEditorKit.FontFamilyAction StyledEditorKit.FontSizeAction StyledEditorKit.ForegroundAction StyledEditorKit.ItalicAction StyledEditorKit.StyledTextAction StyledEditorKit.UnderlineAction Subject SubjectDelegationPermission SubjectDomainCombiner SupportedValuesAttribute SuppressWarnings SwingConstants SwingPropertyChangeSupport SwingUtilities SyncFactory SyncFactoryException SyncFailedException SyncProvider SyncProviderException SyncResolver SyncScopeHelper SynchronousQueue SynthConstants SynthContext SynthGraphicsUtils SynthLookAndFeel SynthPainter SynthStyle SynthStyleFactory Synthesizer SysexMessage System SystemColor SystemException SystemFlavorMap TAG_ALTERNATE_IIOP_ADDRESS TAG_CODE_SETS TAG_INTERNET_IOP TAG_JAVA_CODEBASE TAG_MULTIPLE_COMPONENTS TAG_ORB_TYPE TAG_POLICIES TAG_RMI_CUSTOM_MAX_STREAM_FORMAT TCKind THREAD_POLICY_ID TIMEOUT TRANSACTION_MODE TRANSACTION_REQUIRED TRANSACTION_ROLLEDBACK TRANSACTION_UNAVAILABLE TRANSIENT TRANSPORT_RETRY TabExpander TabSet TabStop TabableView TabbedPaneUI TableCellEditor TableCellRenderer TableColumn TableColumnModel TableColumnModelEvent TableColumnModelListener TableHeaderUI TableModel TableModelEvent TableModelListener TableUI TableView TabularData TabularDataSupport TabularType TagElement TaggedComponent TaggedComponentHelper TaggedComponentHolder TaggedProfile TaggedProfileHelper TaggedProfileHolder Target TargetDataLine TargetedNotification Templates TemplatesHandler Text TextAction TextArea TextAttribute TextComponent TextEvent TextField TextHitInfo TextInputCallback TextLayout TextLayout.CaretPolicy TextListener TextMeasurer TextOutputCallback TextSyntax TextUI TexturePaint Thread Thread.State Thread.UncaughtExceptionHandler ThreadDeath ThreadFactory ThreadGroup ThreadInfo ThreadLocal ThreadMXBean ThreadPolicy ThreadPolicyOperations ThreadPolicyValue ThreadPoolExecutor ThreadPoolExecutor.AbortPolicy ThreadPoolExecutor.CallerRunsPolicy ThreadPoolExecutor.DiscardOldestPolicy ThreadPoolExecutor.DiscardPolicy Throwable Tie TileObserver Time TimeLimitExceededException TimeUnit TimeZone TimeoutException Timer Timer Timer TimerAlarmClockNotification TimerMBean TimerNotification TimerTask Timestamp Timestamp TitledBorder TooManyListenersException ToolBarUI ToolTipManager ToolTipUI Toolkit Track TransactionRequiredException TransactionRolledbackException TransactionService TransactionalWriter TransferHandler Transferable TransformAttribute Transformer TransformerConfigurationException TransformerException TransformerFactory TransformerFactoryConfigurationError TransformerHandler Transmitter Transparency TreeCellEditor TreeCellRenderer TreeExpansionEvent TreeExpansionListener TreeMap TreeModel TreeModelEvent TreeModelListener TreeNode TreePath TreeSelectionEvent TreeSelectionListener TreeSelectionModel TreeSet TreeUI TreeWillExpandListener TrustAnchor TrustManager TrustManagerFactory TrustManagerFactorySpi Type TypeCode TypeCodeHolder TypeInfo TypeInfoProvider TypeMismatch TypeMismatch TypeMismatch TypeMismatchHelper TypeMismatchHelper TypeNotPresentException TypeVariable Types UID UIDefaults UIDefaults.ActiveValue UIDefaults.LazyInputMap UIDefaults.LazyValue UIDefaults.ProxyLazyValue UIManager UIManager.LookAndFeelInfo UIResource ULongLongSeqHelper ULongLongSeqHolder ULongSeqHelper ULongSeqHolder UNKNOWN UNKNOWN UNSUPPORTED_POLICY UNSUPPORTED_POLICY_VALUE URI URIException URIResolver URISyntax URISyntaxException URL URLClassLoader URLConnection URLDecoder URLEncoder URLStreamHandler URLStreamHandlerFactory URLStringHelper USER_EXCEPTION UShortSeqHelper UShortSeqHolder UTFDataFormatException UUID UndeclaredThrowableException UndoManager UndoableEdit UndoableEditEvent UndoableEditListener UndoableEditSupport UnexpectedException UnicastRemoteObject UnionMember UnionMemberHelper UnknownEncoding UnknownEncodingHelper UnknownError UnknownException UnknownFormatConversionException UnknownFormatFlagsException UnknownGroupException UnknownHostException UnknownHostException UnknownObjectException UnknownServiceException UnknownUserException UnknownUserExceptionHelper UnknownUserExceptionHolder UnmappableCharacterException UnmarshalException UnmodifiableClassException UnmodifiableSetException UnrecoverableEntryException UnrecoverableKeyException Unreferenced UnresolvedAddressException UnresolvedPermission UnsatisfiedLinkError UnsolicitedNotification UnsolicitedNotificationEvent UnsolicitedNotificationListener UnsupportedAddressTypeException UnsupportedAudioFileException UnsupportedCallbackException UnsupportedCharsetException UnsupportedClassVersionError UnsupportedEncodingException UnsupportedFlavorException UnsupportedLookAndFeelException UnsupportedOperationException UserDataHandler UserException Util UtilDelegate Utilities VMID VM_ABSTRACT VM_CUSTOM VM_NONE VM_TRUNCATABLE Validator ValidatorHandler ValueBase ValueBaseHelper ValueBaseHolder ValueExp ValueFactory ValueHandler ValueHandlerMultiFormat ValueInputStream ValueMember ValueMemberHelper ValueOutputStream VariableHeightLayoutCache Vector VerifyError VersionSpecHelper VetoableChangeListener VetoableChangeListenerProxy VetoableChangeSupport View ViewFactory ViewportLayout ViewportUI VirtualMachineError Visibility VisibilityHelper VoiceStatus Void VolatileImage WCharSeqHelper WCharSeqHolder WStringSeqHelper WStringSeqHolder WStringValueHelper WeakHashMap WeakReference WebRowSet WildcardType Window WindowAdapter WindowConstants WindowEvent WindowFocusListener WindowListener WindowStateListener WrappedPlainView WritableByteChannel WritableRaster WritableRenderedImage WriteAbortedException Writer WrongAdapter WrongAdapterHelper WrongPolicy WrongPolicyHelper WrongTransaction WrongTransactionHelper WrongTransactionHolder X500Principal X500PrivateCredential X509CRL X509CRLEntry X509CRLSelector X509CertSelector X509Certificate X509Certificate X509EncodedKeySpec X509ExtendedKeyManager X509Extension X509KeyManager X509TrustManager XAConnection XADataSource XAException XAResource XMLConstants XMLDecoder XMLEncoder XMLFilter XMLFilterImpl XMLFormatter XMLGregorianCalendar XMLParseException XMLReader XMLReaderAdapter XMLReaderFactory XPath XPathConstants XPathException XPathExpression XPathExpressionException XPathFactory XPathFactoryConfigurationException XPathFunction XPathFunctionException XPathFunctionResolver XPathVariableResolver Xid XmlReader XmlWriter ZipEntry ZipException ZipFile ZipInputStream ZipOutputStream ZoneView _BindingIteratorImplBase _BindingIteratorStub _DynAnyFactoryStub _DynAnyStub _DynArrayStub _DynEnumStub _DynFixedStub _DynSequenceStub _DynStructStub _DynUnionStub _DynValueStub _IDLTypeStub _NamingContextExtStub _NamingContextImplBase _NamingContextStub _PolicyStub _Remote_Stub _ServantActivatorStub _ServantLocatorStub" list_keywords = Set.fromList $ words $ "abstract case catch class def do else extends false final finally for forSome if implicit import lazy match new null object override package private protected requires return sealed super this throw trait true try type val var while with yield"@@ -81,9 +78,9 @@ regex_'25'28'25'7cn'29 = compileRegex "%(%|n)" regex_'5cb'5b'5fa'2dzA'2dZ'5d'5cw'2a'28'3f'3d'5b'5cs'5d'2a'29 = compileRegex "\\b[_a-zA-Z]\\w*(?=[\\s]*)" -defaultAttributes = [("Normal",NormalTok),("String",StringTok),("Printf",NormalTok),("PrintfString",StringTok),("Member",NormalTok),("Commentar 1",CommentTok),("Commentar 2",CommentTok)]+defaultAttributes = [(("Scala","Normal"),NormalTok),(("Scala","String"),StringTok),(("Scala","Printf"),NormalTok),(("Scala","PrintfString"),StringTok),(("Scala","Member"),NormalTok),(("Scala","Commentar 1"),CommentTok),(("Scala","Commentar 2"),CommentTok)] -parseRules "Normal" =+parseRules ("Scala","Normal") = (((Text.Highlighting.Kate.Syntax.Javadoc.parseExpression)) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok))@@ -122,13 +119,13 @@ <|> ((pRegExpr regex_'2f'2f'5cs'2aEND'2e'2a'24 >>= withAttribute DecValTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Scala","String")) <|>- ((pRegExpr regex_'5c'2e'28format'7cprintf'29'5cb >>= withAttribute FunctionTok) >>~ pushContext "Printf")+ ((pRegExpr regex_'5c'2e'28format'7cprintf'29'5cb >>= withAttribute FunctionTok) >>~ pushContext ("Scala","Printf")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Scala","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Scala","Commentar 2")) <|> ((pDetectChar False '{' >>= withAttribute NormalTok)) <|>@@ -136,23 +133,23 @@ <|> ((pRegExpr regex_'5cb'5b'5f'5cw'5d'5b'5f'5cw'5cd'5d'2a'28'3f'3d'5b'5cs'5d'2a'28'2f'5c'2a'5cs'2a'5cd'2b'5cs'2a'5c'2a'2f'5cs'2a'29'3f'5b'28'5d'29 >>= withAttribute FunctionTok)) <|>- ((pRegExpr regex_'5b'2e'5d'7b1'2c1'7d >>= withAttribute NormalTok) >>~ pushContext "Member")+ ((pRegExpr regex_'5b'2e'5d'7b1'2c1'7d >>= withAttribute NormalTok) >>~ pushContext ("Scala","Member")) <|> ((pAnyChar ":!%&()+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))) -parseRules "String" =+parseRules ("Scala","String") = (((pLineContinue >>= withAttribute StringTok)) <|> ((pHlCStringChar >>= withAttribute CharTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Printf" =+parseRules ("Scala","Printf") = (((pDetectChar False ';' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "PrintfString"))+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Scala","PrintfString"))) -parseRules "PrintfString" =+parseRules ("Scala","PrintfString") = (((pLineContinue >>= withAttribute StringTok)) <|> ((pHlCStringChar >>= withAttribute CharTok))@@ -165,17 +162,17 @@ <|> ((pRegExpr regex_'25'28'25'7cn'29 >>= withAttribute CharTok))) -parseRules "Member" =+parseRules ("Scala","Member") = (((pRegExpr regex_'5cb'5b'5fa'2dzA'2dZ'5d'5cw'2a'28'3f'3d'5b'5cs'5d'2a'29 >>= withAttribute FunctionTok) >>~ (popContext)) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "Commentar 1" =+parseRules ("Scala","Commentar 1") = pzero -parseRules "Commentar 2" =+parseRules ("Scala","Commentar 2") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "" = parseRules "Normal"+parseRules ("Javadoc", _) = Text.Highlighting.Kate.Syntax.Javadoc.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Scheme.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,38 +25,40 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Scheme" }- context <- currentContext <|> (pushContext "Level0" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Scheme",["Level0"])], synStLanguage = "Scheme", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Scheme","Level0")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Level0" -> return ()- "Default" -> return ()- "MultiLineComment" -> return ()- "SpecialNumber" -> (popContext) >> pEndLine- "String" -> return ()- "function_decl" -> return ()- "Level1" -> return ()- "Level2" -> return ()- "Level3" -> return ()- "Level4" -> return ()- "Level5" -> return ()- "Level6" -> return ()+ ("Scheme","Level0") -> return ()+ ("Scheme","Default") -> return ()+ ("Scheme","MultiLineComment") -> return ()+ ("Scheme","SpecialNumber") -> (popContext) >> pEndLine+ ("Scheme","String") -> return ()+ ("Scheme","function_decl") -> return ()+ ("Scheme","Level1") -> return ()+ ("Scheme","Level2") -> return ()+ ("Scheme","Level3") -> return ()+ ("Scheme","Level4") -> return ()+ ("Scheme","Level5") -> return ()+ ("Scheme","Level6") -> return () _ -> return () withAttribute attr txt = do@@ -66,10 +67,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_operators = Set.fromList $ words $ "<= < = => >= > - / *,* *) +" list_characters = Set.fromList $ words $ "#\\nul #\\soh #\\stx #\\etx #\\eot #\\enq #\\ack #\\bel #\\bs #\\ht #\\nl #\\vt #\\np #\\cr #\\so #\\si #\\dle #\\dc1 #\\dc2 #\\dc3 #\\dc4 #\\nak #\\syn #\\etb #\\can #\\em #\\sub #\\esc #\\fs #\\gs #\\rs #\\us #\\space #\\sp #\\newline #\\nl #\\tab #\\ht #\\backspace #\\bs #\\return #\\cr #\\page #\\np #\\null #\\nul" list_defines = Set.fromList $ words $ "define define* define-accessor define-class defined? define-generic define-macro define-method define-module define-private define-public define*-public define-reader-ctor define-syntax define-syntax-macro defmacro defmacro* defmacro*-public"@@ -85,35 +82,35 @@ regex_'5cd'2a'28'5c'2e'5cd'2b'29'3f = compileRegex "\\d*(\\.\\d+)?" regex_'5cs'2a'5bA'2dZa'2dz0'2d9'2d'2b'5c'3c'5c'3e'2f'2f'5c'2a'5d'2a'5cs'2a = compileRegex "\\s*[A-Za-z0-9-+\\<\\>//\\*]*\\s*" -defaultAttributes = [("Level0",NormalTok),("Default",NormalTok),("MultiLineComment",CommentTok),("SpecialNumber",NormalTok),("String",StringTok),("function_decl",FunctionTok),("Level1",NormalTok),("Level2",NormalTok),("Level3",NormalTok),("Level4",NormalTok),("Level5",NormalTok),("Level6",NormalTok)]+defaultAttributes = [(("Scheme","Level0"),NormalTok),(("Scheme","Default"),NormalTok),(("Scheme","MultiLineComment"),CommentTok),(("Scheme","SpecialNumber"),NormalTok),(("Scheme","String"),StringTok),(("Scheme","function_decl"),FunctionTok),(("Scheme","Level1"),NormalTok),(("Scheme","Level2"),NormalTok),(("Scheme","Level3"),NormalTok),(("Scheme","Level4"),NormalTok),(("Scheme","Level5"),NormalTok),(("Scheme","Level6"),NormalTok)] -parseRules "Level0" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level1")+parseRules ("Scheme","Level0") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level1")) <|>- ((parseRules "Default")))+ ((parseRules ("Scheme","Default")))) -parseRules "Default" =+parseRules ("Scheme","Default") = (((pRegExpr regex_'3b'2b'5cs'2aBEGIN'2e'2a'24 >>= withAttribute RegionMarkerTok)) <|> ((pRegExpr regex_'3b'2b'5cs'2aEND'2e'2a'24 >>= withAttribute RegionMarkerTok)) <|> ((pRegExpr regex_'3b'2e'2a'24 >>= withAttribute CommentTok)) <|>- ((pDetect2Chars False '#' '!' >>= withAttribute CommentTok) >>~ pushContext "MultiLineComment")+ ((pDetect2Chars False '#' '!' >>= withAttribute CommentTok) >>~ pushContext ("Scheme","MultiLineComment")) <|> ((pKeyword " \n\t.(),%&;[]^{|}~" list_keywords >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.(),%&;[]^{|}~" list_operators >>= withAttribute KeywordTok)) <|>- ((pKeyword " \n\t.(),%&;[]^{|}~" list_defines >>= withAttribute KeywordTok) >>~ pushContext "function_decl")+ ((pKeyword " \n\t.(),%&;[]^{|}~" list_defines >>= withAttribute KeywordTok) >>~ pushContext ("Scheme","function_decl")) <|> ((pKeyword " \n\t.(),%&;[]^{|}~" list_characters >>= withAttribute CharTok)) <|> ((pRegExpr regex_'23'5c'5c'2e >>= withAttribute CharTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Scheme","String")) <|>- ((pRegExpr regex_'23'5bbodxei'5d >>= withAttribute CharTok) >>~ pushContext "SpecialNumber")+ ((pRegExpr regex_'23'5bbodxei'5d >>= withAttribute CharTok) >>~ pushContext ("Scheme","SpecialNumber")) <|> ((pRegExpr regex_'23'5btf'5d >>= withAttribute DecValTok)) <|>@@ -121,17 +118,17 @@ <|> ((pInt >>= withAttribute DecValTok)) <|>- ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level1"))+ ((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level1"))) -parseRules "MultiLineComment" =+parseRules ("Scheme","MultiLineComment") = ((pColumn 0 >> pRegExpr regex_'21'23'5cs'2a'24 >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "SpecialNumber" =+parseRules ("Scheme","SpecialNumber") = (((pRegExpr regex_'5cd'2a'28'5c'2e'5cd'2b'29'3f >>= withAttribute DecValTok) >>~ (popContext)) <|> (currentContext >>= parseRules)) -parseRules "String" =+parseRules ("Scheme","String") = (((pKeyword " \n\t.(),%&;[]^{|}~" list_characters >>= withAttribute CharTok)) <|> ((pRegExpr regex_'23'5c'5c'2e >>= withAttribute CharTok))@@ -142,51 +139,50 @@ <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "function_decl" =+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)) -parseRules "Level1" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level2")+parseRules ("Scheme","Level1") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level2")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "Default")))+ ((parseRules ("Scheme","Default")))) -parseRules "Level2" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level3")+parseRules ("Scheme","Level2") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level3")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "Default")))+ ((parseRules ("Scheme","Default")))) -parseRules "Level3" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level4")+parseRules ("Scheme","Level3") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level4")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "Default")))+ ((parseRules ("Scheme","Default")))) -parseRules "Level4" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level5")+parseRules ("Scheme","Level4") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level5")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "Default")))+ ((parseRules ("Scheme","Default")))) -parseRules "Level5" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level6")+parseRules ("Scheme","Level5") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level6")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "Default")))+ ((parseRules ("Scheme","Default")))) -parseRules "Level6" =- (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext "Level1")+parseRules ("Scheme","Level6") =+ (((pDetectChar False '(' >>= withAttribute NormalTok) >>~ pushContext ("Scheme","Level1")) <|> ((pDetectChar False ')' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "Default")))+ ((parseRules ("Scheme","Default")))) -parseRules "" = parseRules "Level0" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Sci.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,27 +25,29 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "scilab" }- context <- currentContext <|> (pushContext "main" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("scilab",["main"])], synStLanguage = "scilab", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("scilab","main")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "main" -> return ()+ ("scilab","main") -> return () _ -> return () withAttribute attr txt = do@@ -55,10 +56,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_Structure'2dkeywords = Set.fromList $ words $ "do else for if elseif end select then while" list_Control'2dkeywords = Set.fromList $ words $ "abort break quit return resume pause" list_Function'2dkeywords = Set.fromList $ words $ "function endfunction"@@ -68,9 +65,9 @@ regex_'2f'2f'2e'2a'24 = compileRegex "//.*$" -defaultAttributes = [("main",NormalTok)]+defaultAttributes = [(("scilab","main"),NormalTok)] -parseRules "main" =+parseRules ("scilab","main") = (((pKeyword " \n\t.():!+,-<=>&*/;?[]^{|}~\\" list_Structure'2dkeywords >>= withAttribute NormalTok)) <|> ((pKeyword " \n\t.():!+,-<=>&*/;?[]^{|}~\\" list_Control'2dkeywords >>= withAttribute NormalTok))@@ -91,6 +88,5 @@ <|> ((pRangeDetect '"' '"' >>= withAttribute StringTok))) -parseRules "" = parseRules "main" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Sed.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -25,54 +24,56 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "sed" }- context <- currentContext <|> (pushContext "BeginningOfLine" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("sed",["BeginningOfLine"])], synStLanguage = "sed", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("sed","BeginningOfLine")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "BeginningOfLine" -> return ()- "FirstAddressRegex" -> pushContext "Error" >> return ()- "AfterFirstAddress" -> pushContext "BeginningOfLine" >> return ()- "AfterFirstAddress2" -> pushContext "BeginningOfLine" >> return ()- "SecondAddress" -> pushContext "Error" >> return ()- "SecondAddressRegex" -> pushContext "Error" >> return ()- "AfterSecondAddress" -> pushContext "Error" >> return ()- "Step" -> pushContext "Error" >> return ()- "Command" -> pushContext "Error" >> return ()- "SCommand" -> pushContext "Error" >> return ()- "SRegex" -> pushContext "Error" >> return ()- "SReplacement" -> pushContext "Error" >> return ()- "SFlags" -> pushContext "BeginningOfLine" >> return ()- "WFlag" -> pushContext "BeginningOfLine" >> return ()- "YCommand" -> pushContext "Error" >> return ()- "YSourceList" -> pushContext "Error" >> return ()- "YDestList" -> pushContext "Error" >> return ()- "AICCommand" -> pushContext "Error" >> return ()- "LiteralText" -> pushContext "BeginningOfLine" >> return ()- "BTCommand" -> pushContext "BeginningOfLine" >> return ()- "WRCommand" -> pushContext "Error" >> return ()- "LCommand" -> pushContext "BeginningOfLine" >> return ()- "QCommand" -> pushContext "BeginningOfLine" >> return ()- "Label" -> pushContext "Error" >> return ()- "AfterCommand" -> pushContext "BeginningOfLine" >> return ()- "Regex" -> pushContext "Error" >> return ()- "Comment" -> pushContext "BeginningOfLine" >> return ()- "Error" -> pushContext "BeginningOfLine" >> return ()+ ("sed","BeginningOfLine") -> return ()+ ("sed","FirstAddressRegex") -> pushContext ("sed","Error") >> return ()+ ("sed","AfterFirstAddress") -> pushContext ("sed","BeginningOfLine") >> return ()+ ("sed","AfterFirstAddress2") -> pushContext ("sed","BeginningOfLine") >> return ()+ ("sed","SecondAddress") -> pushContext ("sed","Error") >> return ()+ ("sed","SecondAddressRegex") -> pushContext ("sed","Error") >> return ()+ ("sed","AfterSecondAddress") -> pushContext ("sed","Error") >> return ()+ ("sed","Step") -> pushContext ("sed","Error") >> return ()+ ("sed","Command") -> pushContext ("sed","Error") >> return ()+ ("sed","SCommand") -> pushContext ("sed","Error") >> return ()+ ("sed","SRegex") -> pushContext ("sed","Error") >> return ()+ ("sed","SReplacement") -> pushContext ("sed","Error") >> return ()+ ("sed","SFlags") -> pushContext ("sed","BeginningOfLine") >> return ()+ ("sed","WFlag") -> pushContext ("sed","BeginningOfLine") >> return ()+ ("sed","YCommand") -> pushContext ("sed","Error") >> return ()+ ("sed","YSourceList") -> pushContext ("sed","Error") >> return ()+ ("sed","YDestList") -> pushContext ("sed","Error") >> return ()+ ("sed","AICCommand") -> pushContext ("sed","Error") >> return ()+ ("sed","LiteralText") -> pushContext ("sed","BeginningOfLine") >> return ()+ ("sed","BTCommand") -> pushContext ("sed","BeginningOfLine") >> return ()+ ("sed","WRCommand") -> pushContext ("sed","Error") >> return ()+ ("sed","LCommand") -> pushContext ("sed","BeginningOfLine") >> return ()+ ("sed","QCommand") -> pushContext ("sed","BeginningOfLine") >> return ()+ ("sed","Label") -> pushContext ("sed","Error") >> return ()+ ("sed","AfterCommand") -> pushContext ("sed","BeginningOfLine") >> return ()+ ("sed","Regex") -> pushContext ("sed","Error") >> return ()+ ("sed","Comment") -> pushContext ("sed","BeginningOfLine") >> return ()+ ("sed","Error") -> pushContext ("sed","BeginningOfLine") >> return () _ -> return () withAttribute attr txt = do@@ -81,11 +82,7 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'28'2f'29 = compileRegex "(/)" regex_'5c'5c'28'5cS'29 = compileRegex "\\\\(\\S)" regex_'5cS = compileRegex "\\S"@@ -94,248 +91,248 @@ regex_'5cS'2b = compileRegex "\\S+" regex_'5cw'2b = compileRegex "\\w+" -defaultAttributes = [("BeginningOfLine",NormalTok),("FirstAddressRegex",StringTok),("AfterFirstAddress",NormalTok),("AfterFirstAddress2",NormalTok),("SecondAddress",NormalTok),("SecondAddressRegex",StringTok),("AfterSecondAddress",NormalTok),("Step",NormalTok),("Command",NormalTok),("SCommand",NormalTok),("SRegex",StringTok),("SReplacement",StringTok),("SFlags",NormalTok),("WFlag",NormalTok),("YCommand",NormalTok),("YSourceList",StringTok),("YDestList",StringTok),("AICCommand",NormalTok),("LiteralText",OtherTok),("BTCommand",NormalTok),("WRCommand",NormalTok),("LCommand",NormalTok),("QCommand",NormalTok),("Label",NormalTok),("AfterCommand",NormalTok),("Regex",StringTok),("Comment",CommentTok),("Error",ErrorTok)]+defaultAttributes = [(("sed","BeginningOfLine"),NormalTok),(("sed","FirstAddressRegex"),StringTok),(("sed","AfterFirstAddress"),NormalTok),(("sed","AfterFirstAddress2"),NormalTok),(("sed","SecondAddress"),NormalTok),(("sed","SecondAddressRegex"),StringTok),(("sed","AfterSecondAddress"),NormalTok),(("sed","Step"),NormalTok),(("sed","Command"),NormalTok),(("sed","SCommand"),NormalTok),(("sed","SRegex"),StringTok),(("sed","SReplacement"),StringTok),(("sed","SFlags"),NormalTok),(("sed","WFlag"),NormalTok),(("sed","YCommand"),NormalTok),(("sed","YSourceList"),StringTok),(("sed","YDestList"),StringTok),(("sed","AICCommand"),NormalTok),(("sed","LiteralText"),OtherTok),(("sed","BTCommand"),NormalTok),(("sed","WRCommand"),NormalTok),(("sed","LCommand"),NormalTok),(("sed","QCommand"),NormalTok),(("sed","Label"),NormalTok),(("sed","AfterCommand"),NormalTok),(("sed","Regex"),StringTok),(("sed","Comment"),CommentTok),(("sed","Error"),ErrorTok)] -parseRules "BeginningOfLine" =+parseRules ("sed","BeginningOfLine") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("sed","Comment")) <|>- ((pRegExpr regex_'28'2f'29 >>= withAttribute StringTok) >>~ pushContext "FirstAddressRegex")+ ((pRegExpr regex_'28'2f'29 >>= withAttribute StringTok) >>~ pushContext ("sed","FirstAddressRegex")) <|>- ((pRegExpr regex_'5c'5c'28'5cS'29 >>= withAttribute StringTok) >>~ pushContext "FirstAddressRegex")+ ((pRegExpr regex_'5c'5c'28'5cS'29 >>= withAttribute StringTok) >>~ pushContext ("sed","FirstAddressRegex")) <|>- ((pInt >>= withAttribute DecValTok) >>~ pushContext "AfterFirstAddress")+ ((pInt >>= withAttribute DecValTok) >>~ pushContext ("sed","AfterFirstAddress")) <|>- ((pDetectChar False '$' >>= withAttribute OtherTok) >>~ pushContext "AfterFirstAddress")+ ((pDetectChar False '$' >>= withAttribute OtherTok) >>~ pushContext ("sed","AfterFirstAddress")) <|>- ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext "AfterCommand")+ ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext ("sed","AfterCommand")) <|>- ((pDetectChar False ':' >>= withAttribute FunctionTok) >>~ pushContext "Label")+ ((pDetectChar False ':' >>= withAttribute FunctionTok) >>~ pushContext ("sed","Label")) <|>- ((pDetectChar False '!' >>= withAttribute OtherTok) >>~ pushContext "Command")+ ((pDetectChar False '!' >>= withAttribute OtherTok) >>~ pushContext ("sed","Command")) <|>- ((parseRules "Command"))+ ((parseRules ("sed","Command"))) <|>- ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext "Error"))+ ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))) -parseRules "FirstAddressRegex" =+parseRules ("sed","FirstAddressRegex") = (((pDetectSpaces >>= withAttribute StringTok)) <|> ((pRegExprDynamic "\\\\%1" >>= withAttribute CharTok)) <|>- ((pRegExprDynamic "%1" >>= withAttribute StringTok) >>~ pushContext "AfterFirstAddress")+ ((pRegExprDynamic "%1" >>= withAttribute StringTok) >>~ pushContext ("sed","AfterFirstAddress")) <|>- ((parseRules "Regex")))+ ((parseRules ("sed","Regex")))) -parseRules "AfterFirstAddress" =+parseRules ("sed","AfterFirstAddress") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '!' >>= withAttribute OtherTok) >>~ pushContext "Command")+ ((pDetectChar False '!' >>= withAttribute OtherTok) >>~ pushContext ("sed","Command")) <|>- ((parseRules "AfterFirstAddress2"))+ ((parseRules ("sed","AfterFirstAddress2"))) <|>- ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext "Error"))+ ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))) -parseRules "AfterFirstAddress2" =+parseRules ("sed","AfterFirstAddress2") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False ',' >>= withAttribute NormalTok) >>~ pushContext "SecondAddress")+ ((pDetectChar False ',' >>= withAttribute NormalTok) >>~ pushContext ("sed","SecondAddress")) <|>- ((pDetectChar False '~' >>= withAttribute NormalTok) >>~ pushContext "Step")+ ((pDetectChar False '~' >>= withAttribute NormalTok) >>~ pushContext ("sed","Step")) <|>- ((parseRules "Command"))+ ((parseRules ("sed","Command"))) <|>- ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext "Error"))+ ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))) -parseRules "SecondAddress" =+parseRules ("sed","SecondAddress") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'28'2f'29 >>= withAttribute StringTok) >>~ pushContext "SecondAddressRegex")+ ((pRegExpr regex_'28'2f'29 >>= withAttribute StringTok) >>~ pushContext ("sed","SecondAddressRegex")) <|>- ((pRegExpr regex_'5c'5c'28'5cS'29 >>= withAttribute StringTok) >>~ pushContext "SecondAddressRegex")+ ((pRegExpr regex_'5c'5c'28'5cS'29 >>= withAttribute StringTok) >>~ pushContext ("sed","SecondAddressRegex")) <|>- ((pInt >>= withAttribute DecValTok) >>~ pushContext "AfterSecondAddress")+ ((pInt >>= withAttribute DecValTok) >>~ pushContext ("sed","AfterSecondAddress")) <|>- ((pDetectChar False '$' >>= withAttribute OtherTok) >>~ pushContext "AfterSecondAddress")+ ((pDetectChar False '$' >>= withAttribute OtherTok) >>~ pushContext ("sed","AfterSecondAddress")) <|>- ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext "Error"))+ ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))) -parseRules "SecondAddressRegex" =+parseRules ("sed","SecondAddressRegex") = (((pDetectSpaces >>= withAttribute StringTok)) <|> ((pRegExprDynamic "\\\\%1" >>= withAttribute CharTok)) <|>- ((pRegExprDynamic "%1" >>= withAttribute StringTok) >>~ pushContext "AfterSecondAddress")+ ((pRegExprDynamic "%1" >>= withAttribute StringTok) >>~ pushContext ("sed","AfterSecondAddress")) <|>- ((parseRules "Regex")))+ ((parseRules ("sed","Regex")))) -parseRules "AfterSecondAddress" =+parseRules ("sed","AfterSecondAddress") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '!' >>= withAttribute OtherTok) >>~ pushContext "Command")+ ((pDetectChar False '!' >>= withAttribute OtherTok) >>~ pushContext ("sed","Command")) <|>- ((parseRules "Command"))+ ((parseRules ("sed","Command"))) <|>- ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext "Error"))+ ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))) -parseRules "Step" =+parseRules ("sed","Step") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pInt >>= withAttribute DecValTok) >>~ pushContext "Command")+ ((pInt >>= withAttribute DecValTok) >>~ pushContext ("sed","Command")) <|>- ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext "Error"))+ ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))) -parseRules "Command" =+parseRules ("sed","Command") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False 's' >>= withAttribute KeywordTok) >>~ pushContext "SCommand")+ ((pDetectChar False 's' >>= withAttribute KeywordTok) >>~ pushContext ("sed","SCommand")) <|>- ((pDetectChar False 'y' >>= withAttribute KeywordTok) >>~ pushContext "YCommand")+ ((pDetectChar False 'y' >>= withAttribute KeywordTok) >>~ pushContext ("sed","YCommand")) <|>- ((pAnyChar "dpnDNPhHgGxFvz=" >>= withAttribute KeywordTok) >>~ pushContext "AfterCommand")+ ((pAnyChar "dpnDNPhHgGxFvz=" >>= withAttribute KeywordTok) >>~ pushContext ("sed","AfterCommand")) <|>- ((pAnyChar "aic" >>= withAttribute KeywordTok) >>~ pushContext "AICCommand")+ ((pAnyChar "aic" >>= withAttribute KeywordTok) >>~ pushContext ("sed","AICCommand")) <|>- ((pAnyChar "bTt" >>= withAttribute KeywordTok) >>~ pushContext "BTCommand")+ ((pAnyChar "bTt" >>= withAttribute KeywordTok) >>~ pushContext ("sed","BTCommand")) <|>- ((pAnyChar "WwrR" >>= withAttribute KeywordTok) >>~ pushContext "WRCommand")+ ((pAnyChar "WwrR" >>= withAttribute KeywordTok) >>~ pushContext ("sed","WRCommand")) <|>- ((pAnyChar "lL" >>= withAttribute KeywordTok) >>~ pushContext "LCommand")+ ((pAnyChar "lL" >>= withAttribute KeywordTok) >>~ pushContext ("sed","LCommand")) <|>- ((pAnyChar "qQ" >>= withAttribute KeywordTok) >>~ pushContext "QCommand")+ ((pAnyChar "qQ" >>= withAttribute KeywordTok) >>~ pushContext ("sed","QCommand")) <|>- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "BeginningOfLine")+ ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("sed","BeginningOfLine")) <|>- ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext "Error"))+ ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))) -parseRules "SCommand" =+parseRules ("sed","SCommand") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'28'5cS'29 >>= withAttribute StringTok) >>~ pushContext "SRegex"))+ ((pRegExpr regex_'28'5cS'29 >>= withAttribute StringTok) >>~ pushContext ("sed","SRegex"))) -parseRules "SRegex" =+parseRules ("sed","SRegex") = (((pDetectSpaces >>= withAttribute StringTok)) <|> ((pRegExprDynamic "\\\\%1" >>= withAttribute CharTok)) <|>- ((pRegExprDynamic "(%1)" >>= withAttribute StringTok) >>~ pushContext "SReplacement")+ ((pRegExprDynamic "(%1)" >>= withAttribute StringTok) >>~ pushContext ("sed","SReplacement")) <|>- ((parseRules "Regex")))+ ((parseRules ("sed","Regex")))) -parseRules "SReplacement" =+parseRules ("sed","SReplacement") = (((pDetectSpaces >>= withAttribute StringTok)) <|> ((pRegExprDynamic "\\\\%1" >>= withAttribute CharTok)) <|>- ((pRegExprDynamic "%1" >>= withAttribute StringTok) >>~ pushContext "SFlags")+ ((pRegExprDynamic "%1" >>= withAttribute StringTok) >>~ pushContext ("sed","SFlags")) <|> ((pRegExpr regex_'5c'5c'5b0'2d9LlUuE'5c'5c'26'5d >>= withAttribute CharTok)) <|> ((pDetectChar False '&' >>= withAttribute CharTok))) -parseRules "SFlags" =+parseRules ("sed","SFlags") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pAnyChar "gpeIiMm" >>= withAttribute DataTypeTok)) <|>- ((pDetectChar False 'w' >>= withAttribute DataTypeTok) >>~ pushContext "WFlag")+ ((pDetectChar False 'w' >>= withAttribute DataTypeTok) >>~ pushContext ("sed","WFlag")) <|> ((pInt >>= withAttribute DecValTok)) <|>- ((parseRules "AfterCommand")))+ ((parseRules ("sed","AfterCommand")))) -parseRules "WFlag" =+parseRules ("sed","WFlag") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'5cS'2b >>= withAttribute BaseNTok) >>~ pushContext "SFlags"))+ ((pRegExpr regex_'5cS'2b >>= withAttribute BaseNTok) >>~ pushContext ("sed","SFlags"))) -parseRules "YCommand" =+parseRules ("sed","YCommand") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'28'5cS'29 >>= withAttribute StringTok) >>~ pushContext "YSourceList"))+ ((pRegExpr regex_'28'5cS'29 >>= withAttribute StringTok) >>~ pushContext ("sed","YSourceList"))) -parseRules "YSourceList" =+parseRules ("sed","YSourceList") = (((pDetectSpaces >>= withAttribute StringTok)) <|> ((pRegExprDynamic "\\\\%1" >>= withAttribute CharTok)) <|>- ((pRegExprDynamic "(%1)" >>= withAttribute StringTok) >>~ pushContext "YDestList")+ ((pRegExprDynamic "(%1)" >>= withAttribute StringTok) >>~ pushContext ("sed","YDestList")) <|> ((pDetect2Chars False '\\' 'n' >>= withAttribute CharTok)) <|> ((pDetect2Chars False '\\' '\\' >>= withAttribute CharTok))) -parseRules "YDestList" =+parseRules ("sed","YDestList") = (((pDetectSpaces >>= withAttribute StringTok)) <|> ((pRegExprDynamic "\\\\%1" >>= withAttribute CharTok)) <|>- ((pRegExprDynamic "%1" >>= withAttribute StringTok) >>~ pushContext "AfterCommand")+ ((pRegExprDynamic "%1" >>= withAttribute StringTok) >>~ pushContext ("sed","AfterCommand")) <|> ((pDetect2Chars False '\\' 'n' >>= withAttribute CharTok)) <|> ((pDetect2Chars False '\\' '\\' >>= withAttribute CharTok))) -parseRules "AICCommand" =+parseRules ("sed","AICCommand") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pLineContinue >>= withAttribute OtherTok) >>~ pushContext "LiteralText")+ ((pLineContinue >>= withAttribute OtherTok) >>~ pushContext ("sed","LiteralText")) <|>- ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext "Error"))+ ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))) -parseRules "LiteralText" =- (((pDetect2Chars False '\\' '\\' >>= withAttribute OtherTok) >>~ pushContext "LiteralText")+parseRules ("sed","LiteralText") =+ (((pDetect2Chars False '\\' '\\' >>= withAttribute OtherTok) >>~ pushContext ("sed","LiteralText")) <|>- ((pLineContinue >>= withAttribute OtherTok) >>~ pushContext "LiteralText")+ ((pLineContinue >>= withAttribute OtherTok) >>~ pushContext ("sed","LiteralText")) <|>- ((pDetectChar False '\\' >>= withAttribute ErrorTok) >>~ pushContext "Error"))+ ((pDetectChar False '\\' >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))) -parseRules "BTCommand" =+parseRules ("sed","BTCommand") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'5cw'2b >>= withAttribute FunctionTok) >>~ pushContext "AfterCommand")+ ((pRegExpr regex_'5cw'2b >>= withAttribute FunctionTok) >>~ pushContext ("sed","AfterCommand")) <|>- ((parseRules "AfterCommand")))+ ((parseRules ("sed","AfterCommand")))) -parseRules "WRCommand" =+parseRules ("sed","WRCommand") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'5cS'2b >>= withAttribute BaseNTok) >>~ pushContext "AfterCommand"))+ ((pRegExpr regex_'5cS'2b >>= withAttribute BaseNTok) >>~ pushContext ("sed","AfterCommand"))) -parseRules "LCommand" =+parseRules ("sed","LCommand") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pInt >>= withAttribute DecValTok) >>~ pushContext "AfterCommand")+ ((pInt >>= withAttribute DecValTok) >>~ pushContext ("sed","AfterCommand")) <|>- ((parseRules "AfterCommand")))+ ((parseRules ("sed","AfterCommand")))) -parseRules "QCommand" =+parseRules ("sed","QCommand") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pInt >>= withAttribute DecValTok) >>~ pushContext "AfterCommand")+ ((pInt >>= withAttribute DecValTok) >>~ pushContext ("sed","AfterCommand")) <|>- ((parseRules "AfterCommand")))+ ((parseRules ("sed","AfterCommand")))) -parseRules "Label" =+parseRules ("sed","Label") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_'5cw'2b >>= withAttribute FunctionTok) >>~ pushContext "AfterCommand")+ ((pRegExpr regex_'5cw'2b >>= withAttribute FunctionTok) >>~ pushContext ("sed","AfterCommand")) <|>- ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext "Error"))+ ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))) -parseRules "AfterCommand" =+parseRules ("sed","AfterCommand") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False ';' >>= withAttribute NormalTok) >>~ pushContext "BeginningOfLine")+ ((pDetectChar False ';' >>= withAttribute NormalTok) >>~ pushContext ("sed","BeginningOfLine")) <|>- ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext "AfterCommand")+ ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ pushContext ("sed","AfterCommand")) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("sed","Comment")) <|>- ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext "Error"))+ ((pRegExpr regex_'5cS >>= withAttribute ErrorTok) >>~ pushContext ("sed","Error"))) -parseRules "Regex" =+parseRules ("sed","Regex") = (((pDetect2Chars False '\\' '(' >>= withAttribute CharTok)) <|> ((pDetect2Chars False '\\' ')' >>= withAttribute CharTok))@@ -400,12 +397,11 @@ <|> ((pDetectChar False ']' >>= withAttribute CharTok))) -parseRules "Comment" =+parseRules ("sed","Comment") = pzero -parseRules "Error" =+parseRules ("sed","Error") = pzero -parseRules "" = parseRules "BeginningOfLine" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Sgml.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -25,31 +24,33 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "SGML" }- context <- currentContext <|> (pushContext "Normal Text" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("SGML",["Normal Text"])], synStLanguage = "SGML", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("SGML","Normal Text")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal Text" -> return ()- "Attribute" -> return ()- "Value" -> return ()- "Value 2" -> return ()- "Comment" -> return ()+ ("SGML","Normal Text") -> return ()+ ("SGML","Attribute") -> return ()+ ("SGML","Value") -> return ()+ ("SGML","Value 2") -> return ()+ ("SGML","Comment") -> return () _ -> return () withAttribute attr txt = do@@ -58,41 +59,36 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - 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_'5cs'2a'3d'5cs'2a = compileRegex "\\s*=\\s*" -defaultAttributes = [("Normal Text",NormalTok),("Attribute",OtherTok),("Value",DataTypeTok),("Value 2",DataTypeTok),("Comment",CommentTok)]+defaultAttributes = [(("SGML","Normal Text"),NormalTok),(("SGML","Attribute"),OtherTok),(("SGML","Value"),DataTypeTok),(("SGML","Value 2"),DataTypeTok),(("SGML","Comment"),CommentTok)] -parseRules "Normal Text" =- (((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "Comment")+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 "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"))) -parseRules "Attribute" =+parseRules ("SGML","Attribute") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext "Value"))+ ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("SGML","Value"))) -parseRules "Value" =+parseRules ("SGML","Value") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|> ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext "Value 2"))+ ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ pushContext ("SGML","Value 2"))) -parseRules "Value 2" =+parseRules ("SGML","Value 2") = ((pDetectChar False '"' >>= withAttribute DataTypeTok) >>~ (popContext >> popContext)) -parseRules "Comment" =+parseRules ("SGML","Comment") = ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "" = parseRules "Normal Text" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Sql.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,33 +25,35 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "SQL" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("SQL",["Normal"])], synStLanguage = "SQL", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = False, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("SQL","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = False, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "String literal" -> return ()- "Singleline PL/SQL-style comment" -> (popContext) >> pEndLine- "Multiline C-style comment" -> return ()- "SQL*Plus remark directive" -> (popContext) >> pEndLine- "User-defined identifier" -> (popContext) >> pEndLine- "SQL*Plus directive to include file" -> (popContext) >> pEndLine+ ("SQL","Normal") -> return ()+ ("SQL","String literal") -> return ()+ ("SQL","Singleline PL/SQL-style comment") -> (popContext) >> pEndLine+ ("SQL","Multiline C-style comment") -> return ()+ ("SQL","SQL*Plus remark directive") -> (popContext) >> pEndLine+ ("SQL","User-defined identifier") -> (popContext) >> pEndLine+ ("SQL","SQL*Plus directive to include file") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -61,10 +62,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "access account add admin administer advise after agent all all_rows allocate alter analyze ancillary and any archive archivelog as asc assertion associate at attribute attributes audit authenticated authid authorization autoallocate autoextend automatic backup become before begin behalf between binding bitmap block block_range body bound both break broadcast btitle buffer_pool build bulk by cache cache_instances call cancel cascade case category chained change check checkpoint child choose chunk class clear clone close close_cached_open_cursors cluster coalesce column columns column_value comment commit committed compatibility compile complete composite_limit compress compute connect connect_time consider consistent constant constraint constraints container contents context continue controlfile copy cost cpu_per_call cpu_per_session create create_stored_outlines cross cube current cursor cycle dangling data database datafile datafiles dba ddl deallocate debug declare default deferrable deferred definer degree delete demand desc determines dictionary dimension directory disable disassociate disconnect diskgroup dismount distinct distributed domain drop dynamic each else elsif empty enable end enforce entry escape estimate events except exception exceptions exchange excluding exclusive exec execute exists expire explain explosion extends extent extents externally failed_login_attempts false fast file filter first_rows flagger flashback flush following for force foreign freelist freelists fresh from full function functions generated global globally global_name grant group groups hash hashkeys having header heap hierarchy hour id identified identifier idgenerators idle_time if immediate in including increment incremental index indexed indexes indextype indextypes indicator initial initialized initially initrans inner insert instance instances instead intermediate intersect into invalidate is isolation isolation_level java join keep key kill label layer leading left less level library like limit link list local locator lock locked logfile logging logical_reads_per_call logical_reads_per_session logoff logon loop manage managed management master materialized maxarchlogs maxdatafiles maxextents maxinstances maxlogfiles maxloghistory maxlogmembers maxsize maxtrans maxvalue method member merge minimize minimum minextents minus minute minvalue mode modify monitoring mount move movement mts_dispatchers multiset named natural needed nested nested_table_id network never new next nls_calendar nls_characterset nls_comp nls_currency nls_date_format nls_date_language nls_iso_currency nls_lang nls_language nls_numeric_characters nls_sort nls_special_chars nls_territory no noarchivelog noaudit nocache nocompress nocycle noforce nologging nomaxvalue nominimize nominvalue nomonitoring none noorder nooverride noparallel norely noresetlogs noreverse normal nosegment nosort not nothing novalidate nowait null nulls objno objno_reuse of off offline oid oidindex old on online only opcode open operator optimal optimizer_goal option or order organization out outer outline over overflow overlaps own package packages parallel parameters parent partition partitions partition_hash partition_range password password_grace_time password_life_time password_lock_time password_reuse_max password_reuse_time password_verify_function pctfree pctincrease pctthreshold pctused pctversion percent permanent plan plsql_debug post_transaction prebuilt preceding prepare present preserve previous primary prior private private_sga privilege privileges procedure profile public purge query queue quota random range rba read reads rebuild records_per_block recover recoverable recovery recycle reduced references referencing refresh rely rename replace reset resetlogs resize resolve resolver resource restrict restricted resume return returning reuse reverse revoke rewrite right role roles rollback rollup row rownum rows rule sample savepoint scan scan_instances schema scn scope sd_all sd_inhibit sd_show segment seg_block seg_file select selectivity sequence serializable servererror session session_cached_cursors sessions_per_user set share shared shared_pool shrink shutdown singletask size skip skip_unusable_indexes snapshot some sort source specification split sql_trace standby start startup statement_id statistics static stop storage store structure submultiset subpartition subpartitions successful summary supplemental suspend switch sys_op_bitvec sys_op_enforce_not_null$ sys_op_noexpand sys_op_ntcimg$ synonym sysdba sysoper system table tables tablespace tablespace_no tabno tempfile temporary than the then thread through timeout timezone_hour timezone_minute time_zone to toplevel trace tracing trailing transaction transitional trigger triggers true truncate type types unarchived unbound unbounded undo uniform union unique unlimited unlock unrecoverable until unusable unused upd_indexes updatable update uppper usage use use_stored_outlines user_defined using validate validation values view when whenever where with without work write" list_operators = Set.fromList $ words $ "+ - * / || = != <> < <= > >= ~= ^= := => ** .." list_functions = Set.fromList $ words $ "abs acos add_months ascii asciistr asin atan atan2 avg bfilename bin_to_num bitand cardinality cast ceil chartorowid chr coalesce collect compose concat convert corr corr_k corr_s cos cosh count covar_pop covar_samp cume_dist current_date current_timestamp cv dbtimezone decode decompose dense_rank depth deref dump empty_blob empty_clob existsnode exp extract extractvalue first first_value floor from_tz greatest group_id grouping grouping_id hextoraw initcap instr instrb lag last last_day last_value lead least length lengthb ln lnnvl localtimestamp log lower lpad ltrim make_ref max median min mod months_between nanvl nchr new_time next_day nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_upper nlssort ntile nullif numtodsinterval numtoyminterval nvl nvl2 ora_hash ora_rowscn percent_rank percentile_cont percentile_disc power powermultiset powermultiset_by_cardinality presentnnv presentv rank ratio_to_report rawtohex rawtonhex ref reftohex regexp_instr regexp_like regexp_replace regexp_substr regr_slope regr_intercept regr_count regr_r2 regr_avgx regr_avgy regr_sxx regr_syy regr_sxy remainder round row_number rowidtochar rowidtonchar rpad rtrim scn_to_timestamp sessiontimezone sign sin sinh soundex sqrt stats_binomial_test stats_crosstab stats_f_test stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_one stats_t_test_paired stats_t_test_indep stats_t_test_indepu stats_wsr_test stddev stddev_pop stddev_samp substr substrb sum sys_connect_by_path sys_context sys_dburigen sys_extract_utc sys_guid sys_typeid sys_xmlagg sys_xmlgen sysdate systimestamp tan tanh timestamp_to_scn to_binary_double to_binary_float to_char to_clob to_date to_dsinterval to_lob to_multi_byte to_nchar to_nclob to_number to_single_byte to_timestamp to_timestamp_tz to_yminterval translate treat trim trunc tz_offset uid unistr updatexml upper user userenv value var_pop var_samp variance vsize width_bucket xmlagg xmlcolattval xmlconcat xmlelement xmlforest xmlsequence xmltransform"@@ -77,9 +74,9 @@ regex_'40'40'3f'5b'5e'40_'5ct'5cr'5cn'5d = compileRegex "@@?[^@ \\t\\r\\n]" regex_'26'26'3f'5cw'2b = compileRegex "&&?\\w+" -defaultAttributes = [("Normal",NormalTok),("String literal",StringTok),("Singleline PL/SQL-style comment",CommentTok),("Multiline C-style comment",CommentTok),("SQL*Plus remark directive",CommentTok),("User-defined identifier",OtherTok),("SQL*Plus directive to include file",OtherTok)]+defaultAttributes = [(("SQL","Normal"),NormalTok),(("SQL","String literal"),StringTok),(("SQL","Singleline PL/SQL-style comment"),CommentTok),(("SQL","Multiline C-style comment"),CommentTok),(("SQL","SQL*Plus remark directive"),CommentTok),(("SQL","User-defined identifier"),OtherTok),(("SQL","SQL*Plus directive to include file"),OtherTok)] -parseRules "Normal" =+parseRules ("SQL","Normal") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pKeyword " \n\t(),%&;?[]{}\\" list_keywords >>= withAttribute KeywordTok))@@ -100,23 +97,23 @@ <|> ((pInt >>= withAttribute DecValTok)) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "String literal")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("SQL","String literal")) <|>- ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext "Singleline PL/SQL-style comment")+ ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("SQL","Singleline PL/SQL-style comment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Multiline C-style comment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("SQL","Multiline C-style comment")) <|>- ((pColumn 0 >> pRegExpr regex_rem'5cb >>= withAttribute CommentTok) >>~ pushContext "SQL*Plus remark directive")+ ((pColumn 0 >> pRegExpr regex_rem'5cb >>= withAttribute CommentTok) >>~ pushContext ("SQL","SQL*Plus remark directive")) <|>- ((pDetectChar False '"' >>= withAttribute OtherTok) >>~ pushContext "User-defined identifier")+ ((pDetectChar False '"' >>= withAttribute OtherTok) >>~ pushContext ("SQL","User-defined identifier")) <|> ((pRegExpr regex_'28'3a'7c'26'26'3f'29'5cw'2b >>= withAttribute CharTok)) <|> ((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*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"))) -parseRules "String literal" =+parseRules ("SQL","String literal") = (((pDetect2Chars False '\\' '\'' >>= withAttribute StringTok) >>~ (popContext)) <|> ((pHlCStringChar >>= withAttribute CharTok))@@ -127,21 +124,20 @@ <|> ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Singleline PL/SQL-style comment" =+parseRules ("SQL","Singleline PL/SQL-style comment") = pzero -parseRules "Multiline C-style comment" =+parseRules ("SQL","Multiline C-style comment") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "SQL*Plus remark directive" =+parseRules ("SQL","SQL*Plus remark directive") = pzero -parseRules "User-defined identifier" =+parseRules ("SQL","User-defined identifier") = ((pDetectChar False '"' >>= withAttribute OtherTok) >>~ (popContext)) -parseRules "SQL*Plus directive to include file" =+parseRules ("SQL","SQL*Plus directive to include file") = pzero -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/SqlMysql.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,33 +25,35 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "SQL (MySQL)" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("SQL (MySQL)",["Normal"])], synStLanguage = "SQL (MySQL)", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = False, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("SQL (MySQL)","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = False, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "String" -> return ()- "String2" -> return ()- "Name" -> return ()- "SingleLineComment" -> (popContext) >> pEndLine- "MultiLineComment" -> return ()- "Preprocessor" -> (popContext) >> pEndLine+ ("SQL (MySQL)","Normal") -> return ()+ ("SQL (MySQL)","String") -> return ()+ ("SQL (MySQL)","String2") -> return ()+ ("SQL (MySQL)","Name") -> return ()+ ("SQL (MySQL)","SingleLineComment") -> (popContext) >> pEndLine+ ("SQL (MySQL)","MultiLineComment") -> return ()+ ("SQL (MySQL)","Preprocessor") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -61,10 +62,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "access add all alter analyze and as asc auto_increment bdb berkeleydb between both by cascade case change charset column columns constraint create cross current_date current_time current_timestamp database databases day_hour day_minute day_second dec default delayed delete desc describe distinct distinctrow drop else enclosed escaped exists explain fields for foreign from fulltext function grant group having high_priority if ignore in index infile inner innodb insert interval into is join key keys kill leading left like limit lines load lock low_priority master_server_id match mrg_myisam natural national not null numeric on optimize option optionally or order outer outfile partial precision primary privileges procedure purge read references regexp rename replace require restrict returns revoke right rlike select set show soname sql_big_result sql_calc_found_rows sql_small_result ssl starting straight_join striped table tables terminated then to trailing truncate type union unique unlock unsigned update usage use user_resources using values varying when where with write xor year_month zerofill" list_operators = Set.fromList $ words $ "+ - * / || = != <> < <= > >= ~= ^= := => ** .." list_functions = Set.fromList $ words $ "ascii ord conv bin oct hex char concat concat_ws length octet_length char_length character_length bit_length locate position instr lpad rpad left right substring substring_index mid ltrim rtrim trim soundex space replace repeat reverse insert elt field find_in_set make_set export_set lcase lower ucase upper load_file quote abs sign mod floor ceiling round exp ln log log2 log10 pow power sqrt pi cos sin tan acos asin atan atan2 cot rand least greatest degrees radians dayofweek weekday dayofmonth dayofyear month dayname monthname quarter week year yearweek hour minute second period_add period_diff date_add date_sub adddate subdate extract to_days from_days date_format time_format curdate current_date curtime current_time now sysdate current_timestamp unix_timestamp from_unixtime sec_to_time time_to_sec cast convert bit_count database user system_user session_user password encrypt encode decode md5 sha1 sha aes_encrypt aes_decrypt des_encrypt des_decrypt last_insert_id format version connection_id get_lock release_lock is_free_lock benchmark inet_ntoa inet_aton master_pos_wait found_rows count avg min max sum std stddev bit_or bit_and"@@ -77,9 +74,9 @@ regex_'2f'24 = compileRegex "/$" regex_'40'40'3f'5b'5e'40_'5ct'5cr'5cn'5d = compileRegex "@@?[^@ \\t\\r\\n]" -defaultAttributes = [("Normal",NormalTok),("String",StringTok),("String2",StringTok),("Name",StringTok),("SingleLineComment",CommentTok),("MultiLineComment",CommentTok),("Preprocessor",OtherTok)]+defaultAttributes = [(("SQL (MySQL)","Normal"),NormalTok),(("SQL (MySQL)","String"),StringTok),(("SQL (MySQL)","String2"),StringTok),(("SQL (MySQL)","Name"),StringTok),(("SQL (MySQL)","SingleLineComment"),CommentTok),(("SQL (MySQL)","MultiLineComment"),CommentTok),(("SQL (MySQL)","Preprocessor"),OtherTok)] -parseRules "Normal" =+parseRules ("SQL (MySQL)","Normal") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pRegExpr regex_SET'28'3f'3d'5cs'2a'5c'28'29 >>= withAttribute DataTypeTok))@@ -104,29 +101,29 @@ <|> ((pInt >>= withAttribute DecValTok)) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("SQL (MySQL)","String")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String2")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("SQL (MySQL)","String2")) <|>- ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext "Name")+ ((pDetectChar False '`' >>= withAttribute StringTok) >>~ pushContext ("SQL (MySQL)","Name")) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "SingleLineComment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("SQL (MySQL)","SingleLineComment")) <|>- ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext "SingleLineComment")+ ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("SQL (MySQL)","SingleLineComment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "MultiLineComment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("SQL (MySQL)","MultiLineComment")) <|>- ((pColumn 0 >> pRegExpr regex_rem'5cb >>= withAttribute CommentTok) >>~ pushContext "SingleLineComment")+ ((pColumn 0 >> pRegExpr regex_rem'5cb >>= withAttribute CommentTok) >>~ pushContext ("SQL (MySQL)","SingleLineComment")) <|> ((pAnyChar ":&" >>= withAttribute CharTok)) <|> ((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 "Preprocessor")+ ((pColumn 0 >> pRegExpr regex_'40'40'3f'5b'5e'40_'5ct'5cr'5cn'5d >>= withAttribute OtherTok) >>~ pushContext ("SQL (MySQL)","Preprocessor")) <|> ((pDetectChar False '.' >>= withAttribute CharTok))) -parseRules "String" =+parseRules ("SQL (MySQL)","String") = (((pLineContinue >>= withAttribute StringTok) >>~ (popContext)) <|> ((pHlCStringChar >>= withAttribute CharTok))@@ -135,7 +132,7 @@ <|> ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "String2" =+parseRules ("SQL (MySQL)","String2") = (((pLineContinue >>= withAttribute StringTok) >>~ (popContext)) <|> ((pHlCStringChar >>= withAttribute CharTok))@@ -144,24 +141,23 @@ <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Name" =+parseRules ("SQL (MySQL)","Name") = (((pLineContinue >>= withAttribute StringTok) >>~ (popContext)) <|> ((pHlCStringChar >>= withAttribute CharTok)) <|> ((pDetectChar False '`' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "SingleLineComment" =+parseRules ("SQL (MySQL)","SingleLineComment") = pzero -parseRules "MultiLineComment" =+parseRules ("SQL (MySQL)","MultiLineComment") = (((pLineContinue >>= withAttribute CommentTok) >>~ (popContext)) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Preprocessor" =+parseRules ("SQL (MySQL)","Preprocessor") = pzero -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/SqlPostgresql.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,35 +25,37 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "SQL (PostgreSQL)" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("SQL (PostgreSQL)",["Normal"])], synStLanguage = "SQL (PostgreSQL)", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = False, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("SQL (PostgreSQL)","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = False, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "CreateFunction" -> return ()- "FunctionBody" -> return ()- "MultiLineString" -> return ()- "String" -> return ()- "SingleLineComment" -> (popContext) >> pEndLine- "MultiLineComment" -> return ()- "Identifier" -> (popContext) >> pEndLine- "Preprocessor" -> (popContext) >> pEndLine+ ("SQL (PostgreSQL)","Normal") -> return ()+ ("SQL (PostgreSQL)","CreateFunction") -> return ()+ ("SQL (PostgreSQL)","FunctionBody") -> return ()+ ("SQL (PostgreSQL)","MultiLineString") -> return ()+ ("SQL (PostgreSQL)","String") -> return ()+ ("SQL (PostgreSQL)","SingleLineComment") -> (popContext) >> pEndLine+ ("SQL (PostgreSQL)","MultiLineComment") -> return ()+ ("SQL (PostgreSQL)","Identifier") -> (popContext) >> pEndLine+ ("SQL (PostgreSQL)","Preprocessor") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -63,10 +64,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "abort access action add admin after aggregate alias all allocate alter analyse analyze any are as asc asensitive assertion assignment asymmetric at atomic authorization backward before begin between binary both breadth by c cache call called cardinality cascade cascaded case cast catalog catalog_name chain char_length character_length character_set_catalog character_set_name character_set_schema characteristics check checked checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema column column_name command_function command_function_code comment commit committed completion condition_number connect connection connection_name constraint constraint_catalog constraint_name constraint_schema constraints constructor contains continue convert copy corresponding count create createdb createuser cross cube current current_date current_path current_role current_time current_timestamp current_user cursor cursor_name cycle data database date datetime_interval_code datetime_interval_precision day deallocate dec decimal declare default deferrable deferred defined definer delete delimiters depth deref desc describe descriptor destroy destructor deterministic diagnostics dictionary disconnect dispatch distinct do domain double drop dynamic dynamic_function dynamic_function_code each else encoding encrypted end end-exec equals escape every except exception exclusive exec execute existing exists explain external fetch final first for force foreign fortran forward found free freeze from full function g general generated get global go goto grant granted group grouping handler having hierarchy hold host hour identity ignore ilike immediate immutable implementation in increment index indicator infix inherits initialize initially inner inout input insensitive insert instance instantiable instead intersect interval into invoker is isnull isolation iterate join k key key_member key_type lancompiler language large last lateral leading left length less level like limit listen load local localtime localtimestamp location locator lock lower m map match max maxvalue message_length message_octet_length message_text method min minute minvalue mod mode modifies modify module month more move mumps name names national natural new next no nocreatedb nocreateuser none not nothing notify notnull null nullable nullif number numeric object octet_length of off offset oids old on only open operation operator option options order ordinality out outer output overlaps overlay overriding owner pad parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parameters partial pascal password path pendant pli position postfix precision prefix preorder prepare preserve primary prior privileges procedural procedure public read reads real recursive ref references referencing reindex relative rename repeatable replace reset restrict result return returned_length returned_octet_length returned_sqlstate returns revoke right role rollback rollup routine routine_catalog routine_name routine_schema row row_count rows rule savepoint scale schema schema_name scope scroll search second section security select self sensitive sequence serializable server_name session session_user set setof sets share show similar simple size some source space specific specific_name specifictype sql sqlcode sqlerror sqlexception sqlstate sqlwarning stable start state statement static statistics stdin stdout structure style subclass_origin sublist substring sum symmetric sysid system system_user table table_name temp template temporary terminate than then timezone_hour timezone_minute to toast trailing transaction transaction_active transactions_committed transactions_rolled_back transform transforms translate translation treat trigger trigger_catalog trigger_name trigger_schema trim truncate trusted type uncommitted under unencrypted union unique unknown unlisten unnamed unnest until update upper usage user user_defined_type_catalog user_defined_type_name user_defined_type_schema using vacuum valid value values variable varying verbose version view volatile when whenever where with without work write year zone false true" list_operators = Set.fromList $ words $ "+ - * / || |/ ||/ ! !! @ & | # << >> % ^ = != <> < <= > >= ~ ~* !~ !~* ^= := => ** .. and or not ## && &< &> <-> <^ >^ ?# ?- ?-| @-@ ?| ?|| @@ ~= <<= >>=" list_functions = Set.fromList $ words $ "abs cbrt ceil degrees exp floor ln log mod pi pow radians random round sign sqrt trunc acos asin atan atan2 cos cot sin tan bit_length char_length character_length lower octet_length position substring trim upper ascii btrim chr convert initcap length lpad ltrim pg_client_encoding repeat rpad rtrim strpos substr to_ascii translate encode decode to_char to_date to_timestamp to_number age date_part date_trunc extract isfinite now timeofday timestamp extract area box center diameter height isclosed isopen pclose npoint popen radius width box circle lseg path point polygon broadcast host masklen set_masklen netmask network abbrev nextval currval setval coalesce nullif has_table_privilege pg_get_viewdef pg_get_ruledef pg_get_indexdef pg_get_userbyid obj_description col_description avg count max min stddev sum variance"@@ -84,10 +81,10 @@ regex_'2f'24 = compileRegex "/$" regex_'40'40'3f'5b'5e'40_'5ct'5cr'5cn'5d = compileRegex "@@?[^@ \\t\\r\\n]" -defaultAttributes = [("Normal",NormalTok),("CreateFunction",NormalTok),("FunctionBody",NormalTok),("MultiLineString",StringTok),("String",StringTok),("SingleLineComment",CommentTok),("MultiLineComment",CommentTok),("Identifier",OtherTok),("Preprocessor",OtherTok)]+defaultAttributes = [(("SQL (PostgreSQL)","Normal"),NormalTok),(("SQL (PostgreSQL)","CreateFunction"),NormalTok),(("SQL (PostgreSQL)","FunctionBody"),NormalTok),(("SQL (PostgreSQL)","MultiLineString"),StringTok),(("SQL (PostgreSQL)","String"),StringTok),(("SQL (PostgreSQL)","SingleLineComment"),CommentTok),(("SQL (PostgreSQL)","MultiLineComment"),CommentTok),(("SQL (PostgreSQL)","Identifier"),OtherTok),(("SQL (PostgreSQL)","Preprocessor"),OtherTok)] -parseRules "Normal" =- (((pString False "CREATE FUNCTION" >>= withAttribute KeywordTok) >>~ pushContext "CreateFunction")+parseRules ("SQL (PostgreSQL)","Normal") =+ (((pString False "CREATE FUNCTION" >>= withAttribute KeywordTok) >>~ pushContext ("SQL (PostgreSQL)","CreateFunction")) <|> ((pKeyword " \n\t(),;[]{}\\" list_keywords >>= withAttribute KeywordTok)) <|>@@ -117,40 +114,40 @@ <|> ((pInt >>= withAttribute DecValTok)) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("SQL (PostgreSQL)","String")) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "SingleLineComment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("SQL (PostgreSQL)","SingleLineComment")) <|>- ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext "SingleLineComment")+ ((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("SQL (PostgreSQL)","SingleLineComment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "MultiLineComment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("SQL (PostgreSQL)","MultiLineComment")) <|>- ((pColumn 0 >> pRegExpr regex_rem'5cb >>= withAttribute CommentTok) >>~ pushContext "SingleLineComment")+ ((pColumn 0 >> pRegExpr regex_rem'5cb >>= withAttribute CommentTok) >>~ pushContext ("SQL (PostgreSQL)","SingleLineComment")) <|>- ((pDetectChar False '"' >>= withAttribute CommentTok) >>~ pushContext "Identifier")+ ((pDetectChar False '"' >>= withAttribute CommentTok) >>~ pushContext ("SQL (PostgreSQL)","Identifier")) <|> ((pAnyChar ":&" >>= withAttribute CharTok)) <|> ((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 "Preprocessor")+ ((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 "MultiLineString"))+ ((pRegExprDynamic "\\$([^\\$\\n\\r]*)\\$" >>= withAttribute NormalTok) >>~ pushContext ("SQL (PostgreSQL)","MultiLineString"))) -parseRules "CreateFunction" =- (((pRegExprDynamic "\\$([^\\$\\n\\r]*)\\$" >>= withAttribute FunctionTok) >>~ pushContext "FunctionBody")+parseRules ("SQL (PostgreSQL)","CreateFunction") =+ (((pRegExprDynamic "\\$([^\\$\\n\\r]*)\\$" >>= withAttribute FunctionTok) >>~ pushContext ("SQL (PostgreSQL)","FunctionBody")) <|>- ((parseRules "Normal")))+ ((parseRules ("SQL (PostgreSQL)","Normal")))) -parseRules "FunctionBody" =+parseRules ("SQL (PostgreSQL)","FunctionBody") = (((pRegExprDynamic "\\$%1\\$" >>= withAttribute FunctionTok) >>~ (popContext >> popContext)) <|>- ((parseRules "Normal")))+ ((parseRules ("SQL (PostgreSQL)","Normal")))) -parseRules "MultiLineString" =+parseRules ("SQL (PostgreSQL)","MultiLineString") = ((pRegExprDynamic "\\$%1\\$" >>= withAttribute NormalTok) >>~ (popContext)) -parseRules "String" =+parseRules ("SQL (PostgreSQL)","String") = (((pLineContinue >>= withAttribute StringTok) >>~ (popContext)) <|> ((pHlCStringChar >>= withAttribute CharTok))@@ -159,20 +156,19 @@ <|> ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "SingleLineComment" =+parseRules ("SQL (PostgreSQL)","SingleLineComment") = pzero -parseRules "MultiLineComment" =+parseRules ("SQL (PostgreSQL)","MultiLineComment") = (((pLineContinue >>= withAttribute CommentTok) >>~ (popContext)) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Identifier" =+parseRules ("SQL (PostgreSQL)","Identifier") = ((pDetectChar False '"' >>= withAttribute OtherTok) >>~ (popContext)) -parseRules "Preprocessor" =+parseRules ("SQL (PostgreSQL)","Preprocessor") = pzero -parseRules "" = parseRules "Normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Tcl.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,30 +25,32 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Tcl/Tk" }- context <- currentContext <|> (pushContext "Base" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Tcl/Tk",["Base"])], synStLanguage = "Tcl/Tk", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Tcl/Tk","Base")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Base" -> return ()- "String" -> return ()- "Comment" -> (popContext) >> pEndLine- "New command line" -> return ()+ ("Tcl/Tk","Base") -> return ()+ ("Tcl/Tk","String") -> return ()+ ("Tcl/Tk","Comment") -> (popContext) >> pEndLine+ ("Tcl/Tk","New command line") -> return () _ -> return () withAttribute attr txt = do@@ -58,10 +59,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "after append AppleScript argv argc array auto_execk auto_execok auto_import auto_load auto_mkindex auto_mkindex_old auto_path auto_qualify auto_reset beep bell binary bind bindtags bgerror break button canvas case catch cd chan checkbutton clipboard clock close combobox concat console continue dde destroy dict else elseif encoding entry env eof error errorCode errorInfo eval event exec exit expr fblocked fconfigure fcopy file fileevent flush focus font for foreach format frame gets glob global grab grid history if image incr info interp join label labelframe lappend lassign lindex linsert list listbox llength load lower lrange lremove lrepeat lreplace lreverse lsearch lset lsort menu menubutton message namespace notebook open option OptProc pack package panedwindow parray pid place pkg_mkIndex proc progressbar puts pwd radiobutton raise read regexp registry regsub rename resource return scale scan scrollbar seek selection send separator set sizegrip socket source spinbox split string style subst switch tclLog tcl_endOfWord tcl_findLibrary tcl_library tcl_patchLevel tcl_platform tcl_precision tcl_rcFileName tcl_rcRsrcName tcl_startOfNextWord tcl_startOfPreviousWord tcl_traceCompile tcl_traceExec tcl_version tcl_wordBreakAfter tcl_wordBreakBefore tell text time tk tkTabToWindow tkwait tk_chooseColor tk_chooseDirectory tk_focusFollowMouse tk_focusNext tk_focusPrev tk_getOpenFile tk_getSaveFile tk_library tk_menuSetFocus tk_messageBox tk_optionMenu tk_patchLevel tk_popup tk_strictMotif tk_textCopy tk_textCut tk_textPaste tk_version toplevel trace traverseTo treeview unknown unload unset update uplevel upvar variable vwait while winfo wm" list_keywords'2dopt = Set.fromList $ words $ "add args atime attributes body bytelength cancel channels clicks cmdcount commands compare complete convertfrom convertto copy default delete dirname equal executable exists extension first forget format functions globals hostname idle ifneeded index info is isdirectory isfile join last length level library link loaded locals lstat map match mkdir mtime nameofexecutable names nativename normalize number owned patchlevel pathtype present procs provide range readable readlink remove rename repeat replace require rootname scan script seconds separator sharedlibextension size split stat system tail tclversion tolower totitle toupper trim trimleft trimright type unknown variable vars vcompare vdelete versions vinfo volumes vsatisfies wordend wordstart writable activate actual addtag append appname aspect atom atomname bbox bind broadcast canvasx canvasy caret cells cget children class clear client clone colormapfull colormapwindows command configure containing coords create current curselection dchars debug deiconify delta depth deselect dlineinfo dtag dump edit entrycget entryconfigure families find flash focus focusmodel fpixels fraction frame generate geometry get gettags grid group handle height hide iconbitmap iconify iconmask iconname iconposition iconwindow icursor id identify image insert interps inuse invoke ismapped itemcget itemconfigure keys lower manager mark maxsize measure metrics minsize move name nearest overrideredirect own panecget paneconfigure panes parent pathname pixels pointerx pointerxy pointery positionfrom post postcascade postscript protocol proxy raise release reqheight reqwidth resizable rgb rootx rooty scale scaling screen screencells screendepth screenheight screenmmheight screenmmwidth screenvisual screenwidth search see select selection server set show sizefrom stackorder state status tag title toplevel transient types unpost useinputmethods validate values viewable visual visualid visualsavailable vrootheight vrootwidth vrootx vrooty width window windowingsystem withdraw x xview y" @@ -76,9 +73,9 @@ regex_'5cs'2a'23 = compileRegex "\\s*#" regex_'2e = compileRegex "." -defaultAttributes = [("Base",NormalTok),("String",StringTok),("Comment",CommentTok),("New command line",NormalTok)]+defaultAttributes = [(("Tcl/Tk","Base"),NormalTok),(("Tcl/Tk","String"),StringTok),(("Tcl/Tk","Comment"),CommentTok),(("Tcl/Tk","New command line"),NormalTok)] -parseRules "Base" =+parseRules ("Tcl/Tk","Base") = (((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aBEGIN'2e'2a'24 >>= withAttribute RegionMarkerTok)) <|> ((pFirstNonSpace >> pRegExpr regex_'23'5cs'2aEND'2e'2a'24 >>= withAttribute RegionMarkerTok))@@ -101,11 +98,11 @@ <|> ((pRegExpr regex_'22'7b2'7d >>= withAttribute StringTok)) <|>- ((pRegExpr regex_'22 >>= withAttribute StringTok) >>~ pushContext "String")+ ((pRegExpr regex_'22 >>= withAttribute StringTok) >>~ pushContext ("Tcl/Tk","String")) <|>- ((pDetectChar False ';' >>= withAttribute NormalTok) >>~ pushContext "New command line")+ ((pDetectChar False ';' >>= withAttribute NormalTok) >>~ pushContext ("Tcl/Tk","New command line")) <|>- ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("Tcl/Tk","Comment")) <|> ((pDetectChar False '{' >>= withAttribute KeywordTok)) <|>@@ -115,21 +112,20 @@ <|> ((pDetectChar False ']' >>= withAttribute KeywordTok))) -parseRules "String" =+parseRules ("Tcl/Tk","String") = (((pRegExpr regex_'5c'5c'2e >>= withAttribute CharTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) <|> ((pDetectChar False '$' >>= withAttribute DataTypeTok))) -parseRules "Comment" =+parseRules ("Tcl/Tk","Comment") = pzero -parseRules "New command line" =- (((pRegExpr regex_'5cs'2a'23 >>= withAttribute CommentTok) >>~ pushContext "Comment")+parseRules ("Tcl/Tk","New command line") =+ (((pRegExpr regex_'5cs'2a'23 >>= withAttribute CommentTok) >>~ pushContext ("Tcl/Tk","Comment")) <|> ((lookAhead (pRegExpr regex_'2e) >> (popContext) >> currentContext >>= parseRules))) -parseRules "" = parseRules "Base" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Texinfo.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,31 +25,33 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Texinfo" }- context <- currentContext <|> (pushContext "Normal Text" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Texinfo",["Normal Text"])], synStLanguage = "Texinfo", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Texinfo","Normal Text")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal Text" -> return ()- "singleLineComment" -> (popContext) >> pEndLine- "multiLineComment" -> return ()- "nodeFolding" -> return ()- "folding" -> return ()+ ("Texinfo","Normal Text") -> return ()+ ("Texinfo","singleLineComment") -> (popContext) >> pEndLine+ ("Texinfo","multiLineComment") -> return ()+ ("Texinfo","nodeFolding") -> return ()+ ("Texinfo","folding") -> return () _ -> return () withAttribute attr txt = do@@ -59,11 +60,7 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'40c'28omment'29'3f'5cb = compileRegex "@c(omment)?\\b" regex_'40ignore'5cb = compileRegex "@ignore\\b" regex_'40node'5cb = compileRegex "@node\\b"@@ -71,37 +68,37 @@ regex_'40'5b'5cw'5d'2b'28'5c'7b'28'5b'5cw'5d'2b'5b'5cs'5d'2a'29'2b'5c'7d'29'3f = compileRegex "@[\\w]+(\\{([\\w]+[\\s]*)+\\})?" regex_'40end_'28menu'7csmallexample'7ctable'7cmultitable'29'5cb = compileRegex "@end (menu|smallexample|table|multitable)\\b" -defaultAttributes = [("Normal Text",NormalTok),("singleLineComment",CommentTok),("multiLineComment",CommentTok),("nodeFolding",NormalTok),("folding",NormalTok)]+defaultAttributes = [(("Texinfo","Normal Text"),NormalTok),(("Texinfo","singleLineComment"),CommentTok),(("Texinfo","multiLineComment"),CommentTok),(("Texinfo","nodeFolding"),NormalTok),(("Texinfo","folding"),NormalTok)] -parseRules "Normal Text" =- (((pRegExpr regex_'40c'28omment'29'3f'5cb >>= withAttribute CommentTok) >>~ pushContext "singleLineComment")+parseRules ("Texinfo","Normal Text") =+ (((pRegExpr regex_'40c'28omment'29'3f'5cb >>= withAttribute CommentTok) >>~ pushContext ("Texinfo","singleLineComment")) <|>- ((pRegExpr regex_'40ignore'5cb >>= withAttribute CommentTok) >>~ pushContext "multiLineComment")+ ((pRegExpr regex_'40ignore'5cb >>= withAttribute CommentTok) >>~ pushContext ("Texinfo","multiLineComment")) <|>- ((pRegExpr regex_'40node'5cb >>= withAttribute FunctionTok) >>~ pushContext "nodeFolding")+ ((pRegExpr regex_'40node'5cb >>= withAttribute FunctionTok) >>~ pushContext ("Texinfo","nodeFolding")) <|>- ((pRegExpr regex_'40'28menu'7csmallexample'7ctable'7cmultitable'29'5cb >>= withAttribute FunctionTok) >>~ pushContext "folding")+ ((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))) -parseRules "singleLineComment" =+parseRules ("Texinfo","singleLineComment") = ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) -parseRules "multiLineComment" =+parseRules ("Texinfo","multiLineComment") = (((pString False "@end ignore" >>= withAttribute CommentTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd)))) -parseRules "nodeFolding" =+parseRules ("Texinfo","nodeFolding") = (((lookAhead (pRegExpr regex_'40node'5cb) >> (popContext) >> currentContext >>= parseRules)) <|>- ((parseRules "Normal Text")))+ ((parseRules ("Texinfo","Normal Text")))) -parseRules "folding" =+parseRules ("Texinfo","folding") = (((pRegExpr regex_'40end_'28menu'7csmallexample'7ctable'7cmultitable'29'5cb >>= withAttribute FunctionTok) >>~ (popContext)) <|>- ((parseRules "Normal Text")))+ ((parseRules ("Texinfo","Normal Text")))) -parseRules "" = parseRules "Normal Text"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Verilog.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,36 +26,38 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Verilog" }- context <- currentContext <|> (pushContext "Normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Verilog",["Normal"])], synStLanguage = "Verilog", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Verilog","Normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Normal" -> return ()- "String" -> (popContext) >> pEndLine- "Commentar 1" -> (popContext) >> pEndLine- "Commentar 2" -> return ()- "Preprocessor" -> (popContext) >> pEndLine- "Commentar/Preprocessor" -> return ()- "Some Context" -> (popContext) >> pEndLine- "Some Context2" -> return ()- "Block name" -> (popContext) >> pEndLine- "Port" -> return ()+ ("Verilog","Normal") -> return ()+ ("Verilog","String") -> (popContext) >> pEndLine+ ("Verilog","Commentar 1") -> (popContext) >> pEndLine+ ("Verilog","Commentar 2") -> return ()+ ("Verilog","Preprocessor") -> (popContext) >> pEndLine+ ("Verilog","Commentar/Preprocessor") -> return ()+ ("Verilog","Some Context") -> (popContext) >> pEndLine+ ("Verilog","Some Context2") -> return ()+ ("Verilog","Block name") -> (popContext) >> pEndLine+ ("Verilog","Port") -> return () _ -> return () withAttribute attr txt = do@@ -65,10 +66,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "macromodule table endtable specify specparam endspecify defparam default if ifnone else forever while for wait repeat disable assign deassign force release always initial edge posedge negedge config endconfig library design liblist cell use instance" list_beginwords = Set.fromList $ words $ "begin fork module case casex casez task function generate" list_endwords = Set.fromList $ words $ "end join endmodule endcase endtask endfunction endgenerate"@@ -87,14 +84,14 @@ regex_'5c'24'5ba'2dzA'2dZ'5f'5d'2b'5cw'2a = compileRegex "\\$[a-zA-Z_]+\\w*" regex_'23'5b'5cd'5f'5d'2b = compileRegex "#[\\d_]+" -defaultAttributes = [("Normal",NormalTok),("String",StringTok),("Commentar 1",CommentTok),("Commentar 2",CommentTok),("Preprocessor",OtherTok),("Commentar/Preprocessor",CommentTok),("Some Context",NormalTok),("Some Context2",CommentTok),("Block name",DataTypeTok),("Port",NormalTok)]+defaultAttributes = [(("Verilog","Normal"),NormalTok),(("Verilog","String"),StringTok),(("Verilog","Commentar 1"),CommentTok),(("Verilog","Commentar 2"),CommentTok),(("Verilog","Preprocessor"),OtherTok),(("Verilog","Commentar/Preprocessor"),CommentTok),(("Verilog","Some Context"),NormalTok),(("Verilog","Some Context2"),CommentTok),(("Verilog","Block name"),DataTypeTok),(("Verilog","Port"),NormalTok)] -parseRules "Normal" =+parseRules ("Verilog","Normal") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pRegExpr regex_begin'5c_'2a'3a >>= withAttribute KeywordTok) >>~ pushContext "Block name")+ ((pRegExpr regex_begin'5c_'2a'3a >>= withAttribute KeywordTok) >>~ pushContext ("Verilog","Block name")) <|>- ((pRegExpr regex_fork'5c_'2a'3a >>= withAttribute KeywordTok) >>~ pushContext "Block name")+ ((pRegExpr regex_fork'5c_'2a'3a >>= withAttribute KeywordTok) >>~ pushContext ("Verilog","Block name")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_beginwords >>= withAttribute KeywordTok)) <|>@@ -122,15 +119,15 @@ <|> ((pFirstNonSpace >> pRegExpr regex_'5ba'2dzA'2dZ0'2d9'5f'2c_'5ct'5d'2b'5cs'2a'3a >>= withAttribute DecValTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Verilog","String")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Verilog","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar 2")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Verilog","Commentar 2")) <|> ((pAnyChar "!%&()+,-<=+/:;>?[]^{|}~@" >>= withAttribute NormalTok)) <|>- ((pColumn 0 >> pDetectChar False '`' >>= withAttribute OtherTok) >>~ pushContext "Preprocessor")+ ((pColumn 0 >> pDetectChar False '`' >>= withAttribute OtherTok) >>~ pushContext ("Verilog","Preprocessor")) <|> ((pRegExpr regex_'5c'60'5ba'2dzA'2dZ'5f'5d'2b'5cw'2a >>= withAttribute OtherTok)) <|>@@ -138,49 +135,49 @@ <|> ((pRegExpr regex_'23'5b'5cd'5f'5d'2b >>= withAttribute BaseNTok))) -parseRules "String" =- (((pLineContinue >>= withAttribute StringTok) >>~ pushContext "Some Context")+parseRules ("Verilog","String") =+ (((pLineContinue >>= withAttribute StringTok) >>~ pushContext ("Verilog","Some Context")) <|> ((pHlCStringChar >>= withAttribute CharTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Commentar 1" =+parseRules ("Verilog","Commentar 1") = ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) -parseRules "Commentar 2" =+parseRules ("Verilog","Commentar 2") = (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Preprocessor" =- (((pLineContinue >>= withAttribute OtherTok) >>~ pushContext "Some Context")+parseRules ("Verilog","Preprocessor") =+ (((pLineContinue >>= withAttribute OtherTok) >>~ pushContext ("Verilog","Some Context")) <|> ((pRangeDetect '"' '"' >>= withAttribute FloatTok)) <|> ((pRangeDetect '<' '>' >>= withAttribute FloatTok)) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "Commentar 1")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Verilog","Commentar 1")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Commentar/Preprocessor"))+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Verilog","Commentar/Preprocessor"))) -parseRules "Commentar/Preprocessor" =+parseRules ("Verilog","Commentar/Preprocessor") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "Some Context" =+parseRules ("Verilog","Some Context") = pzero -parseRules "Some Context2" =+parseRules ("Verilog","Some Context2") = (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pFirstNonSpace >> pString False "#endif" >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Block name" =+parseRules ("Verilog","Block name") = ((pDetectIdentifier >>= withAttribute DataTypeTok) >>~ (popContext)) -parseRules "Port" =+parseRules ("Verilog","Port") = ((pDetectIdentifier >>= withAttribute NormalTok) >>~ (popContext)) -parseRules "" = parseRules "Normal"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Vhdl.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,52 +25,54 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "VHDL" }- context <- currentContext <|> (pushContext "start" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("VHDL",["start"])], synStLanguage = "VHDL", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("VHDL","start")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "start" -> return ()- "package" -> return ()- "packagebody" -> return ()- "architecture_main" -> return ()- "arch_decl" -> return ()- "detect_arch_parts" -> return ()- "generate1" -> return ()- "generate2" -> return ()- "process1" -> return ()- "proc_rules" -> return ()- "instance" -> return ()- "forOrWhile" -> return ()- "if_start" -> return ()- "if" -> return ()- "case1" -> return ()- "case2" -> return ()- "caseWhen" -> return ()- "entity" -> return ()- "entity_main" -> return ()- "preDetection" -> return ()- "generalDetection" -> return ()- "comment" -> (popContext) >> pEndLine- "string" -> return ()- "attribute" -> (popContext) >> pEndLine- "quot in att" -> return ()- "signal" -> return ()+ ("VHDL","start") -> return ()+ ("VHDL","package") -> return ()+ ("VHDL","packagebody") -> return ()+ ("VHDL","architecture_main") -> return ()+ ("VHDL","arch_decl") -> return ()+ ("VHDL","detect_arch_parts") -> return ()+ ("VHDL","generate1") -> return ()+ ("VHDL","generate2") -> return ()+ ("VHDL","process1") -> return ()+ ("VHDL","proc_rules") -> return ()+ ("VHDL","instance") -> return ()+ ("VHDL","forOrWhile") -> return ()+ ("VHDL","if_start") -> return ()+ ("VHDL","if") -> return ()+ ("VHDL","case1") -> return ()+ ("VHDL","case2") -> return ()+ ("VHDL","caseWhen") -> return ()+ ("VHDL","entity") -> return ()+ ("VHDL","entity_main") -> return ()+ ("VHDL","preDetection") -> return ()+ ("VHDL","generalDetection") -> return ()+ ("VHDL","comment") -> (popContext) >> pEndLine+ ("VHDL","string") -> return ()+ ("VHDL","attribute") -> (popContext) >> pEndLine+ ("VHDL","quot in att") -> return ()+ ("VHDL","signal") -> return () _ -> return () withAttribute attr txt = do@@ -80,10 +81,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywordsToplevel = Set.fromList $ words $ "file library use" list_keywords = Set.fromList $ words $ "access after alias all array assert assume assume_guarantee attribute begin block body bus component constant context cover default disconnect downto end exit fairness file force function generate generic group guarded impure inertial is label linkage literal map new next null of on open others parameter port postponed procedure process property protected pure range record register reject release report return select sequence severity signal shared strong subtype to transport type unaffected units until variable vmode vprop vunit wait when with note warning error failure in inout out buffer and abs or xor xnor not mod nand nor rem rol ror sla sra sll srl" list_if = Set.fromList $ words $ "if else elsif then"@@ -110,78 +107,78 @@ regex_generic = compileRegex "generic" regex_port = compileRegex "port" -defaultAttributes = [("start",NormalTok),("package",NormalTok),("packagebody",NormalTok),("architecture_main",NormalTok),("arch_decl",NormalTok),("detect_arch_parts",NormalTok),("generate1",NormalTok),("generate2",NormalTok),("process1",NormalTok),("proc_rules",NormalTok),("instance",NormalTok),("forOrWhile",NormalTok),("if_start",NormalTok),("if",NormalTok),("case1",NormalTok),("case2",NormalTok),("caseWhen",NormalTok),("entity",NormalTok),("entity_main",NormalTok),("preDetection",NormalTok),("generalDetection",NormalTok),("comment",CommentTok),("string",StringTok),("attribute",BaseNTok),("quot in att",BaseNTok),("signal",NormalTok)]+defaultAttributes = [(("VHDL","start"),NormalTok),(("VHDL","package"),NormalTok),(("VHDL","packagebody"),NormalTok),(("VHDL","architecture_main"),NormalTok),(("VHDL","arch_decl"),NormalTok),(("VHDL","detect_arch_parts"),NormalTok),(("VHDL","generate1"),NormalTok),(("VHDL","generate2"),NormalTok),(("VHDL","process1"),NormalTok),(("VHDL","proc_rules"),NormalTok),(("VHDL","instance"),NormalTok),(("VHDL","forOrWhile"),NormalTok),(("VHDL","if_start"),NormalTok),(("VHDL","if"),NormalTok),(("VHDL","case1"),NormalTok),(("VHDL","case2"),NormalTok),(("VHDL","caseWhen"),NormalTok),(("VHDL","entity"),NormalTok),(("VHDL","entity_main"),NormalTok),(("VHDL","preDetection"),NormalTok),(("VHDL","generalDetection"),NormalTok),(("VHDL","comment"),CommentTok),(("VHDL","string"),StringTok),(("VHDL","attribute"),BaseNTok),(("VHDL","quot in att"),BaseNTok),(("VHDL","signal"),NormalTok)] -parseRules "start" =- (((parseRules "preDetection"))+parseRules ("VHDL","start") =+ (((parseRules ("VHDL","preDetection"))) <|>- ((lookAhead (pRegExprDynamic "architecture\\s+(\\b(?!(?:process|constant|signal|variable))([A-Za-z_][A-Za-z0-9_]*)\\b)") >> pushContext "architecture_main" >> currentContext >>= parseRules))+ ((lookAhead (pRegExprDynamic "architecture\\s+(\\b(?!(?:process|constant|signal|variable))([A-Za-z_][A-Za-z0-9_]*)\\b)") >> pushContext ("VHDL","architecture_main") >> currentContext >>= parseRules)) <|>- ((pString False "entity" >>= withAttribute KeywordTok) >>~ pushContext "entity")+ ((pString False "entity" >>= withAttribute KeywordTok) >>~ pushContext ("VHDL","entity")) <|>- ((lookAhead (pRegExpr regex_'28'5cb'29'28package'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 "package" >> currentContext >>= parseRules))+ ((lookAhead (pRegExpr regex_'28'5cb'29'28package'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","package") >> currentContext >>= parseRules)) <|>- ((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 "packagebody" >> currentContext >>= parseRules))+ ((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))) -parseRules "package" =+parseRules ("VHDL","package") = (((pString True "%2" >>= withAttribute KeywordTok)) <|>- ((parseRules "preDetection"))+ ((parseRules ("VHDL","preDetection"))) <|> ((pString False "begin" >>= withAttribute KeywordTok)) <|> ((pRegExprDynamic "(\\b)end(\\s+package)?(\\s+%3)?\\s*;" >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "generalDetection")))+ ((parseRules ("VHDL","generalDetection")))) -parseRules "packagebody" =+parseRules ("VHDL","packagebody") = (((pString True "%2" >>= withAttribute KeywordTok)) <|>- ((parseRules "preDetection"))+ ((parseRules ("VHDL","preDetection"))) <|> ((pString False "begin" >>= withAttribute KeywordTok)) <|> ((pRegExprDynamic "(\\b)end(\\s+package)?(\\s+%3)?\\s*;" >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "generalDetection")))+ ((parseRules ("VHDL","generalDetection")))) -parseRules "architecture_main" =- (((parseRules "preDetection"))+parseRules ("VHDL","architecture_main") =+ (((parseRules ("VHDL","preDetection"))) <|>- ((pRegExpr regex_architecture'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'2bof'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 >>= withAttribute KeywordTok) >>~ pushContext "arch_decl")+ ((pRegExpr regex_architecture'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'2bof'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 >>= withAttribute KeywordTok) >>~ pushContext ("VHDL","arch_decl")) <|> ((pRegExprDynamic "(\\b)end(\\s+architecture)?(\\s+%1)?\\s*;" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|> ((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 "detect_arch_parts")))+ ((parseRules ("VHDL","detect_arch_parts")))) -parseRules "arch_decl" =- (((parseRules "preDetection"))+parseRules ("VHDL","arch_decl") =+ (((parseRules ("VHDL","preDetection"))) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_signals >>= withAttribute OtherTok) >>~ pushContext "signal")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_signals >>= withAttribute OtherTok) >>~ pushContext ("VHDL","signal")) <|>- ((pString False "component" >>= withAttribute KeywordTok) >>~ pushContext "entity")+ ((pString False "component" >>= withAttribute KeywordTok) >>~ pushContext ("VHDL","entity")) <|> ((pString False "begin" >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((parseRules "generalDetection")))+ ((parseRules ("VHDL","generalDetection")))) -parseRules "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 "generate1" >> currentContext >>= parseRules))+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)) <|>- ((lookAhead (pRegExprDynamic "(\\b)((\\b(?!(?:process|constant|signal|variable))([A-Za-z_][A-Za-z0-9_]*)\\b)\\s*:\\s*)?process\\b") >> pushContext "process1" >> currentContext >>= parseRules))+ ((lookAhead (pRegExprDynamic "(\\b)((\\b(?!(?:process|constant|signal|variable))([A-Za-z_][A-Za-z0-9_]*)\\b)\\s*:\\s*)?process\\b") >> pushContext ("VHDL","process1") >> currentContext >>= parseRules)) <|>- ((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 "instance" >> currentContext >>= parseRules))+ ((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 "generalDetection")))+ ((parseRules ("VHDL","generalDetection")))) -parseRules "generate1" =- (((parseRules "preDetection"))+parseRules ("VHDL","generate1") =+ (((parseRules ("VHDL","preDetection"))) <|>- ((pRegExpr regex_'28'5cb'29generate'5cb >>= withAttribute KeywordTok) >>~ pushContext "generate2")+ ((pRegExpr regex_'28'5cb'29generate'5cb >>= withAttribute KeywordTok) >>~ pushContext ("VHDL","generate2")) <|> ((pRegExprDynamic "(\\b)%3\\b" >>= withAttribute KeywordTok)) <|>@@ -189,19 +186,19 @@ <|> ((pString False "if" >>= withAttribute KeywordTok)) <|>- ((parseRules "generalDetection")))+ ((parseRules ("VHDL","generalDetection")))) -parseRules "generate2" =- (((parseRules "preDetection"))+parseRules ("VHDL","generate2") =+ (((parseRules ("VHDL","preDetection"))) <|> ((pString False "begin" >>= withAttribute KeywordTok)) <|> ((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 "detect_arch_parts")))+ ((parseRules ("VHDL","detect_arch_parts")))) -parseRules "process1" =- (((parseRules "preDetection"))+parseRules ("VHDL","process1") =+ (((parseRules ("VHDL","preDetection"))) <|> ((pRegExprDynamic "end\\s+process(\\s+%3)?\\s*;" >>= withAttribute KeywordTok) >>~ (popContext)) <|>@@ -211,21 +208,21 @@ <|> ((pString False "begin" >>= withAttribute KeywordTok)) <|>- ((parseRules "proc_rules")))+ ((parseRules ("VHDL","proc_rules")))) -parseRules "proc_rules" =+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)) <|>- ((pRegExpr regex_'28'5cb'29'28if'29'5cb >>= withAttribute KeywordTok) >>~ pushContext "if_start")+ ((pRegExpr regex_'28'5cb'29'28if'29'5cb >>= withAttribute KeywordTok) >>~ pushContext ("VHDL","if_start")) <|>- ((lookAhead (pRegExprDynamic "(\\b)(case)\\b") >> pushContext "case1" >> currentContext >>= parseRules))+ ((lookAhead (pRegExprDynamic "(\\b)(case)\\b") >> pushContext ("VHDL","case1") >> currentContext >>= parseRules)) <|>- ((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 "forOrWhile")+ ((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 "generalDetection")))+ ((parseRules ("VHDL","generalDetection")))) -parseRules "instance" =- (((parseRules "preDetection"))+parseRules ("VHDL","instance") =+ (((parseRules ("VHDL","preDetection"))) <|> ((pRegExprDynamic "\\b%1\\b" >>= withAttribute KeywordTok)) <|>@@ -233,65 +230,65 @@ <|> ((pDetect2Chars False ')' ';' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "generalDetection")))+ ((parseRules ("VHDL","generalDetection")))) -parseRules "forOrWhile" =+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 "proc_rules")))+ ((parseRules ("VHDL","proc_rules")))) -parseRules "if_start" =- (((parseRules "preDetection"))+parseRules ("VHDL","if_start") =+ (((parseRules ("VHDL","preDetection"))) <|>- ((pString False "then" >>= withAttribute KeywordTok) >>~ pushContext "if")+ ((pString False "then" >>= withAttribute KeywordTok) >>~ pushContext ("VHDL","if")) <|>- ((parseRules "generalDetection")))+ ((parseRules ("VHDL","generalDetection")))) -parseRules "if" =- (((parseRules "preDetection"))+parseRules ("VHDL","if") =+ (((parseRules ("VHDL","preDetection"))) <|> ((pRegExpr regex_'28'5cb'29end'5cs'2bif'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 "proc_rules"))+ ((parseRules ("VHDL","proc_rules"))) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_if >>= withAttribute KeywordTok))) -parseRules "case1" =- (((parseRules "preDetection"))+parseRules ("VHDL","case1") =+ (((parseRules ("VHDL","preDetection"))) <|>- ((pString False "is" >>= withAttribute KeywordTok) >>~ pushContext "case2")+ ((pString False "is" >>= withAttribute KeywordTok) >>~ pushContext ("VHDL","case2")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_case >>= withAttribute KeywordTok))) -parseRules "case2" =- (((parseRules "preDetection"))+parseRules ("VHDL","case2") =+ (((parseRules ("VHDL","preDetection"))) <|> ((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 >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((pString False "when" >>= withAttribute KeywordTok) >>~ pushContext "caseWhen")+ ((pString False "when" >>= withAttribute KeywordTok) >>~ pushContext ("VHDL","caseWhen")) <|>- ((parseRules "proc_rules")))+ ((parseRules ("VHDL","proc_rules")))) -parseRules "caseWhen" =- (((parseRules "preDetection"))+parseRules ("VHDL","caseWhen") =+ (((parseRules ("VHDL","preDetection"))) <|> ((lookAhead (pRegExpr regex_'28'5cb'29when'5cb) >> (popContext) >> currentContext >>= parseRules)) <|> ((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 "proc_rules")))+ ((parseRules ("VHDL","proc_rules")))) -parseRules "entity" =- (((parseRules "preDetection"))+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 "entity_main")+ ((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 "generalDetection")))+ ((parseRules ("VHDL","generalDetection")))) -parseRules "entity_main" =- (((parseRules "preDetection"))+parseRules ("VHDL","entity_main") =+ (((parseRules ("VHDL","preDetection"))) <|> ((pRegExprDynamic "(\\b)end(\\s+(entity|component))?(\\s+%1)?\\s*;" >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>@@ -301,21 +298,21 @@ <|> ((pRegExpr regex_port >>= withAttribute KeywordTok)) <|>- ((parseRules "generalDetection")))+ ((parseRules ("VHDL","generalDetection")))) -parseRules "preDetection" =- (((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext "comment")+parseRules ("VHDL","preDetection") =+ (((pDetect2Chars False '-' '-' >>= withAttribute CommentTok) >>~ pushContext ("VHDL","comment")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "string")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("VHDL","string")) <|> ((pAnyChar "[&><=:+\\-*\\/|].," >>= withAttribute OtherTok)) <|>- ((pDetectChar False '\'' >>= withAttribute BaseNTok) >>~ pushContext "attribute"))+ ((pDetectChar False '\'' >>= withAttribute BaseNTok) >>~ pushContext ("VHDL","attribute"))) -parseRules "generalDetection" =+parseRules ("VHDL","generalDetection") = (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_types >>= withAttribute DataTypeTok)) <|>- ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_signals >>= withAttribute OtherTok) >>~ pushContext "signal")+ ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_signals >>= withAttribute OtherTok) >>~ pushContext ("VHDL","signal")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_range >>= withAttribute OtherTok)) <|>@@ -327,14 +324,14 @@ <|> ((pDetectSpaces >>= withAttribute NormalTok))) -parseRules "comment" =+parseRules ("VHDL","comment") = pzero -parseRules "string" =+parseRules ("VHDL","string") = ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) -parseRules "attribute" =- (((pDetectChar False '"' >>= withAttribute BaseNTok) >>~ pushContext "quot in att")+parseRules ("VHDL","attribute") =+ (((pDetectChar False '"' >>= withAttribute BaseNTok) >>~ pushContext ("VHDL","quot in att")) <|> ((pDetectChar False ' ' >>= withAttribute NormalTok) >>~ (popContext)) <|>@@ -342,16 +339,15 @@ <|> ((pAnyChar "()=<>" >>= withAttribute BaseNTok) >>~ (popContext))) -parseRules "quot in att" =+parseRules ("VHDL","quot in att") = ((pDetectChar False '"' >>= withAttribute BaseNTok) >>~ (popContext)) -parseRules "signal" =- (((parseRules "preDetection"))+parseRules ("VHDL","signal") =+ (((parseRules ("VHDL","preDetection"))) <|> ((pDetectChar False ';' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "generalDetection")))+ ((parseRules ("VHDL","generalDetection")))) -parseRules "" = parseRules "start" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Xml.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,45 +25,47 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "XML" }- context <- currentContext <|> (pushContext "Start" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("XML",["Start"])], synStLanguage = "XML", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("XML","Start")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Start" -> return ()- "FindXML" -> return ()- "FindEntityRefs" -> return ()- "FindPEntityRefs" -> return ()- "Comment" -> return ()- "CDATA" -> return ()- "PI" -> return ()- "Doctype" -> return ()- "Doctype Internal Subset" -> return ()- "Doctype Markupdecl" -> return ()- "Doctype Markupdecl DQ" -> return ()- "Doctype Markupdecl SQ" -> return ()- "Element" -> return ()- "El Content" -> return ()- "El End" -> return ()- "Attribute" -> return ()- "Value" -> return ()- "Value DQ" -> return ()- "Value SQ" -> return ()+ ("XML","Start") -> return ()+ ("XML","FindXML") -> return ()+ ("XML","FindEntityRefs") -> return ()+ ("XML","FindPEntityRefs") -> return ()+ ("XML","Comment") -> return ()+ ("XML","CDATA") -> return ()+ ("XML","PI") -> return ()+ ("XML","Doctype") -> return ()+ ("XML","Doctype Internal Subset") -> return ()+ ("XML","Doctype Markupdecl") -> return ()+ ("XML","Doctype Markupdecl DQ") -> return ()+ ("XML","Doctype Markupdecl SQ") -> return ()+ ("XML","Element") -> return ()+ ("XML","El Content") -> return ()+ ("XML","El End") -> return ()+ ("XML","Attribute") -> return ()+ ("XML","Value") -> return ()+ ("XML","Value DQ") -> return ()+ ("XML","Value SQ") -> return () _ -> return () withAttribute attr txt = do@@ -73,11 +74,7 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'3c'21DOCTYPE'5cs'2b = compileRegex "<!DOCTYPE\\s+" regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a = compileRegex "<\\?[\\w:_-]*" regex_'3c'28'3f'21'5b0'2d9'5d'29'5b'5cw'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a = compileRegex "<(?![0-9])[\\w_:][\\w.:_-]*"@@ -90,41 +87,41 @@ regex_'5cS = compileRegex "\\S" regex_'3c'2f'28'3f'21'5b0'2d9'5d'29'5b'5cw'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a = compileRegex "</(?![0-9])[\\w_:][\\w.:_-]*" -defaultAttributes = [("Start",NormalTok),("FindXML",NormalTok),("FindEntityRefs",NormalTok),("FindPEntityRefs",NormalTok),("Comment",CommentTok),("CDATA",NormalTok),("PI",NormalTok),("Doctype",NormalTok),("Doctype Internal Subset",NormalTok),("Doctype Markupdecl",NormalTok),("Doctype Markupdecl DQ",StringTok),("Doctype Markupdecl SQ",StringTok),("Element",NormalTok),("El Content",NormalTok),("El End",NormalTok),("Attribute",NormalTok),("Value",NormalTok),("Value DQ",StringTok),("Value SQ",StringTok)]+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 "Start" =- ((parseRules "FindXML"))+parseRules ("XML","Start") =+ ((parseRules ("XML","FindXML"))) -parseRules "FindXML" =+parseRules ("XML","FindXML") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("XML","Comment")) <|>- ((pString False "<![CDATA[" >>= withAttribute BaseNTok) >>~ pushContext "CDATA")+ ((pString False "<![CDATA[" >>= withAttribute BaseNTok) >>~ pushContext ("XML","CDATA")) <|>- ((pRegExpr regex_'3c'21DOCTYPE'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext "Doctype")+ ((pRegExpr regex_'3c'21DOCTYPE'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext ("XML","Doctype")) <|>- ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "PI")+ ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("XML","PI")) <|>- ((pRegExpr regex_'3c'28'3f'21'5b0'2d9'5d'29'5b'5cw'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "Element")+ ((pRegExpr regex_'3c'28'3f'21'5b0'2d9'5d'29'5b'5cw'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("XML","Element")) <|>- ((parseRules "FindEntityRefs"))+ ((parseRules ("XML","FindEntityRefs"))) <|> ((pDetectIdentifier >>= withAttribute NormalTok))) -parseRules "FindEntityRefs" =+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))) -parseRules "FindPEntityRefs" =+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))) -parseRules "Comment" =+parseRules ("XML","Comment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))@@ -135,7 +132,7 @@ <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "CDATA" =+parseRules ("XML","CDATA") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pDetectIdentifier >>= withAttribute NormalTok))@@ -144,85 +141,85 @@ <|> ((pString False "]]>" >>= withAttribute DecValTok))) -parseRules "PI" =+parseRules ("XML","PI") = ((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext)) -parseRules "Doctype" =+parseRules ("XML","Doctype") = (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext "Doctype Internal Subset"))+ ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("XML","Doctype Internal Subset"))) -parseRules "Doctype Internal Subset" =+parseRules ("XML","Doctype Internal Subset") = (((pDetectChar False ']' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext "Doctype Markupdecl")+ ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("XML","Doctype Markupdecl")) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("XML","Comment")) <|>- ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "PI")+ ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("XML","PI")) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("XML","FindPEntityRefs")))) -parseRules "Doctype Markupdecl" =+parseRules ("XML","Doctype Markupdecl") = (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Doctype Markupdecl DQ")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("XML","Doctype Markupdecl DQ")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Doctype Markupdecl SQ"))+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("XML","Doctype Markupdecl SQ"))) -parseRules "Doctype Markupdecl DQ" =+parseRules ("XML","Doctype Markupdecl DQ") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("XML","FindPEntityRefs")))) -parseRules "Doctype Markupdecl SQ" =+parseRules ("XML","Doctype Markupdecl SQ") = (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("XML","FindPEntityRefs")))) -parseRules "Element" =+parseRules ("XML","Element") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext "El Content")+ ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext ("XML","El Content")) <|>- ((pColumn 0 >> pRegExpr regex_'28'3f'21'5b0'2d9'5d'29'5b'5cw'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute OtherTok) >>~ pushContext "Attribute")+ ((pColumn 0 >> pRegExpr regex_'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'2b'28'3f'21'5b0'2d9'5d'29'5b'5cw'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute OtherTok) >>~ pushContext "Attribute")+ ((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))) -parseRules "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 "El End")+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 "FindXML")))+ ((parseRules ("XML","FindXML")))) -parseRules "El End" =+parseRules ("XML","El End") = (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "Attribute" =- (((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext "Value")+parseRules ("XML","Attribute") =+ (((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("XML","Value")) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "Value" =- (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Value DQ")+parseRules ("XML","Value") =+ (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("XML","Value DQ")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Value SQ")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("XML","Value SQ")) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "Value DQ" =+parseRules ("XML","Value DQ") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext >> popContext >> popContext)) <|>- ((parseRules "FindEntityRefs")))+ ((parseRules ("XML","FindEntityRefs")))) -parseRules "Value SQ" =+parseRules ("XML","Value SQ") = (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext >> popContext >> popContext)) <|>- ((parseRules "FindEntityRefs")))+ ((parseRules ("XML","FindEntityRefs")))) -parseRules "" = parseRules "Start"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Xorg.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,31 +25,33 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "x.org Configuration" }- context <- currentContext <|> (pushContext "xorg" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("x.org Configuration",["xorg"])], synStLanguage = "x.org Configuration", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("x.org Configuration","xorg")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "xorg" -> return ()- "Section" -> return ()- "Section Content" -> return ()- "Keyword" -> (popContext) >> pEndLine- "Comment" -> (popContext) >> pEndLine+ ("x.org Configuration","xorg") -> return ()+ ("x.org Configuration","Section") -> return ()+ ("x.org Configuration","Section Content") -> return ()+ ("x.org Configuration","Keyword") -> (popContext) >> pEndLine+ ("x.org Configuration","Comment") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -59,42 +60,38 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'5cb'5cw'2b'5cb = compileRegex "\\b\\w+\\b" regex_'5b'5cw'5cd'5d'2b = compileRegex "[\\w\\d]+" -defaultAttributes = [("xorg",NormalTok),("Section",NormalTok),("Section Content",NormalTok),("Keyword",KeywordTok),("Comment",CommentTok)]+defaultAttributes = [(("x.org Configuration","xorg"),NormalTok),(("x.org Configuration","Section"),NormalTok),(("x.org Configuration","Section Content"),NormalTok),(("x.org Configuration","Keyword"),KeywordTok),(("x.org Configuration","Comment"),CommentTok)] -parseRules "xorg" =- (((pString False "Section" >>= withAttribute FunctionTok) >>~ pushContext "Section")+parseRules ("x.org Configuration","xorg") =+ (((pString False "Section" >>= withAttribute FunctionTok) >>~ pushContext ("x.org Configuration","Section")) <|>- ((pDetectChar False '#' >>= withAttribute NormalTok) >>~ pushContext "Comment"))+ ((pDetectChar False '#' >>= withAttribute NormalTok) >>~ pushContext ("x.org Configuration","Comment"))) -parseRules "Section" =- (((pRangeDetect '"' '"' >>= withAttribute StringTok) >>~ pushContext "Section Content")+parseRules ("x.org Configuration","Section") =+ (((pRangeDetect '"' '"' >>= withAttribute StringTok) >>~ pushContext ("x.org Configuration","Section Content")) <|>- ((pRangeDetect '\'' '\'' >>= withAttribute StringTok) >>~ pushContext "Section Content")+ ((pRangeDetect '\'' '\'' >>= withAttribute StringTok) >>~ pushContext ("x.org Configuration","Section Content")) <|> ((pDetectIdentifier >>= withAttribute ErrorTok)) <|>- ((pDetectChar False '#' >>= withAttribute NormalTok) >>~ pushContext "Comment"))+ ((pDetectChar False '#' >>= withAttribute NormalTok) >>~ pushContext ("x.org Configuration","Comment"))) -parseRules "Section Content" =+parseRules ("x.org Configuration","Section Content") = (((pString False "EndSection" >>= withAttribute FunctionTok) >>~ (popContext >> popContext)) <|> ((pString False "EndSubSection" >>= withAttribute FunctionTok) >>~ (popContext >> popContext)) <|>- ((pString False "SubSection" >>= withAttribute FunctionTok) >>~ pushContext "Section")+ ((pString False "SubSection" >>= withAttribute FunctionTok) >>~ pushContext ("x.org Configuration","Section")) <|>- ((pRegExpr regex_'5cb'5cw'2b'5cb >>= withAttribute NormalTok) >>~ pushContext "Keyword")+ ((pRegExpr regex_'5cb'5cw'2b'5cb >>= withAttribute NormalTok) >>~ pushContext ("x.org Configuration","Keyword")) <|>- ((pDetectChar False '#' >>= withAttribute NormalTok) >>~ pushContext "Comment"))+ ((pDetectChar False '#' >>= withAttribute NormalTok) >>~ pushContext ("x.org Configuration","Comment"))) -parseRules "Keyword" =+parseRules ("x.org Configuration","Keyword") = (((pRangeDetect '"' '"' >>= withAttribute DataTypeTok)) <|> ((pRangeDetect '\'' '\'' >>= withAttribute DataTypeTok))@@ -105,15 +102,15 @@ <|> ((pRegExpr regex_'5b'5cw'5cd'5d'2b >>= withAttribute OtherTok)) <|>- ((pDetectChar False '#' >>= withAttribute KeywordTok) >>~ pushContext "Comment"))+ ((pDetectChar False '#' >>= withAttribute KeywordTok) >>~ pushContext ("x.org Configuration","Comment"))) -parseRules "Comment" =+parseRules ("x.org Configuration","Comment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "" = parseRules "xorg"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Xslt.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,48 +25,50 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "xslt" }- context <- currentContext <|> (pushContext "normalText" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("xslt",["normalText"])], synStLanguage = "xslt", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("xslt","normalText")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = False, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "normalText" -> return ()- "CDATA" -> return ()- "PI" -> return ()- "Doctype" -> return ()- "Doctype Internal Subset" -> return ()- "Doctype Markupdecl" -> return ()- "Doctype Markupdecl DQ" -> return ()- "Doctype Markupdecl SQ" -> return ()- "detectEntRef" -> return ()- "FindPEntityRefs" -> return ()- "tagname" -> return ()- "attributes" -> return ()- "attrValue" -> return ()- "xattributes" -> return ()- "xattrValue" -> return ()- "string" -> return ()- "sqstring" -> return ()- "comment" -> return ()- "xpath" -> return ()- "sqxpath" -> return ()- "sqxpathstring" -> return ()- "xpathstring" -> return ()+ ("xslt","normalText") -> return ()+ ("xslt","CDATA") -> return ()+ ("xslt","PI") -> return ()+ ("xslt","Doctype") -> return ()+ ("xslt","Doctype Internal Subset") -> return ()+ ("xslt","Doctype Markupdecl") -> return ()+ ("xslt","Doctype Markupdecl DQ") -> return ()+ ("xslt","Doctype Markupdecl SQ") -> return ()+ ("xslt","detectEntRef") -> return ()+ ("xslt","FindPEntityRefs") -> return ()+ ("xslt","tagname") -> return ()+ ("xslt","attributes") -> return ()+ ("xslt","attrValue") -> return ()+ ("xslt","xattributes") -> return ()+ ("xslt","xattrValue") -> return ()+ ("xslt","string") -> return ()+ ("xslt","sqstring") -> return ()+ ("xslt","comment") -> return ()+ ("xslt","xpath") -> return ()+ ("xslt","sqxpath") -> return ()+ ("xslt","sqxpathstring") -> return ()+ ("xslt","xpathstring") -> return () _ -> return () withAttribute attr txt = do@@ -76,10 +77,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keytags = Set.fromList $ words $ "xsl:value-of xsl:output xsl:decimal-format xsl:apply-templates xsl:param xsl:transform xsl:namespace-alias xsl:comment xsl:element xsl:attribute xsl:apply-imports xsl:text xsl:when xsl:template xsl:processing-instruction xsl:include xsl:copy-of xsl:copy xsl:with-param xsl:stylesheet xsl:for-each xsl:choose xsl:sort xsl:otherwise xsl:key xsl:variable xsl:number xsl:message xsl:fallback xsl:strip-space xsl:import xsl:preserve-space xsl:if xsl:call-template xsl:attribute-set" list_keytags'5f2'2e0 = Set.fromList $ words $ "xsl:perform-sort xsl:import-schema xsl:for-each-group xsl:sequence xsl:non-matching-substring xsl:namespace xsl:next-match xsl:function xsl:analyze-string xsl:output-character xsl:matching-substring xsl:result-document xsl:character-map xsl:document" list_functions = Set.fromList $ words $ "format-number position lang substring-before substring normalize-space round translate starts-with concat local-name key count document system-property current boolean number contains name last unparsed-entity-uri sum generate-id function-available element-available false substring-after not string-length id floor ceiling namespace-uri true string text"@@ -102,22 +99,22 @@ regex_'5c'24'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a = compileRegex "\\$[A-Za-z_:][\\w.:_-]*" regex_'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a = compileRegex "[A-Za-z_:][\\w.:_-]*" -defaultAttributes = [("normalText",NormalTok),("CDATA",NormalTok),("PI",NormalTok),("Doctype",NormalTok),("Doctype Internal Subset",NormalTok),("Doctype Markupdecl",NormalTok),("Doctype Markupdecl DQ",NormalTok),("Doctype Markupdecl SQ",NormalTok),("detectEntRef",NormalTok),("FindPEntityRefs",NormalTok),("tagname",KeywordTok),("attributes",OtherTok),("attrValue",ErrorTok),("xattributes",OtherTok),("xattrValue",ErrorTok),("string",StringTok),("sqstring",StringTok),("comment",CommentTok),("xpath",OtherTok),("sqxpath",OtherTok),("sqxpathstring",StringTok),("xpathstring",StringTok)]+defaultAttributes = [(("xslt","normalText"),NormalTok),(("xslt","CDATA"),NormalTok),(("xslt","PI"),NormalTok),(("xslt","Doctype"),NormalTok),(("xslt","Doctype Internal Subset"),NormalTok),(("xslt","Doctype Markupdecl"),NormalTok),(("xslt","Doctype Markupdecl DQ"),NormalTok),(("xslt","Doctype Markupdecl SQ"),NormalTok),(("xslt","detectEntRef"),NormalTok),(("xslt","FindPEntityRefs"),NormalTok),(("xslt","tagname"),KeywordTok),(("xslt","attributes"),OtherTok),(("xslt","attrValue"),ErrorTok),(("xslt","xattributes"),OtherTok),(("xslt","xattrValue"),ErrorTok),(("xslt","string"),StringTok),(("xslt","sqstring"),StringTok),(("xslt","comment"),CommentTok),(("xslt","xpath"),OtherTok),(("xslt","sqxpath"),OtherTok),(("xslt","sqxpathstring"),StringTok),(("xslt","xpathstring"),StringTok)] -parseRules "normalText" =- (((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "comment")+parseRules ("xslt","normalText") =+ (((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("xslt","comment")) <|>- ((pString False "<![CDATA[" >>= withAttribute BaseNTok) >>~ pushContext "CDATA")+ ((pString False "<![CDATA[" >>= withAttribute BaseNTok) >>~ pushContext ("xslt","CDATA")) <|>- ((pRegExpr regex_'3c'21DOCTYPE'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext "Doctype")+ ((pRegExpr regex_'3c'21DOCTYPE'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext ("xslt","Doctype")) <|>- ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "PI")+ ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("xslt","PI")) <|>- ((pDetectChar False '<' >>= withAttribute KeywordTok) >>~ pushContext "tagname")+ ((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))) -parseRules "CDATA" =+parseRules ("xslt","CDATA") = (((pDetectSpaces >>= withAttribute NormalTok)) <|> ((pDetectIdentifier >>= withAttribute NormalTok))@@ -126,121 +123,121 @@ <|> ((pString False "]]>" >>= withAttribute DecValTok))) -parseRules "PI" =+parseRules ("xslt","PI") = ((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext)) -parseRules "Doctype" =+parseRules ("xslt","Doctype") = (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext "Doctype Internal Subset"))+ ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("xslt","Doctype Internal Subset"))) -parseRules "Doctype Internal Subset" =+parseRules ("xslt","Doctype Internal Subset") = (((pDetectChar False ']' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext "Doctype Markupdecl")+ ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("xslt","Doctype Markupdecl")) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "comment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("xslt","comment")) <|>- ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "PI")+ ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("xslt","PI")) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("xslt","FindPEntityRefs")))) -parseRules "Doctype Markupdecl" =+parseRules ("xslt","Doctype Markupdecl") = (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext "Doctype Markupdecl DQ")+ ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("xslt","Doctype Markupdecl DQ")) <|>- ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext "Doctype Markupdecl SQ"))+ ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext ("xslt","Doctype Markupdecl SQ"))) -parseRules "Doctype Markupdecl DQ" =+parseRules ("xslt","Doctype Markupdecl DQ") = (((pDetectChar False '"' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("xslt","FindPEntityRefs")))) -parseRules "Doctype Markupdecl SQ" =+parseRules ("xslt","Doctype Markupdecl SQ") = (((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("xslt","FindPEntityRefs")))) -parseRules "detectEntRef" =+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)) -parseRules "FindPEntityRefs" =+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))) -parseRules "tagname" =- (((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\\"{}" list_keytags >>= withAttribute KeywordTok) >>~ pushContext "xattributes")+parseRules ("xslt","tagname") =+ (((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\\"{}" list_keytags >>= withAttribute KeywordTok) >>~ pushContext ("xslt","xattributes")) <|>- ((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\\"{}" list_keytags'5f2'2e0 >>= withAttribute KeywordTok) >>~ pushContext "xattributes")+ ((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\\"{}" list_keytags'5f2'2e0 >>= withAttribute KeywordTok) >>~ pushContext ("xslt","xattributes")) <|>- ((pRegExpr regex_'5cs'2a >>= withAttribute OtherTok) >>~ pushContext "attributes")+ ((pRegExpr regex_'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("xslt","attributes")) <|> ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext))) -parseRules "attributes" =+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 "attrValue"))+ ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute NormalTok) >>~ pushContext ("xslt","attrValue"))) -parseRules "attrValue" =+parseRules ("xslt","attrValue") = (((pDetect2Chars False '/' '>' >>= withAttribute ErrorTok) >>~ (popContext >> popContext >> popContext)) <|> ((pDetectChar False '>' >>= withAttribute ErrorTok) >>~ (popContext >> popContext >> popContext)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "string")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("xslt","string")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "sqstring"))+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("xslt","sqstring"))) -parseRules "xattributes" =+parseRules ("xslt","xattributes") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|> ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|>- ((pRegExpr regex_select'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext "xattrValue")+ ((pRegExpr regex_select'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("xslt","xattrValue")) <|>- ((pRegExpr regex_test'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext "xattrValue")+ ((pRegExpr regex_test'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("xslt","xattrValue")) <|>- ((pRegExpr regex_match'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext "xattrValue")+ ((pRegExpr regex_match'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("xslt","xattrValue")) <|>- ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext "attrValue"))+ ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("xslt","attrValue"))) -parseRules "xattrValue" =+parseRules ("xslt","xattrValue") = (((pDetect2Chars False '/' '>' >>= withAttribute ErrorTok) >>~ (popContext >> popContext >> popContext)) <|> ((pDetectChar False '>' >>= withAttribute ErrorTok) >>~ (popContext >> popContext >> popContext)) <|>- ((pDetectChar False '"' >>= withAttribute OtherTok) >>~ pushContext "xpath")+ ((pDetectChar False '"' >>= withAttribute OtherTok) >>~ pushContext ("xslt","xpath")) <|>- ((pDetectChar False '\'' >>= withAttribute OtherTok) >>~ pushContext "sqxpath"))+ ((pDetectChar False '\'' >>= withAttribute OtherTok) >>~ pushContext ("xslt","sqxpath"))) -parseRules "string" =- (((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext "xpath")+parseRules ("xslt","string") =+ (((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext ("xslt","xpath")) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext >> popContext)) <|>- ((parseRules "detectEntRef")))+ ((parseRules ("xslt","detectEntRef")))) -parseRules "sqstring" =- (((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext "sqxpath")+parseRules ("xslt","sqstring") =+ (((pDetectChar False '{' >>= withAttribute OtherTok) >>~ pushContext ("xslt","sqxpath")) <|> ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext >> popContext)) <|>- ((parseRules "detectEntRef")))+ ((parseRules ("xslt","detectEntRef")))) -parseRules "comment" =+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))) -parseRules "xpath" =+parseRules ("xslt","xpath") = (((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\\"{}" list_functions >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\\"{}" list_functions'5f2'2e0 >>= withAttribute KeywordTok))@@ -249,7 +246,7 @@ <|> ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext)) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "sqxpathstring")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("xslt","sqxpathstring")) <|> ((pDetectChar False '"' >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>@@ -261,9 +258,9 @@ <|> ((pDetectChar False '$' >>= withAttribute ErrorTok)) <|>- ((parseRules "detectEntRef")))+ ((parseRules ("xslt","detectEntRef")))) -parseRules "sqxpath" =+parseRules ("xslt","sqxpath") = (((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\\"{}" list_functions >>= withAttribute KeywordTok)) <|> ((pKeyword " \n\t.()!+,<=>%&*/;?[]^{|}~\\\"{}" list_functions'5f2'2e0 >>= withAttribute KeywordTok))@@ -272,7 +269,7 @@ <|> ((pDetectChar False '}' >>= withAttribute OtherTok) >>~ (popContext)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "xpathstring")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("xslt","xpathstring")) <|> ((pDetectChar False '\'' >>= withAttribute OtherTok) >>~ (popContext >> popContext)) <|>@@ -284,18 +281,17 @@ <|> ((pDetectChar False '$' >>= withAttribute ErrorTok)) <|>- ((parseRules "detectEntRef")))+ ((parseRules ("xslt","detectEntRef")))) -parseRules "sqxpathstring" =+parseRules ("xslt","sqxpathstring") = (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "detectEntRef")))+ ((parseRules ("xslt","detectEntRef")))) -parseRules "xpathstring" =+parseRules ("xslt","xpathstring") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "detectEntRef")))+ ((parseRules ("xslt","detectEntRef")))) -parseRules "" = parseRules "normalText" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Xul.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Alert import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -27,55 +26,57 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "XUL" }- context <- currentContext <|> (pushContext "Start" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("XUL",["Start"])], synStLanguage = "XUL", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("XUL","Start")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Start" -> return ()- "FindXML" -> return ()- "FindEntityRefs" -> return ()- "FindPEntityRefs" -> return ()- "Comment" -> return ()- "PI" -> return ()- "Doctype" -> return ()- "Doctype Internal Subset" -> return ()- "Doctype Markupdecl" -> return ()- "Doctype Markupdecl DQ" -> return ()- "Doctype Markupdecl SQ" -> return ()- "Element" -> return ()- "El Content" -> return ()- "El End" -> return ()- "Attribute" -> return ()- "Value" -> return ()- "Value DQ" -> return ()- "Value SQ" -> return ()- "CDATA" -> return ()- "String" -> (popContext) >> pEndLine- "String 1" -> (popContext) >> pEndLine- "JSComment" -> (popContext) >> pEndLine- "Multi/inline Comment" -> return ()- "Regular Expression" -> return ()- "(Internal regex catch)" -> return ()- "Regular Expression Character Class" -> return ()- "(regex caret first check)" -> (popContext) >> pEndLine- "(charclass caret first check)" -> (popContext) >> pEndLine- "region_marker" -> (popContext) >> pEndLine+ ("XUL","Start") -> return ()+ ("XUL","FindXML") -> return ()+ ("XUL","FindEntityRefs") -> return ()+ ("XUL","FindPEntityRefs") -> return ()+ ("XUL","Comment") -> return ()+ ("XUL","PI") -> return ()+ ("XUL","Doctype") -> return ()+ ("XUL","Doctype Internal Subset") -> return ()+ ("XUL","Doctype Markupdecl") -> return ()+ ("XUL","Doctype Markupdecl DQ") -> return ()+ ("XUL","Doctype Markupdecl SQ") -> return ()+ ("XUL","Element") -> return ()+ ("XUL","El Content") -> return ()+ ("XUL","El End") -> return ()+ ("XUL","Attribute") -> return ()+ ("XUL","Value") -> return ()+ ("XUL","Value DQ") -> return ()+ ("XUL","Value SQ") -> return ()+ ("XUL","CDATA") -> return ()+ ("XUL","String") -> (popContext) >> pEndLine+ ("XUL","String 1") -> (popContext) >> pEndLine+ ("XUL","JSComment") -> (popContext) >> pEndLine+ ("XUL","Multi/inline Comment") -> return ()+ ("XUL","Regular Expression") -> return ()+ ("XUL","(Internal regex catch)") -> return ()+ ("XUL","Regular Expression Character Class") -> return ()+ ("XUL","(regex caret first check)") -> (popContext) >> pEndLine+ ("XUL","(charclass caret first check)") -> (popContext) >> pEndLine+ ("XUL","region_marker") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -84,10 +85,6 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes))- list_keywords = Set.fromList $ words $ "if else for in while do continue break with try catch finally switch case new var function return delete true false void throw typeof const default" list_functions = Set.fromList $ words $ "escape isFinite isNaN Number parseFloat parseInt reload taint unescape untaint write" list_objects = Set.fromList $ words $ "Anchor Applet Area Array Boolean Button Checkbox Date document window Image FileUpload Form Frame Function Hidden Link MimeType Math Max Min Layer navigator Object Password Plugin Radio RegExp Reset Screen Select String Text Textarea this Window"@@ -118,41 +115,41 @@ regex_'2f'2f'28'3f'3d'3b'29 = compileRegex "//(?=;)" regex_'5c'5c'5b'5c'5b'5c'5d'5d = compileRegex "\\\\[\\[\\]]" -defaultAttributes = [("Start",NormalTok),("FindXML",NormalTok),("FindEntityRefs",NormalTok),("FindPEntityRefs",NormalTok),("Comment",CommentTok),("PI",NormalTok),("Doctype",NormalTok),("Doctype Internal Subset",NormalTok),("Doctype Markupdecl",NormalTok),("Doctype Markupdecl DQ",StringTok),("Doctype Markupdecl SQ",StringTok),("Element",NormalTok),("El Content",NormalTok),("El End",NormalTok),("Attribute",NormalTok),("Value",NormalTok),("Value DQ",StringTok),("Value SQ",StringTok),("CDATA",NormalTok),("String",StringTok),("String 1",CharTok),("JSComment",CommentTok),("Multi/inline Comment",CommentTok),("Regular Expression",OtherTok),("(Internal regex catch)",NormalTok),("Regular Expression Character Class",BaseNTok),("(regex caret first check)",FloatTok),("(charclass caret first check)",FloatTok),("region_marker",RegionMarkerTok)]+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 "Start" =- ((parseRules "FindXML"))+parseRules ("XUL","Start") =+ ((parseRules ("XUL","FindXML"))) -parseRules "FindXML" =+parseRules ("XUL","FindXML") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("XUL","Comment")) <|>- ((pString False "<![CDATA[" >>= withAttribute BaseNTok) >>~ pushContext "CDATA")+ ((pString False "<![CDATA[" >>= withAttribute BaseNTok) >>~ pushContext ("XUL","CDATA")) <|>- ((pRegExpr regex_'3c'21DOCTYPE'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext "Doctype")+ ((pRegExpr regex_'3c'21DOCTYPE'5cs'2b >>= withAttribute DataTypeTok) >>~ pushContext ("XUL","Doctype")) <|>- ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "PI")+ ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("XUL","PI")) <|>- ((pRegExpr regex_'3c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "Element")+ ((pRegExpr regex_'3c'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("XUL","Element")) <|>- ((parseRules "FindEntityRefs"))+ ((parseRules ("XUL","FindEntityRefs"))) <|> ((pDetectIdentifier >>= withAttribute NormalTok))) -parseRules "FindEntityRefs" =+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))) -parseRules "FindPEntityRefs" =+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))) -parseRules "Comment" =+parseRules ("XUL","Comment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((pString False "-->" >>= withAttribute CommentTok) >>~ (popContext))@@ -163,95 +160,95 @@ <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "PI" =+parseRules ("XUL","PI") = ((pDetect2Chars False '?' '>' >>= withAttribute KeywordTok) >>~ (popContext)) -parseRules "Doctype" =+parseRules ("XUL","Doctype") = (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext "Doctype Internal Subset"))+ ((pDetectChar False '[' >>= withAttribute DataTypeTok) >>~ pushContext ("XUL","Doctype Internal Subset"))) -parseRules "Doctype Internal Subset" =+parseRules ("XUL","Doctype Internal Subset") = (((pDetectChar False ']' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext "Doctype Markupdecl")+ ((pRegExpr regex_'3c'21'28ELEMENT'7cENTITY'7cATTLIST'7cNOTATION'29'5cb >>= withAttribute DataTypeTok) >>~ pushContext ("XUL","Doctype Markupdecl")) <|>- ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext "Comment")+ ((pString False "<!--" >>= withAttribute CommentTok) >>~ pushContext ("XUL","Comment")) <|>- ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "PI")+ ((pRegExpr regex_'3c'5c'3f'5b'5cw'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext ("XUL","PI")) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("XUL","FindPEntityRefs")))) -parseRules "Doctype Markupdecl" =+parseRules ("XUL","Doctype Markupdecl") = (((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Doctype Markupdecl DQ")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("XUL","Doctype Markupdecl DQ")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Doctype Markupdecl SQ"))+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("XUL","Doctype Markupdecl SQ"))) -parseRules "Doctype Markupdecl DQ" =+parseRules ("XUL","Doctype Markupdecl DQ") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("XUL","FindPEntityRefs")))) -parseRules "Doctype Markupdecl SQ" =+parseRules ("XUL","Doctype Markupdecl SQ") = (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext)) <|>- ((parseRules "FindPEntityRefs")))+ ((parseRules ("XUL","FindPEntityRefs")))) -parseRules "Element" =+parseRules ("XUL","Element") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext "El Content")+ ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ pushContext ("XUL","El Content")) <|>- ((pColumn 0 >> pRegExpr regex_'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute OtherTok) >>~ pushContext "Attribute")+ ((pColumn 0 >> pRegExpr regex_'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute OtherTok) >>~ pushContext ("XUL","Attribute")) <|>- ((pRegExpr regex_'5cs'2b'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute OtherTok) >>~ pushContext "Attribute")+ ((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))) -parseRules "El Content" =- (((pRegExpr regex_'3c'2f'5bA'2dZa'2dz'5f'3a'5d'5b'5cw'2e'3a'5f'2d'5d'2a >>= withAttribute KeywordTok) >>~ pushContext "El End")+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 "FindXML")))+ ((parseRules ("XUL","FindXML")))) -parseRules "El End" =+parseRules ("XUL","El End") = (((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext >> popContext >> popContext)) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "Attribute" =- (((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext "Value")+parseRules ("XUL","Attribute") =+ (((pDetectChar False '=' >>= withAttribute OtherTok) >>~ pushContext ("XUL","Value")) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "Value" =- (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "Value DQ")+parseRules ("XUL","Value") =+ (((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("XUL","Value DQ")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "Value SQ")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("XUL","Value SQ")) <|> ((pRegExpr regex_'5cS >>= withAttribute ErrorTok))) -parseRules "Value DQ" =+parseRules ("XUL","Value DQ") = (((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext >> popContext >> popContext)) <|>- ((parseRules "FindEntityRefs")))+ ((parseRules ("XUL","FindEntityRefs")))) -parseRules "Value SQ" =+parseRules ("XUL","Value SQ") = (((pDetectChar False '\'' >>= withAttribute StringTok) >>~ (popContext >> popContext >> popContext)) <|>- ((parseRules "FindEntityRefs")))+ ((parseRules ("XUL","FindEntityRefs")))) -parseRules "CDATA" =+parseRules ("XUL","CDATA") = (((pString False "]]>" >>= withAttribute BaseNTok) >>~ (popContext)) <|> ((pString False "]]>" >>= withAttribute DecValTok)) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pString False "//BEGIN" >>= withAttribute RegionMarkerTok) >>~ pushContext "region_marker")+ ((pString False "//BEGIN" >>= withAttribute RegionMarkerTok) >>~ pushContext ("XUL","region_marker")) <|>- ((pString False "//END" >>= withAttribute RegionMarkerTok) >>~ pushContext "region_marker")+ ((pString False "//END" >>= withAttribute RegionMarkerTok) >>~ pushContext ("XUL","region_marker")) <|> ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" list_keywords >>= withAttribute KeywordTok)) <|>@@ -271,17 +268,17 @@ <|> ((pInt >>= withAttribute DecValTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("XUL","String")) <|>- ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext "String 1")+ ((pDetectChar False '\'' >>= withAttribute StringTok) >>~ pushContext ("XUL","String 1")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "JSComment")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("XUL","JSComment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Multi/inline Comment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("XUL","Multi/inline Comment")) <|>- ((pRegExpr regex_'5b'3d'3f'3a'5d >>= withAttribute NormalTok) >>~ pushContext "(Internal regex catch)")+ ((pRegExpr regex_'5b'3d'3f'3a'5d >>= withAttribute NormalTok) >>~ pushContext ("XUL","(Internal regex catch)")) <|>- ((pRegExpr regex_'5c'28 >>= withAttribute NormalTok) >>~ pushContext "(Internal regex catch)")+ ((pRegExpr regex_'5c'28 >>= withAttribute NormalTok) >>~ pushContext ("XUL","(Internal regex catch)")) <|> ((pDetectChar False '{' >>= withAttribute NormalTok)) <|>@@ -289,33 +286,33 @@ <|> ((pAnyChar ":!%&+,-/.*<=>?[]|~^;" >>= withAttribute NormalTok))) -parseRules "String" =+parseRules ("XUL","String") = (((pDetectIdentifier >>= withAttribute StringTok)) <|> ((pHlCStringChar >>= withAttribute CharTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "String 1" =+parseRules ("XUL","String 1") = (((pDetectIdentifier >>= withAttribute CharTok)) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String")+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("XUL","String")) <|> ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext))) -parseRules "JSComment" =+parseRules ("XUL","JSComment") = (((pDetectSpaces >>= withAttribute CommentTok)) <|> ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetectIdentifier >>= withAttribute CommentTok))) -parseRules "Multi/inline Comment" =+parseRules ("XUL","Multi/inline Comment") = (((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute CommentTok) . snd))) <|> ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext))) -parseRules "Regular Expression" =+parseRules ("XUL","Regular Expression") = (((pRegExpr regex_'2f'5big'5d'7b0'2c2'7d >>= withAttribute OtherTok) >>~ (popContext >> popContext >> popContext)) <|> ((pRegExpr regex_'5c'7b'5b'5cd'2c_'5d'2b'5c'7d >>= withAttribute FloatTok))@@ -324,7 +321,7 @@ <|> ((pRegExpr regex_'5c'5c'5bnrtvfDdSsWw'5d >>= withAttribute BaseNTok)) <|>- ((pDetectChar False '[' >>= withAttribute BaseNTok) >>~ pushContext "(charclass caret first check)")+ ((pDetectChar False '[' >>= withAttribute BaseNTok) >>~ pushContext ("XUL","(charclass caret first check)")) <|> ((pRegExpr regex_'5c'5c'2e >>= withAttribute FloatTok)) <|>@@ -332,39 +329,39 @@ <|> ((pAnyChar "?+*()|" >>= withAttribute FloatTok))) -parseRules "(Internal regex catch)" =+parseRules ("XUL","(Internal regex catch)") = (((pRegExpr regex_'5cs'2a >>= withAttribute NormalTok)) <|> ((pRegExpr regex_'2f'2f'28'3f'3d'3b'29 >>= withAttribute OtherTok) >>~ (popContext)) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "JSComment")+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("XUL","JSComment")) <|>- ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "Multi/inline Comment")+ ((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("XUL","Multi/inline Comment")) <|>- ((pDetectChar False '/' >>= withAttribute OtherTok) >>~ pushContext "(regex caret first check)")+ ((pDetectChar False '/' >>= withAttribute OtherTok) >>~ pushContext ("XUL","(regex caret first check)")) <|> ((popContext) >> currentContext >>= parseRules)) -parseRules "Regular Expression Character Class" =+parseRules ("XUL","Regular Expression Character Class") = (((pRegExpr regex_'5c'5c'5b'5c'5b'5c'5d'5d >>= withAttribute BaseNTok)) <|> ((pDetectChar False ']' >>= withAttribute BaseNTok) >>~ (popContext >> popContext))) -parseRules "(regex caret first check)" =- (((pDetectChar False '^' >>= withAttribute FloatTok) >>~ pushContext "Regular Expression")+parseRules ("XUL","(regex caret first check)") =+ (((pDetectChar False '^' >>= withAttribute FloatTok) >>~ pushContext ("XUL","Regular Expression")) <|>- (pushContext "Regular Expression" >> currentContext >>= parseRules))+ (pushContext ("XUL","Regular Expression") >> currentContext >>= parseRules)) -parseRules "(charclass caret first check)" =- (((pDetectChar False '^' >>= withAttribute FloatTok) >>~ pushContext "Regular Expression Character Class")+parseRules ("XUL","(charclass caret first check)") =+ (((pDetectChar False '^' >>= withAttribute FloatTok) >>~ pushContext ("XUL","Regular Expression Character Class")) <|>- (pushContext "Regular Expression Character Class" >> currentContext >>= parseRules))+ (pushContext ("XUL","Regular Expression Character Class") >> currentContext >>= parseRules)) -parseRules "region_marker" =+parseRules ("XUL","region_marker") = (((pDetectIdentifier >>= withAttribute RegionMarkerTok)) <|> ((pDetectSpaces >>= withAttribute RegionMarkerTok))) -parseRules "" = parseRules "Start"+parseRules ("Alerts", _) = Text.Highlighting.Kate.Syntax.Alert.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Yacc.hs view
@@ -8,7 +8,6 @@ import Text.Highlighting.Kate.Common import qualified Text.Highlighting.Kate.Syntax.Cpp import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -26,47 +25,49 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "Yacc/Bison" }- context <- currentContext <|> (pushContext "Pre Start" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("Yacc/Bison",["Pre Start"])], synStLanguage = "Yacc/Bison", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("Yacc/Bison","Pre Start")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "Pre Start" -> return ()- "C Declarations" -> return ()- "Declarations" -> return ()- "Union Start" -> return ()- "Union In" -> return ()- "Union InIn" -> return ()- "Rules" -> return ()- "Rule In" -> return ()- "User Code" -> return ()- "Percent Command" -> (popContext) >> pEndLine- "Percent Command In" -> (popContext >> popContext) >> pEndLine- "PC type" -> (popContext >> popContext >> popContext) >> pEndLine- "Comment" -> return ()- "CommentStar" -> return ()- "CommentSlash" -> return ()- "StringOrChar" -> return ()- "String" -> (popContext) >> pEndLine- "Char" -> (popContext) >> pEndLine- "Normal C Bloc" -> return ()- "Dol" -> return ()- "DolEnd" -> return ()+ ("Yacc/Bison","Pre Start") -> return ()+ ("Yacc/Bison","C Declarations") -> return ()+ ("Yacc/Bison","Declarations") -> return ()+ ("Yacc/Bison","Union Start") -> return ()+ ("Yacc/Bison","Union In") -> return ()+ ("Yacc/Bison","Union InIn") -> return ()+ ("Yacc/Bison","Rules") -> return ()+ ("Yacc/Bison","Rule In") -> return ()+ ("Yacc/Bison","User Code") -> return ()+ ("Yacc/Bison","Percent Command") -> (popContext) >> pEndLine+ ("Yacc/Bison","Percent Command In") -> (popContext >> popContext) >> pEndLine+ ("Yacc/Bison","PC type") -> (popContext >> popContext >> popContext) >> pEndLine+ ("Yacc/Bison","Comment") -> return ()+ ("Yacc/Bison","CommentStar") -> return ()+ ("Yacc/Bison","CommentSlash") -> return ()+ ("Yacc/Bison","StringOrChar") -> return ()+ ("Yacc/Bison","String") -> (popContext) >> pEndLine+ ("Yacc/Bison","Char") -> (popContext) >> pEndLine+ ("Yacc/Bison","Normal C Bloc") -> return ()+ ("Yacc/Bison","Dol") -> return ()+ ("Yacc/Bison","DolEnd") -> return () _ -> return () withAttribute attr txt = do@@ -75,11 +76,7 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'2e = compileRegex "." regex_'5cW = compileRegex "\\W" regex_'5b'5e'5c'5c'5d'24 = compileRegex "[^\\\\]$"@@ -87,137 +84,137 @@ regex_'3c'5b'5e'3e'5d'2b'3e = compileRegex "<[^>]+>" regex_'5cd'2b = compileRegex "\\d+" -defaultAttributes = [("Pre Start",NormalTok),("C Declarations",NormalTok),("Declarations",NormalTok),("Union Start",NormalTok),("Union In",NormalTok),("Union InIn",NormalTok),("Rules",StringTok),("Rule In",NormalTok),("User Code",NormalTok),("Percent Command",KeywordTok),("Percent Command In",NormalTok),("PC type",DataTypeTok),("Comment",CommentTok),("CommentStar",CommentTok),("CommentSlash",CommentTok),("StringOrChar",NormalTok),("String",StringTok),("Char",CharTok),("Normal C Bloc",NormalTok),("Dol",NormalTok),("DolEnd",NormalTok)]+defaultAttributes = [(("Yacc/Bison","Pre Start"),NormalTok),(("Yacc/Bison","C Declarations"),NormalTok),(("Yacc/Bison","Declarations"),NormalTok),(("Yacc/Bison","Union Start"),NormalTok),(("Yacc/Bison","Union In"),NormalTok),(("Yacc/Bison","Union InIn"),NormalTok),(("Yacc/Bison","Rules"),StringTok),(("Yacc/Bison","Rule In"),NormalTok),(("Yacc/Bison","User Code"),NormalTok),(("Yacc/Bison","Percent Command"),KeywordTok),(("Yacc/Bison","Percent Command In"),NormalTok),(("Yacc/Bison","PC type"),DataTypeTok),(("Yacc/Bison","Comment"),CommentTok),(("Yacc/Bison","CommentStar"),CommentTok),(("Yacc/Bison","CommentSlash"),CommentTok),(("Yacc/Bison","StringOrChar"),NormalTok),(("Yacc/Bison","String"),StringTok),(("Yacc/Bison","Char"),CharTok),(("Yacc/Bison","Normal C Bloc"),NormalTok),(("Yacc/Bison","Dol"),NormalTok),(("Yacc/Bison","DolEnd"),NormalTok)] -parseRules "Pre Start" =- (((parseRules "Comment"))+parseRules ("Yacc/Bison","Pre Start") =+ (((parseRules ("Yacc/Bison","Comment"))) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pColumn 0 >> pDetect2Chars False '%' '{' >>= withAttribute BaseNTok) >>~ pushContext "C Declarations")+ ((pColumn 0 >> pDetect2Chars False '%' '{' >>= withAttribute BaseNTok) >>~ pushContext ("Yacc/Bison","C Declarations")) <|>- ((lookAhead (pRegExpr regex_'2e) >> pushContext "Declarations" >> currentContext >>= parseRules)))+ ((lookAhead (pRegExpr regex_'2e) >> pushContext ("Yacc/Bison","Declarations") >> currentContext >>= parseRules))) -parseRules "C Declarations" =- (((parseRules "Comment"))+parseRules ("Yacc/Bison","C Declarations") =+ (((parseRules ("Yacc/Bison","Comment"))) <|> ((pColumn 0 >> pDetect2Chars False '%' '}' >>= withAttribute BaseNTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression))) -parseRules "Declarations" =- (((parseRules "Comment"))+parseRules ("Yacc/Bison","Declarations") =+ (((parseRules ("Yacc/Bison","Comment"))) <|>- ((pString False "%union" >>= withAttribute KeywordTok) >>~ pushContext "Union Start")+ ((pString False "%union" >>= withAttribute KeywordTok) >>~ pushContext ("Yacc/Bison","Union Start")) <|>- ((pDetect2Chars False '%' '%' >>= withAttribute BaseNTok) >>~ pushContext "Rules")+ ((pDetect2Chars False '%' '%' >>= withAttribute BaseNTok) >>~ pushContext ("Yacc/Bison","Rules")) <|>- ((pColumn 0 >> pDetect2Chars False '%' '{' >>= withAttribute BaseNTok) >>~ pushContext "C Declarations")+ ((pColumn 0 >> pDetect2Chars False '%' '{' >>= withAttribute BaseNTok) >>~ pushContext ("Yacc/Bison","C Declarations")) <|>- ((pDetectChar False '%' >>= withAttribute KeywordTok) >>~ pushContext "Percent Command"))+ ((pDetectChar False '%' >>= withAttribute KeywordTok) >>~ pushContext ("Yacc/Bison","Percent Command"))) -parseRules "Union Start" =- (((parseRules "Comment"))+parseRules ("Yacc/Bison","Union Start") =+ (((parseRules ("Yacc/Bison","Comment"))) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "Union In")+ ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("Yacc/Bison","Union In")) <|> ((pRegExpr regex_'2e >>= withAttribute AlertTok) >>~ (popContext))) -parseRules "Union In" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "Union InIn")+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))) -parseRules "Union InIn" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "Union InIn")+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))) -parseRules "Rules" =- (((parseRules "Comment"))+parseRules ("Yacc/Bison","Rules") =+ (((parseRules ("Yacc/Bison","Comment"))) <|>- ((pDetect2Chars False '%' '%' >>= withAttribute BaseNTok) >>~ pushContext "User Code")+ ((pDetect2Chars False '%' '%' >>= withAttribute BaseNTok) >>~ pushContext ("Yacc/Bison","User Code")) <|>- ((pDetectChar False ':' >>= withAttribute NormalTok) >>~ pushContext "Rule In"))+ ((pDetectChar False ':' >>= withAttribute NormalTok) >>~ pushContext ("Yacc/Bison","Rule In"))) -parseRules "Rule In" =- (((parseRules "Comment"))+parseRules ("Yacc/Bison","Rule In") =+ (((parseRules ("Yacc/Bison","Comment"))) <|> ((pDetectChar False ';' >>= withAttribute NormalTok) >>~ (popContext)) <|>- ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "Normal C Bloc")+ ((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("Yacc/Bison","Normal C Bloc")) <|> ((pDetectChar False '|' >>= withAttribute NormalTok)) <|>- ((parseRules "StringOrChar")))+ ((parseRules ("Yacc/Bison","StringOrChar")))) -parseRules "User Code" =+parseRules ("Yacc/Bison","User Code") = ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression)) -parseRules "Percent Command" =- (((parseRules "Comment"))+parseRules ("Yacc/Bison","Percent Command") =+ (((parseRules ("Yacc/Bison","Comment"))) <|>- ((lookAhead (pRegExpr regex_'5cW) >> pushContext "Percent Command In" >> currentContext >>= parseRules)))+ ((lookAhead (pRegExpr regex_'5cW) >> pushContext ("Yacc/Bison","Percent Command In") >> currentContext >>= parseRules))) -parseRules "Percent Command In" =- (((parseRules "StringOrChar"))+parseRules ("Yacc/Bison","Percent Command In") =+ (((parseRules ("Yacc/Bison","StringOrChar"))) <|>- ((pDetectChar False '<' >>= withAttribute DataTypeTok) >>~ pushContext "PC type"))+ ((pDetectChar False '<' >>= withAttribute DataTypeTok) >>~ pushContext ("Yacc/Bison","PC type"))) -parseRules "PC type" =+parseRules ("Yacc/Bison","PC type") = ((pDetectChar False '>' >>= withAttribute DataTypeTok) >>~ (popContext)) -parseRules "Comment" =- (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext "CommentStar")+parseRules ("Yacc/Bison","Comment") =+ (((pDetect2Chars False '/' '*' >>= withAttribute CommentTok) >>~ pushContext ("Yacc/Bison","CommentStar")) <|>- ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext "CommentSlash"))+ ((pDetect2Chars False '/' '/' >>= withAttribute CommentTok) >>~ pushContext ("Yacc/Bison","CommentSlash"))) -parseRules "CommentStar" =+parseRules ("Yacc/Bison","CommentStar") = ((pDetect2Chars False '*' '/' >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "CommentSlash" =+parseRules ("Yacc/Bison","CommentSlash") = ((pRegExpr regex_'5b'5e'5c'5c'5d'24 >>= withAttribute CommentTok) >>~ (popContext)) -parseRules "StringOrChar" =- (((pDetectChar False '\'' >>= withAttribute CharTok) >>~ pushContext "Char")+parseRules ("Yacc/Bison","StringOrChar") =+ (((pDetectChar False '\'' >>= withAttribute CharTok) >>~ pushContext ("Yacc/Bison","Char")) <|>- ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext "String"))+ ((pDetectChar False '"' >>= withAttribute StringTok) >>~ pushContext ("Yacc/Bison","String"))) -parseRules "String" =+parseRules ("Yacc/Bison","String") = (((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok)) <|> ((pDetectChar False '"' >>= withAttribute StringTok) >>~ (popContext))) -parseRules "Char" =+parseRules ("Yacc/Bison","Char") = (((pRegExpr regex_'5c'5c'2e >>= withAttribute StringTok)) <|> ((pDetectChar False '\'' >>= withAttribute CharTok) >>~ (popContext))) -parseRules "Normal C Bloc" =- (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext "Normal C Bloc")+parseRules ("Yacc/Bison","Normal C Bloc") =+ (((pDetectChar False '{' >>= withAttribute NormalTok) >>~ pushContext ("Yacc/Bison","Normal C Bloc")) <|> ((pDetectChar False '}' >>= withAttribute NormalTok) >>~ (popContext)) <|> ((Text.Highlighting.Kate.Syntax.Cpp.parseExpression)) <|>- ((pDetectChar False '$' >>= withAttribute KeywordTok) >>~ pushContext "Dol"))+ ((pDetectChar False '$' >>= withAttribute KeywordTok) >>~ pushContext ("Yacc/Bison","Dol"))) -parseRules "Dol" =- (((pRegExpr regex_'3c'5b'5e'3e'5d'2b'3e >>= withAttribute DataTypeTok) >>~ pushContext "DolEnd")+parseRules ("Yacc/Bison","Dol") =+ (((pRegExpr regex_'3c'5b'5e'3e'5d'2b'3e >>= withAttribute DataTypeTok) >>~ pushContext ("Yacc/Bison","DolEnd")) <|>- (pushContext "DolEnd" >> currentContext >>= parseRules))+ (pushContext ("Yacc/Bison","DolEnd") >> currentContext >>= parseRules)) -parseRules "DolEnd" =+parseRules ("Yacc/Bison","DolEnd") = (((pRegExpr regex_'5cd'2b >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|> ((pDetectChar False '$' >>= withAttribute KeywordTok) >>~ (popContext >> popContext))) -parseRules "" = parseRules "Pre Start"+parseRules ("C++", _) = Text.Highlighting.Kate.Syntax.Cpp.parseExpression -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Syntax/Yaml.hs view
@@ -7,7 +7,6 @@ import Text.Highlighting.Kate.Types import Text.Highlighting.Kate.Common import Text.ParserCombinators.Parsec hiding (State)-import Data.Map (fromList) import Control.Monad.State import Data.Char (isSpace) import Data.Maybe (fromMaybe)@@ -25,46 +24,48 @@ highlight input = evalState (mapM parseSourceLine $ lines input) startingState parseSourceLine :: String -> State SyntaxState SourceLine-parseSourceLine = mkParseSourceLine parseExpressionInternal pEndLine+parseSourceLine = mkParseSourceLine parseExpression -- | Parse an expression using appropriate local context. parseExpression :: KateParser Token parseExpression = do- st <- getState- let oldLang = synStLanguage st- setState $ st { synStLanguage = "YAML" }- context <- currentContext <|> (pushContext "normal" >> currentContext)- result <- parseRules context- optional $ eof >> pEndLine- updateState $ \st -> st { synStLanguage = oldLang }+ (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")+ optional $ do eof+ updateState $ \st -> st{ synStPrevChar = '\n' }+ pEndLine return result -startingState = SyntaxState {synStContexts = fromList [("YAML",["normal"])], synStLanguage = "YAML", synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []}+startingState = SyntaxState {synStContexts = [("YAML","normal")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} pEndLine = do updateState $ \st -> st{ synStPrevNonspace = False } context <- currentContext case context of- "normal" -> return ()- "dash" -> (popContext) >> pEndLine- "header" -> (popContext) >> pEndLine- "EOD" -> return ()- "directive" -> (popContext) >> pEndLine- "attribute" -> (popContext >> popContext) >> pEndLine- "attribute-inline" -> return ()- "attribute-pre" -> (popContext) >> pEndLine- "attribute-pre-inline" -> (popContext) >> pEndLine- "list" -> return ()- "hash" -> return ()- "attribute-string" -> return ()- "attribute-stringx" -> return ()- "attribute-string-inline" -> return ()- "attribute-stringx-inline" -> return ()- "attribute-end" -> (popContext >> popContext >> popContext) >> pEndLine- "attribute-end-inline" -> (popContext >> popContext >> popContext) >> pEndLine- "string" -> return ()- "stringx" -> return ()- "comment" -> (popContext) >> pEndLine+ ("YAML","normal") -> return ()+ ("YAML","dash") -> (popContext) >> pEndLine+ ("YAML","header") -> (popContext) >> pEndLine+ ("YAML","EOD") -> return ()+ ("YAML","directive") -> (popContext) >> pEndLine+ ("YAML","attribute") -> (popContext >> popContext) >> pEndLine+ ("YAML","attribute-inline") -> return ()+ ("YAML","attribute-pre") -> (popContext) >> pEndLine+ ("YAML","attribute-pre-inline") -> (popContext) >> pEndLine+ ("YAML","list") -> return ()+ ("YAML","hash") -> return ()+ ("YAML","attribute-string") -> return ()+ ("YAML","attribute-stringx") -> return ()+ ("YAML","attribute-string-inline") -> return ()+ ("YAML","attribute-stringx-inline") -> return ()+ ("YAML","attribute-end") -> (popContext >> popContext >> popContext) >> pEndLine+ ("YAML","attribute-end-inline") -> (popContext >> popContext >> popContext) >> pEndLine+ ("YAML","string") -> return ()+ ("YAML","stringx") -> return ()+ ("YAML","comment") -> (popContext) >> pEndLine _ -> return () withAttribute attr txt = do@@ -73,11 +74,7 @@ , synStPrevNonspace = synStPrevNonspace st || not (all isSpace txt) } return (attr, txt) -parseExpressionInternal = do- context <- currentContext- parseRules context <|> (pDefault >>= withAttribute (fromMaybe NormalTok $ lookup context defaultAttributes)) - regex_'2d'2d'2d = compileRegex "---" regex_'5c'2e'5c'2e'5c'2e'24 = compileRegex "\\.\\.\\.$" regex_'25 = compileRegex "%"@@ -92,24 +89,24 @@ regex_'5cs'2a = compileRegex "\\s*" regex_'2c'5cs = compileRegex ",\\s" -defaultAttributes = [("normal",NormalTok),("dash",NormalTok),("header",OtherTok),("EOD",CommentTok),("directive",OtherTok),("attribute",NormalTok),("attribute-inline",NormalTok),("attribute-pre",NormalTok),("attribute-pre-inline",NormalTok),("list",NormalTok),("hash",NormalTok),("attribute-string",NormalTok),("attribute-stringx",NormalTok),("attribute-string-inline",NormalTok),("attribute-stringx-inline",NormalTok),("attribute-end",ErrorTok),("attribute-end-inline",ErrorTok),("string",NormalTok),("stringx",NormalTok),("comment",CommentTok)]+defaultAttributes = [(("YAML","normal"),NormalTok),(("YAML","dash"),NormalTok),(("YAML","header"),OtherTok),(("YAML","EOD"),CommentTok),(("YAML","directive"),OtherTok),(("YAML","attribute"),NormalTok),(("YAML","attribute-inline"),NormalTok),(("YAML","attribute-pre"),NormalTok),(("YAML","attribute-pre-inline"),NormalTok),(("YAML","list"),NormalTok),(("YAML","hash"),NormalTok),(("YAML","attribute-string"),NormalTok),(("YAML","attribute-stringx"),NormalTok),(("YAML","attribute-string-inline"),NormalTok),(("YAML","attribute-stringx-inline"),NormalTok),(("YAML","attribute-end"),ErrorTok),(("YAML","attribute-end-inline"),ErrorTok),(("YAML","string"),NormalTok),(("YAML","stringx"),NormalTok),(("YAML","comment"),CommentTok)] -parseRules "normal" =- (((pColumn 0 >> pRegExpr regex_'2d'2d'2d >>= withAttribute OtherTok) >>~ pushContext "header")+parseRules ("YAML","normal") =+ (((pColumn 0 >> pRegExpr regex_'2d'2d'2d >>= withAttribute OtherTok) >>~ pushContext ("YAML","header")) <|>- ((pColumn 0 >> pRegExpr regex_'5c'2e'5c'2e'5c'2e'24 >>= withAttribute CommentTok) >>~ pushContext "EOD")+ ((pColumn 0 >> pRegExpr regex_'5c'2e'5c'2e'5c'2e'24 >>= withAttribute CommentTok) >>~ pushContext ("YAML","EOD")) <|>- ((pColumn 0 >> pRegExpr regex_'25 >>= withAttribute OtherTok) >>~ pushContext "directive")+ ((pColumn 0 >> pRegExpr regex_'25 >>= withAttribute OtherTok) >>~ pushContext ("YAML","directive")) <|> ((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment")) <|>- ((pFirstNonSpace >> pDetectChar False '-' >>= withAttribute KeywordTok) >>~ pushContext "dash")+ ((pFirstNonSpace >> pDetectChar False '-' >>= withAttribute KeywordTok) >>~ pushContext ("YAML","dash")) <|>- ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext "list")+ ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext ("YAML","list")) <|>- ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext "hash")+ ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext ("YAML","hash")) <|> ((pFirstNonSpace >> pRegExpr regex_'21'21'5cS'2b >>= withAttribute DataTypeTok)) <|>@@ -117,20 +114,20 @@ <|> ((pFirstNonSpace >> pRegExpr regex_'5c'2a'5cS'2b >>= withAttribute DataTypeTok)) <|>- ((pRegExpr regex_'5c'3f'3f'5cs'2a'5b'5e'22'27'23'2d'5d'5b'5e'3a'23'5d'2a'3a >>= withAttribute FunctionTok) >>~ pushContext "attribute-pre")+ ((pRegExpr regex_'5c'3f'3f'5cs'2a'5b'5e'22'27'23'2d'5d'5b'5e'3a'23'5d'2a'3a >>= withAttribute FunctionTok) >>~ pushContext ("YAML","attribute-pre")) <|>- ((pRegExpr regex_'5c'3f'3f'5cs'2a'22'5b'5e'22'23'5d'2b'22'5cs'2a'3a >>= withAttribute FunctionTok) >>~ pushContext "attribute-pre")+ ((pRegExpr regex_'5c'3f'3f'5cs'2a'22'5b'5e'22'23'5d'2b'22'5cs'2a'3a >>= withAttribute FunctionTok) >>~ pushContext ("YAML","attribute-pre")) <|>- ((pRegExpr regex_'5c'3f'3f'5cs'2a'27'5b'5e'27'23'5d'2b'27'5cs'2a'3a >>= withAttribute FunctionTok) >>~ pushContext "attribute-pre")+ ((pRegExpr regex_'5c'3f'3f'5cs'2a'27'5b'5e'27'23'5d'2b'27'5cs'2a'3a >>= withAttribute FunctionTok) >>~ pushContext ("YAML","attribute-pre")) <|>- ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext "string")+ ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext ("YAML","string")) <|>- ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext "stringx"))+ ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("YAML","stringx"))) -parseRules "dash" =+parseRules ("YAML","dash") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment")) <|> ((pRegExpr regex_null'24 >>= withAttribute DataTypeTok)) <|>@@ -142,162 +139,161 @@ <|> ((lookAhead (pRegExpr regex_'2e) >> (popContext) >> currentContext >>= parseRules))) -parseRules "header" =- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "comment")+parseRules ("YAML","header") =+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment")) -parseRules "EOD" =+parseRules ("YAML","EOD") = pzero -parseRules "directive" =+parseRules ("YAML","directive") = pzero -parseRules "attribute" =- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "comment")+parseRules ("YAML","attribute") =+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment")) -parseRules "attribute-inline" =+parseRules ("YAML","attribute-inline") = (((pDetectChar False ',' >>= withAttribute KeywordTok) >>~ (popContext >> popContext)) <|> ((lookAhead (pDetectChar False '}') >> (popContext >> popContext) >> currentContext >>= parseRules)) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "comment"))+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment"))) -parseRules "attribute-pre" =+parseRules ("YAML","attribute-pre") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment")) <|> ((pRegExpr regex_null'24 >>= withAttribute DataTypeTok)) <|> ((pRegExpr regex_'21'21'5cS'2b >>= withAttribute DataTypeTok)) <|>- ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext "list")+ ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext ("YAML","list")) <|>- ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext "hash")+ ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext ("YAML","hash")) <|>- ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext "attribute-string")+ ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-string")) <|>- ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext "attribute-stringx")+ ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-stringx")) <|>- ((pRegExpr regex_'26'5cS'2b >>= withAttribute DataTypeTok) >>~ pushContext "attribute")+ ((pRegExpr regex_'26'5cS'2b >>= withAttribute DataTypeTok) >>~ pushContext ("YAML","attribute")) <|>- ((pRegExpr regex_'5c'2a'5cS'2b >>= withAttribute DataTypeTok) >>~ pushContext "attribute")+ ((pRegExpr regex_'5c'2a'5cS'2b >>= withAttribute DataTypeTok) >>~ pushContext ("YAML","attribute")) <|>- ((pRegExpr regex_'2e >>= withAttribute NormalTok) >>~ pushContext "attribute"))+ ((pRegExpr regex_'2e >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute"))) -parseRules "attribute-pre-inline" =+parseRules ("YAML","attribute-pre-inline") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment")) <|> ((pString False "null" >>= withAttribute DataTypeTok)) <|> ((pRegExpr regex_'21'21'5cS'2b >>= withAttribute DataTypeTok)) <|>- ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext "list")+ ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext ("YAML","list")) <|>- ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext "hash")+ ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext ("YAML","hash")) <|>- ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext "attribute-string-inline")+ ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-string-inline")) <|>- ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext "attribute-stringx-inline")+ ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-stringx-inline")) <|>- ((pRegExpr regex_'26'5cS'2b >>= withAttribute DataTypeTok) >>~ pushContext "attribute-inline")+ ((pRegExpr regex_'26'5cS'2b >>= withAttribute DataTypeTok) >>~ pushContext ("YAML","attribute-inline")) <|>- ((pRegExpr regex_'5c'2a'5cS'2b >>= withAttribute DataTypeTok) >>~ pushContext "attribute-inline")+ ((pRegExpr regex_'5c'2a'5cS'2b >>= withAttribute DataTypeTok) >>~ pushContext ("YAML","attribute-inline")) <|> ((pDetectChar False ',' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((lookAhead (pDetectChar False '}') >> (popContext) >> currentContext >>= parseRules)) <|>- ((pRegExpr regex_'2e >>= withAttribute NormalTok) >>~ pushContext "attribute-inline"))+ ((pRegExpr regex_'2e >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-inline"))) -parseRules "list" =+parseRules ("YAML","list") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment")) <|> ((pDetectChar False ']' >>= withAttribute KeywordTok) >>~ (popContext)) <|>- ((pRegExpr regex_'5c'3f'3f'5cs'2a'5b'5e'22'27'23'2d'5d'5b'5e'3a'23'5d'2a'3a >>= withAttribute FunctionTok) >>~ pushContext "attribute-pre")+ ((pRegExpr regex_'5c'3f'3f'5cs'2a'5b'5e'22'27'23'2d'5d'5b'5e'3a'23'5d'2a'3a >>= withAttribute FunctionTok) >>~ pushContext ("YAML","attribute-pre")) <|>- ((pRegExpr regex_'5c'3f'3f'5cs'2a'22'5b'5e'22'23'5d'2b'22'5cs'2a'3a >>= withAttribute FunctionTok) >>~ pushContext "attribute-pre")+ ((pRegExpr regex_'5c'3f'3f'5cs'2a'22'5b'5e'22'23'5d'2b'22'5cs'2a'3a >>= withAttribute FunctionTok) >>~ pushContext ("YAML","attribute-pre")) <|>- ((pRegExpr regex_'5c'3f'3f'5cs'2a'27'5b'5e'27'23'5d'2b'27'5cs'2a'3a >>= withAttribute FunctionTok) >>~ pushContext "attribute-pre")+ ((pRegExpr regex_'5c'3f'3f'5cs'2a'27'5b'5e'27'23'5d'2b'27'5cs'2a'3a >>= withAttribute FunctionTok) >>~ pushContext ("YAML","attribute-pre")) <|> ((pString False "null" >>= withAttribute DataTypeTok)) <|> ((pRegExpr regex_'21'21'5cS'2b >>= withAttribute DataTypeTok)) <|>- ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext "list")+ ((pDetectChar False '[' >>= withAttribute KeywordTok) >>~ pushContext ("YAML","list")) <|>- ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext "hash")+ ((pDetectChar False '{' >>= withAttribute KeywordTok) >>~ pushContext ("YAML","hash")) <|> ((pRegExpr regex_'26'5cS'2b >>= withAttribute DataTypeTok)) <|> ((pRegExpr regex_'5c'2a'5cS'2b >>= withAttribute DataTypeTok)) <|>- ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext "string")+ ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext ("YAML","string")) <|>- ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext "stringx")+ ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("YAML","stringx")) <|> ((pDetectChar False ',' >>= withAttribute KeywordTok))) -parseRules "hash" =+parseRules ("YAML","hash") = (((pDetectSpaces >>= withAttribute NormalTok)) <|>- ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext "comment")+ ((pDetectChar False '#' >>= withAttribute CommentTok) >>~ pushContext ("YAML","comment")) <|>- ((pRegExpr regex_'5c'3f'3f'5cs'2a'5b'5e'22'27'23'2d'5d'5b'5e'3a'23'5d'2a'3a >>= withAttribute FunctionTok) >>~ pushContext "attribute-pre-inline")+ ((pRegExpr regex_'5c'3f'3f'5cs'2a'5b'5e'22'27'23'2d'5d'5b'5e'3a'23'5d'2a'3a >>= withAttribute FunctionTok) >>~ pushContext ("YAML","attribute-pre-inline")) <|>- ((pRegExpr regex_'5c'3f'3f'5cs'2a'22'5b'5e'22'23'5d'2b'22'5cs'2a'3a >>= withAttribute FunctionTok) >>~ pushContext "attribute-pre-inline")+ ((pRegExpr regex_'5c'3f'3f'5cs'2a'22'5b'5e'22'23'5d'2b'22'5cs'2a'3a >>= withAttribute FunctionTok) >>~ pushContext ("YAML","attribute-pre-inline")) <|>- ((pRegExpr regex_'5c'3f'3f'5cs'2a'27'5b'5e'27'23'5d'2b'27'5cs'2a'3a >>= withAttribute FunctionTok) >>~ pushContext "attribute-pre-inline")+ ((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))) -parseRules "attribute-string" =+parseRules ("YAML","attribute-string") = (((pDetectIdentifier >>= withAttribute NormalTok)) <|>- ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext "attribute-end"))+ ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-end"))) -parseRules "attribute-stringx" =+parseRules ("YAML","attribute-stringx") = (((pDetectIdentifier >>= withAttribute NormalTok)) <|>- ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext "attribute-end"))+ ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-end"))) -parseRules "attribute-string-inline" =+parseRules ("YAML","attribute-string-inline") = (((pDetectIdentifier >>= withAttribute NormalTok)) <|>- ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext "attribute-end-inline"))+ ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-end-inline"))) -parseRules "attribute-stringx-inline" =+parseRules ("YAML","attribute-stringx-inline") = (((pDetectIdentifier >>= withAttribute NormalTok)) <|>- ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext "attribute-end-inline"))+ ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ pushContext ("YAML","attribute-end-inline"))) -parseRules "attribute-end" =+parseRules ("YAML","attribute-end") = pzero -parseRules "attribute-end-inline" =+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))) -parseRules "string" =+parseRules ("YAML","string") = (((pDetectIdentifier >>= withAttribute NormalTok)) <|> ((pDetectChar False '\'' >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "stringx" =+parseRules ("YAML","stringx") = (((pDetectIdentifier >>= withAttribute NormalTok)) <|> ((pDetectChar False '"' >>= withAttribute NormalTok) >>~ (popContext))) -parseRules "comment" =+parseRules ("YAML","comment") = pzero -parseRules "" = parseRules "normal" -parseRules x = fail $ "Unknown context" ++ x+parseRules x = fail $ "Unknown context" ++ show x
Text/Highlighting/Kate/Types.hs view
@@ -12,19 +12,20 @@ -} module Text.Highlighting.Kate.Types where-import qualified Data.Map as Map import Text.ParserCombinators.Parsec import Data.Word import Text.Printf --- | A stack of context names for each language. (Language-specific context+-- | A context: pair of syntax name and context name.+type Context = (String, String)++-- | A stack of contexts. (Language-specific context -- stacks must be maintained because of IncludeRules.)-type ContextStack = Map.Map String [String]+type ContextStack = [Context] -- | State for syntax parser. data SyntaxState = SyntaxState { synStContexts :: ContextStack -- ^ Stack of contexts- , synStLanguage :: String -- ^ Language being parsed , synStLineNumber :: Int -- ^ Number of current line , synStPrevChar :: Char -- ^ Last character parsed , synStPrevNonspace :: Bool -- ^ True if we've parsed a nonspace
changelog view
@@ -1,3 +1,19 @@+highlighting-kate 0.5.3 (07 Sep 2012)++ * Improved handling of include directives. This fixes+ bugs in comments caused by doxygen and javadoc includes.++ * Changes to internal Types and Common:++ - Context is now a (String, String) rather than a String.+ The first is the syntax name, the second the context name.+ - ContextStack is now a list of Contexts.+ - synStLanguage has been removed.+ - pEndLine parameter has been removed from mkParseSourceLine.+ - parseExpression now handles the endline.+ - parseExpressionInternal has been removed in the+ individual parsers; we now use parseExpression.+ highlighting-kate 0.5.2 (10 Aug 2012) * Updated xml syntax definitions from kate repository:
highlighting-kate.cabal view
@@ -1,5 +1,5 @@ Name: highlighting-kate-Version: 0.5.2+Version: 0.5.3 Cabal-Version: >= 1.6 Build-Type: Simple Category: Text