Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-skylighting-core for openSUSE:Factory checked in at 2024-07-02 18:16:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-skylighting-core (Old) and /work/SRC/openSUSE:Factory/.ghc-skylighting-core.new.18349 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-skylighting-core" Tue Jul 2 18:16:24 2024 rev:40 rq:1184201 version:0.14.2 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-skylighting-core/ghc-skylighting-core.changes 2024-05-21 18:35:18.931915719 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-skylighting-core.new.18349/ghc-skylighting-core.changes 2024-07-02 18:16:32.291613340 +0200 @@ -1,0 +2,14 @@ +Mon Jun 24 06:07:51 UTC 2024 - Peter Simons <psimons@suse.com> + +- Update skylighting-core to version 0.14.2. + ## 0.14.2 + + * Add `loadValidSyntaxesFromDir` (Kevin Quick) [API change]. + The `loadSyntaxesFromDir` function is an all-or-nothing function: + a single invalid file results in a error and *no* loaded syntaxes. + This adds the `loadValidSyntaxesFromDir`, which is resilient + against individual syntax file load failures. It returns a map + of the failure messages, and the SyntaxMap that is created from + all the successful parsing. + +------------------------------------------------------------------- Old: ---- skylighting-core-0.14.1.2.tar.gz New: ---- skylighting-core-0.14.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-skylighting-core.spec ++++++ --- /var/tmp/diff_new_pack.knO2Ql/_old 2024-07-02 18:16:34.127680528 +0200 +++ /var/tmp/diff_new_pack.knO2Ql/_new 2024-07-02 18:16:34.143681114 +0200 @@ -20,7 +20,7 @@ %global pkgver %{pkg_name}-%{version} %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.14.1.2 +Version: 0.14.2 Release: 0 Summary: Syntax highlighting library License: BSD-3-Clause ++++++ skylighting-core-0.14.1.2.tar.gz -> skylighting-core-0.14.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skylighting-core-0.14.1.2/changelog.md new/skylighting-core-0.14.2/changelog.md --- old/skylighting-core-0.14.1.2/changelog.md 2001-09-09 03:46:40.000000000 +0200 +++ new/skylighting-core-0.14.2/changelog.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,15 @@ # Revision history for skylighting and skylighting-core +## 0.14.2 + + * Add `loadValidSyntaxesFromDir` (Kevin Quick) [API change]. + The `loadSyntaxesFromDir` function is an all-or-nothing function: + a single invalid file results in a error and *no* loaded syntaxes. + This adds the `loadValidSyntaxesFromDir`, which is resilient + against individual syntax file load failures. It returns a map + of the failure messages, and the SyntaxMap that is created from + all the successful parsing. + ## 0.14.1.2 * Add terraform syntax (#190). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skylighting-core-0.14.1.2/skylighting-core.cabal new/skylighting-core-0.14.2/skylighting-core.cabal --- old/skylighting-core-0.14.1.2/skylighting-core.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/skylighting-core-0.14.2/skylighting-core.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,5 @@ name: skylighting-core -version: 0.14.1.2 +version: 0.14.2 synopsis: syntax highlighting library description: Skylighting is a syntax highlighting library. It derives its tokenizers from XML syntax @@ -21,7 +21,7 @@ license-file: LICENSE author: John MacFarlane maintainer: jgm@berkeley.edu -copyright: (C) 2016-2018 John MacFarlane +copyright: (C) 2016-2024 John MacFarlane category: Text build-type: Simple extra-source-files: README.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skylighting-core-0.14.1.2/src/Skylighting/Loader.hs new/skylighting-core-0.14.2/src/Skylighting/Loader.hs --- old/skylighting-core-0.14.1.2/src/Skylighting/Loader.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/skylighting-core-0.14.2/src/Skylighting/Loader.hs 2001-09-09 03:46:40.000000000 +0200 @@ -1,8 +1,10 @@ {-# LANGUAGE CPP #-} +{-# LANGUAGE LambdaCase #-} -- | This module provides routines to load syntax definitions from disk -- files. module Skylighting.Loader ( loadSyntaxFromFile , loadSyntaxesFromDir + , loadValidSyntaxesFromDir ) where @@ -37,7 +39,8 @@ -- | Loads all syntax definitions from the specified directory by -- looking for files with an ".xml" extension. This function assumes -- such files are Kate XML syntax definitions, so XML files with --- unexpected contents will cause a parsing error returned as a 'Left'. +-- unexpected contents will cause a parsing error returned as a 'Left' +-- and syntax parsing will be aborted. loadSyntaxesFromDir :: FilePath -> IO (Either String SyntaxMap) loadSyntaxesFromDir path = runExceptT $ do files <- liftIO $ syntaxFiles path @@ -54,3 +57,20 @@ entries <- listDirectory dir let absEntries = (dir </>) <$> filter isSyntaxFile entries filterM doesFileExist absEntries + +-- | Loads all valid syntax definitions from the specified directory by looking +-- for files with an ".xml" extension. Any files that are not valid Kate XML +-- syntax definitions will have an entry in the resulting error map; the returned +-- SyntaxMap will be made up of only the files that could successfully be loaded +-- and parsed. +loadValidSyntaxesFromDir :: FilePath -> IO (LoadErrMap, SyntaxMap) +loadValidSyntaxesFromDir path = foldM go (mempty, mempty) =<< syntaxFiles path + where + go (errMap, syntaxMap) file = + loadSyntaxFromFile file >>= \case + Right s -> return (errMap, addSyntaxDefinition s syntaxMap) + Left e -> return (M.insert file e errMap, syntaxMap) + +-- | A map from a potential syntax file to the error encountered when trying to +-- load that syntax file. +type LoadErrMap = M.Map FilePath String