Class AParserSyntaxError

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type AParserSyntaxError = class(ALoggedError)

Description

This class represents a syntax error that is logged by a parser to a given instance of ALog. It is defined for convenience, since ALoggedError could be used instead; however, this class changes the format of the message output to the log so that it includes the file name of the source being parsed, if available, and the line number within that source.

Hierarchy

  • AParserSyntaxError

Overview

Fields

Protected MyScanner: AScanner;

Methods

Public constructor inSource(const ThisScanner: AScanner; const fmt: string; const params: array of const); virtual;
Public function init: boolean; override;
Public function shallowCopyFrom(const Other: AnObject): boolean; override;
Public function toString: AnsiString; override;
Public function Scanner: AScanner; virtual;

Description

Fields

Protected MyScanner: AScanner;

Refers to the scanner used to parse the source

Methods

Public constructor inSource(const ThisScanner: AScanner; const fmt: string; const params: array of const); virtual;

Construct a new logged parser message.

When AParserSyntaxError.toString is called, ThisScanner will be queried for the name of the source being parsed and the current line number in that source; both of these items will be output along with the message constructed from fmt and params.

Public function init: boolean; override;

Initializer

Public function shallowCopyFrom(const Other: AnObject): boolean; override;

Construct a shallow copy of the other object.

This method overrides the behavior inherited from ALoggedItem.shallowCopyFrom: it calls that method, then checks to see whether Other is an instance of AParserSyntaxError. If so, it copies the value of AParserSyntaxError.Scanner from Other to Self, overwriting the value in Self.

Public function toString: AnsiString; override;

Construct and return a string representation of the item, suitable for output to a text-based device, such as a console.

This method builds on the behavior inherited from ALoggedError: it calls the inherited routine, then prepends the name of the source file and the current line number within that source, according to the format specified by pmsgStringRepresentation.

Public function Scanner: AScanner; virtual;

Retrieve a reference to the scanner that will be queried for source name and line information.

The caller should NOT free this reference.


Generated by PasDoc 0.13.0 on 2015-06-25 11:12:03