Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Sep 12, 2024
1 parent b24412c commit 9e00460
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 49 deletions.
3 changes: 3 additions & 0 deletions src/Juvix/Compiler/Concrete/Data/Name.hs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ instance HasLoc TopModulePath where
[] -> getLoc _modulePathName
(x : _) -> getLoc x <> getLoc _modulePathName

mkTopModulePath :: NonEmpty Symbol -> TopModulePath
mkTopModulePath l = TopModulePath (NonEmpty.init l) (NonEmpty.last l)

topModulePathToName :: TopModulePath -> Name
topModulePathToName (TopModulePath ms m) = case nonEmpty ms of
Nothing -> NameUnqualified m
Expand Down
54 changes: 6 additions & 48 deletions src/Juvix/Compiler/Concrete/Translation/FromSource.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
module Juvix.Compiler.Concrete.Translation.FromSource
( module Juvix.Compiler.Concrete.Translation.FromSource,
module Juvix.Compiler.Concrete.Translation.FromSource.Data.Context,
( module Juvix.Compiler.Concrete.Translation.FromSource.Data.Context,
module Juvix.Parser.Error,
expressionFromTextSource,
runModuleParser,
fromSource,
replInputFromTextSource,
ReplInput (..),
)
where

import Commonmark qualified as MK
import Control.Applicative.Permutations
import Data.ByteString.UTF8 qualified as BS
import Data.List.NonEmpty.Extra qualified as NonEmpty
Expand Down Expand Up @@ -352,19 +355,6 @@ juvixCodeBlockParser = do
(t ^. withLocParam)
(Just $ t ^. withLocInt)

-- Keep it. Intended to be used later for processing Markdown inside TextBlocks
-- or (Judoc) comments.
commanMarkParser ::
(Members '[ParserResultBuilder, Error ParserError] r) =>
Path Abs File ->
Text ->
Sem r (Either ParserError (Module 'Parsed 'ModuleTop))
commanMarkParser fileName input_ = do
res <- MK.commonmarkWith MK.defaultSyntaxSpec (toFilePath fileName) input_
case res of
Right (r :: Mk) -> runMarkdownModuleParser fileName r
Left r -> return . Left . ErrCommonmark . CommonmarkError $ r

topMarkdownModuleDef ::
(Members '[ParserResultBuilder, Error ParserError, PragmasStash, JudocStash] r) =>
ParsecS r (Module 'Parsed 'ModuleTop)
Expand Down Expand Up @@ -403,9 +393,6 @@ name = do
(Just p, n) -> NameQualified (QualifiedName (SymbolPath p) n)
(Nothing, n) -> NameUnqualified n

mkTopModulePath :: NonEmpty Symbol -> TopModulePath
mkTopModulePath l = TopModulePath (NonEmpty.init l) (NonEmpty.last l)

usingItem :: (Members '[ParserResultBuilder, PragmasStash, JudocStash] r) => ParsecS r (UsingItem 'Parsed)
usingItem = do
_usingModuleKw <- optional (kw kwModule)
Expand Down Expand Up @@ -454,19 +441,6 @@ topModulePath = mkTopModulePath <$> dottedSymbol
-- Top level statement
--------------------------------------------------------------------------------

infixl 3 <?|>

-- | Tries the left alternative. If it fails, backtracks and restores the contents of the pragmas and judoc stashes. Then parses the right alternative
(<?|>) :: (Members '[PragmasStash, JudocStash] r) => ParsecS r a -> ParsecS r a -> ParsecS r a
l <?|> r = do
p <- P.lift (get @(Maybe ParsedPragmas))
j <- P.lift (get @(Maybe (Judoc 'Parsed)))
let recover = do
P.lift (put p)
P.lift (put j)
r
P.withRecovery (const recover) (P.try l)

statement :: (Members '[Error ParserError, ParserResultBuilder, PragmasStash, JudocStash] r) => ParsecS r (Statement 'Parsed)
statement = P.label "<top level statement>" $ do
optional_ stashJudoc
Expand Down Expand Up @@ -1042,16 +1016,6 @@ namedApplicationNew = P.label "<named application>" $ do
let _namedApplicationNewExtra = Irrelevant ()
return NamedApplicationNew {..}

argumentBlockStart ::
forall r.
(Members '[ParserResultBuilder, PragmasStash, JudocStash] r) =>
ParsecS r (KeywordRef, IsImplicit, Symbol, Irrelevant KeywordRef)
argumentBlockStart = do
(l, impl) <- implicitOpen
n <- symbol
a <- Irrelevant <$> kw kwAssign
return (l, impl, n, a)

hole :: (Members '[ParserResultBuilder, PragmasStash, JudocStash] r) => ParsecS r (HoleType 'Parsed)
hole = kw kwHole

Expand Down Expand Up @@ -1199,12 +1163,6 @@ sideIfs = do
{ ..
}

prhsExpression :: (Members '[ParserResultBuilder, PragmasStash, JudocStash] r) => ParsecS r (RhsExpression 'Parsed)
prhsExpression = do
_rhsExpressionAssignKw <- Irrelevant <$> kw kwAssign
_rhsExpression <- parseExpressionAtoms
return RhsExpression {..}

pcaseBranchRhs :: (Members '[ParserResultBuilder, PragmasStash, JudocStash] r) => ParsecS r (CaseBranchRhs 'Parsed)
pcaseBranchRhs =
CaseBranchRhsExpression <$> pcaseBranchRhsExpression
Expand Down
1 change: 0 additions & 1 deletion src/Juvix/Compiler/Pipeline/Package/Loader.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Data.FileEmbed qualified as FE
import Juvix.Compiler.Concrete.Gen
import Juvix.Compiler.Concrete.Language
import Juvix.Compiler.Concrete.Print (ppOutDefaultNoComments)
import Juvix.Compiler.Concrete.Translation.FromSource hiding (symbol)
import Juvix.Compiler.Core.Language qualified as Core
import Juvix.Compiler.Pipeline.Package.Base
import Juvix.Compiler.Pipeline.Package.Loader.Error
Expand Down

0 comments on commit 9e00460

Please sign in to comment.