summaryrefslogtreecommitdiff
path: root/JPratt/src/main/java/bjc/pratt/commands/BlockInitialCommand.java
diff options
context:
space:
mode:
Diffstat (limited to 'JPratt/src/main/java/bjc/pratt/commands/BlockInitialCommand.java')
-rw-r--r--JPratt/src/main/java/bjc/pratt/commands/BlockInitialCommand.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/JPratt/src/main/java/bjc/pratt/commands/BlockInitialCommand.java b/JPratt/src/main/java/bjc/pratt/commands/BlockInitialCommand.java
new file mode 100644
index 0000000..f0448f7
--- /dev/null
+++ b/JPratt/src/main/java/bjc/pratt/commands/BlockInitialCommand.java
@@ -0,0 +1,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);
+ }
+} \ No newline at end of file