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

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

package org.unlaxer.parser.combinator;

import org.unlaxer.context.ParseContext;
import org.unlaxer.context.Transaction.AdditionalPreCommitAction;
import org.unlaxer.parser.Parser;

public class ChoiceCommitAction implements AdditionalPreCommitAction {
	
	Parser chosen;
	
	public ChoiceCommitAction(Parser chosen) {
		super();
		this.chosen = chosen;
	}
	
	@Override
	public void effect(Parser parser, ParseContext parseContext) {
		
		if (chosen != null && parser instanceof ChoiceInterface) {
			parseContext.chosenParserByChoice.put((ChoiceInterface) parser, chosen);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy