Skip to content

Commit

Permalink
Parser interface: remove redundant variable initializer and field mod…
Browse files Browse the repository at this point in the history
…ifiers
  • Loading branch information
mattirn committed Oct 23, 2021
1 parent 44cddcf commit ae78e09
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions reader/src/main/java/org/jline/reader/Parser.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2020, the original author or authors.
* Copyright (c) 2002-2021, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand All @@ -12,8 +12,8 @@
import java.util.regex.Pattern;

public interface Parser {
static final String REGEX_VARIABLE = "[a-zA-Z_]{1,}[a-zA-Z0-9_-]*";
static final String REGEX_COMMAND = "[:]{0,1}[a-zA-Z]{1,}[a-zA-Z0-9_-]*";
String REGEX_VARIABLE = "[a-zA-Z_]+[a-zA-Z0-9_-]*";
String REGEX_COMMAND = "[:]?[a-zA-Z]+[a-zA-Z0-9_-]*";

ParsedLine parse(String line, int cursor, ParseContext context) throws SyntaxError;

Expand All @@ -34,7 +34,7 @@ default boolean validVariableName(String name) {
}

default String getCommand(final String line) {
String out = "";
String out;
Pattern patternCommand = Pattern.compile("^\\s*" + REGEX_VARIABLE + "=(" + REGEX_COMMAND + ")(\\s+|$)");
Matcher matcher = patternCommand.matcher(line);
if (matcher.find()) {
Expand Down

0 comments on commit ae78e09

Please sign in to comment.