summaryrefslogtreecommitdiff
path: root/JPratt/src/main/java/bjc/pratt/blocks/SimpleParseBlock.java
diff options
context:
space:
mode:
authorbjculkin <bjculkin@mix.wvu.edu>2018-02-15 15:25:09 -0500
committerbjculkin <bjculkin@mix.wvu.edu>2018-02-15 15:25:09 -0500
commit5028ad9a1faad0e363d017f18363e8062ba59871 (patch)
tree80df30dc24a2cd79abf7533b98fcfcd28b1f4fee /JPratt/src/main/java/bjc/pratt/blocks/SimpleParseBlock.java
parent1112bb1b44bb3aabe439a2b9f88a51a9c1e435de (diff)
Formatting and things
Diffstat (limited to 'JPratt/src/main/java/bjc/pratt/blocks/SimpleParseBlock.java')
-rw-r--r--JPratt/src/main/java/bjc/pratt/blocks/SimpleParseBlock.java34
1 files changed, 17 insertions, 17 deletions
diff --git a/JPratt/src/main/java/bjc/pratt/blocks/SimpleParseBlock.java b/JPratt/src/main/java/bjc/pratt/blocks/SimpleParseBlock.java
index 1ff561c..4148472 100644
--- a/JPratt/src/main/java/bjc/pratt/blocks/SimpleParseBlock.java
+++ b/JPratt/src/main/java/bjc/pratt/blocks/SimpleParseBlock.java
@@ -13,13 +13,13 @@ import bjc.utils.parserutils.ParserException;
* @author bjculkin
*
* @param <K>
- * The key type of the tokens.
+ * The key type of the tokens.
*
* @param <V>
- * The value type of the tokens.
+ * The value type of the tokens.
*
* @param <C>
- * The state type of the parser.
+ * The state type of the parser.
*/
public class SimpleParseBlock<K, V, C> implements ParseBlock<K, V, C> {
private final int pow;
@@ -32,16 +32,16 @@ public class SimpleParseBlock<K, V, C> implements ParseBlock<K, V, C> {
* Create a new block.
*
* @param precedence
- * The precedence of this block.
+ * The precedence of this block.
* @param validator
- * The predicate to apply to blocks.
+ * The predicate to apply to blocks.
* @param terminator
- * The token type that terminates the block. If this is
- * null, don't check for a terminator.
+ * The token type that terminates the block. If this is null,
+ * don't check for a terminator.
*/
public SimpleParseBlock(final int precedence, final Predicate<ITree<Token<K, V>>> validator,
final K terminator) {
- if (precedence < 0) throw new IllegalArgumentException("Precedence must be non-negative");
+ if(precedence < 0) throw new IllegalArgumentException("Precedence must be non-negative");
pow = precedence;
term = terminator;
@@ -52,11 +52,11 @@ public class SimpleParseBlock<K, V, C> implements ParseBlock<K, V, C> {
public ITree<Token<K, V>> parse(final ParserContext<K, V, C> ctx) throws ParserException {
final ITree<Token<K, V>> res = ctx.parse.parseExpression(pow, ctx.tokens, ctx.state, false);
- if (term != null) {
+ if(term != null) {
ctx.tokens.expect(term);
}
- if (validatr == null || validatr.test(res)) return res;
+ if(validatr == null || validatr.test(res)) return res;
throw new ParserException("Block failed validation");
}
@@ -75,17 +75,17 @@ public class SimpleParseBlock<K, V, C> implements ParseBlock<K, V, C> {
@Override
public boolean equals(final Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (!(obj instanceof SimpleParseBlock)) return false;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(!(obj instanceof SimpleParseBlock)) return false;
final SimpleParseBlock<?, ?, ?> other = (SimpleParseBlock<?, ?, ?>) obj;
- if (pow != other.pow) return false;
+ if(pow != other.pow) return false;
- if (term == null) {
- if (other.term != null) return false;
- } else if (!term.equals(other.term)) return false;
+ if(term == null) {
+ if(other.term != null) return false;
+ } else if(!term.equals(other.term)) return false;
return true;
}