syntax icon indicating copy to clipboard operation
syntax copied to clipboard

Expose original source code to user-level

Open DmitrySoshnikov opened this issue 8 years ago • 0 comments

Some tools may need to analyze original source code corresponding to AST nodes (combined with node locations, it is possible to get a substring of a node in the source code).

We need to expose the source code on parser, tokenizer, and in the handlers. This can be just a global (or scoped) yysource variable.

Program : StatementList
  { $$ = {
      type: 'Program',
      body: $StatementList,
      source: yysource,
    }
  }

DmitrySoshnikov avatar Feb 07 '17 22:02 DmitrySoshnikov