LeafParser.java

package edu.udel.cis.vsl.tass.ast.parser;

import org.xml.sax.Attributes;

abstract class LeafParser implements NodeParserIF {
	
	protected String charData = new String();

	protected Attributes attrs;

	protected final NodeTypes nodeTypes;

	protected final RefMappers refMappers;

	public LeafParser(NodeTypes nodeTypes, RefMappers refMappers) {
		this.nodeTypes = nodeTypes;
		this.refMappers = refMappers;
	}
	
	@Override
	public NodeParserIF makeDescendent(String localName) {
		throw new ParserException("Leaf nodes cannot have children");
	}

	@Override
	public void setAttrs(Attributes attrs) {
		this.attrs = attrs;
	}

	@Override
	public void addDescendent(NodeEltWrapperIF descendent) {
		throw new ParserException("Leaf nodes cannot have children");
	}

	@Override
	public void characters(String newData) {
		charData = charData.concat(newData);
	}
}