Class/Object

pli

Lexer

Related Docs: object Lexer | package pli

Permalink

class Lexer extends AnyRef

Turns a stream of characters into a stream of tokens.

To create a lexer, use the companion object’s forFile or forString methods.

The lexer is the first main componenent in the language implementation. It reads a stream of characters from a file, or for testing, from a string. It produces a stream of tokens which is further processed by the parser.

The lexer classifies tokens according to their token type. The token type of the next token in the token stream is available from nextTokenType.

The lexer keeps track of line and column positions inside the source code. The first character of the source code is line 1 and column 1. The location of the beginning of the next token is available from startLine and startColumn. The location of the first character after the next token is available from currentLine and currentColumn.

Most token types classify a fixed string such as an operator or keyword. The following token types are special:

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Lexer
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Lexer(input: Reader)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def at(tokenType: TokenType): Boolean

    Permalink

    Determine whether the next token has the specified type, but don't process that token.

  6. def atDigit: Boolean

    Permalink

    Determine whether the next code point in the input is a digit according to the Scala Language Specification, Chapter 1.

  7. def atEndOfFile(): Boolean

    Permalink
  8. def atEndOfLine(): Boolean

    Permalink
  9. def atLetter: Boolean

    Permalink

    Determine whether a given code point can be an operator character according to the Scala Language Specification, Chapter 1

  10. def atOperatorCharacter: Boolean

    Permalink

    Determine whether the next code point in the input is an operator character according to the Scala Language Specification, Chapter 1.

  11. def check(tokenType: TokenType): Boolean

    Permalink

    Determine whether the next token has the specified type, and process it if it does.

  12. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. var currentColumn: Int

    Permalink
  14. var currentLine: Int

    Permalink
  15. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  17. def expect(tokenType: TokenType): Unit

    Permalink

    Process the next token if it has the specified type, and throw an error if it doesn't.

  18. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  20. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  21. def isDigit(codepoint: Int): Boolean

    Permalink

    Determine whether the given code point is a digit according to the Scala Language Specification, Chapter 1.

  22. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  23. def isLetter(codepoint: Int): Boolean

    Permalink

    Determine whether the given code point is a letter according to the Scala Language Specification, Chapter 1.

  24. def isOperatorCharacter(codepoint: Int): Boolean

    Permalink

    Determine whether the given code point is an operator character according to the Scala Language Specification, Chapter 1.

  25. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  26. var nextCodepoint: Int

    Permalink

    next code point in input string, after current position

  27. var nextNextCodepoint: Int

    Permalink

    next code point after the next code point after the current position

  28. var nextTokenIntegerValue: Int

    Permalink
  29. val nextTokenText: StringBuilder

    Permalink
  30. var nextTokenType: TokenType

    Permalink
  31. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  32. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  33. def readNextCodepoint(): Unit

    Permalink
  34. def readNextToken(): TokenType

    Permalink
  35. def readNotFirstCodepoint(): Int

    Permalink
  36. def registerCodepoint(codepoint: Int): Unit

    Permalink
  37. def skipNextCodepoint(): Unit

    Permalink
  38. def skipWhitespaceAndComments(): Unit

    Permalink
  39. var startColumn: Int

    Permalink
  40. var startLine: Int

    Permalink
  41. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  42. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  43. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped