summaryrefslogtreecommitdiff
path: root/JPratt/src/main/java/bjc/pratt/commands/BlockInitialCommand.java
blob: f0448f7f8bfe40f112bc8c1b2b6d3e32243e29fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package bjc.pratt.commands;

import bjc.pratt.ParseBlock;
import bjc.pratt.ParserContext;
import bjc.pratt.Token;
import bjc.utils.data.ITree;
import bjc.utils.parserutils.ParserException;

/**
 * An initial command that delegates all the work to a {@link ParseBlock}
 * 
 * @author bjculkin
 * @param <K>
 *                The token key type.
 * 
 * @param <V>
 *                The token value type.
 * 
 * @param <C>
 *                The parser state type.
 *
 */
public class BlockInitialCommand<K, V, C> extends AbstractInitialCommand<K, V, C> {
	private ParseBlock<K, V, C> blck;

	/**
	 * Create a new block initial command.
	 * 
	 * @param block
	 *                The block to delegate to.
	 */
	public BlockInitialCommand(ParseBlock<K, V, C> block) {
		blck = block;
	}

	@Override
	protected ITree<Token<K, V>> intNullDenotation(Token<K, V> operator, ParserContext<K, V, C> ctx)
			throws ParserException {
		return blck.parse(ctx);
	}
}