* Initial estree support for ClassMethod * Handle literals for estree * Fix regex * correct output of regexp and regenerate test * Add tests for validation stuff with estree plugin * Parse Properties correctly This also refactors how babylon parses obj properties in general so that this logic can be more easily extended. * Run all throws-tests a second time with estree plugin * Fix all throw tests * Remove rebase conflict * Correctly set kind This ensures state.inMethod gets propagated correctly * Add computed: false to methods with ident async * Implement directive field on Directives * Test invalid directives * more tests
35 lines
861 B
JavaScript
Executable File
35 lines
861 B
JavaScript
Executable File
import Parser, { plugins } from "./parser";
|
|
import "./parser/util";
|
|
import "./parser/statement";
|
|
import "./parser/lval";
|
|
import "./parser/expression";
|
|
import "./parser/node";
|
|
import "./parser/location";
|
|
import "./parser/comments";
|
|
|
|
import { types as tokTypes } from "./tokenizer/types";
|
|
import "./tokenizer";
|
|
import "./tokenizer/context";
|
|
|
|
import estreePlugin from "./plugins/estree";
|
|
import flowPlugin from "./plugins/flow";
|
|
import jsxPlugin from "./plugins/jsx";
|
|
plugins.estree = estreePlugin;
|
|
plugins.flow = flowPlugin;
|
|
plugins.jsx = jsxPlugin;
|
|
|
|
export function parse(input, options) {
|
|
return new Parser(options, input).parse();
|
|
}
|
|
|
|
export function parseExpression(input, options) {
|
|
const parser = new Parser(options, input);
|
|
if (parser.options.strictMode) {
|
|
parser.state.strict = true;
|
|
}
|
|
return parser.getExpression();
|
|
}
|
|
|
|
|
|
export { tokTypes };
|