diff options
| author | hallgren <hallgren@chalmers.se> | 2014-10-22 15:45:52 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2014-10-22 15:45:52 +0000 |
| commit | 6ee67cd04ffbce375d7f10e74a5d9eb742d6428d (patch) | |
| tree | fa90c0a4d72b30bbe486db51b2ebab81c0767fe9 /src/compiler/GF/Infra | |
| parent | 00922153aa1f94754847f60a959f3849dfc4771b (diff) | |
Various small changes for improved documentation
Diffstat (limited to 'src/compiler/GF/Infra')
| -rw-r--r-- | src/compiler/GF/Infra/Ident.hs | 26 | ||||
| -rw-r--r-- | src/compiler/GF/Infra/UseIO.hs | 2 |
2 files changed, 16 insertions, 12 deletions
diff --git a/src/compiler/GF/Infra/Ident.hs b/src/compiler/GF/Infra/Ident.hs index 7d0bed804..b856d3995 100644 --- a/src/compiler/GF/Infra/Ident.hs +++ b/src/compiler/GF/Infra/Ident.hs @@ -15,15 +15,15 @@ module GF.Infra.Ident (-- ** Identifiers ModuleName(..), moduleNameS, Ident, ident2utf8, showIdent, prefixIdent, - identS, identC, identV, identA, identAV, identW, + -- *** Normal identifiers (returned by the parser) + identS, identC, identW, + -- *** Special identifiers for internal use + identV, identA, identAV, argIdent, isArgIdent, getArgIndex, varStr, varX, isWildIdent, varIndex, - -- ** Raw Identifiers + -- *** Raw identifiers RawIdent, rawIdentS, rawIdentC, ident2raw, prefixRawIdent, - isPrefixOf, showRawIdent{-, - -- ** Refreshing identifiers - IdState, initIdStateN, initIdState, - lookVar, refVar, refVarPlus-} + isPrefixOf, showRawIdent ) where import qualified Data.ByteString.UTF8 as UTF8 @@ -58,6 +58,8 @@ data Ident = deriving (Eq, Ord, Show, Read) -- | Identifiers are stored as UTF-8-encoded bytestrings. +-- (It is also possible to use regular Haskell 'String's, with somewhat +-- reduced performance and increased memory use.) newtype RawIdent = Id { rawId2utf8 :: UTF8.ByteString } deriving (Eq, Ord, Show, Read) @@ -97,12 +99,7 @@ identS :: String -> Ident identS = identC . rawIdentS identC :: RawIdent -> Ident -identV :: RawIdent -> Int -> Ident -identA :: RawIdent -> Int -> Ident -identAV:: RawIdent -> Int -> Int -> Ident identW :: Ident -(identC, identV, identA, identAV, identW) = - (IC, IV, IA, IAV, IW) prefixIdent :: String -> Ident -> Ident @@ -111,6 +108,13 @@ prefixIdent pref = identC . Id . BS.append (pack pref) . ident2utf8 -- normal identifier -- ident s = IC s +identV :: RawIdent -> Int -> Ident +identA :: RawIdent -> Int -> Ident +identAV:: RawIdent -> Int -> Int -> Ident + +(identC, identV, identA, identAV, identW) = + (IC, IV, IA, IAV, IW) + -- | to mark argument variables argIdent :: Int -> Ident -> Int -> Ident argIdent 0 (IC c) i = identA c i diff --git a/src/compiler/GF/Infra/UseIO.hs b/src/compiler/GF/Infra/UseIO.hs index 80677658a..b9ff9c2e5 100644 --- a/src/compiler/GF/Infra/UseIO.hs +++ b/src/compiler/GF/Infra/UseIO.hs @@ -210,7 +210,7 @@ putPointE v opts msg act = do return a -- | Because GHC adds the confusing text "user error" for failures caused by --- calls to fail. +-- calls to 'fail'. ioErrorText e = if isUserError e then ioeGetErrorString e else show e |
