diff --git a/README.md b/README.md index f251ae7..410af4c 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/Language/SystemVerilog/Parser/Lex.x b/src/Language/SystemVerilog/Parser/Lex.x index 2465130..11e2e8e 100644 --- a/src/Language/SystemVerilog/Parser/Lex.x +++ b/src/Language/SystemVerilog/Parser/Lex.x @@ -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