mirror of https://github.com/zachjs/sv2v.git
allow reading from stdin
This commit is contained in:
parent
95299c6f56
commit
58ad1feab1
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue