ats-format 0.1.1.0 → 0.1.2.0
raw patch · 4 files changed
+11/−50 lines, 4 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Setup.hs +3/−44
- ats-format.cabal +2/−4
- src/Language/ATS/Lexer.x +1/−0
- src/Language/ATS/Parser.y +5/−2
Setup.hs view
@@ -1,49 +1,8 @@-import Control.Composition-import Control.Monad (unless, void)-import Data.Maybe+import Distribution.CommandLine import Distribution.Simple-import System.Directory (createDirectoryIfMissing)-import System.Environment (lookupEnv)-import System.Process (readCreateProcessWithExitCode, shell) -manpage :: IO String-manpage = readFile "man/atsfmt.1"- main :: IO () main = setManpath >>- writeManpages >>- writeBashCompletions >>+ writeManpages "man/atsfmt.1" "atsfmt.1" >>+ writeBashCompletions "atsfmt" >> defaultMain--setManpath :: IO ()-setManpath = do- home <- lookupEnv "HOME"- case home of- Just x -> do- let bashRc = x ++ "/.bashrc"- config <- readFile bashRc- unless (or (["#manpath updated by atsfmt", "#manpath updated by madlang"] <&> (`elem` lines config)))- (appendFile bashRc "\n#manpath updated by atsfmt\nexport MANPATH=~/.local/share:$MANPATH\n" >>- void (readCreateProcessWithExitCode (shell $ "MANPATH=" ++ x ++ "/.local/share mandb") ""))- Nothing -> pure ()--writeManpages :: IO ()-writeManpages = do- home <- lookupEnv "HOME"- case home of- Just x -> do- let manPath = x ++ "/.local/share/man/man1"- createDirectoryIfMissing True manPath- writeFile (manPath ++ "/atsfmt.1") =<< manpage- Nothing -> pure ()--writeBashCompletions :: IO ()-writeBashCompletions = do- home <- lookupEnv "HOME"- case home of- Just x -> do- let bashRc = x ++ "/.bashrc"- config <- readFile bashRc- unless ("# Added by atsfmt" `elem` lines config)- (appendFile bashRc "\n# Added by atsfmt\neval \"$(atsfmt --bash-completion-script atsfmt)\"\n")- Nothing -> pure ()
ats-format.cabal view
@@ -1,5 +1,5 @@ name: ats-format-version: 0.1.1.0+version: 0.1.2.0 synopsis: A source-code formatter for ATS description: An opinionated source-code formatter for [ATS](http://www.ats-lang.org/). homepage: https://hub.darcs.net/vmchale/ats-format#readme@@ -26,9 +26,7 @@ custom-setup setup-depends: base , Cabal- , directory- , composition-prelude- , process >= 1.4.0.0+ , cli-setup >= 0.1.0.2 Flag development { Description: Enable `-Werror`
src/Language/ATS/Lexer.x view
@@ -218,6 +218,7 @@ $special { tok (\p s -> Special p s) } "effmask_all" { tok (\p s -> Identifier p s) } "effmask_wrt" { tok (\p s -> Identifier p s) }+ "extype" { tok (\p s -> Identifier p s) } @identifier / " " { tok (\p s -> IdentifierSpace p s) } @identifier { tok (\p s -> Identifier p s) } @string { tok (\p s -> StringTok p s) }
src/Language/ATS/Parser.y view
@@ -111,6 +111,7 @@ floatLit { FloatTok _ $$ } effmaskWrt { Identifier $$ "effmask_wrt" } effmaskAll { Identifier $$ "effmask_all" }+ extype { Identifier $$ "extype" } extfcall { Identifier $$ "extfcall" } ldelay { Identifier $$ "ldelay" } listVT { Identifier $$ "list_vt" }@@ -450,6 +451,7 @@ | dollar identifier dot identifierSpace { Qualified $1 (to_string $4) (to_string $2) } | dollar effmaskWrt { SpecialName $1 "effmask_wrt" } | dollar effmaskAll { SpecialName $1 "effmask_all" }+ | dollar extype { SpecialName $1 "effmask_all" } | dollar listVT { SpecialName $1 "list_vt" } | dollar ldelay { SpecialName $1 "ldelay" } -- FIXME there is probably a better/more efficient way of doing this | underscore {% Left $ Expected $1 "Name" "_" }@@ -599,6 +601,7 @@ | abst0p IdentifierOr eq Type { AbsT0p $1 $2 $4 } | viewdef IdentifierOr openParen FullArgs closeParen eq Type { ViewDef $1 $2 $4 $7 } | absvt0p IdentifierOr openParen FullArgs closeParen MaybeType { AbsVT0p $1 $2 $4 $6 }+ | absvt0p IdentifierOr eq Type { AbsVT0p $1 $2 [] (Just $4) } | absview IdentifierOr openParen FullArgs closeParen MaybeType { AbsView $1 $2 $4 $6 } | abstype IdentifierOr openParen FullArgs closeParen MaybeType { AbsType $1 $2 $4 $6 } | absvtype IdentifierOr openParen FullArgs closeParen MaybeType { AbsViewType $1 $2 $4 $6 }@@ -625,8 +628,8 @@ -- | Parse a declaration Declaration : include string { Include $2 } | define { Define $1 }- | define identifierSpace string { Define ($1 ++ to_string $2 ++ $3) } -- FIXME better approach?- | define identifierSpace intLit { Define ($1 ++ to_string $2 ++ " " ++ show $3) }+ | define identifierSpace string { Define ($1 ++ " " ++ to_string $2 ++ $3) } -- FIXME better approach?+ | define identifierSpace intLit { Define ($1 ++ " " ++ to_string $2 ++ " " ++ show $3) } | cblock { CBlock $1 } | lineComment { Comment (to_string $1) } | staload underscore eq string { Staload (Just "_") $4 }