Class EOFError
- All Implemented Interfaces:
Serializable
EOFError is a specialized type of SyntaxError
that indicates the input
is incomplete rather than invalid. This typically occurs when the user has entered
an incomplete construct, such as an unclosed quote, parenthesis, or bracket.
This exception provides additional information about what is missing to complete the input, which can be used by the LineReader to provide appropriate feedback to the user, such as a continuation prompt that indicates what needs to be closed.
The name "EOFError" refers to "End Of File Error", indicating that the parser reached the end of the input before the syntax was complete.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the string that is missing to complete the input.Returns the next closing bracket that is expected.int
Returns the number of unclosed brackets in the input.Methods inherited from class org.jline.reader.SyntaxError
column, line
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
EOFError
-
EOFError
-
EOFError
-
-
Method Details
-
getMissing
Returns the string that is missing to complete the input.This is typically a closing delimiter such as a quote, parenthesis, or bracket that would complete the current syntactic construct.
- Returns:
- the missing string, or null if not applicable
-
getOpenBrackets
public int getOpenBrackets()Returns the number of unclosed brackets in the input.This count can be used to determine how many closing brackets are needed to complete the input.
- Returns:
- the number of unclosed brackets
-
getNextClosingBracket
Returns the next closing bracket that is expected.This indicates the specific type of bracket (e.g., ')', ']', or '}') that is expected next to continue closing the open brackets.
- Returns:
- the next expected closing bracket, or null if not applicable
-