From 50550928f8012343201834d481bd161c41fc0594 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 19 Jun 2018 23:01:04 +0200 Subject: [PATCH] Nuke --beautify and --output options --- src/saplcg.icl | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/src/saplcg.icl b/src/saplcg.icl index ecd8b3f..865a1cb 100644 --- a/src/saplcg.icl +++ b/src/saplcg.icl @@ -1,21 +1,14 @@ module saplcg -import StdBool import StdFile import StdList -import StdString -import StdTuple -import Data.Error from Data.Func import $, mapSt, seqSt from Data.Map import fromList, newMap -import Data.Maybe import System.CommandLine import System.Environment -import System.File import System.FilePath import System.Options -import System.Process import Text import Sapl.Target.CleanFlavour @@ -27,8 +20,6 @@ import Sapl.Target.JS.CodeGeneratorJS , libraries :: ![String] , modules :: ![String] , trampoline :: !Bool - , output :: !Maybe FilePath - , beautify :: !Maybe FilePath } defaultOptions :: Options @@ -38,8 +29,6 @@ defaultOptions = , libraries = ["StdEnv"] , modules = [] , trampoline = False - , output = Nothing - , beautify = Nothing } defaultParserState :: ParserState @@ -57,7 +46,7 @@ defaultParserState = Start w # ([prog:args],w) = getCommandLine w # noUsage = Nothing -# usage = Just ("Usage: " +++ prog +++ " [OPTIONS] -o OUTPUT MOD [MOD..]") +# usage = Just ("Usage: " +++ prog +++ " [OPTIONS] MOD [MOD..]") # opts = defaultOptions # (home,w) = getEnvironmentVariable "CLEAN_HOME" w @@ -66,27 +55,14 @@ Start w # opts = fromOk opts | isEmpty opts.modules = error usage "No modules given" w -| isNothing opts.output = error usage "No output file given" w -| isNothing opts.output && isJust opts.beautify = error Nothing "Cannot use beautifier when outputting to stdout" w # (files,(pst,w)) = mapSt (parseModule opts) opts.modules (defaultParserState,w) | any isNothing files = error Nothing "Parsing failed" w -# (ok,out,w) = case opts.output of - Nothing -> let (f,w`) = stdio w in (True,f,w`) - Just o -> fopen o FWriteText w +# (out,w) = stdio w # (out,_,w) = seqSt (genCode opts) [f \\ Just f <- files] (out,pst,w) # (_,w) = fclose out w -# w = case opts.beautify of - Nothing -> w - Just beautify - # (err,w) = callProcess beautify [out,"-o",out] Nothing w - with out = fromJust opts.output - | isError err - -> error Nothing ("Error while beautifying: " +++ snd (fromError err)) w - -> w - = w where optionDescription :: Option Options @@ -110,16 +86,6 @@ where "--trampoline" (\opts -> Ok {opts & trampoline=True}) "Turn on trampoline code" - , Shorthand "-b" "--beautify" $ Option - "--beautify" - (\b opts -> Ok {opts & beautify=Just b}) - "PROG" - "Name or path of a JavaScript beautifier" - , Shorthand "-o" "--output" $ Option - "--output" - (\f opts -> Ok {opts & output=Just f}) - "OUTPUT" - "File to write output to" , Operand False (\m opts -> Just $ Ok {opts & modules=opts.modules ++ [m]}) "MODULE" -- GitLab