All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.shapesecurity.shift.es2018.parser.Parser Maven / Gradle / Ivy

There is a newer version: 2.0.4
Show newest version
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