wisent-production-bounds (in lisp/semantic/wisent/wisent.el) computes
the value for the $regioni variables in semantic actions when the region
covers a non-terminal.
It assumes regions are a simple cons (first . last), but the rest of the
wisent parser represents regions as a nested list ((first last)).
This code fixes that:
(defsubst wisent-production-bounds (stack i j)
"Determine the start and end locations of a production value.
Return a pair (START . END), where START is the first available start
location, and END the last available end location, in components
values of the rule currently reduced.
Return nil when no component location is available.
STACK is the parser stack.
I and J are the indices in STACK of respectively the value of the
first and last components of the current rule.
This function is for internal use by semantic actions' generated
(let ((f (caadr (aref stack i)))
(l (cadadr (aref stack j))))
(while (/= i j)
;; item i is an empty production
(setq f (caadr (aref stack (setq i (+ i 2))))))
;; item j is an empty production
(setq l (cadadr (aref stack (setq j (- j 2))))))
((setq i j))))
(and f l (list (list f l)))))
In GNU Emacs 22.214.171.124 (i386-mingw-nt6.1.7601)
of 2012-12-15 on MS-W7-DANI
Bzr revision: 111040 cyd <at> gnu.org-20121215141602-c4qmr11gc39rrpng
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Stephen Leake ( stephen_leake ) - 2013-01-31 23:03:38 PST