@v4fire/core
Version:
V4Fire core library
60 lines (51 loc) • 1.07 kB
text/typescript
/*!
* V4Fire Core
* https://github.com/V4Fire/Core
*
* Released under the MIT license
* https://github.com/V4Fire/Core/blob/master/LICENSE
*/
import type { parserStateTypes } from 'core/json/stream/parser/const';
export type ParserState = typeof parserStateTypes[
keyof typeof parserStateTypes
];
export type ParentParserState =
typeof parserStateTypes.OBJECT |
typeof parserStateTypes.ARRAY |
typeof parserStateTypes.EMPTY;
export type TokenName =
'' |
'startObject' |
'endObject' |
'startArray' |
'endArray' |
'startKey' |
'stringChunk' |
'endKey' |
'keyValue' |
'startString' |
'endString' |
'stringValue' |
'startNumber' |
'numberChunk' |
'numberValue' |
'endNumber' |
'nullValue' |
'trueValue' |
'falseValue';
export type TokenValue =
string |
boolean |
number |
null;
export interface Token {
name: TokenName;
value?: TokenValue;
}
export interface TokenProcessorFn<T> {
(token: Token): Generator<T>;
}
export interface TokenProcessor<T> {
processToken: TokenProcessorFn<T>;
finishTokenProcessing?(): Generator<T>;
}