@adguard/agtree
Version:
Tool set for working with adblock filter lists
53 lines (52 loc) • 1.74 kB
TypeScript
import { type AnyExpressionNode } from '../../nodes/index.js';
import { type OutputByteBuffer } from '../../utils/output-byte-buffer.js';
import { BaseSerializer } from '../base-serializer.js';
/**
* Possible node types in the logical expression.
*/
export declare const NodeType: {
readonly Variable: "Variable";
readonly Operator: "Operator";
readonly Parenthesis: "Parenthesis";
};
export type NodeType = typeof NodeType[keyof typeof NodeType];
/**
* `LogicalExpressionSerializer` is responsible for serializing 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 LogicalExpressionSerializer extends BaseSerializer {
/**
* Serializes a variable node to binary format.
*
* @param node Node to serialize.
* @param buffer ByteBuffer for writing binary data.
*/
private static serializeVariableNode;
/**
* Serializes a parenthesis node to binary format.
*
* @param node Node to serialize.
* @param buffer ByteBuffer for writing binary data.
*/
private static serializeParenthesisNode;
/**
* Serializes an operator node to binary format.
*
* @param node Node to serialize.
* @param buffer ByteBuffer for writing binary data.
*/
private static serializeOperatorNode;
/**
* Serializes a logical expression node to binary format.
*
* @param node Node to serialize.
* @param buffer ByteBuffer for writing binary data.
*/
static serialize(node: AnyExpressionNode, buffer: OutputByteBuffer): void;
}