UNPKG

@zvenigora/ng-eval-core

Version:

An expression evaluator for Angular

58 lines (57 loc) 1.72 kB
import { OnDestroy } from '@angular/core'; import { ParserOptions } from '../../internal/interfaces'; import { Expression, Program, AnyNode } from 'acorn'; import * as i0 from "@angular/core"; /** * @description * Service for parsing expressions and returning ES6/ES2020 AST. * Implements OnDestroy for proper memory cleanup. */ export declare class ParserService implements OnDestroy { private _parserOptions; private _cache?; private _cacheCleanupInterval?; private _isDestroyed; /** * Gets the parser options. */ get parserOptions(): ParserOptions; /** * Sets the parser options. * @param value The parser options to set. */ set parserOptions(value: ParserOptions); /** * Constructs a new instance of the ParserService class. */ constructor(); /** * Setup periodic cache cleanup to prevent memory leaks */ private setupCacheCleanup; /** * Clean up resources to prevent memory leaks */ ngOnDestroy(): void; /** * @description * Returns acorn version. */ get version(): string; /** * Gets the parser options. * @returns The parser options. */ get options(): ParserOptions; /** * @description * Parses expression and returns ES6/ES2023 AST. * @param expr expression to parse * @param options optional parser options * @returns The parsed AST (Abstract Syntax Tree). */ parse(expr: string, options?: ParserOptions): Program | AnyNode | Expression | undefined; private fromCacheOrParse; static ɵfac: i0.ɵɵFactoryDeclaration<ParserService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<ParserService>; }