@@ -43,7 +43,7 @@ import System.FilePath
4343----- COMPILER FLAGS -----------------------------------------------------------
4444
4545data Flag
46- = IRMode
46+ = TextIRMode
4747 | JSONIRMode
4848 | LibMode
4949 | NoRawOpt
@@ -55,12 +55,12 @@ data Flag
5555
5656options :: [OptDescr Flag ]
5757options =
58- [ Option [' i ' ] [ " ir" ] (NoArg IRMode ) " ir interactive mode"
59- , Option [' j ' ] [" json" ] (NoArg JSONIRMode ) " ir json interactive mode"
58+ [ Option [] [ " text- ir" ] (NoArg TextIRMode ) " ir interactive mode (text) "
59+ , Option [] [" json-ir " ] (NoArg JSONIRMode ) " ir interactive mode (json) "
6060 , Option [] [" no-rawopt" ] (NoArg NoRawOpt ) " disable Raw optimization"
6161 , Option [' v' ] [" verbose" ] (NoArg Verbose ) " verbose output"
6262 , Option [' d' ] [" debug" ] (NoArg Debug ) " debugging information in the .js file"
63- , Option [] [" lib" ] (NoArg LibMode ) " compiling a library"
63+ , Option [] [" lib" ] (NoArg LibMode ) " compiling a library [deprecated] "
6464 , Option [' h' ] [" help" ] (NoArg Help ) " print usage"
6565 , Option [' o' ] [" output" ] (ReqArg OutputFile " FILE" ) " output FILE"
6666 ]
@@ -194,7 +194,7 @@ writeExports path exports =
194194--------------------------------------------------------------------------------
195195----- DESERIALIZATION FOR INTERACTIVE MODES ------------------------------------
196196
197- fromStdin putFormattedLn = do
197+ fromStdinIR putFormattedLn = do
198198 eof <- isEOF
199199 if eof then exitSuccess else do
200200 input <- BS. getLine
@@ -212,12 +212,12 @@ fromStdin putFormattedLn = do
212212 debugOut $ " decoding error" ++ s
213213 putStrLn " " -- magic marker to be recognized by the JS runtime; 2018-03-04; aa
214214 hFlush stdout
215- fromStdin putFormattedLn
215+ fromStdinIR putFormattedLn
216216 -- AA: 2018-07-15: consider timestamping these entries
217217 where debugOut s = appendFile " /tmp/debug" (s ++ " \n " )
218218
219- fromStdinIR = fromStdin (putStrLn . IR2JS. irToJSString)
220- fromStdinIRJson = fromStdin (BSLazyChar8. putStrLn . IR2JS. irToJSON)
219+ fromStdinTextIR = fromStdinIR (putStrLn . IR2JS. irToJSString)
220+ fromStdinJsonIR = fromStdinIR (BSLazyChar8. putStrLn . IR2JS. irToJSON)
221221
222222--------------------------------------------------------------------------------
223223----- MAIN ---------------------------------------------------------------------
@@ -234,11 +234,8 @@ main = do
234234 putStrLn compilerUsage
235235 exitSuccess
236236
237- ([JSONIRMode ], [] , [] ) -> fromStdinIRJson
238-
239- ([IRMode ], [] , [] ) -> do
240- fromStdinIR
241- -- hSetBuffering stdout NoBuffering
237+ ([TextIRMode ], [] , [] ) -> fromStdinTextIR
238+ ([JSONIRMode ], [] , [] ) -> fromStdinJsonIR
242239
243240 (o, [file], [] ) | optionsOK o ->
244241 fromFile o file
@@ -254,7 +251,7 @@ main = do
254251 optionsOK :: [Flag ] -> Bool
255252 optionsOK o | length o >= 2 =
256253 -- certain options must not be combined
257- not . or $ map (`elem` o) [IRMode , Help ]
254+ not . or $ map (`elem` o) [TextIRMode , Help ]
258255 optionsOK _ = True
259256
260257
0 commit comments