Currently, @$ provides first_line, first_column, last_line and last_column. These are useful if the input is intended to be read line by line. Otherwise, it is useful to provide also character indexes to the input character string, so that we can do our computations at the string.
In the past, I worked around this issue by replace(/\n/g, '\r') so that first_column + last_column is what I need. But in 0.3.10 jison also treats \r as line breaks!
You're in luck -- ranges were added in 0.3.10 also. Try %options ranges and @$ will have a range property with absolute character position.
That works neatly. Thanks for being forward-looking!
I just hit issues with wrong values from the "range" property when the string covered by the current node contains line break(s). Sorry that I don't have time to make a reduced test case yet. Hope you can reproduce the issue.
Hmm, I've used ranges on a large-ish project without trouble. Create a new issue if you have something we can work of off to try and reproduce.
Oops. It is more like my fault. Sorry about that.