Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!microsoft!earleh From: earleh@microsoft.UUCP (Earle HORTON) Newsgroups: comp.sys.mac.programmer Subject: Re: Flex for MPW Message-ID: <56615@microsoft.UUCP> Date: 16 Aug 90 15:30:41 GMT References: <2632@sequent.cs.qmw.ac.uk> Reply-To: earleh@microsoft.UUCP (Earle HORTON) Organization: Microsoft Corp., Redmond WA Lines: 29 In article <2632@sequent.cs.qmw.ac.uk> morten@cs.qmw.ac.uk (Morten Ronseth) writes: > >For the last couple of days, I've been trying to port flex to the MPW >environment. Everything compiles just fine, no problems there. >But, whatever *.l file i run flex on, it seems to gag and die. For >example, on an empty input file, it does... >... Can anyone tell me why it chokes on an input like this? > >This might not be the correct group to post this to, but I thought I'd give it >a go. It is probably because under the MPW C compiler, '\n' is actually 13, 0x0d, \015, more conventionally named '\r' under other C implementations. As far as the scanner tables in "scan.c" are concerned, however, the Macintosh end-of-line character is just some random control character, not needing the special consideration given to a "real" linefeed. Find the equivalence class translation table in "scan.c" and transpose the (zero-based) tenth and thirteenth elements. Then go through the code and fix up all the places where it is assumed that '\n' is equal to decimal 10. Then implement a bunch more fixes to allow Flex to scan Macintosh extended character set characters. Better yet, get a copy of the already-ported-to-the-Macintosh version. Available via ftp from apple.com and sumex-aim.stanford.edu. Also available from me in exchange for SASE, formatted 800k floppy, and sufficient postage to get it back to you. Earle Horton