mirror of
https://github.com/github/semantic.git
synced 2024-12-25 16:02:43 +03:00
Move encloseIf back into Data.Core.Pretty.
This commit is contained in:
parent
0115512f58
commit
ebafd644d3
@ -39,6 +39,10 @@ symbol = annotate (Pretty.color Pretty.Yellow)
|
|||||||
strlit = annotate (Pretty.colorDull Pretty.Green)
|
strlit = annotate (Pretty.colorDull Pretty.Green)
|
||||||
primitive = keyword . mappend "#"
|
primitive = keyword . mappend "#"
|
||||||
|
|
||||||
|
encloseIf :: Monoid m => Bool -> m -> m -> m -> m
|
||||||
|
encloseIf True l r x = l <> x <> r
|
||||||
|
encloseIf False _ _ x = x
|
||||||
|
|
||||||
type Prec = Int
|
type Prec = Int
|
||||||
|
|
||||||
data Style = Unicode | Ascii
|
data Style = Unicode | Ascii
|
||||||
|
@ -10,7 +10,6 @@ module Data.Name
|
|||||||
, reservedNames
|
, reservedNames
|
||||||
, isSimpleCharacter
|
, isSimpleCharacter
|
||||||
, needsQuotation
|
, needsQuotation
|
||||||
, encloseIf
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import qualified Data.Char as Char
|
import qualified Data.Char as Char
|
||||||
@ -53,10 +52,6 @@ reservedNames = [ "#true", "#false", "let", "#frame", "if", "then", "else"
|
|||||||
needsQuotation :: User -> Bool
|
needsQuotation :: User -> Bool
|
||||||
needsQuotation u = HashSet.member (unpack u) reservedNames || Text.any (not . isSimpleCharacter) u
|
needsQuotation u = HashSet.member (unpack u) reservedNames || Text.any (not . isSimpleCharacter) u
|
||||||
|
|
||||||
encloseIf :: Monoid m => Bool -> m -> m -> m -> m
|
|
||||||
encloseIf True l r x = l <> x <> r
|
|
||||||
encloseIf False _ _ x = x
|
|
||||||
|
|
||||||
-- | A ‘simple’ character is, loosely defined, a character that is compatible
|
-- | A ‘simple’ character is, loosely defined, a character that is compatible
|
||||||
-- with identifiers in most ASCII-oriented programming languages. This is defined
|
-- with identifiers in most ASCII-oriented programming languages. This is defined
|
||||||
-- as the alphanumeric set plus @$@ and @_@.
|
-- as the alphanumeric set plus @$@ and @_@.
|
||||||
|
Loading…
Reference in New Issue
Block a user