scala.tools.nsc.io

# Lexer

#### class Lexer extends AnyRef

A simple lexer for tokens as they are used in JSON, plus parens `(`, `)` Tokens understood are:

`(`, `)`, `[`, `]`, `{`, `}`, `:`, `,`, `true`, `false`, `null`, strings (syntax as in JSON), integer numbers (syntax as in JSON: -?(0|\d+) floating point numbers (syntax as in JSON: -?(0|\d+)(\.\d+)?((e|E)(+|-)?\d+)?) The end of input is represented as its own token, EOF. Lexers can keep one token lookahead

Linear Supertypes
AnyRef, Any
Type Hierarchy Learn more about scaladoc diagrams
Ordering

1. Alphabetic
2. By inheritance

Inherited

1. Lexer
2. AnyRef
3. Any

Implicitly

1. by any2stringadd
2. by any2stringfmt
3. by any2ArrowAssoc
4. by any2Ensuring

1. Hide All
2. Show all

Learn more about member selection
Visibility

1. Public
2. All

### Instance Constructors

1. #### new Lexer(rd: Reader)

   rd

     the reader from which characters are read.

### Value Members

1. #### final def !=(arg0: AnyRef): Boolean

   Definition Classes
     AnyRef

2. #### final def !=(arg0: Any): Boolean

   Definition Classes
     Any

3. #### final def ##(): Int

   Definition Classes
     AnyRef → Any

4. #### def +(other: String): String

   Implicit information
     This member is added by an implicit conversion from Lexer to StringAdd performed by method any2stringadd in scala.Predef.
   Definition Classes
     StringAdd

5. #### def ->[B](y: B): (Lexer, B)

   Implicit information
     This member is added by an implicit conversion from Lexer to ArrowAssoc[Lexer] performed by method any2ArrowAssoc in scala.Predef.
   Definition Classes
     ArrowAssoc
   Annotations
     @inline()

6. #### final def ==(arg0: AnyRef): Boolean

   Definition Classes
     AnyRef

7. #### final def ==(arg0: Any): Boolean

   Definition Classes
     Any

8. #### def accept(ch: Char): Unit

   The current token is a delimiter consisting of given character, reads next token, otherwise raises an error.

   The current token is a delimiter consisting of given character, reads next token, otherwise raises an error.

   Exceptions thrown
     MalformedInput

     if the current token `token` is not a delimiter, or consists of a character different from `c`.

9. #### def accept(t: Token): Unit

   If current token equals given token, reads next token, otherwise raises an error.

   If current token equals given token, reads next token, otherwise raises an error.

   t

     the given token to compare current token with

   Exceptions thrown
     MalformedInput

     if the two tokens do not match.

10. #### def acceptChar(c: Char): Unit

    If last-read character equals given character, reads next character, otherwise raises an error

    If last-read character equals given character, reads next character, otherwise raises an error

    c

      the given character to compare with last-read character

    Exceptions thrown
      MalformedInput

      if character does not match

11. #### final def asInstanceOf[T0]: T0

    Definition Classes
      Any

12. #### var ch: Char

    The last-read character

13. #### def clone(): AnyRef

    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

14. #### def ensuring(cond: (Lexer) ⇒ Boolean, msg: ⇒ Any): Lexer

    Implicit information
      This member is added by an implicit conversion from Lexer to Ensuring[Lexer] performed by method any2Ensuring in scala.Predef.
    Definition Classes
      Ensuring

15. #### def ensuring(cond: (Lexer) ⇒ Boolean): Lexer

    Implicit information
      This member is added by an implicit conversion from Lexer to Ensuring[Lexer] performed by method any2Ensuring in scala.Predef.
    Definition Classes
      Ensuring

16. #### def ensuring(cond: Boolean, msg: ⇒ Any): Lexer

    Implicit information
      This member is added by an implicit conversion from Lexer to Ensuring[Lexer] performed by method any2Ensuring in scala.Predef.
    Definition Classes
      Ensuring

17. #### def ensuring(cond: Boolean): Lexer

    Implicit information
      This member is added by an implicit conversion from Lexer to Ensuring[Lexer] performed by method any2Ensuring in scala.Predef.
    Definition Classes
      Ensuring

18. #### final def eq(arg0: AnyRef): Boolean

    Definition Classes
      AnyRef

19. #### def equals(arg0: Any): Boolean

    Definition Classes
      AnyRef → Any

20. #### def error(msg: String): Nothing

    Always throws a `MalformedInput` exception with given error message.

    Always throws a `MalformedInput` exception with given error message.

    msg

      the error message

21. #### def finalize(): Unit

    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )

22. #### def formatted(fmtstr: String): String

    Implicit information
      This member is added by an implicit conversion from Lexer to StringFormat performed by method any2stringfmt in scala.Predef.
    Definition Classes
      StringFormat
    Annotations
      @inline()

23. #### final def getClass(): Class[_]

    Definition Classes
      AnyRef → Any

24. #### def getNumber(): Unit

    Reads a numeric literal, and forms an `IntLit` or `FloatLit` token from it.

    Reads a numeric literal, and forms an `IntLit` or `FloatLit` token from it. Last-read input character `ch` must be either `-` or a digit.

    Exceptions thrown
      MalformedInput

      if lexeme not recognized as a numeric literal.

25. #### def getString(): Unit

    Reads a string literal, and forms a `StringLit` token from it.

    Reads a string literal, and forms a `StringLit` token from it. Last-read input character `ch` must be opening `"`-quote.

    Exceptions thrown
      MalformedInput

      if lexeme not recognized as a string literal.

26. #### def hashCode(): Int

    Definition Classes
      AnyRef → Any

27. #### final def isInstanceOf[T0]: Boolean

    Definition Classes
      Any

28. #### final def ne(arg0: AnyRef): Boolean

    Definition Classes
      AnyRef

29. #### def nextChar(): Unit

    Reads next character into `ch`

30. #### def nextToken(): Unit

    Skips whitespace and reads next lexeme into `token`

    Skips whitespace and reads next lexeme into `token`

    Exceptions thrown
      MalformedInput

      if lexeme not recognized as a valid token

31. #### final def notify(): Unit

    Definition Classes
      AnyRef

32. #### final def notifyAll(): Unit

    Definition Classes
      AnyRef

33. #### var pos: Long

    The number of characters read so far

34. #### final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
      AnyRef

35. #### def toString(): String

    Definition Classes
      AnyRef → Any

36. #### var token: Token

    The last-read token

37. #### var tokenPos: Long

    The number of characters read before the start of the last-read token

38. #### final def wait(): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

39. #### final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

40. #### final def wait(arg0: Long): Unit

    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

41. #### def →[B](y: B): (Lexer, B)

    Implicit information
      This member is added by an implicit conversion from Lexer to ArrowAssoc[Lexer] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
      ArrowAssoc

### Shadowed Implicit Value Members

1. #### val self: Any

   Implicit information
     This member is added by an implicit conversion from Lexer to StringAdd performed by method any2stringadd in scala.Predef.
   Shadowing
     This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
     To access this member you can use a type ascription:

         (lexer: StringAdd).self

   Definition Classes
     StringAdd

2. #### val self: Any

   Implicit information
     This member is added by an implicit conversion from Lexer to StringFormat performed by method any2stringfmt in scala.Predef.
   Shadowing
     This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
     To access this member you can use a type ascription:

         (lexer: StringFormat).self

   Definition Classes
     StringFormat

### Deprecated Value Members

1. #### def x: Lexer

   Implicit information
     This member is added by an implicit conversion from Lexer to ArrowAssoc[Lexer] performed by method any2ArrowAssoc in scala.Predef.
   Shadowing
     This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
     To access this member you can use a type ascription:

         (lexer: ArrowAssoc[Lexer]).x

   Definition Classes
     ArrowAssoc
   Annotations
     @deprecated
   Deprecated

     (Since version 2.10.0) Use `leftOfArrow`instead``

2. #### def x: Lexer

   Implicit information
     This member is added by an implicit conversion from Lexer to Ensuring[Lexer] performed by method any2Ensuring in scala.Predef.
   Shadowing
     This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
     To access this member you can use a type ascription:

         (lexer: Ensuring[Lexer]).x

   Definition Classes
     Ensuring
   Annotations
     @deprecated
   Deprecated

     (Since version 2.10.0) Use `resultOfEnsuring`instead``

### Inherited from AnyRef

### Inherited from Any

### Inherited by implicit conversion any2stringadd from Lexer to StringAdd

### Inherited by implicit conversion any2stringfmt from Lexer to StringFormat

### Inherited by implicit conversion any2ArrowAssoc from Lexer to ArrowAssoc[Lexer]

### Inherited by implicit conversion any2Ensuring from Lexer to Ensuring[Lexer]

### Ungrouped