Commit d335d2ff by Zachary Snow

use UTF-8 across all platforms

- all inputs are now decoded as UTF-8, regardless of the platform
- decoding failures are now tolerated via transliteration given errant
  characters are generally expected to appear in comments
parent bceec393
......@@ -22,6 +22,8 @@
* Support parameters which use a type-of as the data type
* Support typed valued parameters declared in parameter port lists without
explicitly providing a leading `parameter` or `localparam` marker
* Use UTF-8 on all platforms and tolerate transcoding failures, enabling reading
files encoding using Latin-1 with special characters in comments
## v0.0.8
......
......@@ -19,9 +19,11 @@ import Control.Monad.State.Strict
import Data.Char (ord)
import Data.List (tails, isPrefixOf, findIndex, intercalate)
import Data.Maybe (isJust, fromJust)
import GHC.IO.Encoding.Failure (CodingFailureMode(TransliterateCodingFailure))
import GHC.IO.Encoding.UTF8 (mkUTF8)
import System.Directory (findFile)
import System.FilePath (dropFileName)
import System.IO (hGetContents, openFile, stdin, IOMode(ReadMode))
import System.IO (hGetContents, hSetEncoding, openFile, stdin, IOMode(ReadMode))
import qualified Data.Map.Strict as Map
import Language.SystemVerilog.Parser.Tokens (Position(..))
......@@ -107,6 +109,7 @@ loadFile path = do
if path == "-"
then return stdin
else openFile path ReadMode
hSetEncoding handle $ mkUTF8 TransliterateCodingFailure
contents <- hGetContents handle
return $ normalize contents
......
module top;
//
initial $display("Hi!");
endmodule
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