summaryrefslogtreecommitdiff
path: root/JPratt/src/main/java/bjc/pratt/commands/BlockNonInitialCommand.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2017-04-11 23:12:34 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2017-04-11 23:12:34 -0400
commit6b881e8833596d669fdee9525e064aea0c8946dc (patch)
treef631a0fbb3c10e325ba17cc80343eb47577acc90 /JPratt/src/main/java/bjc/pratt/commands/BlockNonInitialCommand.java
parent2a7f4dd88c0b1095748252eb2fe48c8c52a840c7 (diff)
Add exceptions to sample lang.
Diffstat (limited to 'JPratt/src/main/java/bjc/pratt/commands/BlockNonInitialCommand.java')
-rw-r--r--JPratt/src/main/java/bjc/pratt/commands/BlockNonInitialCommand.java75
1 files changed, 0 insertions, 75 deletions
diff --git a/JPratt/src/main/java/bjc/pratt/commands/BlockNonInitialCommand.java b/JPratt/src/main/java/bjc/pratt/commands/BlockNonInitialCommand.java
deleted file mode 100644
index c361c73..0000000
--- a/JPratt/src/main/java/bjc/pratt/commands/BlockNonInitialCommand.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package bjc.pratt.commands;
-
-import bjc.pratt.NonInitialCommand;
-import bjc.pratt.ParseBlock;
-import bjc.pratt.ParserContext;
-import bjc.pratt.Token;
-import bjc.utils.data.ITree;
-import bjc.utils.data.Tree;
-import bjc.utils.parserutils.ParserException;
-
-/**
- * A non-initial command that delegates all of 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 BlockNonInitialCommand<K, V, C> extends NonInitialCommand<K, V, C> {
- private final ParseBlock<K, V, C> innr;
-
- private final int lftBind;
- private final int nxtBind;
-
- private final Token<K, V> trm;
-
- /**
- * Create a new non-initial command that delegates to a parse block.
- *
- * @param inner
- * The parse block to delegate to.
- *
- * @param leftBind
- * The left binding power (precedence).
- *
- * @param rightBind
- * The right binding power (associativity control).
- *
- * @param term
- * The token to use as the node in the AST.
- */
- public BlockNonInitialCommand(final ParseBlock<K, V, C> inner, final int leftBind, final int rightBind,
- final Token<K, V> term) {
- innr = inner;
-
- lftBind = leftBind;
- nxtBind = rightBind;
-
- trm = term;
- }
-
- @Override
- public ITree<Token<K, V>> denote(final ITree<Token<K, V>> operand, final Token<K, V> operator,
- final ParserContext<K, V, C> ctx) throws ParserException {
- final ITree<Token<K, V>> expression = innr.parse(ctx);
-
- return new Tree<>(trm, expression);
- }
-
- @Override
- public int leftBinding() {
- return lftBind;
- }
-
- @Override
- public int nextBinding() {
- return nxtBind;
- }
-} \ No newline at end of file