[project @ 2001-08-20 10:19:47 by simonmar]
authorsimonmar <unknown>
Mon, 20 Aug 2001 10:19:47 +0000 (10:19 +0000)
committersimonmar <unknown>
Mon, 20 Aug 2001 10:19:47 +0000 (10:19 +0000)
Add a new entry point: parseIdentifier, which parses a qualified or
non-qualified operator or variable, including parenthesised and
backquoted forms, and the special identifiers [], (), (,), (,,) etc.

ghc/compiler/parser/Parser.y

index 30a1950..da612d8 100644 (file)
@@ -1,6 +1,6 @@
 {-
 -----------------------------------------------------------------------------
-$Id: Parser.y,v 1.72 2001/07/23 10:54:48 simonpj Exp $
+$Id: Parser.y,v 1.73 2001/08/20 10:19:47 simonmar Exp $
 
 Haskell grammar.
 
@@ -9,7 +9,7 @@ Author(s): Simon Marlow, Sven Panne 1997, 1998, 1999
 -}
 
 {
-module Parser ( parseModule, parseStmt ) where
+module Parser ( parseModule, parseStmt, parseIdentifier ) where
 
 import HsSyn
 import HsTypes         ( mkHsTupCon )
@@ -206,6 +206,7 @@ Conflicts: 14 shift/reduce
 %lexer { lexer } { ITeof }
 %name parseModule module
 %name parseStmt   maybe_stmt
+%name parseIdentifier  identifier
 %tokentype { Token }
 %%
 
@@ -923,6 +924,11 @@ dbind      : ipvar '=' exp                 { ($1, $3) }
 -----------------------------------------------------------------------------
 -- Variables, Constructors and Operators.
 
+identifier :: { RdrName }
+       : qvar                          { $1 }
+       | gcon                          { $1 }
+       | qop                           { $1 }
+
 depreclist :: { [RdrName] }
 depreclist : deprec_var                        { [$1] }
           | deprec_var ',' depreclist  { $1 : $3 }