Skip to content

Commit

Permalink
remove unused end argument
Browse files Browse the repository at this point in the history
  • Loading branch information
lavajuno committed Dec 27, 2023
1 parent 53f5d44 commit f0d7a1e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
7 changes: 3 additions & 4 deletions src/main/java/org/lavajuno/mirrorlog/yaml/YamlElement.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,11 @@ protected enum LINE_MATCHES {
* @param key Key for the new element
* @param lines Lines we are parsing
* @param begin Where to begin parsing
* @param end This will be set to where we stop parsing
* @param indent Indent of the new element's elements
* @return A new YamlElement. (Either a YamlList or a YamlMap)
* @throws InvalidPropertiesFormatException If an error is encountered while parsing
*/
protected static YamlElement parseElement(String key, List<String> lines, int begin, Integer end, int indent)
protected static YamlElement parseElement(String key, List<String> lines, int begin, int indent)
throws InvalidPropertiesFormatException {
int i = begin + 1;
for(; i < lines.size(); i++) {
Expand All @@ -58,8 +57,8 @@ protected static YamlElement parseElement(String key, List<String> lines, int be
throw new InvalidPropertiesFormatException("Reached end of input.");
}
return switch (matchLine(lines.get(i))) {
case LIST_ELEMENT, LIST_PAIR, LIST_VALUE -> new YamlList(key, lines, i, end, indent);
case ELEMENT, PAIR -> new YamlMap(key, lines, i, end, indent);
case LIST_ELEMENT, LIST_PAIR, LIST_VALUE -> new YamlList(key, lines, i, indent);
case ELEMENT, PAIR -> new YamlMap(key, lines, i, indent);
default -> {
printParseError(lines.get(i), i, "Unexpected line.");
throw new InvalidPropertiesFormatException("Parse error on line " + i + ".");
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/lavajuno/mirrorlog/yaml/YamlList.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ public class YamlList extends YamlElement {
* @param key This YamlMap's key
* @param lines Input we are parsing
* @param begin Where to begin parsing
* @param end This will be set to where we stop parsing
* @param indent Indent of this YamlMap's elements
* @throws InvalidPropertiesFormatException If an error is encountered while parsing
*/
protected YamlList(String key, List<String> lines, int begin, Integer end, int indent) throws InvalidPropertiesFormatException {
protected YamlList(String key, List<String> lines, int begin, int indent) throws InvalidPropertiesFormatException {
this.KEY = key;
this.ELEMENTS = new Vector<>();

Expand All @@ -32,7 +31,7 @@ protected YamlList(String key, List<String> lines, int begin, Integer end, int i
switch(line_match) {
case LIST_ELEMENT:
String curr_key = parseKey(line.split("-", 2)[1]);
ELEMENTS.add(parseElement(curr_key, lines, i, end, indent + 2));
ELEMENTS.add(parseElement(curr_key, lines, i, indent + 2));
break;
case LIST_PAIR:
ELEMENTS.add(new YamlPair(line.split("-", 2)[1].stripLeading()));
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/org/lavajuno/mirrorlog/yaml/YamlMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@ public class YamlMap extends YamlElement {
* @throws InvalidPropertiesFormatException If an error is encountered while parsing
*/
public YamlMap(List<String> lines) throws InvalidPropertiesFormatException {
this("root", lines, 0, 0, 0);
this("root", lines, 0, 0);
}

/**
* Constructs a YamlMap.
* @param key This YamlMap's key
* @param lines Input we are parsing
* @param begin Where to begin parsing
* @param end This will be set to where we stop parsing
* @param indent Indent of this YamlMap's elements
* @throws InvalidPropertiesFormatException If an error is encountered while parsing
*/
protected YamlMap(String key, List<String> lines, int begin, Integer end, int indent) throws InvalidPropertiesFormatException {
protected YamlMap(String key, List<String> lines, int begin, int indent) throws InvalidPropertiesFormatException {
this.KEY = key;
this.ELEMENTS = new TreeMap<>();
for(int i = begin; i < lines.size(); i++) {
Expand All @@ -40,7 +39,7 @@ protected YamlMap(String key, List<String> lines, int begin, Integer end, int in
switch(line_match) {
case ELEMENT:
curr_key = parseKey(line);
ELEMENTS.put(curr_key, parseElement(curr_key, lines, i, end, indent + 2));
ELEMENTS.put(curr_key, parseElement(curr_key, lines, i, indent + 2));
break;
case PAIR:
curr_key = parseKey(line);
Expand Down

0 comments on commit f0d7a1e

Please sign in to comment.