@foxpage/foxpage-core
Version:
foxpage core
84 lines (83 loc) • 1.86 kB
TypeScript
import { ConditionParser, Context, ContextPage, Parser, ParserOption, VariableParser } from '@foxpage/foxpage-types';
import { LibraryParser } from './library';
import { MainParser } from './main';
import { MaterialParser } from './material';
import { PluginParser } from './plugin';
/**
* parser implements
*
* @export
* @class ParserImpl
* @implements {Parser}
*/
export declare class ParserImpl implements Parser {
/**
* variable parser
*
* @type {VariableParserImpl}
*/
variableParser?: VariableParser;
/**
* condition parser
*
* @type {ConditionParserImpl}
*/
conditionParser?: ConditionParser;
/**
* library parser
*
* @type {LibraryParser}
*/
libraryParser?: LibraryParser;
/**
* plugin parser
* csr plugins
*
* @type {PluginParser}
*/
pluginParser?: PluginParser;
/**
* material parser
*
* @type {MaterialParser}
*/
materialParser?: MaterialParser;
mainParsers: Record<string, MainParser>;
constructor();
/**
* prepare
* @param opt parserOption
*/
prepare(opt?: ParserOption): Promise<void>;
/**
* pre parse
* first step: preParse content
* second step: preParse template
*/
preParse(content: ContextPage, ctx: Context, opt: {
sessionId: string;
}): void;
/**
* parse
* first: variable(functions)
* second: condition
* last: content
*/
parse(sessionId: string, ctx: Context): Promise<{
parsed: ContextPage;
messages: string[];
} | undefined>;
/**
* get parse status
*
* @return {*} {boolean} true:parsed,false:no parse
*/
isParsed(): boolean;
/**
* clear instance
*
*/
reset(opt: {
sessionId: string;
}): void;
}