@adguard/agtree
Version:
Tool set for working with adblock filter lists
43 lines (42 loc) • 1.36 kB
TypeScript
import { type AgentCommentRule } from '../../nodes/index.js';
import { BaseParser } from '../base-parser.js';
/**
* `AgentParser` is responsible for parsing an Adblock agent rules.
* Adblock agent comment marks that the filter list is supposed to
* be used by the specified ad blockers.
*
* @example
* - ```adblock
* [AdGuard]
* ```
* - ```adblock
* [Adblock Plus 2.0]
* ```
* - ```adblock
* [uBlock Origin]
* ```
* - ```adblock
* [uBlock Origin 1.45.3]
* ```
* - ```adblock
* [Adblock Plus 2.0; AdGuard]
* ```
*/
export declare class AgentCommentParser extends BaseParser {
/**
* Checks if the raw rule is an adblock agent comment.
*
* @param raw Raw rule
* @returns `true` if the rule is an adblock agent, `false` otherwise
*/
static isAgentRule(raw: string): boolean;
/**
* Parses a raw rule as an adblock agent 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 Agent rule AST or null (if the raw rule cannot be parsed as an adblock agent comment)
*/
static parse(raw: string, options?: import("../index.js").ParserOptions, baseOffset?: number): AgentCommentRule | null;
}