Class EOFError
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.jline.reader.SyntaxError
-
- org.jline.reader.EOFError
-
- All Implemented Interfaces:
java.io.Serializable
public class EOFError extends SyntaxError
Exception thrown when parsing is incomplete due to unexpected end of input.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.
-
-
Constructor Summary
Constructors Constructor Description EOFError(int line, int column, java.lang.String message)
EOFError(int line, int column, java.lang.String message, java.lang.String missing)
EOFError(int line, int column, java.lang.String message, java.lang.String missing, int openBrackets, java.lang.String nextClosingBracket)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getMissing()
Returns the string that is missing to complete the input.java.lang.String
getNextClosingBracket()
Returns the next closing bracket that is expected.int
getOpenBrackets()
Returns the number of unclosed brackets in the input.-
Methods inherited from class org.jline.reader.SyntaxError
column, line
-
-
-
-
Constructor Detail
-
EOFError
public EOFError(int line, int column, java.lang.String message)
-
EOFError
public EOFError(int line, int column, java.lang.String message, java.lang.String missing)
-
EOFError
public EOFError(int line, int column, java.lang.String message, java.lang.String missing, int openBrackets, java.lang.String nextClosingBracket)
-
-
Method Detail
-
getMissing
public java.lang.String 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
public java.lang.String 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
-
-