Tracker: Bugs

5 wisent-production-bounds (in lisp/semantic/wisent/wisent.el) - ID: 3602942
Last Update: Comment added ( stephen_leake )

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
lambda-expression."
(let ((f (caadr (aref stack i)))
(l (cadadr (aref stack j))))
(while (/= i j)
(cond
((not f)
;; item i is an empty production
(setq f (caadr (aref stack (setq i (+ i 2))))))
((not l)
;; 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 24.2.91.1 (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

5

Closed

None

Nobody/Anonymous

None

None

Public


Comment ( 1 )

Date: 2013-02-02 06:13:31 PST
Sender: stephen_leake

It is always good to insist on an example! Attached file shows the
un-patched wisent-production-bounds working properly.

So it's my mistake. I'm not using the semantic lexer, and my lexer is
returning the wrong structure. I thought I had gotten it right, but
apparently not.

Sorry for the noise.


Attached File

No Files Currently Attached

Changes ( 3 )

Field Old Value Date By
close_date - 2013-02-02 06:13:31 PST stephen_leake
allow_comments 1 2013-02-02 06:13:31 PST stephen_leake
status_id Open 2013-02-02 06:13:31 PST stephen_leake