Skip to content
Snippets Groups Projects
Commit 62b87d58 authored by Simon Marlow's avatar Simon Marlow
Browse files

[project @ 1999-06-02 15:50:25 by simonmar]

- parse _scc_ expressions
- give a proper error on illegal characters in the lexer.
parent 1d43b29a
No related branches found
No related tags found
No related merge requests found
...@@ -120,6 +120,7 @@ data Token ...@@ -120,6 +120,7 @@ data Token
| ITthen | ITthen
| ITtype | ITtype
| ITwhere | ITwhere
| ITscc
| ITforall -- GHC extension keywords | ITforall -- GHC extension keywords
| ITforeign | ITforeign
...@@ -155,7 +156,7 @@ data Token ...@@ -155,7 +156,7 @@ data Token
| ITstrict ([Demand], Bool) | ITstrict ([Demand], Bool)
| ITrules | ITrules
| ITcprinfo (CprInfo) | ITcprinfo (CprInfo)
| ITscc | IT__scc
| ITsccAllCafs | ITsccAllCafs
| ITspecialise_prag -- Pragmas | ITspecialise_prag -- Pragmas
...@@ -266,7 +267,8 @@ haskellKeywordsFM = listToUFM $ ...@@ -266,7 +267,8 @@ haskellKeywordsFM = listToUFM $
( "qualified", ITqualified ), ( "qualified", ITqualified ),
( "then", ITthen ), ( "then", ITthen ),
( "type", ITtype ), ( "type", ITtype ),
( "where", ITwhere ) ( "where", ITwhere ),
( "_scc_", ITscc )
] ]
...@@ -588,6 +590,7 @@ lexToken cont glaexts buf = ...@@ -588,6 +590,7 @@ lexToken cont glaexts buf =
| is_symbol c -> lex_sym cont buf | is_symbol c -> lex_sym cont buf
| is_upper c -> lex_con cont glaexts buf | is_upper c -> lex_con cont glaexts buf
| is_ident c -> lex_id cont glaexts buf | is_ident c -> lex_id cont glaexts buf
| otherwise -> lexError "illegal character" buf
-- Int# is unlifted, and therefore faster than Bool for flags. -- Int# is unlifted, and therefore faster than Bool for flags.
{-# INLINE flag #-} {-# INLINE flag #-}
......
{- {-
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
$Id: Parser.y,v 1.2 1999/06/02 14:42:43 simonmar Exp $ $Id: Parser.y,v 1.3 1999/06/02 15:50:25 simonmar Exp $
Haskell grammar. Haskell grammar.
...@@ -23,6 +23,7 @@ import OccName ( varName, dataName, tcClsName, tvName ) ...@@ -23,6 +23,7 @@ import OccName ( varName, dataName, tcClsName, tvName )
import SrcLoc ( SrcLoc ) import SrcLoc ( SrcLoc )
import Module import Module
import CallConv import CallConv
import CmdLineOpts ( opt_SccProfilingOn )
import BasicTypes ( Fixity(..), FixityDirection(..), NewOrData(..) ) import BasicTypes ( Fixity(..), FixityDirection(..), NewOrData(..) )
import Panic import Panic
...@@ -80,6 +81,7 @@ Conflicts: 13 shift/reduce ...@@ -80,6 +81,7 @@ Conflicts: 13 shift/reduce
'then' { ITthen } 'then' { ITthen }
'type' { ITtype } 'type' { ITtype }
'where' { ITwhere } 'where' { ITwhere }
'_scc_' { ITscc }
'forall' { ITforall } -- GHC extension keywords 'forall' { ITforall } -- GHC extension keywords
'foreign' { ITforeign } 'foreign' { ITforeign }
...@@ -117,7 +119,7 @@ Conflicts: 13 shift/reduce ...@@ -117,7 +119,7 @@ Conflicts: 13 shift/reduce
'__litlit' { ITlit_lit } '__litlit' { ITlit_lit }
'__string' { ITstring_lit } '__string' { ITstring_lit }
'__ccall' { ITccall $$ } '__ccall' { ITccall $$ }
'__scc' { ITscc } '__scc' { IT__scc }
'__sccC' { ITsccAllCafs } '__sccC' { ITsccAllCafs }
'__A' { ITarity } '__A' { ITarity }
...@@ -625,6 +627,10 @@ exp10 :: { RdrNameHsExpr } ...@@ -625,6 +627,10 @@ exp10 :: { RdrNameHsExpr }
| '_casm_' CLITLIT aexps0 { CCall $2 $3 False True cbot } | '_casm_' CLITLIT aexps0 { CCall $2 $3 False True cbot }
| '_casm_GC_' CLITLIT aexps0 { CCall $2 $3 True True cbot } | '_casm_GC_' CLITLIT aexps0 { CCall $2 $3 True True cbot }
| '_scc_' STRING exp { if opt_SccProfilingOn
then HsSCC $2 $3
else $3 }
| fexp { $1 } | fexp { $1 }
ccallid :: { FAST_STRING } ccallid :: { FAST_STRING }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment