From 2a321d7910ed89e204ac0bb85cf0d87c318f13f7 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sat, 4 Apr 2009 14:56:00 +0000 Subject: [PATCH] Added a NameExternal item to NameSource, to stop using NamePredefined for externals --- data/AST.hs | 1 + frontends/ParseOccam.hs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/data/AST.hs b/data/AST.hs index 68d9ea8..69c163e 100644 --- a/data/AST.hs +++ b/data/AST.hs @@ -72,6 +72,7 @@ data NameSource = NameUser -- ^ A name from the source program | NameNonce -- ^ A name the compiler generated | NamePredefined -- ^ A magic name without definition (e.g. the Rain timer) + | NameExternal -- ^ A name from an external PRAGMA deriving (Show, Eq, Typeable, Data) -- | The direction of a channel. diff --git a/frontends/ParseOccam.hs b/frontends/ParseOccam.hs index 765232c..1c914bd 100644 --- a/frontends/ParseOccam.hs +++ b/frontends/ParseOccam.hs @@ -1439,7 +1439,7 @@ pragma = do m <- getPosition >>* sourcePosToMeta modify $ \st -> st { csExternals = (A.nameName n, (ext, fs)) : csExternals st } - return $ Just (A.Specification m origN sp, nt, (Just n, A.NamePredefined)) + return $ Just (A.Specification m origN sp, nt, (Just n, A.NameExternal)) ns <- case (prag, mprod) of (Just (_, pragStr), Just prod) -> do let column = metaColumn m + fromMaybe 0 (findIndex (=='\"') rawP)