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

com.github.uscexp.grappa.extension.nodes.AstValueTreeNode Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (C) 2014 - 2016 by haui - all rights reserved
 */
package com.github.uscexp.grappa.extension.nodes;

import com.github.uscexp.grappa.extension.annotations.AstValue;
import com.github.uscexp.grappa.extension.interpreter.AstInterpreter;
import com.github.uscexp.grappa.extension.interpreter.ProcessStore;


/**
 * {@link AstTreeNode} for {@link AstValue} annotated parser rules.
 * will be instanciated automatically from the {@link AstInterpreter}.
 * 
 * @author haui
 *
 */
public class AstValueTreeNode extends AstTreeNode {

	private Class valueType;
	private Class factoryClass;
	private String factoryMethod;
	
	public AstValueTreeNode(String rule, String value, Class valueType, Class factoryClass, String factoryMethod) {
		super(rule, value);
		this.valueType = valueType;
		this.factoryClass = factoryClass;
		this.factoryMethod = factoryMethod;
	}

	@Override
	protected void interpretBeforeChilds(Long id) throws Exception {
	}

	@Override
	protected void interpretAfterChilds(Long id) throws Exception {
		ProcessStore.getInstance(id).getStack().push(convert(value, valueType, factoryClass, factoryMethod));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy