On 16 Aug 2008, at 1:56 pm, Dustin Robert Kick wrote:

Just a thought, I haven't tried it, but the Core Foundation code is pure C, so you could send the NSString as a CFString, which is "toll- free bridged", which should mean you don't even have to make a cast (though, again, I haven't worked with this), but basically, you should be able to create a pure C function that invokes the lexer, and write the flex code to use the Core Foundation libraries, accepting a CFString, and I think that's all you'd need.



Dustin          
KC9MEL  


On Aug 15, 2008, at 9:53 PM, John Joyce wrote:

Right now, I'm toying with using Flex/Lex in a Cocoa project.
Unfortunately, I don't see a reliable or easy way to handle NSStrings correctly all the time with Flex. Does anybody have any suggestions for such text handling and reliable unicode aware regexes? I'm seriously not interested in implementing such details in C with Flex. Flex is fast and cool for that, but if it's going to be stupidly difficult to use reliably with other languages on a mac, it's not a good idea for me.


It's a bit unclear what you're asking. Is it about using unicode with Flex, or using Flex with Cocoa?

Since Obj-C is C plus a few bells and whistles, there's no difficulty in calling Flex from Cocoa - the comment about using CFString instead of NSString doesn't seem particularly relevant - since it's just a pointer you can pass it into C code either way. Where Flex would need to access NSString you could do that via an external wrapper function compiled as Obj-C or just compile Flex using a .m file instead of .c and call NSString's Obj-C methods directly. That should work, not that I've tried it...

I have used BISON with Cocoa in a similar way and didn't run into any particular difficulties.

hth,

Graham
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to