Setting up the use of this module.
§1. This section simply sets up the module in ways expected by foundation, and contains no code of interest. The following constant exists only in tools which use this module:
define LEXICON_MODULE TRUE
§2. This module defines the following classes:
enum excerpt_meaning_CLASS
DECLARE_CLASS(excerpt_meaning)
§3. Like all modules, this one must define a start and end function:
enum EXCERPT_MEANINGS_DA enum EXCERPT_PARSING_DA
void LexiconModule::start(void) { Log::declare_aspect(EXCERPT_MEANINGS_DA, U"excerpt meanings", FALSE, FALSE); Log::declare_aspect(EXCERPT_PARSING_DA, U"excerpt parsing", FALSE, FALSE); Writers::register_logger('M', ExcerptMeanings::log); Declare the tree annotations3.2; } void LexiconModule::end(void) { }
§3.1. This module uses syntax, and adds the following annotations to the syntax tree.
enum meaning_ANNOT excerpt_meaning: for leaves
DECLARE_ANNOTATION_FUNCTIONS(meaning, excerpt_meaning) MAKE_ANNOTATION_FUNCTIONS(meaning, excerpt_meaning)
§3.2. Declare the tree annotations3.2 =
Annotations::declare_type(meaning_ANNOT, LexiconModule::write_meaning_ANNOT);
- This code is used in §3.
void LexiconModule::write_meaning_ANNOT(text_stream *OUT, parse_node *p) { if (Node::get_meaning(p)) { WRITE(" {meaning: "); ExcerptMeanings::log(OUT, Node::get_meaning(p)); WRITE("}"); } }