Skip to content
Permalink
Browse files

Small code cleanup, #364

  • Loading branch information...
gnodet committed Mar 15, 2019
1 parent 514c516 commit b3e6ed2e805214a390fe5a48d8dd9770ae949435
Showing with 14 additions and 12 deletions.
  1. +14 −12 reader/src/main/java/org/jline/reader/impl/DefaultParser.java
@@ -209,18 +209,20 @@ public ParsedLine parse(final String line, final int cursor, ParseContext contex
rawWordLength = rawWordCursor;
}

if (eofOnEscapedNewLine && isEscapeChar(line, line.length() - 1) && context != ParseContext.COMPLETE) {
throw new EOFError(-1, -1, "Escaped new line", "newline");
}
if (eofOnUnclosedQuote && quoteStart >= 0 && context != ParseContext.COMPLETE) {
throw new EOFError(-1, -1, "Missing closing quote", line.charAt(quoteStart) == '\''
? "quote" : "dquote");
}
if (bracketChecker.isOpeningBracketMissing() && context != ParseContext.COMPLETE) {
throw new EOFError(-1, -1, "Missing opening bracket", "missing: " + bracketChecker.getMissingOpeningBracket());
}
if (bracketChecker.isClosingBracketMissing() && context != ParseContext.COMPLETE) {
throw new EOFError(-1, -1, "Missing closing brackets", "add: " + bracketChecker.getMissingClosingBrackets());
if (context != ParseContext.COMPLETE) {
if (eofOnEscapedNewLine && isEscapeChar(line, line.length() - 1)) {
throw new EOFError(-1, -1, "Escaped new line", "newline");
}
if (eofOnUnclosedQuote && quoteStart >= 0) {
throw new EOFError(-1, -1, "Missing closing quote", line.charAt(quoteStart) == '\''
? "quote" : "dquote");
}
if (bracketChecker.isOpeningBracketMissing()) {
throw new EOFError(-1, -1, "Missing opening bracket", "missing: " + bracketChecker.getMissingOpeningBracket());
}
if (bracketChecker.isClosingBracketMissing()) {
throw new EOFError(-1, -1, "Missing closing brackets", "add: " + bracketChecker.getMissingClosingBrackets());
}
}

String openingQuote = quotedWord ? line.substring(quoteStart, quoteStart + 1) : null;

0 comments on commit b3e6ed2

Please sign in to comment.
You can’t perform that action at this time.