Wisent grammar issues

Gracjan Polak <[email protected]> Sat, 12 Mar 2016 18:42:25 +0100
Newsgroups gmane.emacs.semantic
Message-ID <CAChsM3QukoWu2ySNtTYnnbvG2RY14e-pX0ytN8zwTt5N_zqZzw@mail.gmail.com>
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