Re: [F-Script-talk] Patch to allow full unicode string constants.
Brought to you by:
pmougin
From: Philippe M. <pm...@ac...> - 2008-03-23 17:07:02
|
Nice one. I've applied it and it will be in the next alpha. Note: I put the isnotascii test at the the top level of the scan method (just before the isalpha test), where it will catch more invalid inputs. Cheers, Philippe Le 19 mars 08 à 10:32, Niko Matsakis a écrit : > Hello, > > I am considering using FScript to add some scriptability to one of > my Cocoa applications, but I really need the ability to parse full > unicode string constants. I was looking at the FScript 2.0 sources > (I also want garbage collection, and my scripting needs are pretty > simple so I haven't run across ny abugs yet), and I modified the > FSCompiler so that it expects a UTF-8 encoded input string. I also > modified invocation sites to use UTF8String rather than cString, or > ISOLatin1 encoding. The patch is actually pretty small (I have > attached it if you are interested). There are probably some > mistakes, but I think that it will catch attempts to use non-ASCII > characters outside of a string constant and report an error. > > I had originally intended to modify the FSCompiler to operator from > an NSString instead of a char*, but this seemed easier and it did > not raise any kind of backwards compatibility issues (I was not sure > if there were any other callers of the FSCompiler compileCode: > methods besides those obvious in the code base, so changing from a > char* to an NSString* might break them). Of course, it would always > be possible to add new methods (compileCodeString: or some such). I > figure that since all previous inputs were restricted to the ASCII > character set, switching to UTF-8 does not really introduce > backwards compatibility issues, all though I suppose there could be > users even today with accented characters or something like that. > > Anyhow, thank you for all your great work on F-Script! > > > Niko > <utf8strs.diff> > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________ > F-Script-talk mailing list > F-S...@li... > https://lists.sourceforge.net/lists/listinfo/f-script-talk |