gdupont1 / rodin-hs

A collection of Haskell modules for handling Rodin files
GNU General Public License v3.0
0 stars 0 forks source link

Crash on Windows #12

Closed gdupont1 closed 2 years ago

gdupont1 commented 2 years ago

The tool crashes sometimes on windows; this is most likely due to \r characters.

gdupont1 commented 2 years ago

I managed to isolate the bug from the Tokenizer

ghci> l = explode "a+b:NAT\r\n"
ghci> l
["a"[[I]]<<1>>,"+"[[O]]<<2>>,"b"[[I]]<<3>>,":"[[O]]<<4>>,"NAT"[[I]]<<5>>,"\r"[[S]]<<8>>,"\n"[[S]]<<9>>]
ghci> extract showAscii l
Right [TokIdent "a",TokOp Plus,TokIdent "b",TokOp In,TokIdent "NAT",TokSpace *** Exception: Maybe.fromJust: Nothing
CallStack (from HasCallStack):
  error, called at libraries/base/Data/Maybe.hs:148:21 in base:Data.Maybe
  fromJust, called at Rodin/Formula/Tokenizer.hs:175:46 in main:Rodin.Formula.Tokenizer
ghci>