mirror of
https://github.com/gren-lang/compiler.git
synced 2024-08-16 20:10:23 +03:00
Extract Gren.Format
This commit is contained in:
parent
0ef8831280
commit
49fd254f25
9
compiler/src/Gren/Format.hs
Normal file
9
compiler/src/Gren/Format.hs
Normal file
@ -0,0 +1,9 @@
|
||||
module Gren.Format (toByteString) where
|
||||
|
||||
import qualified AST.Source as Src
|
||||
import qualified Data.ByteString as BS
|
||||
|
||||
toByteString :: Src.Module -> BS.ByteString
|
||||
toByteString =
|
||||
-- TODO: implement actual formating
|
||||
undefined
|
@ -91,6 +91,7 @@ Common gren-common
|
||||
Gren.Constraint
|
||||
Gren.Docs
|
||||
Gren.Float
|
||||
Gren.Format
|
||||
Gren.Interface
|
||||
Gren.Kernel
|
||||
Gren.Licenses
|
||||
|
@ -12,7 +12,9 @@ import qualified Data.ByteString as BS
|
||||
import qualified Data.NonEmptyList as NE
|
||||
import qualified Directories as Dirs
|
||||
import qualified File
|
||||
import qualified Gren.Format as Format
|
||||
import qualified Gren.Outline as Outline
|
||||
import qualified Parse.Module as Parse
|
||||
import qualified Reporting
|
||||
import qualified Reporting.Doc as D
|
||||
import qualified Reporting.Exit as Exit
|
||||
@ -154,5 +156,9 @@ formatExistingFile path =
|
||||
|
||||
formatByteString :: BS.ByteString -> BS.ByteString
|
||||
formatByteString original =
|
||||
-- TODO: implement actual formating
|
||||
original
|
||||
case Parse.fromByteString Parse.Application original of
|
||||
Left _ ->
|
||||
-- TODO: report error
|
||||
original
|
||||
Right ast ->
|
||||
Format.toByteString ast
|
||||
|
Loading…
Reference in New Issue
Block a user