[project @ 2003-10-29 17:58:16 by ross]
authorross <unknown>
Wed, 29 Oct 2003 17:58:16 +0000 (17:58 +0000)
committerross <unknown>
Wed, 29 Oct 2003 17:58:16 +0000 (17:58 +0000)
don't recognise (| or (# if followed by a symbol character, e.g. (||)

good for STABLE, I hope

ghc/compiler/parser/Lexer.x

index 52fc03e..97dbd77 100644 (file)
@@ -204,7 +204,8 @@ $white_no_nl+                               ;
 }
 
 <0,glaexts> {
-  "(|" / { ifExtension arrowsEnabled }  { special IToparenbar }
+  "(|" / { ifExtension arrowsEnabled `alexAndPred` notFollowedBySymbol }
+                                       { special IToparenbar }
   "|)" / { ifExtension arrowsEnabled }  { special ITcparenbar }
 }
 
@@ -214,7 +215,7 @@ $white_no_nl+                               ;
 }
 
 <glaexts> {
-  "(#"                                 { token IToubxparen }
+  "(#" / { notFollowedBySymbol }       { token IToubxparen }
   "#)"                                 { token ITcubxparen }
   "{|"                                 { token ITocurlybar }
   "|}"                                 { token ITccurlybar }
@@ -581,6 +582,9 @@ pop_and act loc end buf len = do popLexState; act loc end buf len
 
 notFollowedBy char _ _ _ (_,buf) = atEnd buf || currentChar buf /= char
 
+notFollowedBySymbol _ _ _ (_,buf)
+  = atEnd buf || currentChar buf `notElem` "!#$%&*+./<=>?@\\^|-~"
+
 ifExtension pred bits _ _ _ = pred bits
 
 {-