packages feed

ghc-syntax-highlighter 0.0.4.0 → 0.0.4.1

raw patch · 5 files changed

+61/−117 lines, 5 filesdep +ghc-bootdep ~ghcPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: ghc-boot

Dependency ranges changed: ghc

API changes (from Hackage documentation)

- GHC.SyntaxHighlighter: instance GHC.Enum.Enum GHC.SyntaxHighlighter.ExtBits

Files

CHANGELOG.md view
@@ -1,3 +1,9 @@+## GHC syntax highlighter 0.0.4.1++* Works with GHC 8.8.++* Dropped support for GHC 8.2.+ ## GHC syntax highlighter 0.0.4.0  * Implemented highlighting of file header pragmas such as `OPTIONS_GHC` and
GHC/SyntaxHighlighter.hs view
@@ -1,6 +1,6 @@ -- | -- Module      :  GHC.SyntaxHighlighter--- Copyright   :  © 2018–2019 Mark Karpov+-- Copyright   :  © 2018–present Mark Karpov -- License     :  BSD 3 clause -- -- Maintainer  :  Mark Karpov <markkarpov92@gmail.com>@@ -17,7 +17,7 @@ {-# LANGUAGE LambdaCase                    #-} {-# LANGUAGE OverloadedStrings             #-} {-# LANGUAGE TupleSections                 #-}-{-# OPTIONS_GHC -fno-warn-unused-top-binds #-}+{-# OPTIONS_GHC -fno-warn-missing-fields #-}  module GHC.SyntaxHighlighter   ( Token (..)@@ -27,13 +27,12 @@ where  import Control.Monad-import Data.Bits-import Data.List (unfoldr, foldl')+import Data.List (foldl', unfoldr) import Data.Maybe (isJust) import Data.Text (Text)-import Data.Word (Word64)+import DynFlags import FastString (mkFastString)-import Module (newSimpleUnitId, ComponentId (..))+import GHC.LanguageExtensions import SrcLoc import StringBuffer import qualified Data.Text as T@@ -122,11 +121,17 @@     location = mkRealSrcLoc (mkFastString "") 1 1     buffer = stringToStringBuffer (T.unpack input)     parseState = L.mkPStatePure parserFlags buffer location-    parserFlags = L.ParserFlags-      { L.pWarningFlags = ES.empty-      , L.pExtensionFlags = ES.empty-      , L.pThisPackage = newSimpleUnitId (ComponentId (mkFastString ""))-      , L.pExtsBitmap = extsBitmap+    parserFlags = L.mkParserFlags (foldl' xopt_set initialDynFlags enabledExts)+    initialDynFlags = DynFlags+      { warningFlags = ES.empty+      , generalFlags = ES.fromList+        [ Opt_Haddock+        , Opt_KeepRawTokenStream+        ]+      , extensions = []+      , extensionFlags = ES.empty+      , safeHaskell = Sf_Safe+      , language = Just Haskell2010       }  -- | Haskell lexer.@@ -255,6 +260,9 @@   L.IToverlaps_prag _ -> PragmaTok   L.ITincoherent_prag _ -> PragmaTok   L.ITctype _ -> PragmaTok+#if MIN_VERSION_ghc(8,8,1)+  L.ITcomment_line_prag -> PragmaTok+#endif   -- Reserved symbols   L.ITdotdot -> SymbolTok   L.ITcolon -> SymbolTok@@ -426,109 +434,39 @@   guard (T.isPrefixOf "LANGUAGE" txt1 || T.isPrefixOf "OPTIONS_GHC" txt1)  ------------------------------------------------------------------------------- Exts bitmap hack---- | Extension bitmap we use in this library.--extsBitmap :: Word64-extsBitmap = mkExtsBitmap enabledExts-{-# NOINLINE extsBitmap #-}---- | Create extension bitmap similarly to how it's done in GHC.--mkExtsBitmap :: [ExtBits] -> Word64-mkExtsBitmap = foldl' f 0-  where-    f w x = bit (fromEnum x) .|. w---- | Copied from GHC sources that are not yet available in the @ghc@--- package.--data ExtBits-  = FfiBit-  | InterruptibleFfiBit-  | CApiFfiBit-#if !MIN_VERSION_ghc(8,6,0)-  | ParrBit-#endif-  | ArrowsBit-  | ThBit-  | ThQuotesBit-  | IpBit-  | OverloadedLabelsBit -- #x overloaded labels-  | ExplicitForallBit -- the 'forall' keyword and '.' symbol-  | BangPatBit -- Tells the parser to understand bang-patterns-               -- (doesn't affect the lexer)-  | PatternSynonymsBit -- pattern synonyms-  | HaddockBit-- Lex and parse Haddock comments-  | MagicHashBit -- "#" in both functions and operators-  | RecursiveDoBit -- mdo-  | UnicodeSyntaxBit -- the forall symbol, arrow symbols, etc-  | UnboxedTuplesBit -- (# and #)-  | UnboxedSumsBit -- (# and #)-  | DatatypeContextsBit-  | TransformComprehensionsBit-  | QqBit -- enable quasiquoting-  | InRulePragBit-  | RawTokenStreamBit -- producing a token stream with all comments included-  | SccProfilingOnBit-  | HpcBit-  | AlternativeLayoutRuleBit-  | RelaxedLayoutBit-  | NondecreasingIndentationBit-  | SafeHaskellBit-  | TraditionalRecordSyntaxBit-  | ExplicitNamespacesBit-  | LambdaCaseBit-  | BinaryLiteralsBit-  | NegativeLiteralsBit-  | HexFloatLiteralsBit-  | TypeApplicationsBit-  | StaticPointersBit-  | NumericUnderscoresBit-#if MIN_VERSION_ghc(8,6,0)-  | StarIsTypeBit-#endif-  deriving Enum+-- Language extensions --- | Extension we enable for the best user experience.+-- | Language extensions we enable by default. -enabledExts :: [ExtBits]+enabledExts :: [Extension] enabledExts =-  [ FfiBit-  , InterruptibleFfiBit-  , CApiFfiBit-#if !MIN_VERSION_ghc(8,6,0)-  , ParrBit-#endif-  , ArrowsBit-  , ThBit-  , ThQuotesBit-  , IpBit-  , OverloadedLabelsBit-  , ExplicitForallBit-  , BangPatBit-  , PatternSynonymsBit-  , HaddockBit-  , MagicHashBit-  , RecursiveDoBit-  , UnicodeSyntaxBit-  , UnboxedTuplesBit-  , UnboxedSumsBit-  , DatatypeContextsBit-  , TransformComprehensionsBit-  , QqBit-  , InRulePragBit-  , RawTokenStreamBit-  , SafeHaskellBit-  , LambdaCaseBit-  , BinaryLiteralsBit-  , NegativeLiteralsBit-  , HexFloatLiteralsBit-  , TypeApplicationsBit-  , StaticPointersBit-  , NumericUnderscoresBit+  [ ForeignFunctionInterface+  , InterruptibleFFI+  , CApiFFI+  , Arrows+  , TemplateHaskell+  , TemplateHaskellQuotes+  , ImplicitParams+  , OverloadedLabels+  , ExplicitForAll+  , BangPatterns+  , PatternSynonyms+  , MagicHash+  , RecursiveDo+  , UnicodeSyntax+  , UnboxedTuples+  , UnboxedSums+  , DatatypeContexts+  , TransformListComp+  , QuasiQuotes+  , LambdaCase+  , BinaryLiterals+  , NegativeLiterals+  , HexFloatLiterals+  , TypeApplications+  , StaticPointers #if MIN_VERSION_ghc(8,6,0)-  , StarIsTypeBit+  , NumericUnderscores+  , StarIsType #endif   ]
LICENSE.md view
@@ -1,4 +1,4 @@-Copyright © 2018 Mark Karpov+Copyright © 2018–present Mark Karpov  All rights reserved. 
README.md view
@@ -138,7 +138,7 @@  ## License -Copyright © 2018–2019 Mark Karpov+Copyright © 2018–present Mark Karpov  Distributed under BSD 3 clause license. 
ghc-syntax-highlighter.cabal view
@@ -1,7 +1,7 @@ name:                 ghc-syntax-highlighter-version:              0.0.4.0+version:              0.0.4.1 cabal-version:        1.18-tested-with:          GHC==8.4.4, GHC==8.6.5+tested-with:          GHC==8.4.4, GHC==8.6.5, GHC==8.8.1 license:              BSD3 license-file:         LICENSE.md author:               Mark Karpov <markkarpov92@gmail.com>@@ -27,7 +27,8 @@  library   build-depends:      base             >= 4.11 && < 5.0-                    , ghc              >= 8.4  && < 8.7+                    , ghc              >= 8.4  && < 8.9+                    , ghc-boot         >= 8.4  && < 8.9                     , text             >= 0.2  && < 1.3   exposed-modules:    GHC.SyntaxHighlighter   if flag(dev)@@ -35,7 +36,6 @@                       -Wincomplete-record-updates                       -Wincomplete-uni-patterns                       -Wnoncanonical-monad-instances-                      -Wnoncanonical-monadfail-instances   else     ghc-options:      -O2 -Wall   default-language:   Haskell2010