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/Grammar/Grammar.hs | |
| 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/Grammar/Grammar.hs')
| -rw-r--r-- | src/compiler/GF/Grammar/Grammar.hs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/compiler/GF/Grammar/Grammar.hs b/src/compiler/GF/Grammar/Grammar.hs index c59cd809e..2efec220b 100644 --- a/src/compiler/GF/Grammar/Grammar.hs +++ b/src/compiler/GF/Grammar/Grammar.hs @@ -74,7 +74,6 @@ import Data.Array.Unboxed import qualified Data.Map as Map import qualified Data.Set as Set import qualified Data.IntMap as IntMap -import qualified Data.ByteString.Char8 as BS import Text.PrettyPrint import System.FilePath import Control.Monad.Identity @@ -472,7 +471,7 @@ data TInfo = -- | record label data Label = - LIdent BS.ByteString + LIdent RawIdent | LVar Int deriving (Show, Eq, Ord) @@ -497,16 +496,15 @@ varLabel :: Int -> Label varLabel = LVar tupleLabel, linLabel :: Int -> Label -tupleLabel i = LIdent $! BS.pack ('p':show i) -linLabel i = LIdent $! BS.pack ('s':show i) +tupleLabel i = LIdent $! rawIdentS ('p':show i) +linLabel i = LIdent $! rawIdentS ('s':show i) theLinLabel :: Label -theLinLabel = LIdent (BS.singleton 's') +theLinLabel = LIdent (rawIdentS "s") ident2label :: Ident -> Label -ident2label c = LIdent (ident2bs c) +ident2label c = LIdent (ident2raw c) label2ident :: Label -> Ident label2ident (LIdent s) = identC s -label2ident (LVar i) = identC (BS.pack ('$':show i)) - +label2ident (LVar i) = identS ('$':show i) |
