How to determine the goal symbol when tokenize ECMAScript in lexical grammar

61 views Asked by At

I'm writing a JS macro preprocessor, and refer to the ECMA-262 specification for some guide to parse js code.

I use the code parser to determine where to do macro replace in a standard/precise way, which will distinguish some environments like:

macro(); // valid
foo = /macro()/; // invalid
foo = `macro()`; // invalid
foo = `some text ${macro()}`; // valid

When handling the source code tokenizing procedure, I encountered something called the goal symbol. I made some effort to understand them with some articles from V8 blog and another question.

However, I still can't understand how to determine the goal symbol in a standard way, I searched the specification and didn't find anything about this.

0

There are 0 answers