summaryrefslogtreecommitdiff
path: root/JPratt/src/main/java/bjc/pratt/TokenStream.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2017-04-10 16:49:31 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2017-04-10 16:49:31 -0400
commit251419e1f0ab8eb04d21287b708b06a552f4c58a (patch)
tree5127ac36aa7b6e683901ff2954ffaa51b27bc0b2 /JPratt/src/main/java/bjc/pratt/TokenStream.java
parent4d69e8b9aaebc253f3ed0864734b8c1db9a1eedd (diff)
Warning resolution
Diffstat (limited to 'JPratt/src/main/java/bjc/pratt/TokenStream.java')
-rw-r--r--JPratt/src/main/java/bjc/pratt/TokenStream.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/JPratt/src/main/java/bjc/pratt/TokenStream.java b/JPratt/src/main/java/bjc/pratt/TokenStream.java
index d3472a0..e377352 100644
--- a/JPratt/src/main/java/bjc/pratt/TokenStream.java
+++ b/JPratt/src/main/java/bjc/pratt/TokenStream.java
@@ -69,9 +69,9 @@ public abstract class TokenStream<K, V> implements Iterator<Token<K, V>> {
String expectedList = StringUtils.toEnglishList(expectedKeys.toArray(), false);
throw new ExpectationException("One of '" + expectedList + "' was expected, not " + curKey);
- } else {
- next();
}
+
+ next();
}
/**
@@ -88,7 +88,15 @@ public abstract class TokenStream<K, V> implements Iterator<Token<K, V>> {
public final void expect(K... expectedKeys) throws ExpectationException {
expect(new HashSet<>(Arrays.asList(expectedKeys)));
}
-
+
+ /**
+ * Check whether the head token is a certain type.
+ *
+ * @param val
+ * The type to check for.
+ *
+ * @return Whether or not the head token is of that type.
+ */
public boolean headIs(K val) {
return current().getKey().equals(val);
}