blob: 612167a3ff721ada23c5d7cde29aeeb75fc29183 (
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
42
43
|
package com.ashardalon.pratt.commands.impls;
import com.ashardalon.pratt.ParserContext;
import com.ashardalon.pratt.blocks.ParseBlock;
import com.ashardalon.pratt.commands.AbstractInitialCommand;
import com.ashardalon.pratt.commands.CommandResult;
import com.ashardalon.pratt.tokens.Token;
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 final ParseBlock<K, V, C> blck;
/**
* Create a new block initial command.
*
* @param block
* The block to delegate to.
*/
public BlockInitialCommand(final ParseBlock<K, V, C> block) {
blck = block;
}
@Override
protected CommandResult<K, V> intNullDenotation(final Token<K, V> operator, final ParserContext<K, V, C> ctx)
throws ParserException {
return blck.parse(ctx);
}
}
|