I would try for the lexer first; it probably won't be that bad.  I did a
lot of work like this when I first started doing all this location-aware
work. For example, when I started into this, "terminator" tokens were
always at the start of the next line.  :P

-Jason
On Mar 6, 2013 10:31 PM, "Demian Ferreiro" <notifications@github.com> wrote:

> In src/coffee-script.coffee:
>
> >  parser.yy = require './nodes'
> > +
> > +# Override Jison's default error handling function.
> > +parser.yy.parseError = (message, {token}) ->
> > +  # Disregard Jison's message, it contains redundant line numer information.
> > +  message = "unexpected #{token}"
>
> @marchaefner <https://github.com/marchaefner>, awesome! That works really
> good in the (albeit few) cases i tested!
>
> The "end of input" thing is definitely needed. About the OUTDENT location
> correction, i feel like it should be added to the lexer (that is, for the
> OUTDENT tokens to have a better location), but at the same time, if it's
> going to add more work to the lexer *for every OUTDENT token* maybe it
> makes more sense to just patch it there in the error handler.
>
> I'd like to have another opinion in this one. @jashkenas<https://github.com/jashkenas>(or anyone who's reading this =P), maybe you could provide some insight
> here? What would be the expected error location for "unexpected OUTDENT"
> errors? And should that location be set on the lexer or is it OK to patch
> it in the error reporting?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/jashkenas/coffee-script/pull/2723/files#r3274449>
> .
>