du blog
Hello, welcome to my blog
babel源码阅读(一)-@babel/parser
created: Jan 31 21updated: Jan 31 21

继承顺序:

parser/index.js =>

constructor:

options = getOptions(options);

super(options, input);

const ScopeHandler = this.getScopeHandler();

this.options = options;

this.inModule = this.options.sourceType === "module"; // 源代码类型

this.scope = new ScopeHandler(this.raise.bind(this), this.inModule);

this.prodParam = new ProductionParameterHandler();

this.classScope = new ClassScopeHandler(this.raise.bind(this));

this.expressionScope = new ExpressionScopeHandler(this.raise.bind(this));

this.plugins = pluginsMap(this.options.plugins);

this.filename = options.sourceFilename;

paser/StatementParser.js =>

parser/ExpressionParser =>

parser/LValParser.js =>

parser/node.js =>

parser/util.js =>

tokenizr/index.js =>

constructor:

super();

this.state = new State(); // 初始化node

this.state.init(options);

this.input = input;

this.length = input.length;

this.isLookahead = false;

parser/error.js =>

parser/comments =>

parser/baseParser