Ticket #5 (closed defect: fixed)

Opened 19 months ago

Last modified 19 months ago

Chokes on DOS style newlines in combination with preprocessor comments

Reported by: ezyang Owned by: benedikt
Priority: major Milestone:
Component: parser Version: 0.3.1.1
Keywords: Cc: ezyang@…

Description

Under certain circumstances, DOS style newlines can cause Language.C to become unhappy.

ezyang@javelin:~$ cat min.i 
# 1 "foobar.h"

int main() {}
ezyang@javelin:~$ cat test.hs 
import Language.C
main = do
    (Right r) <- parseCFilePre "min.i"
    putStrLn "Ok"
ezyang@javelin:~$ runghc test.hs 
Ok
ezyang@javelin:~$ todos min.i 
ezyang@javelin:~$ runghc test.hs 
test.hs: user error (Pattern match failure in do expression at test.hs:3:4-12)

Change History

Changed 19 months ago by ezyang

The error given is:

min.i:1: (column 1) [ERROR]  >>> Syntax Error !
  Lexical error !
  The character '#' does not fit here.

Changed 19 months ago by benedikt

  • status changed from new to closed
  • resolution set to fixed

Thank you for the bug report; for line pragmas, the lexer did not deal with DOS style newlines correctly. This is now fixed in the darcs repository.

  Allow optional \r before \n (DOS newline) when lexing line pragmas 
  benedikt.huber@gmail.com**20100713230011
  Ignore-this: 4f8dc3973926b89e37f7e506a3d6710

Changed 19 months ago by ezyang

  • cc ezyang@… added

Awesome! Can't wait to see a release with this fix.

Note: See TracTickets for help on using tickets.