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

org.unlaxer.parser.combinator.LazyChoice Maven / Gradle / Ivy

package org.unlaxer.parser.combinator;

import java.util.List;
import java.util.Optional;

import org.unlaxer.Name;
import org.unlaxer.Parsed;
import org.unlaxer.RecursiveMode;
import org.unlaxer.TokenKind;
import org.unlaxer.context.ParseContext;
import org.unlaxer.parser.HasChildrenParser;
import org.unlaxer.parser.LazyParserChildrenSpecifier;
import org.unlaxer.parser.Parser;

public abstract class LazyChoice extends LazyCombinatorParser implements ChoiceInterface , LazyParserChildrenSpecifier{

	private static final long serialVersionUID = 1346285131943887894L;

	public LazyChoice() {
		super();
	}

	public LazyChoice(Name name) {
		super(name);
	}
	
	@Override
	public Parsed parse(ParseContext parseContext, TokenKind tokenKind, boolean invertMatch) {
		return ChoiceInterface.super.parse(parseContext, tokenKind, invertMatch);
	}

	@Override
	public HasChildrenParser createWith(List children) {
		return new LazyChoice(getName()) {
			
			private static final long serialVersionUID = 6650564064744230492L;

			@Override
			public List getLazyParsers() {
				return children;
			}
			
		};
	}

	
	@Override
	public Optional getNotAstNodeSpecifier() {
		return Optional.empty();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy