Production class | parser.t[3326]

Our root class for grammar productions. (A "production" represents a match to a syntax rule, as defined with a 'grammar' template.)

The language module's grammar rules can define certain special properties on any production match object, and we'll find them in the course of building the command from the match tree:

endOfSentence=true - define this on a production for a sentence-ending verb conjunction. In English (and most Western languages), this can be used with rules that match punctuation marks like periods, exclamation points, and question marks, since these marks typically end a sentence. The parser distinguishes between the grammar rules for the first clause in a sentence vs subsequent clauses. It starts a new input line with the first-in-sentence rule, then uses the additional clause rule for each subsequent clause. When a clause ends with a sentence-ending mark, though, we'll treat the next clause as a sentence opener again.

`class Production : object`

Superclass Tree (in declaration order)

`Production`
`object`

Subclass Tree

`Production`
`actorBadCommandPhrase(main)`
`atSingleNoun(main)`
`BadListProduction`
`singleNoun(multiple)`
`commandOnlyConjunction(nonSentenceEnding)`
`commandOnlyConjunction(sentenceEnding)`
`commandOrNounConjunction(main)`
`CommandProduction`
`commandPhrase(ambiguousConj)`
`commandPhrase(definiteConj)`
`defaultCommandPhrase(examine)`
`firstCommandPhrase(askTellActorTo)`
`firstCommandPhrase(commandOnly)`
`firstCommandPhrase(withActor)`
`completeNounPhrase(main)`
`completeNounPhrase(miscPrep)`
`completeNounPhraseWithAll(main)`
`completeNounPhraseWithoutAll(main)`
`compoundNounArticle(main)`
`compoundNounPhrase(of)`
`compoundNounPhrase(simple)`
`compoundNounPrep(main)`
`compoundPluralPhrase(of)`
`compoundPluralPhrase(simple)`
`contentsPrep(main)`
`contentsPrepOrVerb(main)`
`ContentsQualifierProduction`
`nounPhraseWithContents(contents)`
`pluralPhraseWithContents(contents)`
`qualifiedPluralNounPhrase(theOnesContaining)`
`qualifiedSingularNounPhrase(theOneContaining)`
`CoreNounPhraseProduction`
`nounPhrase(main)`
`pluralPhrase(main)`
`detPluralNounPhrase(main)`
`detPluralOnlyNounPhrase(main)`
`directionName(root)`
`disambigListItem(noun)`
`disambigListItem(plural)`
`disambigListItem(possessive)`
`disambigPhrase(all)`
`disambigPhrase(any)`
`disambigPhrase(list)`
`disambigPhrase(ordinalList)`
`DisambigProduction`
`mainDisambigPhrase(main)`
`EmptyNounProduction`
`literalPhrase(empty)`
`nounList(empty)`
`simpleNounPhrase(empty)`
`simplePluralPhrase(empty)`
`singleNoun(empty)`
`exceptListBody(single)`
`ExceptListProduction`
`exceptList(main)`
`exceptNounPhrase(singleComplete)`
`exceptNounPhrase(singlePossessive)`
`explicitDetPluralNounPhrase(definite)`
`explicitDetPluralNounPhrase(possessive)`
`explicitDetPluralOnlyNounPhrase(definite)`
`explicitDetPluralOnlyNounPhrase(possessive)`
`forSingleNoun(main)`
`fromSingleNoun(main)`
`implicitDetPluralOnlyNounPhrase(main)`
`indetPluralNounPhrase(basic)`
`indetPluralOnlyNounPhrase(basic)`
`indetSingularNounPhrase(basic)`
`inSingleNoun(main)`
`literalNounPhrase(number)`
`literalNounPhrase(string)`
`LiteralNounProduction`
`literalPhrase(miscList)`
`literalPhrase(string)`
`LocationalProduction`
`disambigPhrase(locational)`
`indetPluralNounPhrase(locational)`
`indetPluralOnlyNounPhrase(locational)`
`indetSingularNounPhrase(locational)`
`qualifiedPluralNounPhrase(theOnesIn)`
`qualifiedSingularNounPhrase(anyOneIn)`
`qualifiedSingularNounPhrase(theOneIn)`
`LocationPrepProduction`
`locationPrep(from)`
`locationPrep(in)`
`locationPrep(on)`
`MiscWordListProduction`
`miscWordList(list)`
`miscWordList(wordOrNumber)`
`nounConjunction(main)`
`nounList(list)`
`nounList(nonTerminal)`
`nounList(terminal)`
`NounListProduction`
`disambigList(list)`
`disambigOrdinalList(head)`
`disambigOrdinalList(tail)`
`exceptListBody(list)`
`nonTerminalNounMultiList(multi)`
`nonTerminalNounMultiList(pair)`
`nounMultiList(multi)`
`nounMultiList(nonterminal)`
`nounPhraseWithContents(basic)`
`nounWord(noun)`
`nounWord(nounAbbr)`
`nounWord(nounApostS)`
`NumberNounProduction`
`numberObjPhrase(main)`
`numberPhrase(digits)`
`numberPhrase(spelled)`
`poundNumberPhrase(main)`
`onSingleNoun(main)`
`oopsCommand(main)`
`OopsProduction`
`oopsPhrase(main)`
`OrdinalProduction`
`disambigListItem(ordinal)`
`disambigOrdinalItem(main)`
`outOfSingleNoun(main)`
`pluralPhraseWithContents(basic)`
`PossessiveProduction`
`possessiveAdjPhrase(definiteNpApostropheS)`
`possessiveAdjPhrase(her)`
`possessiveAdjPhrase(his)`
`possessiveAdjPhrase(indefiniteNpApostropheS)`
`possessiveAdjPhrase(its)`
`possessiveAdjPhrase(my)`
`possessiveAdjPhrase(npApostropheS)`
`possessiveAdjPhrase(their)`
`possessiveAdjPhrase(your)`
`possessiveNounPhrase(hers)`
`possessiveNounPhrase(his)`
`possessiveNounPhrase(its)`
`possessiveNounPhrase(mine)`
`possessiveNounPhrase(npApostropheS)`
`possessiveNounPhrase(theirs)`
`possessiveNounPhrase(yours)`
`PronounProduction`
`pronounPhrase(her)`
`pronounPhrase(herself)`
`pronounPhrase(him)`
`pronounPhrase(himself)`
`pronounPhrase(it)`
`pronounPhrase(itself)`
`pronounPhrase(me)`
`pronounPhrase(them)`
`pronounPhrase(themselves)`
`pronounPhrase(us)`
`pronounPhrase(you)`
`putPrep(main)`
`putPrepSingleNoun(main)`
`qualifiedNounPhrase(main)`
`qualifiedPluralNounPhrase(all)`
`qualifiedPluralNounPhrase(determiner)`
`qualifiedSingularNounPhrase(anyPlural)`
`qualifiedSingularNounPhrase(arbitrary)`
`qualifiedSingularNounPhrase(definite)`
`qualifiedSingularNounPhrase(indefinite)`
`qualifiedSingularNounPhrase(possessive)`
`QuantifierProduction`
`disambigPhrase(both)`
`explicitDetPluralNounPhrase(definiteNumber)`
`explicitDetPluralNounPhrase(possessiveNumber)`
`explicitDetPluralNounPhrase(possessiveNumber2)`
`explicitDetPluralOnlyNounPhrase(definiteNumber)`
`explicitDetPluralOnlyNounPhrase(possessiveNumber)`
`explicitDetPluralOnlyNounPhrase(possessiveNumber2)`
`qualifiedPluralNounPhrase(allNum)`
`qualifiedPluralNounPhrase(anyNum)`
`qualifiedPluralNounPhrase(both)`
`qualifiedPluralNounPhrase(definiteNum)`
`quotedStringPhrase(main)`
`simpleNounPhrase(adjAndOne)`
`simpleNounPhrase(adjAndOnes)`
`simpleNounPhrase(list)`
`simpleNounPhrase(literal)`
`simpleNounPhrase(literalAndList)`
`simpleNounPhrase(misc)`
`simpleNounPhrase(noun)`
`simplePluralPhrase(adjAndOnes)`
`simplePluralPhrase(misc)`
`simplePluralPhrase(plural)`
`singleNoun(normal)`
`singleNounOnly(main)`
`spelledHundred(aHundred)`
`spelledHundred(aHundredPlus)`
`spelledHundred(hundreds)`
`spelledHundred(hundredsPlus)`
`spelledHundred(small)`
`spelledMillion(aMillion)`
`spelledMillion(aMillionAndSmall)`
`spelledMillion(millions)`
`spelledMillion(millionsAndSmall)`
`spelledMillion(millionsPlus)`
`spelledNumber(main)`
`spelledSmallNumber(digit)`
`spelledSmallNumber(teen)`
`spelledSmallNumber(tens)`
`spelledSmallNumber(tensAndUnits)`
`spelledSmallNumber(zero)`
`spelledThousand(aThousand)`
`spelledThousand(aThousandAndSmall)`
`spelledThousand(thousands)`
`spelledThousand(thousandsAndSmall)`
`spelledThousand(thousandsPlus)`
`terminalNounPhrase(allBut)`
`terminalNounPhrase(anyBut)`
`terminalNounPhrase(pluralExcept)`
`throughSingleNoun(main)`
`TopicNounProduction`
`aboutTopicPhrase(main)`
`topicPhrase(main)`
`topicPhrase(misc)`
`toSingleNoun(main)`
`VerbProduction`
`defaultVerbPhrase(noun)`
`EnTravelVia`
`VerbRule(About)`
`VerbRule(Again)`
`VerbRule(AskAbout)`
`VerbRule(AskAboutImplicit)`
`VerbRule(AskAboutWhat)`
`VerbRule(AskFor)`
`VerbRule(AskForImplicit)`
`VerbRule(AskVague)`
`VerbRule(AskWhomFor)`
`VerbRule(Attach)`
`VerbRule(AttachTo)`
`VerbRule(Attack)`
`VerbRule(AttackWith)`
`VerbRule(AuxQuery)`
`VerbRule(Board)`
`VerbRule(Break)`
`VerbRule(Brief)`
`VerbRule(Burn)`
`VerbRule(BurnWith)`
`VerbRule(Clean)`
`VerbRule(CleanWith)`
`VerbRule(Climb)`
`VerbRule(ClimbDown)`
`VerbRule(ClimbDownWhat)`
`VerbRule(ClimbUp)`
`VerbRule(ClimbUpWhat)`
`VerbRule(Close)`
`VerbRule(CmdMenu)`
`VerbRule(ConsultAbout)`
`VerbRule(ConsultWhatAbout)`
`VerbRule(Continue)`
`VerbRule(Credits)`
`VerbRule(Cut)`
`VerbRule(CutWith)`
`VerbRule(Debug)`
`VerbRule(DebugI)`
`VerbRule(Detach)`
`VerbRule(DetachFrom)`
`VerbRule(Dig)`
`VerbRule(DigWith)`
`VerbRule(Doff)`
`VerbRule(Drink)`
`VerbRule(Drop)`
`VerbRule(Eat)`
`VerbRule(Enter)`
`VerbRule(EnterOn)`
`VerbRule(Evaluate)`
`VerbRule(Examine)`
`VerbRule(Exits)`
`VerbRule(ExitsColour)`
`VerbRule(ExitsMode)`
`VerbRule(Extinguish)`
`VerbRule(ExtraHints)`
`VerbRule(FactInfo)`
`VerbRule(Fasten)`
`VerbRule(FastenTo)`
`VerbRule(Feel)`
`VerbRule(FiatLux)`
`VerbRule(Flip)`
`VerbRule(Follow)`
`VerbRule(Footnote)`
`VerbRule(FootnotesFull)`
`VerbRule(FootnotesMedium)`
`VerbRule(FootnotesOff)`
`VerbRule(FootnotesStatus)`
`VerbRule(FullScore)`
`VerbRule(GetOff)`
`VerbRule(GetOut)`
`VerbRule(GetOutOf)`
`VerbRule(GiveTo)`
`VerbRule(GiveToImplicit)`
`VerbRule(GiveToType2)`
`VerbRule(GoAlong)`
`VerbRule(GoBack)`
`VerbRule(GoNear)`
`VerbRule(Goodbye)`
`VerbRule(GoSomewhere)`
`VerbRule(GoThrough)`
`VerbRule(GoTo)`
`VerbRule(Hello)`
`VerbRule(Help)`
`VerbRule(Hints)`
`VerbRule(HintsOff)`
`VerbRule(In)`
`VerbRule(instructions)`
`VerbRule(Intro)`
`VerbRule(Inventory)`
`VerbRule(InventoryTall)`
`VerbRule(InventoryWide)`
`VerbRule(Jump)`
`VerbRule(JumpOff)`
`VerbRule(JumpOffIntransitive)`
`VerbRule(JumpOver)`
`VerbRule(KeepGoing)`
`VerbRule(Kiss)`
`VerbRule(Lie)`
`VerbRule(LieIn)`
`VerbRule(LieOn)`
`VerbRule(Light)`
`VerbRule(Listen)`
`VerbRule(ListenTo)`
`VerbRule(ListFacts)`
`VerbRule(ListRelations)`
`VerbRule(ListTests)`
`VerbRule(Lock)`
`VerbRule(LockWith)`
`VerbRule(Look)`
`VerbRule(LookBehind)`
`VerbRule(LookHere)`
`VerbRule(LookIn)`
`VerbRule(LookThrough)`
`VerbRule(LookUnder)`
`VerbRule(LookUp)`
`VerbRule(LookX)`
`VerbRule(Move)`
`VerbRule(MoveTo)`
`VerbRule(MoveWith)`
`VerbRule(No)`
`VerbRule(Notify)`
`VerbRule(NotifyOff)`
`VerbRule(NotifyOn)`
`VerbRule(Open)`
`VerbRule(Out)`
`VerbRule(PlugIn)`
`VerbRule(PlugInto)`
`VerbRule(PlugIntoWhat)`
`VerbRule(Pour)`
`VerbRule(PourInto)`
`VerbRule(PourOnto)`
`VerbRule(Pull)`
`VerbRule(Purloin)`
`VerbRule(Push)`
`VerbRule(PushTravelClimbDown)`
`VerbRule(PushTravelClimbUp)`
`VerbRule(PushTravelDir)`
`VerbRule(PushTravelEnter)`
`VerbRule(PushTravelGetOutOf)`
`VerbRule(PushTravelThrough)`
`VerbRule(PutBehind)`
`VerbRule(PutIn)`
`VerbRule(PutOn)`
`VerbRule(PutUnder)`
`VerbRule(PutWhere)`
`VerbRule(Query)`
`VerbRule(Query2)`
`VerbRule(QueryAbout)`
`VerbRule(QueryVague)`
`VerbRule(Quit)`
`VerbRule(Read)`
`VerbRule(Record)`
`VerbRule(RecordEvents)`
`VerbRule(RecordEventsString)`
`VerbRule(RecordOff)`
`VerbRule(RecordString)`
`VerbRule(RelationDetails)`
`VerbRule(Remove)`
`VerbRule(ReplayQuiet)`
`VerbRule(ReplayString)`
`VerbRule(Restart)`
`VerbRule(Restore)`
`VerbRule(RestoreString)`
`VerbRule(Sample)`
`VerbRule(Save)`
`VerbRule(SaveString)`
`VerbRule(Say)`
`VerbRule(SayTo)`
`VerbRule(Score)`
`VerbRule(Screw)`
`VerbRule(ScrewWith)`
`VerbRule(ScriptOff)`
`VerbRule(ScriptOn)`
`VerbRule(ScriptString)`
`VerbRule(Search)`
`VerbRule(Seek)`
`VerbRule(Set)`
`VerbRule(SetTo)`
`VerbRule(ShowTo)`
`VerbRule(ShowToImplicit)`
`VerbRule(ShowToType2)`
`VerbRule(Sit)`
`VerbRule(SitIn)`
`VerbRule(SitOn)`
`VerbRule(Sleep)`
`VerbRule(Smell)`
`VerbRule(SmellSomething)`
`VerbRule(Stand)`
`VerbRule(StandIn)`
`VerbRule(StandOn)`
`VerbRule(Strike)`
`VerbRule(Switch)`
`VerbRule(SwitchOff)`
`VerbRule(SwitchOn)`
`VerbRule(Take)`
`VerbRule(TakeFrom)`
`VerbRule(TalkAbout)`
`VerbRule(TalkAboutImplicit)`
`VerbRule(TalkTo)`
`VerbRule(Taste)`
`VerbRule(TellAbout)`
`VerbRule(TellAboutImplicit)`
`VerbRule(TellAboutWhat)`
`VerbRule(TellThat)`
`VerbRule(TellTo)`
`VerbRule(TellVague)`
`VerbRule(Test)`
`VerbRule(Think)`
`VerbRule(ThinkAbout)`
`VerbRule(Throw)`
`VerbRule(ThrowAt)`
`VerbRule(ThrowDir)`
`VerbRule(ThrowDirDown)`
`VerbRule(ThrowTo)`
`VerbRule(ThrowToType2)`
`VerbRule(ToggleDiaambigEnum)`
`VerbRule(Topics)`
`VerbRule(Travel)`
`VerbRule(Turn)`
`VerbRule(TurnTo)`
`VerbRule(TurnWith)`
`VerbRule(TypeLiteralOn)`
`VerbRule(TypeLiteralOnWhat)`
`VerbRule(TypeOn)`
`VerbRule(Undo)`
`VerbRule(Unfasten)`
`VerbRule(UnfastenFrom)`
`VerbRule(Unlock)`
`VerbRule(UnlockWith)`
`VerbRule(Unplug)`
`VerbRule(UnplugFrom)`
`VerbRule(Unscrew)`
`VerbRule(UnscrewWith)`
`VerbRule(VagueTravel)`
`VerbRule(Verbose)`
`VerbRule(Version)`
`VerbRule(Wait)`
`VerbRule(Wear)`
`VerbRule(WhatAmICarrying)`
`VerbRule(WhatIsNoun)`
`VerbRule(WhatNext)`
`VerbRule(WhatsHere)`
`VerbRule(WhatsThePoint)`
`VerbRule(WhatThisGame)`
`VerbRule(WhereAmI)`
`VerbRule(WhereGo)`
`VerbRule(WhereHelp)`
`VerbRule(WhoAmI)`
`VerbRule(Write)`
`VerbRule(WriteOn)`
`VerbRule(Yell)`
`VerbRule(Yes)`
`withSingleNoun(main)`
`YesOrNoProduction`
`yesOrNoPhrase(no)`
`yesOrNoPhrase(yes)`

Global Objects

(none)

Summary of Properties

`determiner nounPhraseRole npClass parent`

Summary of Methods

`addNounListItem build findAction findChild findParent getNounPhraseRole getText getTokens grammarInfoForBuild isChildOf noteEndOfSentence visitLiteral visitProd`

Properties

`determiner` | `parser.t[3511]`

The determiner that this production applies to the noun phrase it's part of, as a Determiner object. If this is non-nil, this Determiner will be set in the current NounPhrase when we visit this production in the build process.

`nounPhraseRole` | `parser.t[3470]`

My assigned noun phrase role, as a NounRole object. This must be explicitly set for the top node in a noun slot (which can be a noun list production, a single noun production, a topic, etc).

In a positional language grammar, the predicate production will mark its immediate child in each noun phrase slot by setting this according to the role that the sub-tree plays in the predicate grammar. Non-positional languages that use grammatical case or other ways of encoding the role information must set this some other way.

`npClass` | `parser.t[3456]`

The NounPhrase subclass to use for noun phrases within this sub-tree. By default, we look to our parent; if we don't have a parent, we use the base NounPhrase class.

Special phrase types (topics, literals, and numbers) have their own NounPhrase subclasses. This is important because the resolution rules for these phrase types differ from the regular object resolution rules.

`parent` | `parser.t[3526]`

My parent production. The low-level GrammarProd mechanism doesn't set this up, so we set it up ourselves in the course of building out the tree. In build(), just before we visit each sub-production, we set the sub-production's 'parent' property to point back to the parent production. This property is therefore always set while we're traversing the child's tree, but won't necessarily be set yet if we're not currently working somewhere within the child's tree. That means that you can always look at 'parent' within your own build() routine or a child build() routine, but you can't necessarily look at it across the tree or within your own children.

Methods

`addNounListItem (cmd, prod)` | `parser.t[3428]`

Add a new NounPhrase item to the list under construction. Certain productions are associated with specific functional slots in the abstract command - direct object, indirect object, EXCEPT list, etc. This routine is for such production subclasses to override, to direct new noun phrases into the appropriate slot lists. In a grammar, the functional role is typically at a higher level in the tree, with ordinary noun phrases plugged in underneath.

Our default handling is to first check our nounPhraseRole property; if it's set, it tells us the role that this sub-tree plays in the predicate (direct object, indirect object, accessory). We use that information to add the new NounPhrase to the Command list that we're building for our assigned role.

If nounPhraseRole is nil, then we simply pass the request up to our parent. Eventually we should reach a node encoding the function slot.

`build (cmd, np)` | `parser.t[3353]`

Build the command for this production and its children. By default, we'll simply traverse into our children.

`findAction ( )` | `parser.t[3562]`

Find the action. This finds the child of type VerbProduction, then retrieves the action from the verb production.

`findChild (cls)` | `parser.t[3574]`

Find a child of a given class.

`findParent (func)` | `parser.t[3533]`

Find a parent matching a given test. We'll scan up the parent tree, looking for the nearest parent p for which func(p) returns true, returning p. If we can't find one, we return nil.

`getNounPhraseRole ( )` | `parser.t[3476]`

Get our noun phrase role. If we don't have a role defined directly, we'll inherit the role from our parent node.

`getText ( )` | `parser.t[3328]`

get the original text of the command for this match

`getTokens ( )` | `parser.t[3339]`

get my original token list, in canonical tokenizer format

`grammarInfoForBuild ( )` | `parser.t[3403]`

Get the grammar match list for build() purposes. By default, this simply returns the grammarInfo() results, which are automatically generated by the compiler to return a list of the "->prop" values from the matched grammar rule. Some rules might want to modify that default value list, so we provide this routine as an override hook.

`isChildOf (prod)` | `parser.t[3544]`

Is this production a child of the given production?

`noteEndOfSentence (cmd, prod)` | `parser.t[3440]`

Note an end-of-sentence marker. We'll simply notify our parent by default.

`visitLiteral (cmd, np, tok)` | `parser.t[3487]`

Visit a literal token child in our sub-tree. This is called during the build process for each literal token in our child list. By default, we add the token to the command's current noun phrase.

`visitProd (cmd, np, prod)` | `parser.t[3499]`

Visit a production object in our list. This is called during the build process for each production object in our child list. By default, we simply build the child production recursively.

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