summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/parserutils/delims
diff options
context:
space:
mode:
Diffstat (limited to 'base/src/main/java/bjc/utils/parserutils/delims')
-rw-r--r--base/src/main/java/bjc/utils/parserutils/delims/DelimiterException.java2
-rw-r--r--base/src/main/java/bjc/utils/parserutils/delims/DelimiterGroup.java147
-rw-r--r--base/src/main/java/bjc/utils/parserutils/delims/RegexCloser.java2
-rw-r--r--base/src/main/java/bjc/utils/parserutils/delims/RegexOpener.java8
-rw-r--r--base/src/main/java/bjc/utils/parserutils/delims/SequenceCharacteristics.java32
-rw-r--r--base/src/main/java/bjc/utils/parserutils/delims/SequenceDelimiter.java65
-rw-r--r--base/src/main/java/bjc/utils/parserutils/delims/StringDelimiter.java4
7 files changed, 132 insertions, 128 deletions
diff --git a/base/src/main/java/bjc/utils/parserutils/delims/DelimiterException.java b/base/src/main/java/bjc/utils/parserutils/delims/DelimiterException.java
index 071afb4..4172d32 100644
--- a/base/src/main/java/bjc/utils/parserutils/delims/DelimiterException.java
+++ b/base/src/main/java/bjc/utils/parserutils/delims/DelimiterException.java
@@ -13,7 +13,7 @@ public class DelimiterException extends RuntimeException {
* Create a new generic delimiter exception.
*
* @param res
- * The reason for this exception.
+ * The reason for this exception.
*/
public DelimiterException(final String res) {
super(res);
diff --git a/base/src/main/java/bjc/utils/parserutils/delims/DelimiterGroup.java b/base/src/main/java/bjc/utils/parserutils/delims/DelimiterGroup.java
index 73c3473..5d020a6 100644
--- a/base/src/main/java/bjc/utils/parserutils/delims/DelimiterGroup.java
+++ b/base/src/main/java/bjc/utils/parserutils/delims/DelimiterGroup.java
@@ -24,7 +24,7 @@ import bjc.utils.funcdata.IList;
* @author EVE
*
* @param <T>
- * The type of items in the sequence.
+ * The type of items in the sequence.
*/
public class DelimiterGroup<T> {
/**
@@ -47,17 +47,17 @@ public class DelimiterGroup<T> {
/*
* The token that opened the group, and any opening parameters.
*/
- private final T opener;
- private final T[] params;
+ private final T opener;
+ private final T[] params;
/**
* Create a new instance of a delimiter group.
*
* @param open
- * The item that opened this group.
+ * The item that opened this group.
*
* @param parms
- * Any parameters from the opener.
+ * Any parameters from the opener.
*/
public OpenGroup(final T open, final T[] parms) {
opener = open;
@@ -72,7 +72,7 @@ public class DelimiterGroup<T> {
* Add an item to this group instance.
*
* @param itm
- * The item to add to this group instance.
+ * The item to add to this group instance.
*/
public void addItem(final ITree<T> itm) {
currentGroup.add(itm);
@@ -82,33 +82,33 @@ public class DelimiterGroup<T> {
* Mark a subgroup.
*
* @param marker
- * The item that indicated this subgroup.
+ * The item that indicated this subgroup.
*
* @param chars
- * The characteristics for building the tree.
+ * The characteristics for building the tree.
*/
public void markSubgroup(final T marker, final SequenceCharacteristics<T> chars) {
/*
* Add all of the contents to the subgroup.
*/
final ITree<T> subgroupContents = new Tree<>(chars.contents);
- for (final ITree<T> itm : currentGroup) {
+ for(final ITree<T> itm : currentGroup) {
subgroupContents.addChild(itm);
}
/*
* Handle subordinate sub-groups.
*/
- while (!contents.isEmpty()) {
+ while(!contents.isEmpty()) {
final ITree<T> possibleSubordinate = contents.peek();
/*
* Subordinate lower priority subgroups.
*/
- if (possibleSubordinate.getHead().equals(chars.subgroup)) {
+ if(possibleSubordinate.getHead().equals(chars.subgroup)) {
final T otherMarker = possibleSubordinate.getChild(1).getHead();
- if (subgroups.get(marker) > subgroups.get(otherMarker)) {
+ if(subgroups.get(marker) > subgroups.get(otherMarker)) {
subgroupContents.prependChild(contents.pop());
} else {
break;
@@ -129,10 +129,10 @@ public class DelimiterGroup<T> {
* Convert this group into a tree.
*
* @param closer
- * The item that closed this group.
+ * The item that closed this group.
*
* @param chars
- * The characteristics for building the tree.
+ * The characteristics for building the tree.
*
* @return This group as a tree.
*/
@@ -140,20 +140,20 @@ public class DelimiterGroup<T> {
/*
* Mark any implied subgroups.
*/
- if (impliedSubgroups.containsKey(closer)) {
+ if(impliedSubgroups.containsKey(closer)) {
markSubgroup(impliedSubgroups.get(closer), chars);
}
final ITree<T> res = new Tree<>(chars.contents);
/*
- * Add either the contents of the current group,
- * or subgroups if they're their.
+ * Add either the contents of the current group, or
+ * subgroups if they're their.
*/
- if (contents.isEmpty()) {
+ if(contents.isEmpty()) {
currentGroup.forEach(res::addChild);
} else {
- while (!contents.isEmpty()) {
+ while(!contents.isEmpty()) {
res.prependChild(contents.poll());
}
@@ -182,7 +182,7 @@ public class DelimiterGroup<T> {
* Check if a group is excluded at the top level of this group.
*
* @param grupName
- * The group to check.
+ * The group to check.
*
* @return Whether or not the provided group is excluded.
*/
@@ -194,16 +194,16 @@ public class DelimiterGroup<T> {
* Check if the provided delimiter would close this group.
*
* @param del
- * The string to check as a closing delimiter.
+ * The string to check as a closing delimiter.
*
* @return Whether or not the provided delimiter closes this
* group.
*/
public boolean isClosing(final T del) {
- if (closingDelimiters.contains(del)) return true;
+ if(closingDelimiters.contains(del)) return true;
- for (final BiPredicate<T, T[]> pred : predClosers) {
- if (pred.test(del, params)) return true;
+ for(final BiPredicate<T, T[]> pred : predClosers) {
+ if(pred.test(del, params)) return true;
}
return closingDelimiters.contains(del);
@@ -242,7 +242,7 @@ public class DelimiterGroup<T> {
* Checks if a given token marks a subgroup.
*
* @param tok
- * The token to check.
+ * The token to check.
*
* @return Whether or not the token marks a subgroup.
*/
@@ -254,18 +254,18 @@ public class DelimiterGroup<T> {
* Checks if a given token opens a group.
*
* @param marker
- * The token to check.
+ * The token to check.
*
* @return The name of the group T opens, or null if it doesn't
* open one.
*/
public IPair<T, T[]> doesOpen(final T marker) {
- if (openDelimiters.containsKey(marker)) return new Pair<>(openDelimiters.get(marker), null);
+ if(openDelimiters.containsKey(marker)) return new Pair<>(openDelimiters.get(marker), null);
- for (final Function<T, IPair<T, T[]>> pred : predOpeners) {
+ for(final Function<T, IPair<T, T[]>> pred : predOpeners) {
final IPair<T, T[]> par = pred.apply(marker);
- if (par.getLeft() != null) return par;
+ if(par.getLeft() != null) return par;
}
return new Pair<>(null, null);
@@ -341,10 +341,10 @@ public class DelimiterGroup<T> {
* Create a new empty delimiter group.
*
* @param name
- * The name of the delimiter group
+ * The name of the delimiter group
*/
public DelimiterGroup(final T name) {
- if (name == null) throw new NullPointerException("Group name must not be null");
+ if(name == null) throw new NullPointerException("Group name must not be null");
groupName = name;
@@ -367,16 +367,16 @@ public class DelimiterGroup<T> {
* Adds one or more delimiters that close this group.
*
* @param closers
- * Delimiters that close this group.
+ * Delimiters that close this group.
*/
@SafeVarargs
public final void addClosing(final T... closers) {
final List<T> closerList = Arrays.asList(closers);
- for (final T closer : closerList) {
- if (closer == null)
+ for(final T closer : closerList) {
+ if(closer == null)
throw new NullPointerException("Closing delimiter must not be null");
- else if (closer.equals(""))
+ else if(closer.equals(""))
/*
* We can do this because equals works on
* arbitrary objects, not just those of the same
@@ -394,14 +394,14 @@ public class DelimiterGroup<T> {
* group.
*
* @param exclusions
- * The groups forbidden in the top level of this group.
+ * The groups forbidden in the top level of this group.
*/
@SafeVarargs
public final void addTopLevelForbid(final T... exclusions) {
- for (final T exclusion : exclusions) {
- if (exclusion == null)
+ for(final T exclusion : exclusions) {
+ if(exclusion == null)
throw new NullPointerException("Exclusion must not be null");
- else if (exclusion.equals(""))
+ else if(exclusion.equals(""))
/*
* We can do this because equals works on
* arbitrary objects, not just those of the same
@@ -418,14 +418,14 @@ public class DelimiterGroup<T> {
* Adds one or more groups that cannot occur at all in this group.
*
* @param exclusions
- * The groups forbidden inside this group.
+ * The groups forbidden inside this group.
*/
@SafeVarargs
public final void addGroupForbid(final T... exclusions) {
- for (final T exclusion : exclusions) {
- if (exclusion == null)
+ for(final T exclusion : exclusions) {
+ if(exclusion == null)
throw new NullPointerException("Exclusion must not be null");
- else if (exclusion.equals(""))
+ else if(exclusion.equals(""))
/*
* We can do this because equals works on
* arbitrary objects, not just those of the same
@@ -442,13 +442,13 @@ public class DelimiterGroup<T> {
* Adds sub-group markers to this group.
*
* @param subgroup
- * The token to mark a sub-group.
+ * The token to mark a sub-group.
*
* @param priority
- * The priority of this sub-group.
+ * The priority of this sub-group.
*/
public void addSubgroup(final T subgroup, final int priority) {
- if (subgroup == null) throw new NullPointerException("Subgroup marker must not be null");
+ if(subgroup == null) throw new NullPointerException("Subgroup marker must not be null");
subgroups.put(subgroup, priority);
}
@@ -457,14 +457,15 @@ public class DelimiterGroup<T> {
* Adds a marker that opens a group at the top level of this group.
*
* @param opener
- * The marker that opens the group.
+ * The marker that opens the group.
*
* @param group
- * The group opened by the marker.
+ * The group opened by the marker.
*/
public void addOpener(final T opener, final T group) {
- if (opener == null) throw new NullPointerException("Opener must not be null");
- else if (group == null) throw new NullPointerException("Group to open must not be null");
+ if(opener == null)
+ throw new NullPointerException("Opener must not be null");
+ else if(group == null) throw new NullPointerException("Group to open must not be null");
openDelimiters.put(opener, group);
}
@@ -473,14 +474,15 @@ public class DelimiterGroup<T> {
* Adds a marker that opens a group inside of this group.
*
* @param opener
- * The marker that opens the group.
+ * The marker that opens the group.
*
* @param group
- * The group opened by the marker.
+ * The group opened by the marker.
*/
public void addNestedOpener(final T opener, final T group) {
- if (opener == null) throw new NullPointerException("Opener must not be null");
- else if (group == null) throw new NullPointerException("Group to open must not be null");
+ if(opener == null)
+ throw new NullPointerException("Opener must not be null");
+ else if(group == null) throw new NullPointerException("Group to open must not be null");
nestedOpenDelimiters.put(opener, group);
}
@@ -489,16 +491,20 @@ public class DelimiterGroup<T> {
* Mark a closing delimiter as implying a subgroup.
*
* @param closer
- * The closing delimiter.
+ * The closing delimiter.
*
* @param subgroup
- * The subgroup to imply.
+ * The subgroup to imply.
*/
public void implySubgroup(final T closer, final T subgroup) {
- if (closer == null) throw new NullPointerException("Closer must not be null");
- else if (subgroup == null) throw new NullPointerException("Subgroup must not be null");
- else if (!closingDelimiters.contains(closer)) throw new IllegalArgumentException(String.format("No closing delimiter '%s' defined", closer));
- else if (!subgroups.containsKey(subgroup)) throw new IllegalArgumentException(String.format("No subgroup '%s' defined", subgroup));
+ if(closer == null)
+ throw new NullPointerException("Closer must not be null");
+ else if(subgroup == null)
+ throw new NullPointerException("Subgroup must not be null");
+ else if(!closingDelimiters.contains(closer))
+ throw new IllegalArgumentException(String.format("No closing delimiter '%s' defined", closer));
+ else if(!subgroups.containsKey(subgroup))
+ throw new IllegalArgumentException(String.format("No subgroup '%s' defined", subgroup));
impliedSubgroups.put(closer, subgroup);
}
@@ -514,26 +520,26 @@ public class DelimiterGroup<T> {
builder.append("], ");
builder.append("closingDelimiters=[");
- for (final T closer : closingDelimiters) {
+ for(final T closer : closingDelimiters) {
builder.append(closer + ",");
}
builder.deleteCharAt(builder.length() - 1);
builder.append("]");
- if (topLevelExclusions != null && !topLevelExclusions.isEmpty()) {
+ if(topLevelExclusions != null && !topLevelExclusions.isEmpty()) {
builder.append(", ");
builder.append("topLevelExclusions=[");
- for (final T exclusion : topLevelExclusions) {
+ for(final T exclusion : topLevelExclusions) {
builder.append(exclusion + ",");
}
builder.deleteCharAt(builder.length() - 1);
builder.append("]");
}
- if (groupExclusions != null && !groupExclusions.isEmpty()) {
+ if(groupExclusions != null && !groupExclusions.isEmpty()) {
builder.append(", ");
builder.append("groupExclusions=[");
- for (final T exclusion : groupExclusions) {
+ for(final T exclusion : groupExclusions) {
builder.append(exclusion + ",");
}
builder.deleteCharAt(builder.length() - 1);
@@ -549,10 +555,10 @@ public class DelimiterGroup<T> {
* Open an instance of this group.
*
* @param opener
- * The item that opened this group.
+ * The item that opened this group.
*
* @param parms
- * The parameters that opened this group
+ * The parameters that opened this group
*
* @return An opened instance of this group.
*/
@@ -564,8 +570,7 @@ public class DelimiterGroup<T> {
* Adds a predicated opener to the top level of this group.
*
* @param pred
- * The predicate that defines the opener and its
- * parameters.
+ * The predicate that defines the opener and its parameters.
*/
public void addPredOpener(final Function<T, IPair<T, T[]>> pred) {
predOpeners.add(pred);
@@ -575,7 +580,7 @@ public class DelimiterGroup<T> {
* Adds a predicated closer to the top level of this group.
*
* @param pred
- * The predicate that defines the closer.
+ * The predicate that defines the closer.
*/
public void addPredCloser(final BiPredicate<T, T[]> pred) {
predClosers.add(pred);
@@ -585,7 +590,7 @@ public class DelimiterGroup<T> {
* Set whether or not this group starts a new nesting set.
*
* @param forgetful
- * Whether this group starts a new nesting set.
+ * Whether this group starts a new nesting set.
*/
public void setForgetful(final boolean forgetful) {
this.forgetful = forgetful;
diff --git a/base/src/main/java/bjc/utils/parserutils/delims/RegexCloser.java b/base/src/main/java/bjc/utils/parserutils/delims/RegexCloser.java
index 4b29949..ac257d1 100644
--- a/base/src/main/java/bjc/utils/parserutils/delims/RegexCloser.java
+++ b/base/src/main/java/bjc/utils/parserutils/delims/RegexCloser.java
@@ -15,7 +15,7 @@ public class RegexCloser implements BiPredicate<String, String[]> {
* Create a new regex closer.
*
* @param closer
- * The format string to use for closing.
+ * The format string to use for closing.
*/
public RegexCloser(final String closer) {
rep = closer;
diff --git a/base/src/main/java/bjc/utils/parserutils/delims/RegexOpener.java b/base/src/main/java/bjc/utils/parserutils/delims/RegexOpener.java
index ee93b73..15f11e3 100644
--- a/base/src/main/java/bjc/utils/parserutils/delims/RegexOpener.java
+++ b/base/src/main/java/bjc/utils/parserutils/delims/RegexOpener.java
@@ -22,10 +22,10 @@ public class RegexOpener implements Function<String, IPair<String, String[]>> {
* Create a new regex opener.
*
* @param groupName
- * The name of the opened group.
+ * The name of the opened group.
*
* @param groupRegex
- * The regex that matches the opener.
+ * The regex that matches the opener.
*/
public RegexOpener(final String groupName, final String groupRegex) {
name = groupName;
@@ -37,12 +37,12 @@ public class RegexOpener implements Function<String, IPair<String, String[]>> {
public IPair<String, String[]> apply(final String str) {
final Matcher m = patt.matcher(str);
- if (m.matches()) {
+ if(m.matches()) {
final int numGroups = m.groupCount();
final String[] parms = new String[numGroups + 1];
- for (int i = 0; i <= numGroups; i++) {
+ for(int i = 0; i <= numGroups; i++) {
parms[i] = m.group(i);
}
diff --git a/base/src/main/java/bjc/utils/parserutils/delims/SequenceCharacteristics.java b/base/src/main/java/bjc/utils/parserutils/delims/SequenceCharacteristics.java
index 882b4c5..9e4c167 100644
--- a/base/src/main/java/bjc/utils/parserutils/delims/SequenceCharacteristics.java
+++ b/base/src/main/java/bjc/utils/parserutils/delims/SequenceCharacteristics.java
@@ -6,7 +6,7 @@ package bjc.utils.parserutils.delims;
* @author EVE
*
* @param <T>
- * The type of item in the tree.
+ * The type of item in the tree.
*/
public class SequenceCharacteristics<T> {
/**
@@ -29,11 +29,11 @@ public class SequenceCharacteristics<T> {
* Create a new set of parameters for building a tree.
*
* @param root
- * The root marker.
+ * The root marker.
* @param contents
- * The group/subgroup contents marker.
+ * The group/subgroup contents marker.
* @param subgroup
- * The subgroup marker.
+ * The subgroup marker.
*/
public SequenceCharacteristics(final T root, final T contents, final T subgroup) {
this.root = root;
@@ -55,23 +55,23 @@ public class SequenceCharacteristics<T> {
@Override
public boolean equals(final Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (!(obj instanceof SequenceCharacteristics)) return false;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(!(obj instanceof SequenceCharacteristics)) return false;
final SequenceCharacteristics<?> other = (SequenceCharacteristics<?>) obj;
- if (contents == null) {
- if (other.contents != null) return false;
- } else if (!contents.equals(other.contents)) return false;
+ if(contents == null) {
+ if(other.contents != null) return false;
+ } else if(!contents.equals(other.contents)) return false;
- if (root == null) {
- if (other.root != null) return false;
- } else if (!root.equals(other.root)) return false;
+ if(root == null) {
+ if(other.root != null) return false;
+ } else if(!root.equals(other.root)) return false;
- if (subgroup == null) {
- if (other.subgroup != null) return false;
- } else if (!subgroup.equals(other.subgroup)) return false;
+ if(subgroup == null) {
+ if(other.subgroup != null) return false;
+ } else if(!subgroup.equals(other.subgroup)) return false;
return true;
}
diff --git a/base/src/main/java/bjc/utils/parserutils/delims/SequenceDelimiter.java b/base/src/main/java/bjc/utils/parserutils/delims/SequenceDelimiter.java
index ccfaffb..0eddebe 100644
--- a/base/src/main/java/bjc/utils/parserutils/delims/SequenceDelimiter.java
+++ b/base/src/main/java/bjc/utils/parserutils/delims/SequenceDelimiter.java
@@ -24,7 +24,7 @@ import bjc.utils.funcutils.StringUtils;
* @author EVE
*
* @param <T>
- * The type of items in the sequence.
+ * The type of items in the sequence.
*/
public class SequenceDelimiter<T> {
/*
@@ -63,10 +63,9 @@ public class SequenceDelimiter<T> {
* </pre>
*
* @param chars
- * The parameters on how to mark certain portions of the
- * tree.
+ * The parameters on how to mark certain portions of the tree.
* @param seq
- * The sequence to delimit.
+ * The sequence to delimit.
*
* @return The sequence as a tree that matches its group structure. Each
* node in the tree is either a data node, a subgroup node, or a
@@ -89,14 +88,14 @@ public class SequenceDelimiter<T> {
* recursive tree.
*
* @throws DelimiterException
- * Thrown if something went wrong during sequence
- * delimitation.
+ * Thrown if something went wrong during sequence delimitation.
*
*/
public ITree<T> delimitSequence(final SequenceCharacteristics<T> chars,
@SuppressWarnings("unchecked") final T... seq) throws DelimiterException {
- if (initialGroup == null) throw new NullPointerException("Initial group must be specified.");
- else if (chars == null) throw new NullPointerException("Sequence characteristics must not be null");
+ if(initialGroup == null)
+ throw new NullPointerException("Initial group must be specified.");
+ else if(chars == null) throw new NullPointerException("Sequence characteristics must not be null");
/*
* The stack of opened and not yet closed groups.
@@ -128,7 +127,7 @@ public class SequenceDelimiter<T> {
/*
* Process each member of the sequence.
*/
- for (int i = 0; i < seq.length; i++) {
+ for(int i = 0; i < seq.length; i++) {
final T tok = seq[i];
/*
@@ -137,14 +136,14 @@ public class SequenceDelimiter<T> {
final IPair<T, T[]> possibleOpenPar = groupStack.top().doesOpen(tok);
T possibleOpen = possibleOpenPar.getLeft();
- if (possibleOpen == null) {
+ if(possibleOpen == null) {
/*
* Handle nested openers.
*
* Local openers take priority over nested ones
* if they overlap.
*/
- if (allowedDelimiters.top().containsKey(tok)) {
+ if(allowedDelimiters.top().containsKey(tok)) {
possibleOpen = allowedDelimiters.top().get(tok).iterator().next();
}
}
@@ -152,7 +151,7 @@ public class SequenceDelimiter<T> {
/*
* If we have an opening delimiter, handle it.
*/
- if (possibleOpen != null) {
+ if(possibleOpen != null) {
final DelimiterGroup<T> group = groups.get(possibleOpen);
/*
@@ -163,10 +162,10 @@ public class SequenceDelimiter<T> {
* top-level of this group, as well as nested
* exclusions from all enclosing groups.
*/
- if (isForbidden(groupStack, forbiddenDelimiters, possibleOpen)) {
+ if(isForbidden(groupStack, forbiddenDelimiters, possibleOpen)) {
T forbiddenBy;
- if (whoForbid.containsKey(tok)) {
+ if(whoForbid.containsKey(tok)) {
forbiddenBy = whoForbid.get(tok);
} else {
forbiddenBy = groupStack.top().getName();
@@ -188,7 +187,7 @@ public class SequenceDelimiter<T> {
/*
* Handle 'forgetful' groups that reset nesting
*/
- if (open.isForgetful()) {
+ if(open.isForgetful()) {
allowedDelimiters.push(HashMultimap.create());
forbiddenDelimiters.push(HashMultiset.create());
}
@@ -197,7 +196,7 @@ public class SequenceDelimiter<T> {
* Add the nested opens from this group.
*/
final Multimap<T, T> currentAllowed = allowedDelimiters.top();
- for (final Entry<T, T> opener : open.getNestingOpeners().entrySet()) {
+ for(final Entry<T, T> opener : open.getNestingOpeners().entrySet()) {
currentAllowed.put(opener.getKey(), opener.getValue());
}
@@ -205,12 +204,12 @@ public class SequenceDelimiter<T> {
* Add the nested exclusions from this group
*/
final Multiset<T> currentForbidden = forbiddenDelimiters.top();
- for (final T exclusion : open.getNestingExclusions()) {
+ for(final T exclusion : open.getNestingExclusions()) {
currentForbidden.add(exclusion);
whoForbid.put(exclusion, possibleOpen);
}
- } else if (!groupStack.empty() && groupStack.top().isClosing(tok)) {
+ } else if(!groupStack.empty() && groupStack.top().isClosing(tok)) {
/*
* Close the group.
*/
@@ -222,7 +221,7 @@ public class SequenceDelimiter<T> {
* Remove nested exclusions from this group.
*/
final Multiset<T> currentForbidden = forbiddenDelimiters.top();
- for (final T excludedGroup : closed.getNestingExclusions()) {
+ for(final T excludedGroup : closed.getNestingExclusions()) {
currentForbidden.remove(excludedGroup);
whoForbid.remove(excludedGroup);
@@ -232,18 +231,18 @@ public class SequenceDelimiter<T> {
* Remove the nested opens from this group.
*/
final Multimap<T, T> currentAllowed = allowedDelimiters.top();
- for (final Entry<T, T> closer : closed.getNestingOpeners().entrySet()) {
+ for(final Entry<T, T> closer : closed.getNestingOpeners().entrySet()) {
currentAllowed.remove(closer.getKey(), closer.getValue());
}
/*
* Handle 'forgetful' groups that reset nesting.
*/
- if (closed.isForgetful()) {
+ if(closed.isForgetful()) {
allowedDelimiters.drop();
forbiddenDelimiters.drop();
}
- } else if (!groupStack.empty() && groupStack.top().marksSubgroup(tok)) {
+ } else if(!groupStack.empty() && groupStack.top().marksSubgroup(tok)) {
/*
* Mark a subgroup.
*/
@@ -259,7 +258,7 @@ public class SequenceDelimiter<T> {
/*
* Error if not all groups were closed.
*/
- if (groupStack.size() > 1) {
+ if(groupStack.size() > 1) {
final DelimiterGroup<T>.OpenGroup group = groupStack.top();
final StringBuilder msgBuilder = new StringBuilder();
@@ -294,7 +293,7 @@ public class SequenceDelimiter<T> {
/*
* Check if a delimiter is locally forbidden.
*/
- if (groupStack.empty()) {
+ if(groupStack.empty()) {
localForbid = false;
} else {
localForbid = groupStack.top().excludes(groupName);
@@ -307,10 +306,10 @@ public class SequenceDelimiter<T> {
* Add a delimiter group.
*
* @param group
- * The delimiter group.
+ * The delimiter group.
*/
public void addGroup(final DelimiterGroup<T> group) {
- if (group == null) throw new NullPointerException("Group must not be null");
+ if(group == null) throw new NullPointerException("Group must not be null");
groups.put(group.groupName, group);
}
@@ -319,11 +318,11 @@ public class SequenceDelimiter<T> {
* Creates and adds a delimiter group using the provided settings.
*
* @param openers
- * The tokens that open this group
+ * The tokens that open this group
* @param groupName
- * The name of the group
+ * The name of the group
* @param closers
- * The tokens that close this group
+ * The tokens that close this group
*/
public void addGroup(final T[] openers, final T groupName, @SuppressWarnings("unchecked") final T... closers) {
final DelimiterGroup<T> group = new DelimiterGroup<>(groupName);
@@ -332,7 +331,7 @@ public class SequenceDelimiter<T> {
addGroup(group);
- for (final T open : openers) {
+ for(final T open : openers) {
group.addOpener(open, groupName);
}
}
@@ -343,13 +342,13 @@ public class SequenceDelimiter<T> {
builder.append("SequenceDelimiter [");
- if (groups != null) {
+ if(groups != null) {
builder.append("groups=");
builder.append(groups);
builder.append(",");
}
- if (initialGroup != null) {
+ if(initialGroup != null) {
builder.append("initialGroup=");
builder.append(initialGroup);
}
@@ -363,7 +362,7 @@ public class SequenceDelimiter<T> {
* Set the initial group of this delimiter.
*
* @param initialGroup
- * The initial group of this delimiter.
+ * The initial group of this delimiter.
*/
public void setInitialGroup(final DelimiterGroup<T> initialGroup) {
this.initialGroup = initialGroup;
diff --git a/base/src/main/java/bjc/utils/parserutils/delims/StringDelimiter.java b/base/src/main/java/bjc/utils/parserutils/delims/StringDelimiter.java
index e3eeea5..10c680c 100644
--- a/base/src/main/java/bjc/utils/parserutils/delims/StringDelimiter.java
+++ b/base/src/main/java/bjc/utils/parserutils/delims/StringDelimiter.java
@@ -16,12 +16,12 @@ public class StringDelimiter extends SequenceDelimiter<String> {
* for ease of use for strings.
*
* @param seq
- * The sequence to delimit.
+ * The sequence to delimit.
*
* @return The sequence as a tree.
*
* @throws DelimiterException
- * if something went wrong with delimiting the sequence.
+ * if something went wrong with delimiting the sequence.
*
* @see SequenceDelimiter
*/