@adguard/agtree
Version:
Tool set for working with adblock filter lists
56 lines (55 loc) • 2 kB
TypeScript
import { type AnyExpressionNode } from '../../nodes/index.js';
import { type InputByteBuffer } from '../../utils/input-byte-buffer.js';
import { BaseDeserializer } from '../base-deserializer.js';
/**
* Gets the frequent name of the variable from the binary representation.
*
* @param binary Binary representation of the variable
* @returns Frequent name of the variable
* @throws If the variable is unknown
*/
export declare const getFrequentNameOrFail: (binary: number) => string;
/**
* `LogicalExpressionDeserializer` is responsible for deserializing logical expressions.
*
* @example
* From the following rule:
* ```adblock
* !#if (adguard_ext_android_cb || adguard_ext_safari)
* ```
* this parser will parse the expression `(adguard_ext_android_cb || adguard_ext_safari)`.
*/
export declare class LogicalExpressionDeserializer extends BaseDeserializer {
/**
* Deserializes a variable node from binary format.
*
* @param buffer ByteBuffer for reading binary data.
* @param node Destination node.
* @throws If the binary data is malformed.
*/
private static deserializeVariableNode;
/**
* Deserializes a parenthesis node from binary format.
*
* @param buffer ByteBuffer for reading binary data.
* @param node Destination node.
* @throws If the binary data is malformed.
*/
private static deserializeParenthesisNode;
/**
* Deserializes an operator node from binary format.
*
* @param buffer ByteBuffer for reading binary data.
* @param node Destination node.
* @throws If the binary data is malformed.
*/
private static deserializeOperatorNode;
/**
* Deserializes a logical expression node from binary format.
*
* @param buffer ByteBuffer for reading binary data.
* @param node Destination node.
* @throws If the binary data is malformed.
*/
static deserialize(buffer: InputByteBuffer, node: Partial<AnyExpressionNode>): void;
}