MessageParamsclass | messages.t[903] |
Superclass Tree | Subclass Tree | Global Objects | Property Summary | Method Summary | Property Details | Method Details |
The language module must provide one instance of this class. The name of the instance doesn't matter - we'll find it at preinit time. The object must provide the 'params' property giving the language-specific list of substitution parameter names and handler functions.
class
MessageParams : object
cmdInfo
construct
expand
findStrParam
langObj | messages.t[1158] |
params | messages.t[980] |
The parameter name must be all lower case. During expansion, we convert the first space-delimited token within the {curly brace} parameter string to lower case, then look for an entry in the list with the matching parameter name. If we find an entry, we call its handler function.
The handler function is a pointer to a function that takes two arguments: func(params, ctx), where 'params' is the list of tokens within the {curly braces} of the substitution string, as a list of strings, where each string is a space-delimited token in the original {curly brace} string; and 'ctx' is the MessageCtx object for the expansion. The function returns a string giving the expansion of the parameter.
The parameter list must be provided by the language module, since each language's list of parameters and expansions will vary.
paramTab | messages.t[1155] |
cmdInfo (ctx, src, objProp, role) | messages.t[1015] |
For example, {the dobj} could be handled via cmdInfo('ctx, dobj', &theName, vSubject): we find the current 'dobj' object in the Command, then evaluate the &theName property on that object.
'ctx' is the MessageCtx object with the current sentence context.
'src' is the source object in the Command. This can be given as a property pointer (&actor, say), in which case we simply evaluate that property of the Command object (cmd.(src)) to get the source object. Or, it can be a string giving a NounRole name (dobj, iobj, acc), in which case we'll retrieve the current object for the noun role from the Command. Or, it can be a string with a number, in which case we'll use the number as an index into the argument list.
'objProp' is the property of the source object to evaluate to get the expansion string.
'role' is vSubject if this is a noun phrase with subject usage (in most languages, this is a noun phrase in the nominative case; in English this is called subjective case). It's vObject for any other noun phrase role (direct object, prepositional object, etc). If the role isn't clear from the context (the case marking of the parameter, or the position), use vAmbig to mark it as ambiguous.
construct ( ) | messages.t[1161] |
expand (ctx, params) | messages.t[913] |
findStrParam (src, role) | messages.t[1086] |