Parse/tokenize objective-c with objective-c (iPhon

2019-08-04 16:48发布

问题:

What are the options available of parsing and/or tokenizing Objective-C on iPhone?

Essentially I'm thinking of parsing/tokenizing enough to power syntax highlighting and autocompletion at somewhat the same level as Xcode does.

回答1:

I know the topic is old, but this might help someone else.

Apple already provides the (very nice) CFStringTokenizer, with support for multiple languages. Here's a good presentation on that, including sample code. In case tokenization is enough, that should do it.

If parsing is required however (it shouldn't for syntax highlight) there's ParseKit or C-based solutions, such as YACC.

Best.