Class StiLexer

Performs the lexical analysis.

Hierarchy

  • StiLexer

Index

Constructors

constructor

  • new StiLexer(textValue: string): StiLexer
  • Creates a new instance of the StiLexer class.

    Parameters

    • textValue: string

      The Text for lexical analysis.

    Returns StiLexer

Properties

baseText

baseText: string

Gets or sets text for analys.

positionInText

positionInText: number

Gets or sets current position in text.

Accessors

text

  • get text(): string
  • set text(value: string): void
  • Gets or sets text for analys.

    Returns string

  • Gets or sets text for analys.

    Parameters

    • value: string

    Returns void

Methods

getPosition

  • Gets position of token in text.

    Parameters

    • positionInText: number

    Returns StiPosition

    Position of token in text.

getToken

  • Gets next token.

    Returns StiToken

    Next token.

replaceWithNotEqualPrefix

  • replaceWithNotEqualPrefix(prefix: StiTokenType, oldValue: string, newValue: string): void
  • Replaces all occurrences of a specified String, with another specified string. Before oldValue must not follow specified prefix - string.

    Parameters

    • prefix: StiTokenType

      Prefix - string.

    • oldValue: string

      A String to be replaced.

    • newValue: string

      A String to replace all occurrences of oldValue.

    Returns void

    Replaced string.

replaceWithPrefix

  • replaceWithPrefix(prefix: string, oldValue: string, newValue: string): void
  • Replaces all occurrences of a specified String, with another specified string. Before oldValue must follow specified prefix - string. Replacing is produced with provision for tokens.

    Parameters

    • prefix: string

      Prefix - string.

    • oldValue: string

      A String to be replaced.

    • newValue: string

      A String to replace all occurrences of oldValue.

    Returns void

    Replaced string.

reset

  • reset(): void
  • Reset state.

    Returns void

savePosToken

  • savePosToken(): void
  • Saves position of token in text.

    Returns void

scanChar

  • Scans the symbol.

    Returns StiToken

    Token containing symbol.

scanIdent

  • Scans the identifier.

    Returns StiToken

    Token containing identifier.

scanNumber

  • Scans the number.

    Returns StiToken

    Token containing number.

scanString

  • Scans the string.

    Returns StiToken

    Token containing string.

skip

  • skip(): void
  • Skips all not control symbols.

    Returns void

ungetToken

  • ungetToken(): void
  • Returns to previous token.

    Returns void

waitAssign2

  • waitAssign2(): boolean
  • Wait the assign.

    Returns boolean

waitComma2

  • waitComma2(): boolean
  • Wait the right bracket.

    Returns boolean

waitLbrace2

  • waitLbrace2(): boolean
  • Wait the left brace.

    Returns boolean

waitLparen2

  • waitLparen2(): boolean
  • Wait the left paren.

    Returns boolean

waitRbrace2

  • waitRbrace2(): boolean
  • Wait the right brace.

    Returns boolean

waitRparen2

  • waitRparen2(): boolean
  • Wait the right paren.

    Returns boolean

waitSemicolon2

  • waitSemicolon2(): boolean
  • Wait the semicolon.

    Returns boolean

Static getAllTokens

Static identExists

  • identExists(str: string, name: string, caseSensitive: boolean): boolean
  • Parameters

    • str: string
    • name: string
    • caseSensitive: boolean

    Returns boolean

Static replaceWithPrefix

  • replaceWithPrefix(textValue: string, prefix: string, oldValue: string, newValue: string): string
  • Replaces all occurrences of a specified String, with another specified String. Before oldValue must follow specified prefix - token. Replacing is produced with provision for tokens.

    Parameters

    • textValue: string

      Text for replace.

    • prefix: string

      Prefix - token.

    • oldValue: string

      A String to be replaced.

    • newValue: string

      A String to replace all occurrences of oldValue.

    Returns string

    Replaced string.

Generated using TypeDoc