mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-24 03:52:50 -06:00
Prevent Unicode characters in warning messages from stopping grammar compilation
When compiling a grammar containing characters that are not supported in the current locale, warning messages could cause GF fail with hPutChar: invalid argument (Invalid or incomplete multibyte or wide character) With this quick fix, warning messages that can not be displayed are silently truncated instead, and compilation continues.
This commit is contained in:
@@ -83,10 +83,12 @@ intermOut opts d doc
|
|||||||
|
|
||||||
warnOut opts warnings
|
warnOut opts warnings
|
||||||
| null warnings = return ()
|
| null warnings = return ()
|
||||||
| otherwise = ioeIO (hPutStrLn stderr $
|
| otherwise = ioeIO $ hPutStrLn stderr ws `catch` oops
|
||||||
if flag optVerbosity opts == Normal
|
where
|
||||||
then ('\n':warnings)
|
oops _ = hPutStrLn stderr "" -- prevent crash on character encoding problem
|
||||||
else warnings)
|
ws = if flag optVerbosity opts == Normal
|
||||||
|
then '\n':warnings
|
||||||
|
else warnings
|
||||||
|
|
||||||
-- | the environment
|
-- | the environment
|
||||||
type CompileEnv = (Int,SourceGrammar,ModEnv)
|
type CompileEnv = (Int,SourceGrammar,ModEnv)
|
||||||
|
|||||||
Reference in New Issue
Block a user