Distinguisherclass | parser.t[1234]

A Distinguisher is an abstract parser object that represents one way that we can tell two objects apart, both in the name we display and in command input.

Note that this class is designed primarily for the parser's internal use, to facilitate some bookkeeping that we have to do during disambiguation. It's not really designed as an extensibility mechanism, because it's not usually enough to just add a new instance: you usually also have to add grammar for whatever new phrasing the new distinguisher represents, plus object resolution code to handle the new form of qualification.

`class Distinguisher : object`

Superclass Tree (in declaration order)

`Distinguisher`
`object`

Subclass Tree

`Distinguisher`
`StateDistinguisher`

Global Objects

`contentsDistinguisher disambigNameDistinguisher locationDistinguisher nameDistinguisher ownerDistinguisher`

Summary of Properties

`all classInitFirst sortOrder`

Summary of Methods

`appliesTo apply classInit equal getNames`

Properties

`all` | `parser.t[1310]`

class property: master list of all distinguishers

`classInitFirst` | `parser.t[1323]`

make sure the StateDistinguisher instances are constructed first

`sortOrder` | `parser.t[1240]`

Sorting order. The parser sorts the master list of distinguishers in ascending order of this value to determine the order of application.

Methods

`appliesTo (obj)` | `parser.t[1257]`

Is this distinguisher applicable to the given object? Some distinguishers can only apply to certain objects. For example, a Lit/Unlit distinguisher can only be applied to objects with that state variable, because there's no vocabulary that we can add to an object without the variable. (We can talk about "lit" and "unlit" matches, but we don't have any standard vocabulary to talk about "unlightable" matches.)

`apply (lst)` | `parser.t[1263]`

Apply the distinguisher. Returns a DistResult object with the results.

`classInit ( )` | `parser.t[1313]`

during initialization, build the master list

`equal (a, b)` | `parser.t[1246]`

Compare two objects for equivalence under this distinguisher. Returns true if the objects are equivalent, nil others.

`getNames (objs, article)` | `parser.t[1340]`

Class method: generate distinguishing names for a list of objects. This generates names that distinguish the objects from one another, by applying as many Distinguishers as needed to come up with unique names.

If 'article' is true, we'll use a definite or indefinite article, as appropriate: definite if the name we settle upon uniquely identifies the object within the list, indefinite if not. If 'article' is nil, the names don't have articles at all.

Returns a list of [name, [objects]] sublists. The name is a string giving the distinguished name; the [objects] sub-sublist is a list of the objects known under that name.

Adv3Lite Library Reference Manual
Generated on 28/03/2016 from adv3Lite version 1.5