attrpath
Version:
Attribute Path Traverser.
177 lines (176 loc) • 3.67 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 { BaseHandler } from './handler';
import { ParserStream } from './stream';
export declare enum TokenType {
operator = 0,
number = 1,
name = 2,
index = 3
}
/**
* BaseParser
* @remarks
*/
export declare abstract class BaseParser {
protected stream: ParserStream;
protected handler: BaseHandler | null;
/**
*
* @remarks
*/
protected constructor(handler: BaseHandler | null, stream: ParserStream);
/**
* is_s
* s ::= | \t
*/
protected is_s(): boolean;
/**
* is_s
*
* S ::= ( " " | tab ) *
*
* @remarks Spaces or Tabs
*/
protected parse_s(): boolean;
/**
* is_terminal
*
* @remarks
*
*/
protected is_terminal(): boolean;
/**
* is_char
*
* @param c
*
* @remarks
*/
protected is_char(c: string): boolean;
private between;
/**
* is_symbol
* symbol ::= "." | "[" | "]" | "'" | '"' | "+" | "-" | "*" | "/" | "%" | "~" | "&" | "|" | "^" | ">" | "<" | "!" | "=" | "`" | "(" | ")" | "{" | "}" | "?" | ":" | ";" | ","
* @remarks
*/
/**
* is_digit
* digit ::= ( 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 )
*/
protected is_digit(): boolean;
/**
* parse_number
* number ::= digit *
*/
protected parse_number(): boolean;
}
export declare class FormulaParser extends BaseParser {
/**
*
* @remarks
*/
constructor(handler: BaseHandler | null, stream: ParserStream);
/**
*
* expr ::= term { S { "+" | "-" } S term } *
* @remarks
* */
protected is_expr(): boolean;
/**
* is_term
*
* @remarks
* term ::= factor { S { "*" | "/" } S factor } *
*
*
* */
protected is_term(): boolean;
/**
* is_factor
*
* @remarks
* factor ::= "(" S expr S ")" | number
*
* */
protected is_factor(): boolean;
}
/**
* Parse semantic strings of object references in JavaScript.
*
*/
export declare class AttributeParser extends FormulaParser {
/**
*
* @remarks
*
*/
constructor(handler: BaseHandler | null, stream: ParserStream);
/**
* is_reading
*
* @remarks
* reading ::= ( alpha | "_" | "$" ) *
*
*/
protected is_reading(): boolean;
/**
* is_trailing
*
* @remarks
* trailing ::= ( alpha | "_" | "$" | digit ) *
*
*/
protected is_trailing(): boolean;
/**
* is_subscript_trailing
*
* @remarks
* subscript_trailing ::= ( alpha | "_" | "$" | digit | "." ) *
*
*/
protected is_subscript_trailing(): boolean;
/**
* parse_name
*
* @remarks
* name ::= reading [ trailing ]
*
*/
protected parse_name(): boolean;
/**
* parse_subscript_name
*
* @remarks
* subscript_name ::= subscript_reading [ subscript_trailing ]
*
*/
protected parse_subscript_name(): boolean;
/**
* parse_subscript_string
*
* @remarks
* subscript_string = "'" subscript_mame "'" | '"' subscript_mame '"'
*
*/
protected parse_subscript_string(): boolean;
/**
* parse_attr
*
* @remarks
* attr ::= "." name | '[' subscript_string | number ']'
*
*/
protected parse_attr(): boolean;
/**
* parse_path
*
* @remarks
* path ::= attr *
*
*/
parse_path(): boolean;
}