Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## lp.parse
Class LpParserException

    java.lang.Object
      java.lang.Throwable
          java.lang.Exception
              java.lang.RuntimeException
                  lp.parse.LpParserException

All Implemented Interfaces:
  Serializable

    public class LpParserException

extends RuntimeException

An exception thrown by `LpParser` when it can't parse the input. Contains information about what token the parser expected, what it found and where. This information is accessible through getter methods (`getExpected()`, `getFound()`, `getLineNumber()` and `getPosition()`) and is also included in the message returned by `getMessage()`.

Version:
  1.0.0
Author:
  Martin Slota
See Also:
  `LpParser`, `LpTokenType`, Serialized Form

Field Summary
`private LpTokenType` | `expected` Expected token.
`private String` | `found` Token found instead.
`private int` | `lineNumber` Line number within the input where the problematic token was found.
`private int` | `position` Line position of the problematic token's beginning.

Constructor Summary
`LpParserException(LpTokenType expected, LpLexer lexer)` Exception constructor taking the necessary information about the problematic token from a given `LpLexer`.
`LpParserException(LpTokenType expected, String found, int lineNumber, int position)` Exception constructor.

Method Summary
`LpTokenType` | `getExpected()` Getter method for the expected token.
`String` | `getFound()` Getter method for the problematic token, i.e. the token found instead of the expected token.
`int` | `getLineNumber()` Getter method for number of line on which the problematic token was found.
`String` | `getMessage()` Returns a message containing information about the parser problem.
`int` | `getPosition()` Getter method for line position of the problematic token's beginning.

Methods inherited from class java.lang.Throwable
`fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### expected

    private final LpTokenType expected

  Expected token.

### found

    private final String found

  Token found instead.

### position

    private final int position

  Line position of the problematic token's beginning.

### lineNumber

    private final int lineNumber

  Line number within the input where the problematic token was found.

Constructor Detail

### LpParserException

    public LpParserException(LpTokenType expected,
                             LpLexer lexer)

  Exception constructor taking the necessary information about the problematic token from a given `LpLexer`.

  Parameters:
    `expected` - expected token
    `lexer` - lexer that just returned the token found

### LpParserException

    public LpParserException(LpTokenType expected,
                             String found,
                             int lineNumber,
                             int position)

  Exception constructor. Doesn't check if the expected token and the token found differ.

  Parameters:
    `expected` - expected token
    `found` - token found instead of the expected token
    `lineNumber` - number of the line where the problematic token was found
    `position` - position of the problematic token within the line

Method Detail

### getExpected

    public LpTokenType getExpected()

  Getter method for the expected token.

  Returns:
    expected token

### getFound

    public String getFound()

  Getter method for the problematic token, i.e. the token found instead of the expected token.

  Returns:
    problematic token

### getPosition

    public int getPosition()

  Getter method for line position of the problematic token's beginning.

  Returns:
    line position of the problematic token's beginning

### getLineNumber

    public int getLineNumber()

  Getter method for number of line on which the problematic token was found.

  Returns:
    number of line on which the problematic token was found

### getMessage

    public String getMessage()

  Returns a message containing information about the parser problem.

  Overrides:
    `getMessage` in class `Throwable`
  Returns:
    message containing the position in the input where the problem was encountered, the expected token and the token found instead

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD