librelist archives

« back to archive

Bison Location API implemented

Bison Location API implemented

From:
Zachary Carter
Date:
2011-01-22 @ 21:52
I've implemented Bison's location API[1] in Jison 0.2.2. Now within
semantic actions you can access more detailed position information
about each symbol.

Similar to how you would access the value of each symbol using $$, $1,
$2, ect. you can access the location information of each symbol using
@$, @1, @2, ect. The available properties are first_line, last_line,
first_column, and last_column.

[1] 
http://www.gnu.org/software/bison/manual/html_node/Actions-and-Locations.html#Actions-and-Locations
-- 
Zach Carter

Re: [jison] Bison Location API implemented

From:
Yehuda Katz
Date:
2011-01-22 @ 22:19
That's awesome. I am going to use this in handlebars ASAP to provide
better debugging info in the AST :)

Sent from my iPhone

On Jan 22, 2011, at 1:52 PM, Zachary Carter <zack.carter@gmail.com> wrote:

> I've implemented Bison's location API[1] in Jison 0.2.2. Now within
> semantic actions you can access more detailed position information
> about each symbol.
>
> Similar to how you would access the value of each symbol using $$, $1,
> $2, ect. you can access the location information of each symbol using
> @$, @1, @2, ect. The available properties are first_line, last_line,
> first_column, and last_column.
>
> [1] 
http://www.gnu.org/software/bison/manual/html_node/Actions-and-Locations.html#Actions-and-Locations
> --
> Zach Carter