@@ -42,7 +42,7 @@ import System.FilePath
4242----- COMPILER FLAGS -----------------------------------------------------------
4343
4444data Flag
45- = IRMode
45+ = TextIRMode
4646 | JSONIRMode
4747 | LibMode
4848 | NoRawOpt
@@ -54,12 +54,12 @@ data Flag
5454
5555options :: [OptDescr Flag ]
5656options =
57- [ Option [' i ' ] [ " ir" ] (NoArg IRMode ) " ir interactive mode"
58- , Option [' j ' ] [" json" ] (NoArg JSONIRMode ) " ir json interactive mode"
57+ [ Option [] [ " text- ir" ] (NoArg TextIRMode ) " ir interactive mode (text) "
58+ , Option [] [" json-ir " ] (NoArg JSONIRMode ) " ir interactive mode (json) "
5959 , Option [] [" no-rawopt" ] (NoArg NoRawOpt ) " disable Raw optimization"
6060 , Option [' v' ] [" verbose" ] (NoArg Verbose ) " verbose output"
6161 , Option [' d' ] [" debug" ] (NoArg Debug ) " debugging information in the .js file"
62- , Option [] [" lib" ] (NoArg LibMode ) " compiling a library"
62+ , Option [] [" lib" ] (NoArg LibMode ) " compiling a library [deprecated] "
6363 , Option [' h' ] [" help" ] (NoArg Help ) " print usage"
6464 , Option [' o' ] [" output" ] (ReqArg OutputFile " FILE" ) " output FILE"
6565 ]
@@ -193,7 +193,7 @@ writeExports path exports =
193193--------------------------------------------------------------------------------
194194----- DESERIALIZATION FOR INTERACTIVE MODES ------------------------------------
195195
196- fromStdin putFormattedLn = do
196+ fromStdinIR putFormattedLn = do
197197 eof <- isEOF
198198 if eof then exitSuccess else do
199199 input <- BS. getLine
@@ -211,12 +211,12 @@ fromStdin putFormattedLn = do
211211 debugOut $ " decoding error" ++ s
212212 putStrLn " " -- magic marker to be recognized by the JS runtime; 2018-03-04; aa
213213 hFlush stdout
214- fromStdin putFormattedLn
214+ fromStdinIR putFormattedLn
215215 -- AA: 2018-07-15: consider timestamping these entries
216216 where debugOut s = appendFile " /tmp/debug" (s ++ " \n " )
217217
218- fromStdinIR = fromStdin (putStrLn . IR2JS. irToJSString)
219- fromStdinIRJson = fromStdin (BSLazyChar8. putStrLn . IR2JS. irToJSON)
218+ fromStdinTextIR = fromStdinIR (putStrLn . IR2JS. irToJSString)
219+ fromStdinJsonIR = fromStdinIR (BSLazyChar8. putStrLn . IR2JS. irToJSON)
220220
221221--------------------------------------------------------------------------------
222222----- MAIN ---------------------------------------------------------------------
@@ -233,11 +233,8 @@ main = do
233233 putStrLn compilerUsage
234234 exitSuccess
235235
236- ([JSONIRMode ], [] , [] ) -> fromStdinIRJson
237-
238- ([IRMode ], [] , [] ) -> do
239- fromStdinIR
240- -- hSetBuffering stdout NoBuffering
236+ ([TextIRMode ], [] , [] ) -> fromStdinTextIR
237+ ([JSONIRMode ], [] , [] ) -> fromStdinJsonIR
241238
242239 (o, [file], [] ) | optionsOK o ->
243240 fromFile o file
@@ -253,7 +250,7 @@ main = do
253250 optionsOK :: [Flag ] -> Bool
254251 optionsOK o | length o >= 2 =
255252 -- certain options must not be combined
256- not . or $ map (`elem` o) [IRMode , Help ]
253+ not . or $ map (`elem` o) [TextIRMode , Help ]
257254 optionsOK _ = True
258255
259256
0 commit comments