diff options
author | Tristan Gingold <tgingold@free.fr> | 2015-01-21 06:00:16 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2015-01-21 06:00:16 +0100 |
commit | b2882d7837aa57b0af6c7dd57e30e19b07cce900 (patch) | |
tree | 409d7a28693f525c960c93ccf606d76eac4ac2d7 /src/libraries.adb | |
parent | 04d92625d6761d80feb826d5a04cfcbe54d3c0f4 (diff) | |
download | ghdl-b2882d7837aa57b0af6c7dd57e30e19b07cce900.tar.gz ghdl-b2882d7837aa57b0af6c7dd57e30e19b07cce900.tar.bz2 ghdl-b2882d7837aa57b0af6c7dd57e30e19b07cce900.zip |
Detect and report UTF BOM at beginning of source files.
Diffstat (limited to 'src/libraries.adb')
-rw-r--r-- | src/libraries.adb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libraries.adb b/src/libraries.adb index 9852c5261..0cca4d0b0 100644 --- a/src/libraries.adb +++ b/src/libraries.adb @@ -1353,8 +1353,15 @@ package body Libraries is Res : Iir_Design_File; begin Scanner.Set_File (File); - Res := Parse.Parse_Design_File; + if Scanner.Detect_Encoding_Errors then + -- Don't even try to parse such a file. The BOM will be interpreted + -- as an identifier, which is not valid at the beginning of a file. + Res := Null_Iir; + else + Res := Parse.Parse_Design_File; + end if; Scanner.Close_File; + if Res /= Null_Iir then Set_Parent (Res, Work_Library); Set_Design_File_Filename (Res, Files_Map.Get_File_Name (File)); |