summaryrefslogtreecommitdiff
path: root/JPratt/src/main/java/com/ashardalon/pratt/blocks/ParseBlock.java
blob: 51aa7fa83b59b387c0bf3db03199db694ff7e6f5 (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
package com.ashardalon.pratt.blocks;

import com.ashardalon.pratt.ParserContext;
import com.ashardalon.pratt.commands.CommandResult;

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.
	 */
	CommandResult<K, V> parse(ParserContext<K, V, C> ctx) throws ParserException;
}