summaryrefslogtreecommitdiff
path: root/JPratt/src/main/java/bjc/pratt/blocks/ParseBlocks.java
diff options
context:
space:
mode:
authorBenjamin Culkin <scorpress@gmail.com>2024-06-03 17:33:53 -0400
committerBenjamin Culkin <scorpress@gmail.com>2024-06-03 17:33:53 -0400
commit15a2b29e48f134bc93cfd0a3d8512001e9242f3d (patch)
treeb3f5c4c5f0e474479cd47ad0ac0f35770fc44881 /JPratt/src/main/java/bjc/pratt/blocks/ParseBlocks.java
parent39ba97edf49270715ec61bedb7d4a62ada819ba0 (diff)
Rename package to new domainHEADtrunk
Rename the package to the new domain
Diffstat (limited to 'JPratt/src/main/java/bjc/pratt/blocks/ParseBlocks.java')
-rw-r--r--JPratt/src/main/java/bjc/pratt/blocks/ParseBlocks.java97
1 files changed, 0 insertions, 97 deletions
diff --git a/JPratt/src/main/java/bjc/pratt/blocks/ParseBlocks.java b/JPratt/src/main/java/bjc/pratt/blocks/ParseBlocks.java
deleted file mode 100644
index 96b9737..0000000
--- a/JPratt/src/main/java/bjc/pratt/blocks/ParseBlocks.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package bjc.pratt.blocks;
-
-import java.util.function.Predicate;
-import java.util.function.UnaryOperator;
-
-import bjc.pratt.tokens.Token;
-import bjc.data.Tree;
-
-/**
- * Utility class for creating common implementations of {@link ParseBlock}
- *
- * @author bjculkin
- *
- */
-public class ParseBlocks {
- /*
- * Grammar parse blocks are complex enough to not get a builder method.
- */
-
- /**
- * Create a new repeating parse block.
- *
- * @param <K> The key type for the tokens.
- * @param <V> The value type for the tokens.
- * @param <C> The context type for the tokens.
- *
- * @param inner
- * The parse block to repeat.
- *
- * @param delim
- * The token type that separates repetitions.
- *
- * @param term
- * The token type that terminates repetitions.
- *
- * @param mark
- * The token to use as the node in the AST.
- *
- * @param action
- * The action to perform on the state after every repetition.
- *
- * @return A configured repeating parse block.
- */
- public static <K, V, C> ParseBlock<K, V, C> repeating(final ParseBlock<K, V, C> inner, final K delim,
- final K term, final Token<K, V> mark, final UnaryOperator<C> action) {
- return new RepeatingParseBlock<>(inner, delim, term, mark, action);
- }
-
- /**
- * Create a new triggered parse block.
- *
- * @param <K> The key type for the tokens.
- * @param <V> The value type for the tokens.
- * @param <C> The context type for the tokens.
- *
- * @param source
- * The block to trigger around.
- *
- * @param onEnter
- * The action to perform upon the state before entering the
- * block.
- *
- * @param onExit
- * The action to perform upon the state after exiting the block.
- *
- * @return A configured trigger parse block.
- */
- public static <K, V, C> ParseBlock<K, V, C> trigger(final ParseBlock<K, V, C> source,
- final UnaryOperator<C> onEnter, final UnaryOperator<C> onExit) {
- return new TriggeredParseBlock<>(onEnter, onExit, source);
- }
-
- /**
- * Create a new simple parse block.
- *
- * @param <K> The key type for the tokens.
- * @param <V> The value type for the tokens.
- * @param <C> The context type for the tokens.
- *
- * @param precedence
- * The precedence of the expression inside the block.
- *
- * @param terminator
- * The key type of the token expected after this block, or null
- * if none is expected.
- *
- * @param validator
- * The predicate to use to validate parsed expressions, or null
- * if none is used.
- *
- * @return A configured simple parse block.
- */
- public static <K, V, C> ParseBlock<K, V, C> simple(final int precedence, final K terminator,
- final Predicate<Tree<Token<K, V>>> validator) {
- return new SimpleParseBlock<>(precedence, validator, terminator);
- }
-} \ No newline at end of file