langMessageBuilderobjecten_us.t[3758]

The English-specific message builder.

langMessageBuilder :   MessageBuilder

Superclass Tree   (in declaration order)

langMessageBuilder
        MessageBuilder
                OutputFilter
                        object
                PreinitObject
                        ModuleExecObject
                                object

Summary of Properties  

fixedTenseProp_  lastSubject_  lastSubjectName_  paramList_  pastEnding_  patEndOfSentence  patIdObjApostS  patIdObjSlashIdApostS  patParamWithExclam  patSpecial  patSSlashLetterEd  patTenseSwitching 

Inherited from MessageBuilder :
lastParamObj_  lastTargetObj_  nameTable_  paramTable_  patAllCaps  patIdObj  patIdObjSlashId  patIdSlash  patUpper 

Inherited from ModuleExecObject :
execAfterMe  execBeforeMe  hasInitialized_  isDoingExec_  isExecuted_ 

Summary of Methods  

generateMessage  getTargetProp  langRewriteParam  processOrig  processResult 

Inherited from MessageBuilder :
execute  filterText  genLiteral  quoteMessage 

Inherited from ModuleExecObject :
_execute  classExec 

Properties  

fixedTenseProp_en_us.t[4249]

This property is used to temporarily store either a boolean value indicating whether the last encountered parameter string had an exclamation mark at the end of any word, or a property to be invoked by Thing.propWithPresentMessageBuilder_. This field is for internal use only; authors shouldn't have any reason to access it directly.

lastSubject_en_us.t[4053]
The most recent target object used in the nominative case. We note this so that we can supply reflexive mappings when the same object is re-used in the objective case. This allows us to map things like "you can't take you" to the better-sounding "you can't take yourself".

lastSubjectName_en_us.t[4056]
the parameter name of the last subject ('dobj', 'actor', etc)

paramList_OVERRIDDENen_us.t[3777]
The English message substitution parameter table.

Note that we specify two additional elements for each table entry beyond the standard language-independent complement:

info[4] = reflexive property - this is the property to invoke when the parameter is used reflexively (in other words, its target object is the same as the most recent target object used in the nominative case). If this is nil, the parameter has no reflexive form.

info[5] = true if this is a nominative usage, nil if not. We use this to determine which target objects are used in the nominative case, so that we can remember those objects for subsequent reflexive usages.

pastEnding_en_us.t[4239]
This property is used to temporarily store the past-tense ending of a verb to be displayed by Thing.verbEndingSMessageBuilder_. It's for internal use only; game authors shouldn't have any reason to access it directly.

patEndOfSentenceen_us.t[4125]
end-of-sentence match pattern

patIdObjApostSen_us.t[4159]
no description available

patIdObjSlashIdApostSen_us.t[4157]
some pre-compiled search patterns we use a lot

patParamWithExclamen_us.t[4161]
no description available

patSpecialen_us.t[4027]
Pre-compiled regular expression pattern matching any sequence with a special meaning in a message string.

We match either a stuttered opening brace, or a single opening brace followed by any sequence of characters that doesn't contain a closing brace followed by a closing brace.

patSSlashLetterEden_us.t[4162]
no description available

patTenseSwitchingen_us.t[4040]
Pre-compiled regular expression pattern matching our special tense-switching syntax.

We match a single opening brace, followed by any sequence of characters that doesn't contain a closing brace or a vertical bar, followed by a vertical bar, followed by any sequence of characters that doesn't contain a closing brace or a vertical bar, followed by a closing brace.

Methods  

generateMessage (orig)OVERRIDDENen_us.t[3912]

Add a hook to the generateMessage method, which we use to pre-process the source string before expanding the substitution parameters.

getTargetProp (targetObj, paramObj, info)OVERRIDDENen_us.t[4069]
Get the target object property mapping. If the target object is the same as the most recent subject object (i.e., the last object used in the nominative case), and this parameter has a reflexive form property, we'll return the reflexive form property. Otherwise, we'll return the standard property mapping.

Also, if there was an exclamation mark at the end of any word in the tag, we'll return a property returning a fixed-tense form of the property for the tag.

langRewriteParam (paramStr)OVERRIDDENen_us.t[4184]
Rewrite a parameter string for a language-specific syntax extension.

For English, we'll handle the possessive apostrophe-s suffix specially, by allowing the apostrophe-s to be appended to the target object name. If we find an apostrophe-s on the target object name, we'll move it to the preceding identifier name:

the dobj's -> the's dobj
the dobj's/he -> the's dobj/he
he/the dobj's -> he/the's dobj

We also use this method to check for the presence of an exclamation mark at the end of any word in the parameter string (triggering the fixed-tense handling), and to detect a parameter string matching the {s/?ed} syntax, where ? is any letter, and rewrite it literally as 's/?ed' literally.

processOrig (str)en_us.t[3941]
Pre-process a source string containing substitution parameters, before generating the expanded message from it.

We use this hook to implement the special tense-switching syntax {<present>|<past>}. Although it superficially looks like an ordinary substitution parameter, we actually can't use the normal parameter substitution framework for that, because we want to allow the <present> and <past> substrings themselves to contain substitution parameters, and the normal framework doesn't allow for recursive substitution.

We simply replace every sequence of the form {<present>|<past>} with either <present> or <past>, depending on the current narrative tense. We then substitute braces for square brackets in the resulting string. This allows treating every bracketed tag inside the tense-switching sequence as a regular substitution parameter.

For example, the sequence "{take[s]|took}" appearing in the message string would be replaced with "take{s}" if the current narrative tense is present, and would be replaced with "took" if the current narrative tense is past. The string "take{s}", if selected, would in turn be expanded to either "take" or "takes", depending on the grammatical person of the subject, as per the regular substitution mechanism.

processResult (txt)OVERRIDDENen_us.t[4130]
Process result text.

TADS 3 Library Manual
Generated on 5/16/2013 from TADS version 3.1.3