--------------------------------------------------------
\begin{code}
-
+{-# OPTIONS -#include "hs_ctype.h" #-}
module Lex (
ifaceParseErr, srcParseErr,
| ITthen
| ITtype
| ITwhere
- | ITscc
+ | ITscc -- ToDo: remove (we use {-# SCC "..." #-} now)
| ITforall -- GHC extension keywords
| ITforeign
| ITccallconv
| ITinterface -- interface keywords
- | ITexpr
| IT__export
| ITdepends
| IT__forall
| ITrules_prag
| ITdeprecated_prag
| ITline_prag
+ | ITscc_prag
| ITclose_prag
| ITdotdot -- reserved symbols
( "LINE", ITline_prag ),
( "RULES", ITrules_prag ),
( "RULEZ", ITrules_prag ), -- american spelling :-)
+ ( "SCC", ITscc_prag ),
( "DEPRECATED", ITdeprecated_prag )
]
( "then", ITthen ),
( "type", ITtype ),
( "where", ITwhere ),
- ( "_scc_", ITscc )
+ ( "_scc_", ITscc ) -- ToDo: remove
]
isSpecial :: Token -> Bool
-- interface keywords
("__interface", ITinterface),
- ("__expr", ITexpr),
("__export", IT__export),
("__depends", ITdepends),
("__forall", IT__forall),
-- special GHC extension: we grok cpp-style #line pragmas
'#'# | lexemeIndex buf ==# bol -> -- the '#' must be in column 0
- line_prag next_line (stepOn buf) s'
+ case expandWhile# is_space (stepOn buf) of { buf1 ->
+ if is_digit (currentChar# buf1)
+ then line_prag next_line buf1 s'
+ else is_a_token
+ }
where
next_line buf = lexer cont (stepOnUntilChar# buf '\n'#)