Class BeerScanner

Classdesc

Scans the source code string and returns a list of tokens.

Hierarchy

  • BeerScanner

Implements

Implemented by

Constructors

Properties

current: number = 0
line: number = 1
logger: Logger = ...
source: string
start: number = 0
tokens: Token[]

Methods

  • Parameters

    • source: string

    Returns void

  • Accumulate tokens at the specific range of the source code string

    Parameters

    Returns void

  • Consume the next character in the source code string and return it.

    Returns string

    the next character

  • Lookahead check the current character

    Returns string

    current character

  • Getter for the tokens

    Returns Token[]

    the tokens

  • Look for reserved keywords or identifiers

    Returns void

  • Check if is a letter

    Parameters

    • c: string

      {string} the character to check

    Returns boolean

  • Check if the character is a letter or a digit

    Parameters

    • c: string

      {string} the character to check

    Returns boolean

  • Check if is a digit

    Parameters

    • c: string

      {string} the character to check

    Returns boolean

  • Checks if the scanner has reached the end of the source code string

    Returns boolean

  • Match the current character in the source code string with expected one

    Parameters

    • expected: string

      {string} the expected character

    Returns boolean

  • Look for number literals

    Returns void

  • Lookahead check the next character but does not consume like this.advance()

    Returns string

    See

    this.advance()

  • Returns void

  • Returns void

  • Scan for tokens in the source code string

    Returns void

  • Scan the source code string and return a list of tokens. updates the tokens property of the class

    Returns void

  • Parameters

    • source: string

    Returns void

  • Look for string literals

    Returns void

Generated using TypeDoc