diff options
| author | kr.angelov <kr.angelov@chalmers.se> | 2008-05-21 13:10:54 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@chalmers.se> | 2008-05-21 13:10:54 +0000 |
| commit | c544ef31823c7d2c28c28cae408cca5d71e6978d (patch) | |
| tree | b9693bc684d1737062e45438cedf7536cf5513d5 /src-3.0/GF/Grammar/Lockfield.hs | |
| parent | 529374caaa6d451400f57f1ff82106d89d603944 (diff) | |
use ByteString internally in Ident, CId and Label
Diffstat (limited to 'src-3.0/GF/Grammar/Lockfield.hs')
| -rw-r--r-- | src-3.0/GF/Grammar/Lockfield.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src-3.0/GF/Grammar/Lockfield.hs b/src-3.0/GF/Grammar/Lockfield.hs index 960b12983..12b78ab9b 100644 --- a/src-3.0/GF/Grammar/Lockfield.hs +++ b/src-3.0/GF/Grammar/Lockfield.hs @@ -16,8 +16,10 @@ module GF.Grammar.Lockfield (lockRecType, unlockRecord, lockLabel, isLockLabel) where -import GF.Grammar.Grammar +import qualified Data.ByteString.Char8 as BS + import GF.Infra.Ident +import GF.Grammar.Grammar import GF.Grammar.Macros import GF.Grammar.PrGrammar @@ -38,9 +40,12 @@ unlockRecord c ft = do return $ mkAbs xs t' lockLabel :: Ident -> Label -lockLabel c = LIdent $ "lock_" ++ prt c ---- +lockLabel c = LIdent $! BS.append lockPrefix (ident2bs c) isLockLabel :: Label -> Bool isLockLabel l = case l of - LIdent c -> take 5 c == "lock_" - _ -> False + LIdent c -> BS.isPrefixOf lockPrefix c + _ -> False + + +lockPrefix = BS.pack "lock_" |
