Commit 58ad1fea by Zachary Snow

allow reading from stdin

parent 95299c6f
......@@ -60,7 +60,8 @@ running `stack install`, or copy over the executable manually.
sv2v takes in a list of files and prints the converted Verilog to `stdout`.
Users may specify `include` search paths, define macros during preprocessing,
and exclude some of the conversions.
and exclude some of the conversions. Specifying `-` as an input file will read
from `stdin`.
Below is the current usage printout. This interface is subject to change.
......
......@@ -527,7 +527,10 @@ alexInitUserState = LS [] "" Map.empty [] [] []
-- public-facing lexer entrypoint
lexFile :: [String] -> Env -> FilePath -> IO (Either String ([Token], Env))
lexFile includePaths env path = do
str <- readFile path >>= return . normalize
str <-
if path == "-"
then getContents
else readFile path >>= return . normalize
let result = runAlex str $ setEnv >> alexMonadScan >> get
return $ case result of
Left msg -> Left msg
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment