Re: reverse scanner
Re: reverse scanner
- Subject: Re: reverse scanner
- From: Tom Davie <email@hidden>
- Date: Sat, 10 Aug 2013 20:17:21 +0200
Heh, I’d actually argue that NSScanner is a much much better API to use here (and in fact nearly everywhere). Regular expressions constrain you only to regular grammars, which are a pretty small set. In my experience 99% of the use of them is actually trying to parse something that’s not *quite* a regular grammar, and uses a hack on top of regular expressions to do something not-quite-right.
NSScanner by comparison makes the separation of what’s scanning/tokenisation, and what’s up to your (turing complete) program much more clear. So basically, (at least in my opinion), if you want to parse something that’s regular, NSScanner is a great choice. If you want to parse something that’s context free, look at CoreParse (Not tooting my own horn, honest). And finally, if you want to parse something that’s more even than that, then you’re probably back to NSScanner and a turing complete program.
About the only use for regular expressions I can think of is asking NSScanner to scan something that it doesn’t by default know about.
Tom Davie
On 10 Aug 2013, at 19:53, Jerry Krinock <email@hidden> wrote:
>
> On 2013 Aug 10, at 10:07, Boyd Collier <email@hidden> wrote:
>
>> but if someone has already come up with a clean way of scanning in reverse
>
> In Mac OS X 10.7+, we have NSRegularExpression. In earlier systems, call out to Perl. Regexes are fun.
>
>
> _______________________________________________
>
> 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
_______________________________________________
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