tunnckoCore/parse-function

Functions containing GREATER_THAN are parsed incorrectly

eush77 opened this issue · 2 comments

> parseFunction(function (a, b) { return a > b })
{ name: 'anonymous',
  body: ' ',
  params: 'unction (a, b) { return ',
  args: [ 'unction (a', 'b) { return ' ] }

Functions that contain > character are loosely considered arrow functions in walk, and later in build function params and args properties are computed incorrectly because of that. I'm not sure how you would fix that.

Aaaand yes, problems start appearing, haha - normal. But that's the interesting, I like to play this game and experimenting and learn new things.

Thanks for the report, I'll review what I can do.

Cheers,
Charlike.

Actually, when i built walk that way i though to check prev ch for = which would be the correct way.
I reviewed few parsers and have some idea.

We need strongly to implement benchmark tests. If it is slower, then we can return to regex, otherwise we will stay that way and will try to fix every new issue.