GrammarAltInfo class | gramprod.t[43]

Rule alternative descriptor. This describes one alternative in a grammar production. An alternative is one complete list of matchable tokens.

In a 'grammar' statement, alternatives are delimited by '|' symbols at the top level. Each group of tokens set off by '|' symbols is one alternative.

When '|' symbols are grouped with parentheses in a 'grammar' statement, the compiler "flattens" the grouping by expanding out the parenthesized groups until it has entirely top-level alternatives. So, at the level of a GrammarProd object, there's no such thing as parentheses or nested '|' symbols.

`class GrammarAltInfo : object`

Superclass Tree (in declaration order)

`GrammarAltInfo`
`object`

Subclass Tree

(none)

Global Objects

(none)

Summary of Properties

`gramBadness gramMatchObj gramTokens`

Summary of Methods

`construct`

Properties

`gramBadness` | `gramprod.t[66]`

The 'badness' value associated with the alternative. A value of zero means that there's no badness.

`gramMatchObj` | `gramprod.t[73]`

the "match object" class - this is the class that GrammarProd.parseTokens() instantiates to represent a match to this alternative in the match list that the method returns

`gramTokens` | `gramprod.t[80]`

The token descriptor list. This is a list of zero or more GrammarAltTokInfo objects describing the tokens making up this rule.

Methods

`construct (score, badness, matchObj, toks, ...)` | `gramprod.t[54]`

Constructor. GrammarProd.getGrammarInfo() calls this once for each alternative making up the production, passing in the values that define the alternative. Note that we have a '...' in our argument list so that we'll be compatible with any future GrammarProd versions that add additional arguments - we won't do anything with the extra arguments, but we'll harmlessly ignore them, so code compiled with this library version will continue to work correctly.

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