UNPKG

@aire-ux/aire-condensation

Version:

Client-side serialization library for Aire-UX

81 lines (80 loc) 1.69 kB
/** * we need to be able to parse invocations of the form: * * <region>::<address>.<prop1>.<prop2>(${parameter1}, ${parameter2}) */ export declare enum TokenType { Whitespace = 0, /** * represents a property on an object */ Identifier = 1, /** * a number (address or parameter) */ Number = 2, /** * open parenthesis '(' */ OpenParenthesis = 3, /** * close parenthesis ')' */ CloseParenthesis = 4, /** * period '.' */ PropertySeparator = 5, /** * Comma ',' */ ParameterSeparator = 6, /** * '::' */ NamespaceSeparator = 7, /** * ${ */ ParameterOpen = 8, /** * } */ ParameterClose = 9, EOF = 10 } export declare type Token = { /** * the end position of this token */ end: number; /** * the start position of this token */ start: number; /** * the value of this token */ value: string; /** * */ type: TokenType; }; export declare class TokenStream implements Iterable<Token> { readonly charseq: string; constructor(charseq: string); [Symbol.iterator](): Iterator<Token>; } export declare const lex: (vs: string) => Iterable<Token>; export declare function generateStream(vs: string): IterableIterator<Token>; export declare const stream: (vs: string) => PushbackIterator; export declare class PushbackIterator { readonly iterator: IterableIterator<Token>; private readonly values; constructor(iterator: IterableIterator<Token>); hasNext(): boolean; peek(): Token; next(): Token; unread(token: Token): void; }