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 LpToken

    java.lang.Object
      lp.parse.LpToken

    public class LpToken

extends Object

An immutable container for information about 1 token in an input created by a `LpLexer`. Contains a type, the corresponding lexem, line number and the position within the line.

Version:
  1.0.0
Author:
  Martin Slota
See Also:
  `LpLexer`, `LpTokenType`

Field Summary
`private String` | `lexem` The corresponding lexem.
`private int` | `lineNumber` Number of the line where the token occurs.
`private int` | `position` Position within the line where the token occurs.
`private LpTokenType` | `type` Type of the token.

Constructor Summary
`LpToken(LpTokenType type, String lexem, int lineNumber, int position)` Creates a new instance.

Method Summary
`String` | `getLexem()` Returns the corresponding lexem.
`int` | `getLineNumber()` Returns the position within the line where the token occurs.
`int` | `getPosition()` Returns the number of the line where the token occurs.
`LpTokenType` | `getType()` Returns the type of the token.

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

Field Detail

### type

    private final LpTokenType type

  Type of the token.

### lexem

    private final String lexem

  The corresponding lexem.

### lineNumber

    private final int lineNumber

  Number of the line where the token occurs. Lines are numbered from 1.

### position

    private final int position

  Position within the line where the token occurs. Numbered from 1.

Constructor Detail

### LpToken

    public LpToken(LpTokenType type,
                   String lexem,
                   int lineNumber,
                   int position)

  Creates a new instance.

  Parameters:
    `type` - type of the token.
    `lexem` - the corresponding lexem.
    `lineNumber` - number of the line where the token occurs.
    `position` - position within the line where the token occurs.

Method Detail

### getType

    public LpTokenType getType()

  Returns the type of the token.

  Returns:
    the type of the token

### getLexem

    public String getLexem()

  Returns the corresponding lexem.

  Returns:
    the corresponding lexem.

### getPosition

    public int getPosition()

  Returns the number of the line where the token occurs.

  Returns:
    the number of the line where the token occurs.

### getLineNumber

    public int getLineNumber()

  Returns the position within the line where the token occurs.

  Returns:
    the position within the line where the token occurs.

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