GerHobbelt / jison

bison / YACC / LEX in JavaScript (LALR(1), SLR(1), etc. lexer/parser generator)
https://gerhobbelt.github.io/jison/
MIT License
117 stars 20 forks source link

Decorator error when using `@` variables in actions #69

Open AprilArcus opened 1 year ago

AprilArcus commented 1 year ago

This error is produced on the current master, 396e9250c8afd5d7d7e5658951b0d89f8bd97dd9.

It appears that the legacy decorators plugin is being introduced here: https://github.com/GerHobbelt/recast/blob/master/parsers/_babel_options.ts#L29

It looks like a workaround was committed at https://github.com/GerHobbelt/jison/commit/625fcce046508ab3fde5e39f99284c16a89f49b0 but that it hasn't yet been built into dist/cli-cjs.js

JisonParserError: 
production rule action code block does not compile: Leading decorators must be attached to a class declaration (64:66)

  Erroneous area:
63:     | end_of_file {
^^....................^
64:                 parser.addError(yy.myFunction(@$))
^^..^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65:             }
^^..^^^^^^^^^^^^^
66:     ;
67: 

Related: https://github.com/GerHobbelt/jison/issues/63