@adguard/agtree
Version:
Tool set for working with adblock filter lists
34 lines (33 loc) • 1.35 kB
TypeScript
import { type HintCommentRule } from '../../nodes/index.js';
import { BaseParser } from '../base-parser.js';
/**
* `HintRuleParser` is responsible for parsing AdGuard hint rules.
*
* @example
* The following hint rule
* ```adblock
* !+ NOT_OPTIMIZED PLATFORM(windows)
* ```
* contains two hints: `NOT_OPTIMIZED` and `PLATFORM`.
* @see {@link https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#hints}
*/
export declare class HintCommentParser extends BaseParser {
/**
* Checks if the raw rule is a hint rule.
*
* @param raw Raw rule
* @returns `true` if the rule is a hint rule, `false` otherwise
*/
static isHintRule(raw: string): boolean;
/**
* Parses a raw rule as a hint comment.
*
* @param raw Raw input to parse.
* @param options Global parser options.
* @param baseOffset Starting offset of the input. Node locations are calculated relative to this offset.
* @returns Hint AST or null (if the raw rule cannot be parsed as a hint comment)
* @throws If the input matches the HINT pattern but syntactically invalid
* @see {@link https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#hints-1}
*/
static parse(raw: string, options?: import("../index.js").ParserOptions, baseOffset?: number): HintCommentRule | null;
}