attrpath
Version:
Attribute Path Traverser.
104 lines (103 loc) • 2 kB
TypeScript
/**
* Copyright © 2020 2021 2022 7thCode.(http://seventh-code.com/)
* This software is released under the MIT License.
* opensource.org/licenses/mit-license.php
*/
import { TokenType } from "./parser";
/**
* BaseHandler
*
* @remarks
*
*/
export declare abstract class BaseHandler {
abstract token(type: TokenType, word: string, term: boolean): void;
}
/**
* ValueHandler
*
* actually traverse the object.
*
* @remarks
*
*/
export declare class ValueHandler extends BaseHandler {
protected current_value: any;
/**
* value
*
* Data
*/
get value(): any;
/**
*
* @remarks
*/
constructor(root_value: any);
/**
* Symbol Handler
*
* @remarks
* Executed when Parser recognizes Token.
*
* @param type - Symbol Type
* @param word
* @param term
* @returns void
*
*/
token(type: TokenType, word: string, term: boolean): void;
/**
* Sibling
*
* @remarks
* Extract array elements from index
*
* @param array - Array
* @param index - Index
* @returns Array member
*
*/
protected static sibling(array: any[], index: string): any;
/**
* child
*
* @remarks
* Returns an object member.
*
* @param obj - Object
* @param attr - Attribute Name
* @returns Object member
*
*/
protected static child(obj: any, attr: string): any;
}
/**
* Updater
*
* It actually traverses and updates objects.
*
* @remarks
*
*/
export declare class Updater extends ValueHandler {
private readonly new_value;
/**
*
* @remarks
*/
constructor(root_value: any, new_value: any);
/**
* Symbol Handler
*
* @remarks
* Executed when Parser recognizes Token.
*
* @param type - Symbol Type
* @param word
* @param term
* @returns void
*
*/
token(type: TokenType, word: string, term: boolean): void;
}