parsekit

Custom objects in ParseKit Actions

廉价感情. 提交于 2019-12-11 11:33:38
问题 I am very intrigued by the ability to add actions to ParseKit grammars. There is surprisingly little documentation on what is available in those actions. Say I have two rules like: databaseName = Word; createTableStmt ='CREATE' ('TEMP'| 'TEMPORARY')? 'TABLE' 'IF NOT EXISTS'? databaseName; This obviously isn't a whole grammar but will serve as an example. When parsing i'd like to "return" a CreateTableStmt object that has certain properties. If I understand the tool correctly i'd add an action

Parsekit: how to match individual quote characters?

一个人想着一个人 提交于 2019-12-11 01:19:21
问题 When using the parser Parsekit for the iPhone. Is it possible to include against a double quote? And things which are part of the special BNF? (Is it possible to escape sequences in a defined grammer?) @start = doublequote+; doublequote= '"' 回答1: Developer of ParseKit here. By default you can match against quoted strings easily using the built-in QuotedString parser (which will match QuotedString tokens): @start = quotes; quotes = QuotedString+; that would match input like: "foo" 'bar' "baz"

Xcode armv7 issue

两盒软妹~` 提交于 2019-12-08 09:31:04
问题 My application builds fine for the simulator but not the device: ld: warning: ignoring file /Users/newuser/Downloads/release-1.5-tag/build/Release-iphoneos/parsekit.a, file was built for archive which is not the architecture being linked (armv7) I'm using the ParseKit lib which doesn't seem to like being mixed with armv7. I think I have to do some form of linking with the library? But how? Thanks. 回答1: You seem to have linked the library, only it is not built for armv7. The ParseKit Xcode

ParseKit assembler callbacks not called: What am I doing wrong?

不问归期 提交于 2019-12-07 17:47:25
问题 Having got to grips a bit with the ParseKit grammar syntax (playing around in the demo app) I'm now trying to get my own mini demo working, but so far without much success. The assembler callbacks are not getting called. Below is a condensed version of the relevant code. When testParse runs the parser seems to do it's thing OK and correctly match my string to my anything production (which also works in the demo) but didMatchAnything: is just not getting called. #import <Foundation/Foundation

How to debug an invalid ParseKit Grammar?

烂漫一生 提交于 2019-12-06 04:12:36
I am trying to write a grammar for ParseKit so that it matches basic propositional logic sentences in an iphone app. Can someone please tell me where im going wrong. @start = wff; wff = disjunction (implies disjunction)?; disjunction = conjuction (or conjuction)*; conjunction = notExpression (and notExpression)*; notExpression = (not | not primaryExpression); primaryExpression = variable | lbracket wff rbracket; variable = p | q | r; p = 'P'; q = 'Q'; r = 'R'; implies = '→'; and = '∧'; or = '∨'; not = '¬'; lbracket = '('; rbracket = ')'; Also how would i go about adding some extra call backs

ParseKit assembler callbacks not called: What am I doing wrong?

不打扰是莪最后的温柔 提交于 2019-12-06 01:05:10
Having got to grips a bit with the ParseKit grammar syntax (playing around in the demo app) I'm now trying to get my own mini demo working, but so far without much success. The assembler callbacks are not getting called. Below is a condensed version of the relevant code. When testParse runs the parser seems to do it's thing OK and correctly match my string to my anything production (which also works in the demo) but didMatchAnything: is just not getting called. #import <Foundation/Foundation.h> @class PKParser; @interface FileParserThing : NSObject { PKParser* _parser; } - (void)testParse;

parsekit given unexpected calls to selectors

…衆ロ難τιáo~ 提交于 2019-12-01 09:20:40
I have the following very simple (test) grammer file @start = expression+; expression = keyword | otherWord; otherWord = Word; keyword = a | the; a = 'a'; the = 'the'; Then I run the following code: // Grammer contains the contents of the above grammer file. PKParser *parser = [[PKParserFactory factory] parserFromGrammar:grammer assembler:self]; NSString *s = @"The parrot"; [parser parse:s]; PKReleaseSubparserTree(parser); And the following methods: - (void)didMatchA:(PKAssembly *)a{ [self log:a type:@"didMatchA "]; } - (void)didMatchThe:(PKAssembly *)a{ [self log:a type:@"didMatchThe "]; } -

parsekit given unexpected calls to selectors

这一生的挚爱 提交于 2019-12-01 05:53:26
问题 I have the following very simple (test) grammer file @start = expression+; expression = keyword | otherWord; otherWord = Word; keyword = a | the; a = 'a'; the = 'the'; Then I run the following code: // Grammer contains the contents of the above grammer file. PKParser *parser = [[PKParserFactory factory] parserFromGrammar:grammer assembler:self]; NSString *s = @"The parrot"; [parser parse:s]; PKReleaseSubparserTree(parser); And the following methods: - (void)didMatchA:(PKAssembly *)a{ [self

How do ParseKit's Assembler Callbacks work? Where should I store the work I do in them?

流过昼夜 提交于 2019-11-30 20:34:19
How should I use callback functions in parsekit? suppose I have the following rule: expr_s = expr_p '+' expr_s | expr_p ; should I pop 3 symbols from the resulting PKAssembly and add first and last numbers and then push the answer back to the stack? And for the above rule how should I know it is the first or the second rule that caused a match? I don't understand the order in which ParseKit calls callback functions. I could really use some help. Thanks Todd for your response, keeping in mind your instructions I wrote the following grammar and callback functions for a simple mathematics

How do ParseKit's Assembler Callbacks work? Where should I store the work I do in them?

杀马特。学长 韩版系。学妹 提交于 2019-11-30 05:03:13
问题 How should I use callback functions in parsekit? suppose I have the following rule: expr_s = expr_p '+' expr_s | expr_p ; should I pop 3 symbols from the resulting PKAssembly and add first and last numbers and then push the answer back to the stack? And for the above rule how should I know it is the first or the second rule that caused a match? I don't understand the order in which ParseKit calls callback functions. I could really use some help. Thanks Todd for your response, keeping in mind