From b4e4e7f1d6749de92b0f2c5ca09eb4170704100f Mon Sep 17 00:00:00 2001 From: bjculkin Date: Fri, 31 Mar 2017 08:53:33 -0400 Subject: Move Pratt Parser to new project --- .../parserutils/pratt/blocks/ParseBlocks.java | 84 ---------------------- 1 file changed, 84 deletions(-) delete mode 100644 BJC-Utils2/src/main/java/bjc/utils/parserutils/pratt/blocks/ParseBlocks.java (limited to 'BJC-Utils2/src/main/java/bjc/utils/parserutils/pratt/blocks/ParseBlocks.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/parserutils/pratt/blocks/ParseBlocks.java b/BJC-Utils2/src/main/java/bjc/utils/parserutils/pratt/blocks/ParseBlocks.java deleted file mode 100644 index 9df8355..0000000 --- a/BJC-Utils2/src/main/java/bjc/utils/parserutils/pratt/blocks/ParseBlocks.java +++ /dev/null @@ -1,84 +0,0 @@ -package bjc.utils.parserutils.pratt.blocks; - -import java.util.function.Predicate; -import java.util.function.UnaryOperator; - -import bjc.utils.data.ITree; -import bjc.utils.parserutils.pratt.ParseBlock; -import bjc.utils.parserutils.pratt.Token; - -/** - * Utility class for creating common implementations of {@link ParseBlock} - * - * @author bjculkin - * - */ -public class ParseBlocks { - /** - * Create a new repeating parse block. - * - * @param inner - * The parse block to repeat. - * - * @param delim - * The token type that seperates repetitions. - * - * @param term - * The token type that terminates repititions. - * - * @param mark - * The token to use as the node in the AST. - * - * @param action - * The action to perform on the state after every - * repitition. - * - * @return A configured repeating parse block. - */ - public static ParseBlock repeating(ParseBlock inner, K delim, K term, - Token mark, UnaryOperator action) { - return new RepeatingParseBlock<>(inner, delim, term, mark, action); - } - - /** - * Create a new triggered parse block. - * - * @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 ParseBlock trigger(ParseBlock source, UnaryOperator onEnter, - UnaryOperator onExit) { - return new TriggeredParseBlock<>(onEnter, onExit, source); - } - - /** - * Create a new simple parse block. - * - * @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 ParseBlock simple(int precedence, K terminator, - Predicate>> validator) { - return new SimpleParseBlock<>(precedence, terminator, validator); - } -} \ No newline at end of file -- cgit v1.2.3