ParseErrorclass | parser.t[4939]

ParseError is an Exception subclass for parsing errors.

`class ParseError : Exception`

Superclass Tree (in declaration order)

`ParseError`
`Exception`
`object`

Subclass Tree

`ParseError`
`BadMultiError`
`CommandError`
`EmptyNounError`
`RejectParseTreeError`
`NotUnderstoodError`
`OopsError`
`CantOopsError`
`ResolutionError`
`ActorResolutionError`
`InsufficientNounsError`
`NoneInLocationError`
`NoneInOwnerError`
`NoneWithContentsError`
`UnmatchedNounError`
`AmbiguousMultiDefiniteError`
`AmbiguousError`
`OrdinalRangeError`
`PronounError`
`AntecedentScopeError`
`NoAntecedentError`
`UnmatchedActorError`
`UnknownWordError`

Global Objects

(none)

Summary of Properties

`allowOnRespell curable errStage`

Inherited from `Exception` :
`errmsg_`

Summary of Methods

`display rankCorrection tryCuring`

Inherited from `Exception` :
`construct displayException getExceptionMessage showStackTrace`

Properties

`allowOnRespell` | `parser.t[4972]`

Is this error allowed on a spelling correction candidate? By default, this is nil, meaning that this error invalidates a correction candidate. We mostly reject spelling "corrections" that result in errors because these are probably false positives: they probably replace a misspelled word with one that's in the dictionary but that's still wrong. However, there are a few curable errors where it can make sense to keep a correction, such as an ambiguous noun phrase: that's so close to being a working command that we probably have a good correction.

`curable` | `parser.t[4986]`

Is this a "curable" error? A curable error is one that the user can fix by answering a question, such as "which one do you mean?" or "what do you want to unlock it with?"

When we find more than one grammar match to an input string, the parser tries resolving each one, in order of the predicate match quality. If one resolves without an error, the parser stops and uses that match. But if *none* of the possible matches resolve without an error, the parser picks a match with a curable error over one with an incurable error.

`errStage` | `parser.t[5012]`

The parsing "stage" of this error. We can distinguish three levels of intelligibility as we work through the parsing process: (1) completely unintelligible, (2) valid verb structure, and (3) resolved noun phrases. This property tells us which stage we finish in when we encounter an error of this type.

Methods

`display ( )` | `parser.t[4943]`

Display the error message

`rankCorrection (toks, idx, dict)` | `parser.t[4959]`

Rank a spelling correction candidate for input that triggered this error on parsing.

'toks' is the new token list, with the spelling correction applied; 'idx' is the index in the list of the corrected word. 'dict' is the Dictionary used for parsing.

Returns an integer value giving the ranking. The ranking is used for sorting, so the scale is arbitrary - we simply take the highest ranking item. The value 0 is special, though: it means that we should filter out the candidate and not consider it at all.

`tryCuring (toks, dict)` | `parser.t[5003]`

Try curing this error with the user's answer to the error message. The parser calls this when (a) the PREVIOUS command resulted in this error, (b) this error is curable, and (c) the user typed something on the CURRENT command that didn't parse as a valid new command. Since the new input doesn't look like a valid command, the parser calls this to determine if the input was instead meant as an answer to the question posed by the last error.

If this new command is indeed a valid response to the error message, we return a CommandList with the "cured" version of the command. This new command list should supplement the command with the new information provided by the reply. If not, we simply return nil.

Adv3Lite Library Reference Manual
Generated on 15/03/2023 from adv3Lite version 1.6.1