MessageCtx class | messages.t[433]

Message expansion sentence context. This keeps track of the parts of the sentence we've seen so far in the substitution parameters.

The sentence context is important for expanding certain items. For verbs, it tells us which object is the subject, so that we can generate the agreeing conjugation of the verb (in number and grammatical person). For direct and indirect objects, it lets us generate a reflexive when the same object appears in a second role ("You can't put the box in itself").

`class MessageCtx : object`

Superclass Tree (in declaration order)

`MessageCtx`
`object`

Subclass Tree

(none)

Global Objects

(none)

Summary of Properties

`args cmd gotVerb lastParam prescan reflexiveAnte subj vobj`

Summary of Methods

`actorIsPC construct endPreScan lastParamPlural noteObj noteParam noteVerb paramToNum paramToString startSentence`

Properties

`args` | `messages.t[756]`

the message argument list

`cmd` | `messages.t[759]`

the Command object among the arguments, if any

`gotVerb` | `messages.t[753]`

have we seen a verb parameter in this sentence yet?

`lastParam` | `messages.t[741]`

the last parameter value

`prescan` | `messages.t[744]`

are we on the initial pre-expansion scan?

`reflexiveAnte` | `messages.t[772]`

The reflexive antecedents. Each time we see an object in a non-subject role, and the object has different pronoun usage from any previous entry, we'll add it to this list. If we see the same object subsequently in another non-subject role, we'll know that we should generate a reflexive pronoun for the object rather than the name or a regular pronoun:

You can't put the tongs in the box with the tongs -> with themselves

`subj` | `messages.t[747]`

the subject of the sentence (as a Mentionable object)

`vobj` | `messages.t[750]`

the last object of the verb we saw

Methods

`actorIsPC ( )` | `messages.t[734]`

Is the actor involved in the Command the PC? If there's a Command with an actor, we check to see if it's the PC. If there's no Command or no actor, we assume that the PC is the relevant actor (since there's nothing else specified anywhere) and return true.

`construct (args)` | `messages.t[434]`

no description available

`endPreScan ( )` | `messages.t[472]`

End the pre-expansion scan. The expander makes two passes over each sentence. The first scan doesn't actually do any substitutions, but merely invokes each parameter to give it a chance to exert its side effects on the sentence context. The second scan actually applies the substitutions. At the end of the first pass, the expander calls this to let us finalize the initial scan and prepare for the second scan.

`lastParamPlural ( )` | `messages.t[703]`

Was the last parameter value plural? If the value is numeric, 1 is singular and anything else is plural. If it's a list, a one-element list is singular and anything else is plural. If it's a Mentionable, the 'plural' property determines it.

`noteObj (obj, role)` | `messages.t[580]`

Note an object being used as a parameter in the given sentence role. The role is one of the noun role enums defined above: vSubject, vObject, or vAmbig. If the object is a subject, we'll save it as the sentence subject, so that we can generate an agreeing verb. Regardless of role, we'll also save it as a reflexive antecedent, so that we can generate a reflexive pronoun if we see the same object again in another role in the same sentence.

`noteParam (val)` | `messages.t[494]`

Note a parameter value. Some parameters refer back to the immediately preceding parameter, so it's useful to have the most recent value stashed away. Returns the parameter value as given.

`noteVerb ( )` | `messages.t[691]`

Note a verb parameter.

`paramToNum (val)` | `messages.t[542]`

Convert a parameter value to a numeric representation. If the value is an integer or BigNumber, we return it as is; if a list or vector, we return the number of elements; if nil, 0; if a string, the parsed numeric value of the string; otherwise we simply return 1.

`paramToString (val)` | `messages.t[504]`

Convert a parameter value to a string representation suitable for message substitution.

`startSentence ( )` | `messages.t[448]`

start a new sentence

Adv3Lite Library Reference Manual
Generated on 25/04/2024 from adv3Lite version 2.0