From: simonmar Date: Mon, 20 Aug 2001 10:19:47 +0000 (+0000) Subject: [project @ 2001-08-20 10:19:47 by simonmar] X-Git-Tag: Approximately_9120_patches~1183 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=e20dee90944fdf811b2e6c4ffbe790e4242b1410;p=ghc-hetmet.git [project @ 2001-08-20 10:19:47 by simonmar] 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. --- diff --git a/ghc/compiler/parser/Parser.y b/ghc/compiler/parser/Parser.y index 30a1950..da612d8 100644 --- a/ghc/compiler/parser/Parser.y +++ b/ghc/compiler/parser/Parser.y @@ -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 }