diff --git a/.ghci b/.ghci index 65dc2f7b2..d8fd64b8d 100644 --- a/.ghci +++ b/.ghci @@ -25,7 +25,7 @@ assignmentExample lang = case lang of "Markdown" -> mk "md" "markdown" "JSON" -> mk "json" "json" _ -> mk "" "" - where mk fileExtension parser = putStrLn ("example: fmap (() <$) . runTask . parse " ++ parser ++ "Parser =<< Semantic.Util.file \"example." ++ fileExtension ++ "\"") >> return ("import Parser\nimport Semantic.Task\nimport Semantic.Util") + where mk fileExtension parser = putStrLn ("example: fmap (() <$) . runTask . parse " ++ parser ++ "Parser =<< Semantic.Util.file \"example." ++ fileExtension ++ "\"") >> return ("import Parsing.Parser\nimport Semantic.Task\nimport Semantic.Util") :} :undef assignment :def assignment assignmentExample diff --git a/semantic-diff.cabal b/semantic-diff.cabal index 925d97ace..7ade087f8 100644 --- a/semantic-diff.cabal +++ b/semantic-diff.cabal @@ -63,9 +63,9 @@ library , Language.Python.Assignment , Language.Python.Grammar , Language.Python.Syntax - , Parser - , Parser.CMark - , Parser.TreeSitter + , Parsing.Parser + , Parsing.CMark + , Parsing.TreeSitter , Paths_semantic_diff , Renderer , Renderer.JSON diff --git a/src/Language/Markdown/Assignment.hs b/src/Language/Markdown/Assignment.hs index 3c3dc3826..4ee3d7fda 100644 --- a/src/Language/Markdown/Assignment.hs +++ b/src/Language/Markdown/Assignment.hs @@ -19,7 +19,7 @@ import qualified Data.Text as Text import Data.Text.Encoding (encodeUtf8) import Data.Union import GHC.Stack -import Parser.CMark as Grammar (Grammar(..)) +import Parsing.CMark as Grammar (Grammar(..)) import qualified Language.Markdown.Syntax as Markup type Syntax = diff --git a/src/Parsing/AST.hs b/src/Parsing/AST.hs new file mode 100644 index 000000000..ae2e6f985 --- /dev/null +++ b/src/Parsing/AST.hs @@ -0,0 +1 @@ +module Parsing.AST where diff --git a/src/Parser/CMark.hs b/src/Parsing/CMark.hs similarity index 99% rename from src/Parser/CMark.hs rename to src/Parsing/CMark.hs index f43b24d49..6795a7f10 100644 --- a/src/Parser/CMark.hs +++ b/src/Parsing/CMark.hs @@ -1,5 +1,5 @@ {-# LANGUAGE DataKinds, TypeOperators #-} -module Parser.CMark +module Parsing.CMark ( Grammar(..) , cmarkParser , toGrammar diff --git a/src/Parser.hs b/src/Parsing/Parser.hs similarity index 99% rename from src/Parser.hs rename to src/Parsing/Parser.hs index c0fd3fac2..a380ee2b8 100644 --- a/src/Parser.hs +++ b/src/Parsing/Parser.hs @@ -1,5 +1,5 @@ {-# LANGUAGE ConstraintKinds, DataKinds, GADTs, RankNTypes, ScopedTypeVariables, TypeFamilies, TypeOperators #-} -module Parser +module Parsing.Parser ( Parser(..) , SomeParser(..) , someParser diff --git a/src/Parser/TreeSitter.hs b/src/Parsing/TreeSitter.hs similarity index 99% rename from src/Parser/TreeSitter.hs rename to src/Parsing/TreeSitter.hs index b99c64b5a..a28bdc3cc 100644 --- a/src/Parser/TreeSitter.hs +++ b/src/Parsing/TreeSitter.hs @@ -1,5 +1,5 @@ {-# LANGUAGE DataKinds, ScopedTypeVariables, TypeOperators #-} -module Parser.TreeSitter +module Parsing.TreeSitter ( treeSitterParser , parseToAST ) where diff --git a/src/Semantic.hs b/src/Semantic.hs index 815624a26..40c544ea1 100644 --- a/src/Semantic.hs +++ b/src/Semantic.hs @@ -27,7 +27,7 @@ import Decorator import Info import Diffing.Interpreter import qualified Language -import Parser +import Parsing.Parser import Renderer import Semantic.Task as Task import Semantic.Stat as Stat diff --git a/src/Semantic/Task.hs b/src/Semantic/Task.hs index 6b7a1c7cc..904cea13b 100644 --- a/src/Semantic/Task.hs +++ b/src/Semantic/Task.hs @@ -47,9 +47,9 @@ import Data.Union import Decorator (RAlgebra, decoratorWithAlgebra) import Info hiding (Category(..)) import Language -import Parser -import Parser.CMark -import Parser.TreeSitter +import Parsing.Parser +import Parsing.CMark +import Parsing.TreeSitter import System.Exit (die) import System.IO (Handle, stderr) import qualified Semantic.IO as IO diff --git a/src/Semantic/Util.hs b/src/Semantic/Util.hs index 7c7b862f7..f64dfd486 100644 --- a/src/Semantic/Util.hs +++ b/src/Semantic/Util.hs @@ -14,7 +14,7 @@ import Data.Span import Data.Term import Diffing.Algorithm import Diffing.Interpreter -import Parser +import Parsing.Parser import Renderer.TOC import Semantic import Semantic.IO as IO diff --git a/test/TOCSpec.hs b/test/TOCSpec.hs index ec5ac78fc..e9f61a65d 100644 --- a/test/TOCSpec.hs +++ b/test/TOCSpec.hs @@ -26,6 +26,7 @@ import Info hiding (Go) import Diffing.Algorithm.RWS import Diffing.Interpreter import Language +import Parsing.Parser import Prelude hiding (readFile) import Renderer import Renderer.TOC @@ -38,7 +39,6 @@ import Test.Hspec (Spec, describe, it, parallel, pending) import Test.Hspec.Expectations.Pretty import Test.Hspec.LeanCheck import Test.LeanCheck -import Parser spec :: Spec spec = parallel $ do