com.shapesecurity.shift.es2018.parser.Parser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of es2018 Show documentation
Show all versions of es2018 Show documentation
Shift format ECMAScript 2018 AST tooling
package com.shapesecurity.shift.es2018.parser;
import com.shapesecurity.functional.Unit;
import com.shapesecurity.shift.es2018.ast.Module;
import com.shapesecurity.shift.es2018.ast.Node;
import com.shapesecurity.shift.es2018.ast.Script;
import javax.annotation.Nonnull;
public class Parser extends GenericParser {
protected Parser(@Nonnull String source, boolean isModule) throws JsError {
super(source, isModule);
}
@Nonnull
public static Script parseScript(@Nonnull String text) throws JsError {
return new Parser(text, false).parseScript();
}
@Nonnull
public static Module parseModule(@Nonnull String text) throws JsError {
return new Parser(text, true).parseModule();
}
@Nonnull
@Override
protected T finishNode(@Nonnull Unit startState, @Nonnull T node) {
return node;
}
@Nonnull
@Override
protected Unit startNode() {
return Unit.unit;
}
@Nonnull
@Override
protected T copyNode(@Nonnull Node src, @Nonnull T dest) {
return dest;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy