diff --git a/ParseSyntaxFiles.hs b/ParseSyntaxFiles.hs
--- a/ParseSyntaxFiles.hs
+++ b/ParseSyntaxFiles.hs
@@ -303,10 +303,13 @@
                      else empty) <>
                   if parserType parser == "IncludeRules"
                      then mainParser <> char ')'
-                     else mainParser <> text " >>= withAttribute " <> 
-                          text (if null (parserAttribute parser)
-                                   then show (contAttribute context)
-                                   else show (parserAttribute parser)) <> char ')' <>
+                     else (if parserLookAhead parser
+                             then text "lookAhead (" <> mainParser <> text ") >> return ([],\"\") " 
+                             else mainParser <> text " >>= withAttribute " <> 
+                                  text (if null (parserAttribute parser)
+                                           then show (contAttribute context)
+                                           else show (parserAttribute parser))) <> 
+                          char ')' <>
                           (if parserContext parser `elem` ["", "#stay"]
                               then empty 
                               else text " >>~ " <> switchContext (parserContext parser))
diff --git a/Text/Highlighting/Kate.hs b/Text/Highlighting/Kate.hs
--- a/Text/Highlighting/Kate.hs
+++ b/Text/Highlighting/Kate.hs
@@ -35,4 +35,4 @@
 import Text.Highlighting.Kate.Syntax ( highlightAs, languages, languagesByExtension )
 import Text.Highlighting.Kate.Definitions ( SourceLine, LabeledSource )
 
-highlightingKateVersion = "0.2"
+highlightingKateVersion = "0.2.1"
diff --git a/Text/Highlighting/Kate/Syntax/Bash.hs b/Text/Highlighting/Kate/Syntax/Bash.hs
--- a/Text/Highlighting/Kate/Syntax/Bash.hs
+++ b/Text/Highlighting/Kate/Syntax/Bash.hs
@@ -230,7 +230,7 @@
                         <|>
                         ((pRegExpr (compileRegex "\\d*<<<") >>= withAttribute "Redirection"))
                         <|>
-                        ((pString False "<<" >>= withAttribute "Redirection") >>~ pushContext "HereDoc")
+                        ((lookAhead (pString False "<<") >> return ([],"") ) >>~ pushContext "HereDoc")
                         <|>
                         ((pRegExpr (compileRegex "[<>]\\(") >>= withAttribute "Redirection") >>~ pushContext "ProcessSubst")
                         <|>
@@ -598,21 +598,21 @@
      return (attr, result)
 
 parseRules "HereDoc" = 
-  do (attr, result) <- (((pRegExpr (compileRegex "(<<-\\s*\"([^|&;()<>\\s]+)\")") >>= withAttribute "Redirection") >>~ pushContext "HereDocIQ")
+  do (attr, result) <- (((lookAhead (pRegExpr (compileRegex "(<<-\\s*\"([^|&;()<>\\s]+)\")")) >> return ([],"") ) >>~ pushContext "HereDocIQ")
                         <|>
-                        ((pRegExpr (compileRegex "(<<-\\s*'([^|&;()<>\\s]+)')") >>= withAttribute "Redirection") >>~ pushContext "HereDocIQ")
+                        ((lookAhead (pRegExpr (compileRegex "(<<-\\s*'([^|&;()<>\\s]+)')")) >> return ([],"") ) >>~ pushContext "HereDocIQ")
                         <|>
-                        ((pRegExpr (compileRegex "(<<-\\s*\\\\([^|&;()<>\\s]+))") >>= withAttribute "Redirection") >>~ pushContext "HereDocIQ")
+                        ((lookAhead (pRegExpr (compileRegex "(<<-\\s*\\\\([^|&;()<>\\s]+))")) >> return ([],"") ) >>~ pushContext "HereDocIQ")
                         <|>
-                        ((pRegExpr (compileRegex "(<<-\\s*([^|&;()<>\\s]+))") >>= withAttribute "Redirection") >>~ pushContext "HereDocINQ")
+                        ((lookAhead (pRegExpr (compileRegex "(<<-\\s*([^|&;()<>\\s]+))")) >> return ([],"") ) >>~ pushContext "HereDocINQ")
                         <|>
-                        ((pRegExpr (compileRegex "(<<\\s*\"([^|&;()<>\\s]+)\")") >>= withAttribute "Redirection") >>~ pushContext "HereDocQ")
+                        ((lookAhead (pRegExpr (compileRegex "(<<\\s*\"([^|&;()<>\\s]+)\")")) >> return ([],"") ) >>~ pushContext "HereDocQ")
                         <|>
-                        ((pRegExpr (compileRegex "(<<\\s*'([^|&;()<>\\s]+)')") >>= withAttribute "Redirection") >>~ pushContext "HereDocQ")
+                        ((lookAhead (pRegExpr (compileRegex "(<<\\s*'([^|&;()<>\\s]+)')")) >> return ([],"") ) >>~ pushContext "HereDocQ")
                         <|>
-                        ((pRegExpr (compileRegex "(<<\\s*\\\\([^|&;()<>\\s]+))") >>= withAttribute "Redirection") >>~ pushContext "HereDocQ")
+                        ((lookAhead (pRegExpr (compileRegex "(<<\\s*\\\\([^|&;()<>\\s]+))")) >> return ([],"") ) >>~ pushContext "HereDocQ")
                         <|>
-                        ((pRegExpr (compileRegex "(<<\\s*([^|&;()<>\\s]+))") >>= withAttribute "Redirection") >>~ pushContext "HereDocNQ")
+                        ((lookAhead (pRegExpr (compileRegex "(<<\\s*([^|&;()<>\\s]+))")) >> return ([],"") ) >>~ pushContext "HereDocNQ")
                         <|>
                         ((pString False "<<" >>= withAttribute "Redirection") >>~ (popContext >> return ())))
      return (attr, result)
diff --git a/Text/Highlighting/Kate/Syntax/C.hs b/Text/Highlighting/Kate/Syntax/C.hs
--- a/Text/Highlighting/Kate/Syntax/C.hs
+++ b/Text/Highlighting/Kate/Syntax/C.hs
@@ -89,7 +89,7 @@
                         <|>
                         ((pFirstNonSpace >> pRegExpr (compileRegex "#\\s*if\\s+0") >>= withAttribute "Preprocessor") >>~ pushContext "Outscoped")
                         <|>
-                        ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute "Normal Text") >>~ pushContext "AfterHash")
+                        ((pFirstNonSpace >> lookAhead (pDetectChar False '#') >> return ([],"") ) >>~ pushContext "AfterHash")
                         <|>
                         ((pFirstNonSpace >> pString False "//BEGIN" >>= withAttribute "Region Marker") >>~ pushContext "Region Marker")
                         <|>
diff --git a/Text/Highlighting/Kate/Syntax/Cpp.hs b/Text/Highlighting/Kate/Syntax/Cpp.hs
--- a/Text/Highlighting/Kate/Syntax/Cpp.hs
+++ b/Text/Highlighting/Kate/Syntax/Cpp.hs
@@ -89,7 +89,7 @@
                         <|>
                         ((pFirstNonSpace >> pRegExpr (compileRegex "#\\s*if\\s+0") >>= withAttribute "Preprocessor") >>~ pushContext "Outscoped")
                         <|>
-                        ((pFirstNonSpace >> pDetectChar False '#' >>= withAttribute "Normal Text") >>~ pushContext "AfterHash")
+                        ((pFirstNonSpace >> lookAhead (pDetectChar False '#') >> return ([],"") ) >>~ pushContext "AfterHash")
                         <|>
                         ((pFirstNonSpace >> pString False "//BEGIN" >>= withAttribute "Region Marker") >>~ pushContext "Region Marker")
                         <|>
diff --git a/Text/Highlighting/Kate/Syntax/Djangotemplate.hs b/Text/Highlighting/Kate/Syntax/Djangotemplate.hs
--- a/Text/Highlighting/Kate/Syntax/Djangotemplate.hs
+++ b/Text/Highlighting/Kate/Syntax/Djangotemplate.hs
@@ -122,7 +122,7 @@
      return (attr, result)
 
 parseRules "In Block" = 
-  do (attr, result) <- (((pRegExpr (compileRegex "\\{%\\s*end[a-z]+\\s*%\\}") >>= withAttribute "Normal Text") >>~ (popContext >> return ()))
+  do (attr, result) <- (((lookAhead (pRegExpr (compileRegex "\\{%\\s*end[a-z]+\\s*%\\}")) >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((parseRules "FindTemplate"))
                         <|>
@@ -168,7 +168,7 @@
      return (attr, result)
 
 parseRules "Template Tag" = 
-  do (attr, result) <- (((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" ["for","block","if","ifequal","ifnotequal","ifchanged","blocktrans","spaceless"] >>= withAttribute "Template Tag") >>~ pushContext "Found Block Tag")
+  do (attr, result) <- (((lookAhead (pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}~\\" ["for","block","if","ifequal","ifnotequal","ifchanged","blocktrans","spaceless"]) >> return ([],"") ) >>~ pushContext "Found Block Tag")
                         <|>
                         ((pDetectIdentifier >>= withAttribute "Template Tag") >>~ pushContext "In Template Tag"))
      return (attr, result)
@@ -180,7 +180,7 @@
 parseRules "In Block Tag" = 
   do (attr, result) <- (((pRegExprDynamic "\\{%\\s*end%1\\s*%\\}" >>= withAttribute "Template Tag") >>~ (popContext >> popContext >> popContext >> return ()))
                         <|>
-                        ((pRegExpr (compileRegex "\\{%\\s*end[a-z]+\\s*%\\}") >>= withAttribute "Template Tag Argument") >>~ pushContext "Non Matching Tag")
+                        ((lookAhead (pRegExpr (compileRegex "\\{%\\s*end[a-z]+\\s*%\\}")) >> return ([],"") ) >>~ pushContext "Non Matching Tag")
                         <|>
                         ((pDetect2Chars False '%' '}' >>= withAttribute "Template Tag") >>~ pushContext "In Block")
                         <|>
diff --git a/Text/Highlighting/Kate/Syntax/Doxygen.hs b/Text/Highlighting/Kate/Syntax/Doxygen.hs
--- a/Text/Highlighting/Kate/Syntax/Doxygen.hs
+++ b/Text/Highlighting/Kate/Syntax/Doxygen.hs
@@ -172,13 +172,13 @@
      return (attr, result)
 
 parseRules "ML_TagWord" = 
-  do (attr, result) <- (((pDetect2Chars False '*' '/' >>= withAttribute "Comment") >>~ (popContext >> return ()))
+  do (attr, result) <- (((lookAhead (pDetect2Chars False '*' '/') >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((parseRules "SL_TagWord")))
      return (attr, result)
 
 parseRules "ML_TagParam" = 
-  do (attr, result) <- (((pDetect2Chars False '*' '/' >>= withAttribute "Comment") >>~ (popContext >> return ()))
+  do (attr, result) <- (((lookAhead (pDetect2Chars False '*' '/') >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((pDetectSpaces >>= withAttribute "Comment"))
                         <|>
@@ -194,7 +194,7 @@
      return (attr, result)
 
 parseRules "ML_TagWordWord" = 
-  do (attr, result) <- (((pDetect2Chars False '*' '/' >>= withAttribute "Comment") >>~ (popContext >> return ()))
+  do (attr, result) <- (((lookAhead (pDetect2Chars False '*' '/') >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((pDetectSpaces >>= withAttribute "Comment"))
                         <|>
@@ -204,7 +204,7 @@
      return (attr, result)
 
 parseRules "ML_Tag2ndWord" = 
-  do (attr, result) <- (((pDetect2Chars False '*' '/' >>= withAttribute "Comment") >>~ (popContext >> popContext >> return ()))
+  do (attr, result) <- (((lookAhead (pDetect2Chars False '*' '/') >> return ([],"") ) >>~ (popContext >> popContext >> return ()))
                         <|>
                         ((parseRules "SL_Tag2ndWord")))
      return (attr, result)
@@ -212,7 +212,7 @@
 parseRules "ML_TagString" = 
   do (attr, result) <- (((pDetectSpaces >>= withAttribute "Comment"))
                         <|>
-                        ((pDetect2Chars False '*' '/' >>= withAttribute "Comment") >>~ (popContext >> return ()))
+                        ((lookAhead (pDetect2Chars False '*' '/') >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((pString False "<!--" >>= withAttribute "HTML Comment") >>~ pushContext "ML_htmlcomment")
                         <|>
@@ -224,13 +224,13 @@
      return (attr, result)
 
 parseRules "ML_TagWordString" = 
-  do (attr, result) <- (((pDetect2Chars False '*' '/' >>= withAttribute "Comment") >>~ (popContext >> return ()))
+  do (attr, result) <- (((lookAhead (pDetect2Chars False '*' '/') >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((parseRules "SL_TagWordString")))
      return (attr, result)
 
 parseRules "ML_htmltag" = 
-  do (attr, result) <- (((pDetect2Chars False '*' '/' >>= withAttribute "Comment") >>~ (popContext >> return ()))
+  do (attr, result) <- (((lookAhead (pDetect2Chars False '*' '/') >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((pDetect2Chars False '/' '>' >>= withAttribute "HTML Tag") >>~ (popContext >> return ()))
                         <|>
@@ -240,7 +240,7 @@
      return (attr, result)
 
 parseRules "ML_htmlcomment" = 
-  do (attr, result) <- (((pDetect2Chars False '*' '/' >>= withAttribute "Comment") >>~ (popContext >> return ()))
+  do (attr, result) <- (((lookAhead (pDetect2Chars False '*' '/') >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((Text.Highlighting.Kate.Syntax.Alert.parseExpression >>= ((withAttribute "") . snd)))
                         <|>
@@ -248,7 +248,7 @@
      return (attr, result)
 
 parseRules "ML_identifiers" = 
-  do (attr, result) <- (((pDetect2Chars False '*' '/' >>= withAttribute "Comment") >>~ (popContext >> return ()))
+  do (attr, result) <- (((lookAhead (pDetect2Chars False '*' '/') >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((pRegExpr (compileRegex "\\s*#?[a-zA-Z0-9]*") >>= withAttribute "String") >>~ (popContext >> return ()))
                         <|>
@@ -258,13 +258,13 @@
      return (attr, result)
 
 parseRules "ML_types1" = 
-  do (attr, result) <- (((pDetect2Chars False '*' '/' >>= withAttribute "Comment") >>~ (popContext >> return ()))
+  do (attr, result) <- (((lookAhead (pDetect2Chars False '*' '/') >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((pDetectChar False '\'' >>= withAttribute "Types") >>~ (popContext >> popContext >> return ())))
      return (attr, result)
 
 parseRules "ML_types2" = 
-  do (attr, result) <- (((pDetect2Chars False '*' '/' >>= withAttribute "Comment") >>~ (popContext >> return ()))
+  do (attr, result) <- (((lookAhead (pDetect2Chars False '*' '/') >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((pDetectChar False '"' >>= withAttribute "Types") >>~ (popContext >> popContext >> return ())))
      return (attr, result)
@@ -272,7 +272,7 @@
 parseRules "SL_TagWord" = 
   do (attr, result) <- (((pDetectSpaces >>= withAttribute "Comment"))
                         <|>
-                        ((pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" ["\\addtogroup","\\a","\\anchor","\\b","\\c","\\class","\\cond","\\copydoc","\\def","\\dontinclude","\\dotfile","\\e","\\elseif","\\em","\\enum","\\example","\\exception","\\exceptions","\\file","\\htmlinclude","\\if","\\ifnot","\\include","\\link","\\namespace","\\p","\\package","\\ref","\\relatesalso","\\relates","\\retval","\\throw","\\throws","\\verbinclude","\\version","\\xrefitem","@addtogroup","@a","@anchor","@b","@c","@class","@cond","@copydoc","@def","@dontinclude","@dotfile","@e","@elseif","@em","@enum","@example","@exception","@exceptions","@file","@htmlinclude","@if","@ifnot","@include","@link","@namespace","@p","@package","@ref","@relatesalso","@relates","@retval","@throw","@throws","@verbinclude","@version","@xrefitem"] >>= withAttribute "Tags") >>~ (popContext >> return ()))
+                        ((lookAhead (pKeyword " \n\t.():!+,-<=>%&*/;?[]^{|}" ["\\addtogroup","\\a","\\anchor","\\b","\\c","\\class","\\cond","\\copydoc","\\def","\\dontinclude","\\dotfile","\\e","\\elseif","\\em","\\enum","\\example","\\exception","\\exceptions","\\file","\\htmlinclude","\\if","\\ifnot","\\include","\\link","\\namespace","\\p","\\package","\\ref","\\relatesalso","\\relates","\\retval","\\throw","\\throws","\\verbinclude","\\version","\\xrefitem","@addtogroup","@a","@anchor","@b","@c","@class","@cond","@copydoc","@def","@dontinclude","@dotfile","@e","@elseif","@em","@enum","@example","@exception","@exceptions","@file","@htmlinclude","@if","@ifnot","@include","@link","@namespace","@p","@package","@ref","@relatesalso","@relates","@retval","@throw","@throws","@verbinclude","@version","@xrefitem"]) >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((pRegExpr (compileRegex "\\S(?=([][,?;()]|\\.$|\\.?\\s))") >>= withAttribute "Word") >>~ (popContext >> return ()))
                         <|>
diff --git a/Text/Highlighting/Kate/Syntax/Erlang.hs b/Text/Highlighting/Kate/Syntax/Erlang.hs
--- a/Text/Highlighting/Kate/Syntax/Erlang.hs
+++ b/Text/Highlighting/Kate/Syntax/Erlang.hs
@@ -96,7 +96,7 @@
                         <|>
                         ((pRegExpr (compileRegex "\\b[a-z][_a-z@-Z0-9]*(?:(?=[^_a-z@-Z0-9])|$):\\b[a-z][_a-z@-Z0-9]*(?:(?=[^_a-z@-Z0-9])|$)") >>= withAttribute "Function") >>~ (popContext >> return ()))
                         <|>
-                        ((pRegExpr (compileRegex "\\b[a-z][_a-z@-Z0-9]*(?:(?=[^_a-z@-Z0-9])|$)\\(") >>= withAttribute "Functon") >>~ pushContext "isfunction")
+                        ((lookAhead (pRegExpr (compileRegex "\\b[a-z][_a-z@-Z0-9]*(?:(?=[^_a-z@-Z0-9])|$)\\(")) >> return ([],"") ) >>~ pushContext "isfunction")
                         <|>
                         ((pRegExpr (compileRegex "\\b[_A-Z][_a-z@-Z0-9]*(?:(?=[^_a-z@-Z0-9])|$)") >>= withAttribute "Variable") >>~ (popContext >> return ()))
                         <|>
diff --git a/Text/Highlighting/Kate/Syntax/Json.hs b/Text/Highlighting/Kate/Syntax/Json.hs
--- a/Text/Highlighting/Kate/Syntax/Json.hs
+++ b/Text/Highlighting/Kate/Syntax/Json.hs
@@ -106,9 +106,9 @@
                         <|>
                         ((pDetectChar False '[' >>= withAttribute "Style_Seperator_Array") >>~ pushContext "Array")
                         <|>
-                        ((pDetectChar False '}' >>= withAttribute "Style_Error") >>~ (popContext >> return ()))
+                        ((lookAhead (pDetectChar False '}') >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
-                        ((pDetectChar False ',' >>= withAttribute "Style_Error") >>~ (popContext >> return ()))
+                        ((lookAhead (pDetectChar False ',') >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((pDetectSpaces >>= withAttribute "Style_Normal"))
                         <|>
diff --git a/Text/Highlighting/Kate/Syntax/Latex.hs b/Text/Highlighting/Kate/Syntax/Latex.hs
--- a/Text/Highlighting/Kate/Syntax/Latex.hs
+++ b/Text/Highlighting/Kate/Syntax/Latex.hs
@@ -331,7 +331,7 @@
 parseRules "VerbatimEnv" = 
   do (attr, result) <- (((pDetectChar False '}' >>= withAttribute "Normal Text") >>~ pushContext "Verbatim")
                         <|>
-                        ((pRegExpr (compileRegex "[a-zA-Z]") >>= withAttribute "Environment") >>~ (popContext >> return ()))
+                        ((lookAhead (pRegExpr (compileRegex "[a-zA-Z]")) >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((parseRules "EnvCommon"))
                         <|>
@@ -365,7 +365,7 @@
 parseRules "MathEnv" = 
   do (attr, result) <- (((pDetectChar False '}' >>= withAttribute "Normal Text") >>~ pushContext "MathModeEnv")
                         <|>
-                        ((pRegExpr (compileRegex "[a-zA-Z]") >>= withAttribute "Environment") >>~ (popContext >> return ()))
+                        ((lookAhead (pRegExpr (compileRegex "[a-zA-Z]")) >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((parseRules "EnvCommon")))
      return (attr, result)
@@ -375,7 +375,7 @@
                         <|>
                         ((pDetectChar False '}' >>= withAttribute "Normal Text") >>~ pushContext "MathModeEnv")
                         <|>
-                        ((pRegExpr (compileRegex "[a-zA-Z]") >>= withAttribute "Environment") >>~ (popContext >> return ()))
+                        ((lookAhead (pRegExpr (compileRegex "[a-zA-Z]")) >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((parseRules "EnvCommon")))
      return (attr, result)
diff --git a/Text/Highlighting/Kate/Syntax/Lex.hs b/Text/Highlighting/Kate/Syntax/Lex.hs
--- a/Text/Highlighting/Kate/Syntax/Lex.hs
+++ b/Text/Highlighting/Kate/Syntax/Lex.hs
@@ -94,7 +94,7 @@
 defaultAttributes = [("Pre Start","Normal Text"),("Definitions","Normal Text"),("Rules","Normal Text"),("User Code","Normal Text"),("Percent Command","Directive"),("Comment","Comment"),("Definition RegExpr","RegExpr"),("Rule RegExpr","RegExpr"),("RegExpr (","RegExpr"),("RegExpr [","RegExpr"),("RegExpr {","RegExpr"),("RegExpr Q","RegExpr"),("RegExpr Base","RegExpr"),("Start Conditions Scope","Normal Text"),("Action","Normal Text"),("Detect C","Normal Text"),("Indented C","Normal Text"),("Lex C Bloc","Normal Text"),("Lex Rule C Bloc","Normal Text"),("Normal C Bloc","Normal Text"),("Action C","Normal Text")]
 
 parseRules "Pre Start" = 
-  do (attr, result) <- ((pRegExpr (compileRegex ".") >>= withAttribute "Normal Text") >>~ pushContext "Definitions")
+  do (attr, result) <- ((lookAhead (pRegExpr (compileRegex ".")) >> return ([],"") ) >>~ pushContext "Definitions")
      return (attr, result)
 
 parseRules "Definitions" = 
diff --git a/Text/Highlighting/Kate/Syntax/Mediawiki.hs b/Text/Highlighting/Kate/Syntax/Mediawiki.hs
--- a/Text/Highlighting/Kate/Syntax/Mediawiki.hs
+++ b/Text/Highlighting/Kate/Syntax/Mediawiki.hs
@@ -172,7 +172,7 @@
      return (attr, result)
 
 parseRules "WikiLinkDescription" = 
-  do (attr, result) <- ((pDetect2Chars False ']' ']' >>= withAttribute "Wiki-Tag") >>~ (popContext >> return ()))
+  do (attr, result) <- ((lookAhead (pDetect2Chars False ']' ']') >> return ([],"") ) >>~ (popContext >> return ()))
      return (attr, result)
 
 parseRules "Link" = 
diff --git a/Text/Highlighting/Kate/Syntax/Perl.hs b/Text/Highlighting/Kate/Syntax/Perl.hs
--- a/Text/Highlighting/Kate/Syntax/Perl.hs
+++ b/Text/Highlighting/Kate/Syntax/Perl.hs
@@ -178,7 +178,7 @@
                         <|>
                         ((pDetectChar False '`' >>= withAttribute "Operator") >>~ pushContext "Backticked")
                         <|>
-                        ((pRegExpr (compileRegex "(?:[$@]\\S|%[\\w{]|\\*[^\\d\\*{\\$@%=(])") >>= withAttribute "Normal Text") >>~ pushContext "find_variable")
+                        ((lookAhead (pRegExpr (compileRegex "(?:[$@]\\S|%[\\w{]|\\*[^\\d\\*{\\$@%=(])")) >> return ([],"") ) >>~ pushContext "find_variable")
                         <|>
                         ((pRegExpr (compileRegex "<[A-Z0-9_]+>") >>= withAttribute "Keyword"))
                         <|>
@@ -266,7 +266,7 @@
                         <|>
                         ((pRegExpr (compileRegex "\\\\.") >>= withAttribute "String (interpolated)"))
                         <|>
-                        ((pRegExpr (compileRegex "(?:[\\$@]\\S|%[\\w{])") >>= withAttribute "Normal Text") >>~ pushContext "find_variable_unsafe"))
+                        ((lookAhead (pRegExpr (compileRegex "(?:[\\$@]\\S|%[\\w{])")) >> return ([],"") ) >>~ pushContext "find_variable_unsafe"))
      return (attr, result)
 
 parseRules "ip_string" = 
@@ -590,7 +590,7 @@
 parseRules "regex_pattern_internal_ip" = 
   do (attr, result) <- (((parseRules "regex_pattern_internal_rules_1"))
                         <|>
-                        ((pRegExpr (compileRegex "[$@][^\\]\\s{}()|>']") >>= withAttribute "Data Type") >>~ pushContext "find_variable_unsafe")
+                        ((lookAhead (pRegExpr (compileRegex "[$@][^\\]\\s{}()|>']")) >> return ([],"") ) >>~ pushContext "find_variable_unsafe")
                         <|>
                         ((parseRules "regex_pattern_internal_rules_2")))
      return (attr, result)
@@ -802,7 +802,7 @@
 parseRules "sub_name_def" = 
   do (attr, result) <- (((pRegExpr (compileRegex "\\w+") >>= withAttribute "Function"))
                         <|>
-                        ((pRegExpr (compileRegex "\\$\\S") >>= withAttribute "Normal Text") >>~ pushContext "find_variable")
+                        ((lookAhead (pRegExpr (compileRegex "\\$\\S")) >> return ([],"") ) >>~ pushContext "find_variable")
                         <|>
                         ((pRegExpr (compileRegex "\\s*\\(") >>= withAttribute "Normal Text") >>~ pushContext "sub_arg_definition")
                         <|>
diff --git a/Text/Highlighting/Kate/Syntax/Php.hs b/Text/Highlighting/Kate/Syntax/Php.hs
--- a/Text/Highlighting/Kate/Syntax/Php.hs
+++ b/Text/Highlighting/Kate/Syntax/Php.hs
@@ -97,7 +97,7 @@
 parseRules "phpsource" = 
   do (attr, result) <- (((pDetectSpaces >>= withAttribute "PHP Text"))
                         <|>
-                        ((pString False "?>" >>= withAttribute "Keyword") >>~ (popContext >> return ()))
+                        ((lookAhead (pString False "?>") >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((pDetectChar False '#' >>= withAttribute "Comment") >>~ pushContext "onelinecomment")
                         <|>
@@ -143,7 +143,7 @@
      return (attr, result)
 
 parseRules "onelinecomment" = 
-  do (attr, result) <- ((pString False "?>" >>= withAttribute "Keyword") >>~ (popContext >> return ()))
+  do (attr, result) <- ((lookAhead (pString False "?>") >> return ([],"") ) >>~ (popContext >> return ()))
      return (attr, result)
 
 parseRules "twolinecomment" = 
diff --git a/Text/Highlighting/Kate/Syntax/Tcl.hs b/Text/Highlighting/Kate/Syntax/Tcl.hs
--- a/Text/Highlighting/Kate/Syntax/Tcl.hs
+++ b/Text/Highlighting/Kate/Syntax/Tcl.hs
@@ -127,7 +127,7 @@
 parseRules "New command line" = 
   do (attr, result) <- (((pRegExpr (compileRegex "\\s*#") >>= withAttribute "Comment") >>~ pushContext "Comment")
                         <|>
-                        ((pRegExpr (compileRegex ".") >>= withAttribute "Normal Text") >>~ (popContext >> return ())))
+                        ((lookAhead (pRegExpr (compileRegex ".")) >> return ([],"") ) >>~ (popContext >> return ())))
      return (attr, result)
 
 parseRules x = fail $ "Unknown context" ++ x
diff --git a/Text/Highlighting/Kate/Syntax/Texinfo.hs b/Text/Highlighting/Kate/Syntax/Texinfo.hs
--- a/Text/Highlighting/Kate/Syntax/Texinfo.hs
+++ b/Text/Highlighting/Kate/Syntax/Texinfo.hs
@@ -100,7 +100,7 @@
      return (attr, result)
 
 parseRules "nodeFolding" = 
-  do (attr, result) <- (((pRegExpr (compileRegex "@node\\b") >>= withAttribute "Command") >>~ (popContext >> return ()))
+  do (attr, result) <- (((lookAhead (pRegExpr (compileRegex "@node\\b")) >> return ([],"") ) >>~ (popContext >> return ()))
                         <|>
                         ((parseRules "Normal Text")))
      return (attr, result)
diff --git a/Text/Highlighting/Kate/Syntax/Yacc.hs b/Text/Highlighting/Kate/Syntax/Yacc.hs
--- a/Text/Highlighting/Kate/Syntax/Yacc.hs
+++ b/Text/Highlighting/Kate/Syntax/Yacc.hs
@@ -100,7 +100,7 @@
                         <|>
                         ((pColumn 0 >> pDetect2Chars False '%' '{' >>= withAttribute "Content-Type Delimiter") >>~ pushContext "C Declarations")
                         <|>
-                        ((pRegExpr (compileRegex ".") >>= withAttribute "Normal Text") >>~ pushContext "Declarations"))
+                        ((lookAhead (pRegExpr (compileRegex ".")) >> return ([],"") ) >>~ pushContext "Declarations"))
      return (attr, result)
 
 parseRules "C Declarations" = 
@@ -176,7 +176,7 @@
 parseRules "Percent Command" = 
   do (attr, result) <- (((parseRules "Comment"))
                         <|>
-                        ((pRegExpr (compileRegex "\\W") >>= withAttribute "Normal Text") >>~ pushContext "Percent Command In"))
+                        ((lookAhead (pRegExpr (compileRegex "\\W")) >> return ([],"") ) >>~ pushContext "Percent Command In"))
      return (attr, result)
 
 parseRules "Percent Command In" = 
diff --git a/changelog b/changelog
new file mode 100644
--- /dev/null
+++ b/changelog
@@ -0,0 +1,10 @@
+highlighting-kate (0.2.1)
+
+  *  Implemented lookAhead in parsers, which fixed bugs in perl, bash,
+     and other parsers.
+
+highlighting-kate 0.2
+
+  *  Initial release
+  
+ -- John MacFarlane <jgm@berkeley.edu> 10 Feb 2008
diff --git a/highlighting-kate.cabal b/highlighting-kate.cabal
--- a/highlighting-kate.cabal
+++ b/highlighting-kate.cabal
@@ -1,5 +1,5 @@
 Name:                highlighting-kate
-Version:             0.2
+Version:             0.2.1
 Cabal-Version:       >= 1.2
 Build-Type:          Simple
 Category:            Text
@@ -27,8 +27,10 @@
 License-file:        LICENSE
 Author:              John MacFarlane
 Maintainer:          jgm@berkeley.edu
+Homepage:            http://johnmacfarlane.net/highlighting-kate
 Extra-Source-Files:  README
                      BUGS
+                     changelog
                      Highlight.hs
                      ParseSyntaxFiles.hs
                      css/hk-espresso.css
