clang.lexer( variant as String, [normalization as String?], [args as Sequence], [library as String] ) as element(lang.lexer)
This function constructs a custom lexer configuration item, suitable for use with clang.userLanguagePlugin.
clang.lexer
and when passing a lexer to
clang.userLanguagePlugin
then the value in the lexer takes precedence over the value in the
plugin configuration.
For a built-in lexer, specify an empty string for the library name,
or omit the library
parameter and specify an empty string in
clang.userLanguagePlugin
.
For a user-defined plugin, the library name should be of the form
plugin_path/plugin_id
, such as "native/sample_plugin".
If you omit this parameter, then the library
value from
clang.userLanguagePlugin
will be used.
// Create a lexer config item for a user-defined plugin. 'use strict'; const clang = require('/MarkLogic/custom-language'); clang.lexer('special_lexer','NFD', (), 'native/sample_plugin');
// Create a lexer config item from a built-in plugin (atilika), and // pass in a configuration option. 'use strict'; const clang = require('/MarkLogic/custom-language'); clang:lexer('atilika', null, Sequence.from(['normal-mode']), '')
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.