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)


Subclass Tree  


Global Objects  


Summary of Properties  

gramBadness  gramMatchObj  gramTokens 

Summary of Methods  




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

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

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


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