summaryrefslogtreecommitdiff
path: root/JPratt/src/main/java/bjc/pratt/ParseBlock.java
blob: 28caf43a460a745e07eb8b9ef3960a1f07ab044b (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
package bjc.pratt;

import bjc.utils.data.ITree;
import bjc.utils.parserutils.ParserException;

/**
 * Represents a embedded block in an expression.
 *
 * @author bjculkin
 *
 * @param <K>
 *                The key type of the token.
 *
 * @param <V>
 *                The value type of the token.
 *
 * @param <C>
 *                The state type of the parser.
 */
@FunctionalInterface
public interface ParseBlock<K, V, C> {

	/**
	 * Parse the block this represents.
	 *
	 * @param ctx
	 *                The context for parsing.
	 *
	 * @return A AST for this block.
	 *
	 * @throws ParserException
	 *                 If something goes wrong during parsing, or the block
	 *                 fails validation.
	 */
	ITree<Token<K, V>> parse(ParserContext<K, V, C> ctx) throws ParserException;

}