parser.t file | source file

TADS 3 Library: parser

This modules defines the language-independent parts of the command parser.

Portions based on xiny.t, copyright 2002 by Steve Breslin and incorporated by permission.

Summary of Classes

`ActorResolveResults AllInContainerNounPhraseProd AllPluralProd AmbigResponseKeeper ArbitraryNounProd BasicContainerResolver BasicPossessiveProd BasicProd BasicResolveResults BothPluralProd ButPossessiveProd ButProd CancelCommandLineException commandPhrase(ambiguousConj) commandPhrase(definiteConj) CommandProd CommandProdWithActor CommandProdWithAmbiguousConj CommandProdWithDefiniteConj CommandRanking CommandRankingByProblem CommandRankingByWeakness CommandRankingCriterion ContainerNounPhraseProd ContainerResolver DefiniteNounProd DefinitePluralProd DirectionProd DisambigPossessiveProd DisambigProd EmptyLiteralPhraseProd EmptyNounPhraseProd EmptyTopicPhraseProd EverythingButProd EverythingProd ExactQuantifiedPluralProd ExactQuantifiedPossessivePluralProd ExceptListProd ExceptResolver ExceptResults firstCommandPhrase(commandOnly) FirstCommandProd FirstCommandProdWithActor HerAdjProd HerProd HerselfProd HersNounProd HimProd HimselfProd HisAdjProd HisNounProd ImpliedActorNounPhraseProd IndefiniteNounButProd IndefiniteNounProd ItProd ItsAdjProd ItselfProd ItsNounProd LayeredNounPhraseProd ListButProd LiteralProd MeProd MineNounProd MissingObjectRanking MyAdjProd NounListProd NounPhraseProd NounPhraseWithVocab OopsResults ParseFailureException ParserException PluralProd PossessiveNounProd PossessivePluralProd PossessivePronounAdjProd PossessivePronounNounProd PreResolvedAmbigProd PreResolvedLiteralProd PreResolvedProd PronounProd QuantifiedPluralProd ReflexivePronounProd ReplacementCommandStringException ResolveAsker ResolveInfo ResolveResults RetryCommandTokensException SingleNounProd SingleNounWithListProd StillToResolveItem TerminateCommandException TheirAdjProd TheirsNounProd ThemProd ThemselvesProd TokenListProd TopicProd TryAsActorResolveResults VagueContainerDefiniteNounPhraseProd VagueContainerIndefiniteNounPhraseProd VagueContainerNounPhraseProd VagueContainerResolver YouProd YourAdjProd YoursNounProd`

Summary of Global Objects

`rankByActorSpecified rankByAllExcluded rankByAmbiguity rankByEmptyBut rankByEndAdj rankByIndefinite rankByInsufficient rankByListForSingle rankByLiteralLength rankByMiscWordList rankByMissing rankByNonMatch rankByNonMatchPoss rankByPluralTrunc rankByPronoun rankBySubcommands rankByTokenCount rankByTrunc rankByUnwantedPlural rankByVerbStructure rankByVocabNonMatch rankByWeakness`

Summary of Global Functions

`getResolvedObjects intersectNounLists spliceList tryAskingForObject tryOops tryOopsMain`

Global Functions

`getResolvedObjects (lst)` | `parser.t[485]`

Extract the objects from a list obtained with resolveNouns(). Returns a list composed only of the objects in the resolution information list.

`intersectNounLists (lst1, lst2)` | `parser.t[447]`

Intersect two resolved noun lists, returning a list consisting only of the unique objects from the two lists.

`spliceList (lst, idx, newItems)` | `parser.t[4551]`

splice a new sublist into a list, replacing the item at 'idx'

`tryAskingForObject (issuingActor, targetActor, resolver, results, responseProd)` | `parser.t[4569]`

Try reading a response to a missing object question. If we successfully read a noun phrase that matches the given production rule, we'll resolve it, stash the resolved list in the resolvedObjects_ property of the match tree, and return the match tree. If they enter something that doesn't look like a response to the question at all, we'll throw a new-command exception to process it.

`tryOops (tokList, issuingActor, targetActor, firstTokenIndex, cmdTokenList, cmdType)` | `parser.t[4349]`

Look for an undefined word in a list of tokens, and give the player a chance to correct a typo with "OOPS" if appropriate.

If we find an unknown word and we can prompt for interactive resolution, we'll do so, and we'll throw an appropriate exception to handle the response. If we can't resolve the missing word interactively, we'll throw a parse failure exception.

If there are no undefined words in the command, we'll simply return.

tokList is the list of tokens under examination; this is a subset of the full command token list. cmdTokenList is the full command token list, in the usual tokenizer format. firstTokenIndex is the index of the first token in tokList within cmdTokenList.

cmdType is an rmcXxx code giving the type of input we're reading.

`tryOopsMain (tokList, issuingActor, targetActor, firstTokenIndex, cmdTokenList, cmdType)` | `parser.t[4360]`

main "oops" processor

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