Options
All
  • Public
  • Public/Protected
  • All
Menu

tlex

Index

Type aliases

typeDFA

typeDFA: Array<{ exit: boolean; links: Array<typeDFALink> }>

typeDFALink

typeDFALink: { action: string; next: number }

Type declaration

  • action: string
  • next: number

typeNFA

typeNFA: Array<{ action: string; offsets: Array<number> }>

typeRule

typeRule: { dfa: typeDFA; token: string }

Type declaration

typeToken

typeToken: { col: number; line: number; symbol: string; token: string }

Type declaration

  • col: number
  • line: number
  • symbol: string
  • token: string

Functions

Const Driver

  • Driver(...rules: typeRule[]): { addCode: (code: string) => string; drop: () => 0 | -1; generate: () => 0 | 1 | -1; getToken: () => typeToken; reset: () => void }
  • 輸入多條 Token Rule 後回傳 Lexical Analyzer

    Parameters

    Returns { addCode: (code: string) => string; drop: () => 0 | -1; generate: () => 0 | 1 | -1; getToken: () => typeToken; reset: () => void }

    • addCode: (code: string) => string
        • (code: string): string
        • Parameters

          • code: string

          Returns string

    • drop: () => 0 | -1

      丟棄

        • (): 0 | -1
        • Returns 0 | -1

    • generate: () => 0 | 1 | -1
        • (): 0 | 1 | -1
        • Returns 0 | 1 | -1

    • getToken: () => typeToken
    • reset: () => void
        • (): void
        • Returns void

Const and

Const char

  • 將 Input RegExp 變成 Nondeterministic Finite Automata(NFA)

    Parameters

    • elem: RegExp

    Returns typeNFA

Const chars

  • chars(...elems: RegExp[]): Array<typeNFA>
  • 將多個 RegExp 變成多個 Nondeterministic Finite Automata(NFA)

    Parameters

    • Rest ...elems: RegExp[]

    Returns Array<typeNFA>

Const kleene

Const or

Const rule

Const star

Generated using TypeDoc