diff options
| author | hallgren <hallgren@chalmers.se> | 2013-09-19 20:48:10 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2013-09-19 20:48:10 +0000 |
| commit | 021b5f06d3900fe2b10d5d3ccf6ac286a779ef16 (patch) | |
| tree | cff0a0ca9c945dcef34f58a6e09fc5042c7abd65 /src/compiler/GF/Compile | |
| parent | 3d5b9bd1fd46a51651cbfbd45f03e5b878aebbac (diff) | |
Introduce type RawIdent; only 9 imports of Data.ByteString.Char8 remain
The fact that identifiers are represented as ByteStrings is now an internal
implentation detail in module GF.Infra.Ident. Conversion between ByteString
and identifiers is only needed in the lexer and the Binary instances.
Diffstat (limited to 'src/compiler/GF/Compile')
| -rw-r--r-- | src/compiler/GF/Compile/GrammarToPGF.hs | 4 | ||||
| -rw-r--r-- | src/compiler/GF/Compile/SubExOpt.hs | 9 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/compiler/GF/Compile/GrammarToPGF.hs b/src/compiler/GF/Compile/GrammarToPGF.hs index 5ec7f9774..b1a2c5d33 100644 --- a/src/compiler/GF/Compile/GrammarToPGF.hs +++ b/src/compiler/GF/Compile/GrammarToPGF.hs @@ -30,7 +30,6 @@ import Data.Char (isDigit,isSpace) import qualified Data.Set as Set import qualified Data.Map as Map import qualified Data.IntMap as IntMap -import qualified Data.ByteString.Char8 as BS import Data.Array.IArray import Text.PrettyPrint import Control.Monad.Identity @@ -250,8 +249,7 @@ genCncFuns gr am cm seqs0 cdefs fid_cnt cnccats = ctxt = mapM (mkCtxt lindefs) hargs_C fids = map (mkFId arg_C) fid0s - mkLinDefId id = - identC (BS.append (BS.pack "lindef ") (ident2bs id)) + mkLinDefId id = prefixIdent "lindef " id toLinDef res offs lindefs (Production fid0 funid0 _) = IntMap.insertWith (++) fid [offs+funid0] lindefs diff --git a/src/compiler/GF/Compile/SubExOpt.hs b/src/compiler/GF/Compile/SubExOpt.hs index bfa2a1334..4c056f479 100644 --- a/src/compiler/GF/Compile/SubExOpt.hs +++ b/src/compiler/GF/Compile/SubExOpt.hs @@ -32,8 +32,7 @@ import GF.Data.Operations import Control.Monad import Data.Map (Map) import qualified Data.Map as Map -import qualified Data.ByteString.Char8 as BS -import Data.List + subexpModule :: SourceModule -> SourceModule subexpModule (n,mo) = errVal (n,mo) $ do @@ -133,9 +132,9 @@ collectSubterms mo t = case t of return t --- only because of composOp operIdent :: Int -> Ident -operIdent i = identC (operPrefix `BS.append` (BS.pack (show i))) --- +operIdent i = identC (operPrefix `prefixRawIdent` (rawIdentS (show i))) --- isOperIdent :: Ident -> Bool -isOperIdent id = BS.isPrefixOf operPrefix (ident2bs id) +isOperIdent id = isPrefixOf operPrefix (ident2raw id) -operPrefix = BS.pack ("A''") +operPrefix = rawIdentS ("A''") |
