From 99dcfbd976e7dcaf635fd41ecda438fbd51aaaa4 Mon Sep 17 00:00:00 2001 From: VegOwOtenks Date: Mon, 17 Feb 2025 01:38:52 +0100 Subject: [PATCH] Broken commit --- package.yaml | 3 +++ src/Ubc/Parse/Syntax/Import.hs | 26 +++++++++++++++++++------- stack.yaml | 5 +---- stack.yaml.lock | 14 ++++++-------- ubcc.cabal | 9 +++++++++ 5 files changed, 38 insertions(+), 19 deletions(-) diff --git a/package.yaml b/package.yaml index ca514a5..874de9f 100644 --- a/package.yaml +++ b/package.yaml @@ -23,6 +23,9 @@ dependencies: - base >= 4.7 && < 5 - containers - parsec +- filepath +- path +- directory ghc-options: - -Wall diff --git a/src/Ubc/Parse/Syntax/Import.hs b/src/Ubc/Parse/Syntax/Import.hs index f603946..4c7c0b7 100644 --- a/src/Ubc/Parse/Syntax/Import.hs +++ b/src/Ubc/Parse/Syntax/Import.hs @@ -3,19 +3,31 @@ module Ubc.Parse.Syntax.Import parse) where -import Data.Functor ((<&>)) +import Text.Parsec (sepBy1, ParsecT, anyChar, many, char, choice, notFollowedBy, oneOf) -import Text.Parsec (sepBy1, ParsecT) - -import qualified Data.List as List +import OsPath as OsPath import qualified Ubc.Parse.Syntax.Language as UbcLanguage +import System.OsPath (encodeUtf, OsPath) +import System.OsPath.Encoding (EncodingException (EncodingError)) +import Control.Exception (SomeException(SomeException)) importPath :: Monad m => ParsecT String u m [String] -importPath = UbcLanguage.identifier `sepBy1` UbcLanguage.symbol "/" +importPath = UbcLanguage.angles (many importChar `sepBy1` char '/') -parse :: Monad m => ParsecT String u m [String] +importChar :: (Monad m) => ParsecT String u m Char +importChar = choice + [ char '\\' >> oneOf ">/\\" + , notFollowedBy (oneOf ">/") >> anyChar + ] + +parse :: ParsecT String u IO [String] parse = do UbcLanguage.reserved "import" - importPath + fragments <- importPath + case mapM encodeUtf fragments :: Either EncodingException [OsPath] of + Left err -> pure () + Right success -> pure () + + pure [] diff --git a/stack.yaml b/stack.yaml index 33f7bce..0909beb 100644 --- a/stack.yaml +++ b/stack.yaml @@ -17,7 +17,7 @@ # # snapshot: ./custom-snapshot.yaml # snapshot: https://example.com/snapshots/2024-01-01.yaml -snapshot: ghc-9.8.2 +snapshot: nightly-2025-02-16 # User packages to be built. # Various formats can be used as shown in the example below. @@ -29,7 +29,6 @@ snapshot: ghc-9.8.2 # - auto-update # - wai packages: -- . # Dependency packages to be pulled from upstream that are not in the snapshot. # These entries can reference officially published versions as well as # forks / in-progress versions pinned to a git hash. For example: @@ -41,8 +40,6 @@ packages: # # extra-deps: [] extra-deps: -- hoogle-5.0.18.4 - # Override default flag values for project packages and extra-deps # flags: {} diff --git a/stack.yaml.lock b/stack.yaml.lock index 1630d61..11f9ce8 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -3,12 +3,10 @@ # For more information, please see the documentation at: # https://docs.haskellstack.org/en/stable/topics/lock_files -packages: +packages: [] +snapshots: - completed: - hackage: hoogle-5.0.18.4@sha256:aaf0274da7de4e31ade69ad09f57a59ee25b3765cd102e631629850521754984,3333 - pantry-tree: - sha256: 62d0ccb848ecd2b8f29dc782e3d0a9bde57fa626f09e800822229965728f476c - size: 3414 - original: - hackage: hoogle-5.0.18.4 -snapshots: [] + sha256: bd404e36d2a254aace97d37fba81a785cc6e9b575b36e5e632937a1e14f8d6f6 + size: 654475 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2025/2/16.yaml + original: nightly-2025-02-16 diff --git a/ubcc.cabal b/ubcc.cabal index 738d7ab..106a473 100644 --- a/ubcc.cabal +++ b/ubcc.cabal @@ -47,7 +47,10 @@ library build-depends: base >=4.7 && <5 , containers + , directory + , filepath , parsec + , path default-language: Haskell2010 executable ubcc-exe @@ -62,7 +65,10 @@ executable ubcc-exe build-depends: base >=4.7 && <5 , containers + , directory + , filepath , parsec + , path , ubcc default-language: Haskell2010 @@ -79,6 +85,9 @@ test-suite ubcc-test build-depends: base >=4.7 && <5 , containers + , directory + , filepath , parsec + , path , ubcc default-language: Haskell2010