I don't know if this was always the case in D5 but running the unit
tests for SmaCC in D6 fails on this test: testReduceRules | parserCompiler | parserCompiler := SmaCCGrammarCompiler new. parserCompiler buildScanner: ' <char> : [a-zA-Z] ; <ws> : \s ;' andParser: ' Start ::= Chars {#liftFirstValue:}; Chars : WS A WS {#liftSecondValue:}; A : WS WS C {#liftLastValue:} | C WS {#liftLastValue:}; WS : <ws> {#nil}; C : <char> {#stringValue:};'. parserCompiler compileInto: TestScanner andParser: TestParser. self assert: (TestParser parse: ' a ') = nil. <<<<<<===== self assert: (TestParser parse: ' a ') = 'a' TestParser parse: 'a ' returns #liftFirstValue: (symbol) not nil? Not knowing much about parsers, I'm not sure what impact this has? I do notice that when you load the packages it gives 2 transcript errors: Warning: SmaCCScannerCompiler>>regularExpressionsDo: at line 2: can't optimize 'ifNotNil:' (requires niladic or monadic block argument) Warning: SmaCCScannerParser>>reduceActionForRegexTerm8: at line 2: can't optimize 'repeat' (requires niladic block receiver) However it looked like they were ok. The first one is interesting - the complaint is a bit wrong as the call thats like this: regExpDo: aBlock collection do: [ :each | each ifNotNil: aBlock ] So its supposed to be a block, and fixing it to: ifNotNil: [ aBlock value ] seems a bit smelly. Tim |
TimM wrote:
> I don't know if this was always the case in D5 but running the unit > tests for SmaCC in D6 fails on this test: > > testReduceRules > ... > > TestParser parse: 'a ' returns #liftFirstValue: (symbol) not nil? Not > knowing much about parsers, I'm not sure what impact this has? The #isLiteral method on the program node class was renamed to #isLiteralNode, since it interfered with the existing #isLiteral method on Object. SmaCC sends the #isLiteral in SmaCCRHS>>compileSourceFor:in: and SmaCCNode>>addImplementationSpecificRewritesTo:. Both of these should be changed to send #isLiteralNode. While you are fixing the SmaCCRHS>>compileSourceFor:in:, you could also fix the #withCRs message send in that method. All of these have been fixed in our next version. However, I don't know when we will release it. John Brant |
Thanks John -
For anyone following on - be careful using senders of #isLiteral as #addImplementationSpecificRewritesTo: includes this in a String (so it doesn't show up in a basic senders of query). The #withCRs referred to is (I believe) a case of changing it to: '<N>' expandMacros. Anyway all the tests pass now. Tim p.s. Thanks for your influence on the parser OA uses in Dolphin. Adding additional features to Dolphin has been extremely easy because of the thought you guys put into that parser and the behaviors the nodes have. e.g. To figure out which parameter of a keyword message my cursor is sitting on was just a case of asking each keyword if it #intersectsInterval: I thought I would be screwed when I first thought about doing this, and was blown away to discover the functionality already there. So thanks! "John Brant" <[hidden email]> wrote in message news:[hidden email]... > TimM wrote: >> I don't know if this was always the case in D5 but running the unit >> tests for SmaCC in D6 fails on this test: >> >> testReduceRules >> ... >> >> TestParser parse: 'a ' returns #liftFirstValue: (symbol) not nil? Not >> knowing much about parsers, I'm not sure what impact this has? > > The #isLiteral method on the program node class was renamed to > #isLiteralNode, since it interfered with the existing #isLiteral method > on Object. SmaCC sends the #isLiteral in SmaCCRHS>>compileSourceFor:in: > and SmaCCNode>>addImplementationSpecificRewritesTo:. Both of these > should be changed to send #isLiteralNode. While you are fixing the > SmaCCRHS>>compileSourceFor:in:, you could also fix the #withCRs message > send in that method. All of these have been fixed in our next version. > However, I don't know when we will release it. > > > John Brant |
Free forum by Nabble | Edit this page |