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

org.unlaxer.parser.Parser Maven / Gradle / Ivy

package org.unlaxer.parser;

import java.io.Serializable;

import org.unlaxer.Parsed;
import org.unlaxer.ParserPath;
import org.unlaxer.TaggableAccessor;
import org.unlaxer.TokenKind;
import org.unlaxer.context.ParseContext;


public interface Parser extends //
	PropagatableDestination , //
	TaggableAccessor , //
//	Taggable , //
	ParserPath,//
//	ParserHierarchy , //
//	ParserFinder,//
	Serializable{

	//FIXME make Parsed parse(ParseContext parseContext) only. use to get tokenKind and invertMatch 
	public Parsed parse(ParseContext parseContext , TokenKind tokenKind ,boolean invertMatch);
	
	public default Parsed parse(ParseContext parseContext) {
		return parse(parseContext,getTokenKind(),false);
	}
	
	public default TokenKind getTokenKind(){
		return TokenKind.consumed;
	}
	
	public default boolean forTerminalSymbol(){
		return this instanceof TerminalSymbol;
	}
	
	public default boolean equalsByClass(Parser other){
		return getClass().equals(other.getClass());
	}
	
	public default Parser getChild(){
		return getChildren().get(0);
	}

	@Override
	default Parser getThisParser() {
		return this;
	}
	
	public NodeReduceMarker getNodeReduceMarker();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy