• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using Flex/Lex in a Cocoa project
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using Flex/Lex in a Cocoa project


  • Subject: Re: Using Flex/Lex in a Cocoa project
  • From: Graham Cox <email@hidden>
  • Date: Sat, 16 Aug 2008 14:53:51 +1000


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 (email@hidden)

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:
This email sent to email@hidden


References: 
 >Using Flex/Lex in a Cocoa project (From: John Joyce <email@hidden>)
 >Re: Using Flex/Lex in a Cocoa project (From: Dustin Robert Kick <email@hidden>)

  • Prev by Date: RE: Threading problem using AsyncSocket
  • Next by Date: Re: Problem with NSImage and .PNG file
  • Previous by thread: Re: Using Flex/Lex in a Cocoa project
  • Next by thread: Re: Using Flex/Lex in a Cocoa project
  • Index(es):
    • Date
    • Thread