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

com.github.uscexp.dotnotation.parser.attributedetail.AstSimpleMapKeyTreeNode Maven / Gradle / Ivy

/*
 * Copyright (C) 2014 - 2018 by haui - all rights reserved
 */
package com.github.uscexp.dotnotation.parser.attributedetail;

import com.github.uscexp.parboiled.extension.interpreter.ProcessStore;
import com.github.uscexp.parboiled.extension.nodes.AstCommandTreeNode;
import com.github.uscexp.parboiled.extension.util.IStack;

/**
 * @author haui
 *
 */
public class AstSimpleMapKeyTreeNode extends AstCommandTreeNode {

	public AstSimpleMapKeyTreeNode(String node, String value) {
		super(node, value);
	}

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

	@Override
	protected void interpretAfterChilds(Long id) throws ReflectiveOperationException {
		ProcessStore processStore = ProcessStore.getInstance(id);
		IStack stack = processStore.getStack();
		AttributeDetailInterpreterResult attributeDetailInterpreterResult = (AttributeDetailInterpreterResult) processStore.getVariable(
				AttributeDetailParser.ATTRIBUTE_DETAIL_INTERPRETER_RESULT);
		attributeDetailInterpreterResult.setArrayType(false);
		attributeDetailInterpreterResult.setMapType(true);
		String mapKey = (String) stack.pop();
		attributeDetailInterpreterResult.setSimpleMapKey(mapKey);
	}

}