Interface ILookaheadStrategyExperimental

Hierarchy

  • ILookaheadStrategy

Methods

  • Builds a lookahead function for alternations/OR parser methods.

    Parameters

    • options: {
          dynamicTokensEnabled: boolean;
          hasPredicates: boolean;
          maxLookahead: number;
          prodOccurrence: number;
          rule: Rule;
      }
      • dynamicTokensEnabled: boolean

        Whether dynamic tokens are enabled for this parser.

      • hasPredicates: boolean

        Whether any of the alternatives contain a predicate.

      • maxLookahead: number

        The maximum amount of lookahead for this OR.

      • prodOccurrence: number

        The occurrence number of this OR within its rule.

      • rule: Rule

        The rule that contains this OR.

    Returns ((orAlts?) => undefined | number)

    A function that is able to compute which of the alternatives to choose while parsing.

      • (orAlts?): undefined | number
      • Builds a lookahead function for alternations/OR parser methods.

        Parameters

        • Optional orAlts: IOrAlt<any>[]

        Returns undefined | number

        A function that is able to compute which of the alternatives to choose while parsing.

  • Builds a lookahead function for optional productions.

    Parameters

    • options: {
          dynamicTokensEnabled: boolean;
          maxLookahead: number;
          prodOccurrence: number;
          prodType: OptionalProductionType;
          rule: Rule;
      }
      • dynamicTokensEnabled: boolean

        Whether dynamic tokens are enabled for this parser.

      • maxLookahead: number

        The maximum amount of lookahead for this production.

      • prodOccurrence: number

        The occurrence number of this production within its rule.

      • prodType: OptionalProductionType

        The type of this production.

      • rule: Rule

        The rule that contains this production.

    Returns (() => boolean)

    A function is able to compute whether to parse the production or to continue with the rest of the parser rule.

      • (): boolean
      • Builds a lookahead function for optional productions.

        Returns boolean

        A function is able to compute whether to parse the production or to continue with the rest of the parser rule.

  • Initializes the lookahead for a grammar.

    Note that this method does not build the lookahead functions. It only initializes the internal state of the strategy based on all grammar rules.

    Parameters

    • options: {
          rules: Rule[];
      }
      • rules: Rule[]

        All parser rules of the grammar.

    Returns void

  • Performs validations on the grammar specific to this lookahead strategy. This method is not called if parser validations are disabled.

    Parameters

    • options: {
          grammarName: string;
          rules: Rule[];
          tokenTypes: TokenType[];
      }
      • grammarName: string

        The name of the grammar.

      • rules: Rule[]

        All parser rules of the grammar.

      • tokenTypes: TokenType[]

        All token types of the grammar.

    Returns ILookaheadValidationError[]

Generated using TypeDoc