Re: Wisent grammar issues
Gracjan Polak <[email protected]> Sat, 12 Mar 2016 19:55:17 +0100
| Newsgroups | gmane.emacs.semantic |
|---|---|
| Message-ID | <CAChsM3TwVcJLwms-b=gpqN2TP4=goDMOYS+6q8PUF29mW9q8rQ@mail.gmail.com> |
Also, interestingly this grammar produces strange automaton:
zonk (30)
on left: 1
state 0
QVARID shift, and go to state 1
zonk go to state 2
state 1
zonk -> QVARID . (rule 1)
$default reduce using rule 1 (zonk)
state 2
$EOI shift, and go to state 3
state 3
$EOI shift, and go to state 4
state 4
$default accept
Note that $EOI is mentioned twice in state 2 and state 3. Why is that?
2016-03-12 18:42 GMT+01:00 Gracjan Polak <[email protected]>:
> Hi,
>
> As advised in other email on this list I try to wrap my grammar in a
> couple of ERT tests. I'm stuck trying to get wisent grammar do anything for
> me in context of ERT tests.
>
> I have a lexer that works correctly and I have this grammar:
>
> %start zonk
> %token QVARID
>
> %%
>
> zonk : QVARID
> ;
>
> And I have this ert-test declaration:
>
> (defmacro ws (start source expected)
> `(with-temp-buffer
> (haskell-mode)
> (insert ,source)
> (haskell-default-setup)
> (semantic-mode)
> (let ((wisent-parse-verbose-flag t)
> (wisent-lex-istream
> (funcall semantic-lex-analyzer (point-min) (point-max)))
> (wisent-result (wisent-parse semantic--parse-table #'wisent-lex
> (lambda (msg) (message "%s" msg)) ',start)))
> (message "%S" wisent-lex-istream)
> (message "%S" wisent-result)
> (should (equal ',expected wisent-result)))))
>
> (ert-deftest zzzz ()
> (ws zonk "
> fun"
> (zonk)))
>
> What I get is strange and I do not know how to interpret this:
>
> Running 1 tests (2016-03-12 18:38:25+0100)
> Syntax error, unexpected $EOI@13(""), expecting QVARID
> ((QVARID 2 . 5))
> nil
>
> Test zzzz condition:
> (ert-test-failed
> ((should
> (equal '... wisent-result))
> :form
> (equal
> (zonk)
> nil)
> :value nil :explanation
> (different-types
> (zonk)
> nil)))
> FAILED 1/1 zzzz
>
> I would expect:
> 1. That is parsers 'fun' a QVARID and zonk rule fires properly.
> 2. That it does not try to parse further.
> 3. That it does not report $EOI issues.
> 4. That it returns a result of any kind, not nil.
>
> Is there anything obvious I'm doing wrong?
>
> --
> Gracjan
>
>
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
cedet-semantic mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cedet-semantic