quoteFilter object | output.t[1584]

quoteFilter: this loooks for smart quotes in the output and checks that they are balanced.

The problem with the smart quotes <q> </q> is that if one is missing, or a spurious one is added, the error is perpetrated throughout the rest of the game (or until a compensating error is located). The purpose of quoteFilter is (a) to report such errors (to make them easier to fix) and (b) to prevent them being propagated beyond a single turn. In the main this works by having quoteFilter take over responsibility for turning the <q> and </q> tags into the appropriate HTML entities rather than leaving it to the HTML rendering engine in the interpreter. The quoteFilter OutputFilter keeps its own track of whether a double quote or a single quote is rquired next, and resets this count at the start of each turn.

`quoteFilter : OutputFilter InitObject`

Superclass Tree (in declaration order)

`quoteFilter`
`OutputFilter`
`object`
`InitObject`
`ModuleExecObject`
`object`

Summary of Properties

`quoteCount quotePat showWarnings`

``

``

Inherited from `ModuleExecObject` :
`execAfterMe execBeforeMe hasInitialized_ isDoingExec_ isExecuted_`

Summary of Methods

`execute filterText quoteCheck`

``

``

Inherited from `ModuleExecObject` :
`_execute classExec`

Properties

`quoteCount` | `output.t[1648]`

Our quoteCount is the net number of quote marks we've output this turn, i.e. the number of opening quote marks less the number of closing quote marks.

`quotePat` | `output.t[1651]`

Our rex pattern to match <q> and </q>

`showWarnings` | `output.t[1676]`

Should I show a warning when I find unmatched smart quotes over the course of a turn? Displaying such a warning would probably look intrusive in a released version, but might well be useful in a version sent out to beta-testers (so it shouldn't be tied to a version compiled for debugging). The showWarnings flag thus allows the warning messages to be turned on and off as desired.

Methods

`execute ( )`OVERRIDDEN | `output.t[1655]`

In Initialize this filter

`filterText (ostr, txt)`OVERRIDDEN | `output.t[1585]`

no description available

`quoteCheck ( )` | `output.t[1685]`

The PromptDaemon set up in our execute() method at Initialization runs this method at the end of each turn. It checks to see if the number of opening smart quotes over the course of the turn just completed is the same as the number of closing smart quotes, and optionally prints a warning message if it is not.

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