I am trying to parse a PGN file using ParseKit. I want to recognize the type of the token and take subsequent answer
PKTokenizer *t = [PKTokenizer tokenizerWithString:moveString];
[t.symbolState add:@"..."];
[t setTokenizerState:t.commentState from:'{' to:'{'];
[t.commentState addMultiLineStartMarker:@"{" endMarker:@"}"];
[t setTokenizerState:t.wordState from:'$' to:'$'];
t.commentState.reportsCommentTokens = YES;
PKToken *eof = [PKToken EOFToken];
PKToken *tok = nil;
while ((tok = [t nextToken]) != eof) {
NSLog(@" %@", [tok debugDescription]);
}
I want to add word type into an array only when symbol ( has been received.
Any documentation on using ParseKit will be a great help Thanks
Developer of ParseKit here.
Here’s a simple way to capture tokens within parentheses:
Prints: