Options
All
  • Public
  • Public/Protected
  • All
Menu

Recursive-descent parser for human-readable schedule text expressions. Drives a ScheduleBuilder to produce a ScheduleDefinition consumable by CalendarIntervalParser.compile. Kept file-local so callers always go through CalendarIntervalParser.parseText.

internal

Hierarchy

  • ScheduleTextParserImpl

Index

Methods

Private checkAndParse

  • checkAndParse(tokenType: RegExp): boolean
  • If tokenType matches at the current position, consume it.

    Parameters

    • tokenType: RegExp

    Returns boolean

    true when consumed

Private makeToken

  • makeToken(start: number, end: number, text: string, type?: RegExp): any
  • Build a token record.

    Parameters

    • start: number
    • end: number
    • text: string
    • Optional type: RegExp

    Returns any

parse

  • Parse a schedule expression.

    Parameters

    • str: string

      Expression (e.g. "every 5 minutes")

    Returns ScheduleDefinition

Private parseEvery

  • Parse an every N <period> clause onto builder.

    Parameters

    Returns void

Private parseOnThe

  • Parse an on the first / last / Nth clause onto builder.

    Parameters

    Returns void

Private parseRanges

  • parseRanges(tokenType: RegExp): number[]
  • Parse one or more comma/and-separated range expressions.

    Parameters

    • tokenType: RegExp

    Returns number[]

Private parseScheduleExpr

  • Main recursive-descent entry point; drives the builder to completion.

    Parameters

    • expression: string

      Lowercased expression

    Returns ScheduleDefinition

Private parseThroughExpr

  • parseThroughExpr(tokenType: RegExp): number[]
  • Parse an a-b range expression (or a single value).

    Parameters

    • tokenType: RegExp

    Returns number[]

Private parseTimePeriod

  • Consume a time-period token (second/minute/hour/day/…) and call the matching builder method.

    Parameters

    Returns any

    Matched token

Private parseToken

  • parseToken(tokenType: RegExp | RegExp[]): any
  • Scan the next token and normalize its text via CalendarIntervalParser.convertTextTokenValue.

    Intentional: pass the outer tokenType through (possibly an array). convertTextTokenValue only converts when tokenType is a known single regex; arrays fall through returning the text unchanged — correct for dispatch-style calls.

    Parameters

    • tokenType: RegExp | RegExp[]

    Returns any

    Matched token with normalized text

Private parseTokenValue

  • parseTokenValue(tokenType: RegExp | RegExp[]): any
  • Shorthand for this.parseToken(tokenType).text.

    Parameters

    • tokenType: RegExp | RegExp[]

    Returns any

    Converted token value

Private peek

  • peek(expected: RegExp | RegExp[]): any
  • Look ahead without consuming; returns the best-matching token for expected.

    Parameters

    • expected: RegExp | RegExp[]

      Regex(es) to try

    Returns any

    Matched token (or placeholder)

Private scan

  • scan(expectedToken: RegExp | RegExp[]): any
  • Consume the next matching token (advances pos).

    Parameters

    • expectedToken: RegExp | RegExp[]

    Returns any

Generated using TypeDoc