Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

AsyncPendingInfo

AsyncPendingInfo: { jison: number; jscc: number; pegjs: number; reset: any }

Type declaration

Variables

Const _default

_default: { compile: typeof compile; createPendingAsyncGrammarsInfo: typeof createPendingAsyncGrammarsInfo; fileVersion: number; getEngine: typeof getEngine; getPendingAsyncGrammars: () => AsyncPendingInfo; initPendingAsyncGrammarInfo: typeof initPendingAsyncGrammarInfo; isAsyncCompile: typeof isAsyncCompile; isAsyncSupported: () => boolean; setPendingAsyncGrammars: (pending: AsyncPendingInfo) => void; updatePendingAsyncGrammarFinished: typeof updatePendingAsyncGrammarFinished }

Type declaration

Const _default

_default: { addGrammarsToAppConfig: (grammars: GrammarBuildEntry[], appConfig: BuildAppConfig | WebpackAppConfig, directories: DirectoriesInfo, _resources: ResourceConfig, runtimeConfiguration: RuntimeConfiguration) => void; applyDefaultOptions: (options: GrammarOptions, grammarList: GrammarEntry[]) => GrammarBuildEntry[]; jsonGrammarsFromDir: (options: GrammarOptions, appRootDir: string, grammarList: GrammarEntry[]) => GrammarBuildEntry[]; jsonGrammarsFromOptions: (options: GrammarOptions, appRootDir: string, grammarList: GrammarEntry[]) => GrammarBuildEntry[]; parseRuntimeConfigurationForOptions: typeof parseRuntimeConfigurationForOptions; toAliasId: typeof toAliasId; toAliasPath: typeof toAliasPath }

Type declaration

  • addGrammarsToAppConfig: (grammars: GrammarBuildEntry[], appConfig: BuildAppConfig | WebpackAppConfig, directories: DirectoriesInfo, _resources: ResourceConfig, runtimeConfiguration: RuntimeConfiguration) => void

    add grammars to (webpack) app build configuration

    param

    list of GrammarEntry objects: grammar.id {String}: the grammar id (usually the language code, e.g. "en" or "de") grammar.file {String}: the path to the JSON grammar (from which the executable grammar will be created) grammar.ignore {Boolean}: OPTIONAL if true, the grammar will not be loaded (and registered) when the the app is initialized, i.e. needs to be "manually" loaded/initialized by app implementation and/or other mechanisms. If omitted or false, the grammar will be loaded on start-up of the app, and then will be available e.g. via mmir.semantic.interpret(, ).

    param

    the app configuration to which the grammars will be added

    param

    the directories.json representation

    param

    the resources configuration

    param

    the configuration.json representation

  • applyDefaultOptions: (options: GrammarOptions, grammarList: GrammarEntry[]) => GrammarBuildEntry[]

    apply the "global" options from options or default values to the entries from grammarList if its corresponding options-field is not explicitly specified.

    param

    the grammar options

    param
    returns
  • jsonGrammarsFromDir: (options: GrammarOptions, appRootDir: string, grammarList: GrammarEntry[]) => GrammarBuildEntry[]

    parse directories for JSON grammars and create/return GrammarEntry list

    param

    the grammar options where options.path: REQUIRED the directory from which to add the grammars, and has the following structure: //grammar.json //grammar.json ... options.grammars: OPTIONAL a map of grammar IDs, i.e. {[grammarID: string]: GrammarOption} with specific options for compiling the corresponding JSON grammar: options.grammars[id].engine {"jscc" | "jison" | "pegjs"}: OPTIONAL the Grammar engine that will be used to compile the executable grammar. DEFAULT: "jscc" options.grammars[id].async {Boolean}: OPTIONAL if true, and the execution environment supports Workers, then the grammar will be loaded in a Worker on app start-up, i.e. execution will be asynchronously in a worker-thread options.grammars[id].exclude {Boolean}: OPTIONAL if true, the corresponding grammar will be completely excluded, i.e. no executable grammar will be compiled from the corresponding JSON grammar options.grammars[id].ignore {Boolean}: OPTIONAL if true, the grammar will not be loaded (and registered) when the the app is initialized, i.e. needs to be "manually" loaded/initialized by app implementation and/or other mechanisms. If omitted or false, the grammar will be loaded on start-up of the app, and then will be available e.g. via mmir.semantic.interpret(, ).

    param

    the root directory of the app (against which relative paths will be resolved)

    param

    OPTIONAL list of GrammarEntry objects, to which the new entries (read from the options.directory) will be added if omitted, a new list will be created and returned. GrammarEntry.id {String}: the grammar id (usually the language code, e.g. "en" or "de") GrammarEntry.file {String}: the path to the JSON grammar (from which the executable grammar will be created) GrammarEntry.engine {"jscc" | "jison" | "pegjs"}: OPTIONAL the Grammar engine that will be used to compile the executable grammar. DEFAULT: "jscc" GrammarEntry.ignore {Boolean}: OPTIONAL if true, the grammar will not be loaded (and registered) when the the app is initialized, i.e. needs to be "manually" loaded/initialized by app implementation and/or other mechanisms. If omitted or false, the grammar will be loaded on start-up of the app, and then will be available e.g. via mmir.semantic.interpret(, ). GrammarEntry.async {Boolean}: OPTIONAL if true, and the execution environment supports Workers, then the grammar will be loaded in a Worker on app start-up, i.e. execution will be asynchronously in a worker-thread GrammarEntry.initPhrase {String}: OPTIONAL an initalization phrase that will be executed, if grammar is set for async-execution GrammarEntry.asyncCompile {Boolean}: OPTIONAL if true, and the build environment supports Workers, then the grammar will be compiled in a Worker (during build)

    returns

    the list of GrammarEntry objects

  • jsonGrammarsFromOptions: (options: GrammarOptions, appRootDir: string, grammarList: GrammarEntry[]) => GrammarBuildEntry[]

    add grammars from options.grammar map {[grammarID: string]: GrammarOption}, if the GrammarOption has a file field set.

    param

    the grammar options with field options.grammars

    param

    the root directory of the app (against which relative paths will be resolved)

    param

    OPTIONAL

    returns
  • parseRuntimeConfigurationForOptions: typeof parseRuntimeConfigurationForOptions

    parse RuntimeConfiguration for grammar-related settings and "convert" them to the corresponding GrammarOptions

    param

    the grammar options

    param

    the runtime configuration settings

    returns

    the grammar options with new/modified options from RuntimeConfiguration

  • toAliasId: typeof toAliasId
  • toAliasPath: typeof toAliasPath

Functions

compile

  • compile a JSON grammar into an executable JS grammar

    Parameters

    • content: string

      the JSON grammar as string

    • grammarFile: string

      the path of the JSON grammar (for debugging/error information)

    • options: GrammarCompilerOptions

      the GrammarLoadOptions with property mapping (list of GrammarOptions)

    • callback: CompilerCallback

      the callback when grammar compilation has been completed: callback(error | null, compiledGrammar, map, meta)

    • _map: any
    • _meta: any

    Returns void

createPendingAsyncGrammarsInfo

getEngine

initPendingAsyncGrammarInfo

isAsyncCompile

parseRuntimeConfigurationForOptions

toAliasId

toAliasPath

updatePendingAsyncGrammarFinished

Generated using TypeDoc