import GRule, { GImport, GElement } from "./grammar/GRule"; import GRuleToken from "./grammar/GRuleToken"; import IObjectMap from "./IObjectMap"; import PAnnotator from "./annotator/PAnnotator"; import GRuleContext from "./grammar/GRuleContext"; import GrammarStyleManager from "./GrammarStyleManager"; import AbstractProvenanceProvider from "@cafetextual/util/dist/src/module/AbstractProvenanceProvider"; import IProvenanceProvider from "@cafetextual/util/dist/src/module/IProvenanceProvider"; import { Hash, ITypeManifest } from "@cafetextual/util"; import { MTypeDef } from "@cafetextual/util/dist/src/manifest/MTypeDef"; import ISeepGrammar from "./ISeepGrammar"; export default class SeepGrammar extends AbstractProvenanceProvider implements ISeepGrammar, IProvenanceProvider { constructor(); map: IObjectMap; _ruleTokens: Hash; _valid: boolean; /** * collected line rules of anonmyous rules * * * For instance, generated rules may have generated anonmyous line rules /w generated line rules. Need to explicity collect these for initialisation iteration */ _anonmyousLineRules: Array; imports: Array; tokens: Array; /** * Mainfest of types */ parentManifest: ITypeManifest; /** * when true, doesn't require manifest definitions, but creates objects as {__cls:MyType ... } */ dynamicManifest: boolean; /** * parsed manifest. */ manifest: ITypeManifest; /** * Raw style objects as embedded in style sheet itself */ styles: Array; /** * stylesheet processed from styles */ stylesheet: any; /** * Style Manager - invloves mapping of styles */ styleManager: GrammarStyleManager; annotators: Array; getAnnotator(id?: string): PAnnotator; getValidator(id?: string): PAnnotator; private getAnnotatorOrValidator(id, isValidator); _isInit: boolean; _baseRulesInit: boolean; readonly isInit: boolean; _ruleContext: GRuleContext; init(): void; private isIGRuleGenerator(v); private initBaseRules(); readonly ruleTokens: Hash; /** * recurse on all rules, child rules in their elements, and child line rules */ iterateOnrules(f: Function, recurseOnChildRules?: boolean, recurseOnLineRules?: boolean, includeImported?: boolean): void; /** * Applies funcion to rule, recurses on line rules, and optionally on the rules's child rules

*/ private iterateRule(r, f, recurseOnChildRules, recurseOnLineRules?); private addRuleToken(v); rules: Array; _importedRules: Array; getRule(name: string): GRule; /** * Gets rules w/o initial */ private getRulePreinit(name); prefix: { [index: string]: string; }; suffix: { [index: string]: string; }; filters: { [index: string]: string; }; contentTokens: { [index: string]: Array; }; private setUpTokens(); /** * */ elementValidation(r: GRule, treeNode?: GElement): void; /** * After top level rules have had children injected, iterate over line rules. * * Recall that line rules are never cloned. */ private injectLineChildRules1(rule); private injectLineChildRules2(rule); private collectAnonymousLineRules(r); _imports: { [index: string]: MTypeDef; }; setImport(from: string, to: MTypeDef): void; getImportType(from: string): MTypeDef; setTypeFromManifest(rule: GRule): void; /** * Called while recursing over items */ resolveTypes(r: GRule): void; private setTypes(node, typeDefs); private initSwitchImports(); initImports(): boolean; private addImportedRule(importDef, r); isImported(r: GRule): boolean; /** * A bit of a hack to ensure that the last element in a rule doesn't have an inmplicit requirement for WS */ private fixLastElementWS(rule); /** * Apply Node tokens (ie ^, ^^^) * * - this is invokes before recursion is applied, which means a) don't need to worry about it, b) * * - all we currently support is a treeNode, * * * */ private injectNodeTokens(r, parentTreeNodes?); getDefaultRule(): GRule; isValid(): boolean; toErrorString(r?: GRule, prefix?: string): string; /** * For chaining, returns self, but only if valid. */ validated(): SeepGrammar; toErrorString_low(r: GRule, prefix?: string): string; traceStackContext(): string; getInjectionCount(contextName?: string): Number; _errors: Array; addError(v: string): void; showCloning(): string; }