Class ASourceInputStream

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type ASourceInputStream = class(ATextInputStream)

Description

This class is defined for convenience and need not be used, strictly speaking, since instances of ASourceScanner will happily accept any valid instance of ATextInputStream or its descendants. However, this class overrides AStream.Iterator to make the construction of a source scanner for a given source stream more convenient. It retains a reference to a language definition, which is automatically passed to the scanner it creates, and it defines a constructor to make wrapping another stream convenient.

Hierarchy

Overview

Fields

Protected MyLanguage: AParsedLanguage;

Methods

Public constructor using(const ThisLanguage: AParsedLanguage; const ThisTarget: AStream; const takeOwnershipOfTarget: boolean = true); virtual;
Public function init: boolean; override;
Public function Iterator: AnIterator; override;
Public function Language: AParsedLanguage; virtual;

Description

Fields

Protected MyLanguage: AParsedLanguage;

Refers to the language definition associated with the source stream

Methods

Public constructor using(const ThisLanguage: AParsedLanguage; const ThisTarget: AStream; const takeOwnershipOfTarget: boolean = true); virtual;

Construct a new source input stream that will be parsed using the specified language definition and that will wrap the specified target stream.

If takeOwnershipOfTarget is True, then the instance will assume ownership of ThisTarget and will free it when it is, itself, freed.

The language specified by ThisLanguage will be saved and passed along to the instance of ASourceScanner created when ASourceInputStream.Iterator is called.

Public function init: boolean; override;

Initializer

Public function Iterator: AnIterator; override;

Construct an iterator suitable for iterating over the contents of the stream.

This method overrides the behavior inherited from AStream: it constructs and returns an instance of ASourceScanner, passing along the value of ASourceInputStream.Language. The caller is responsible for freeing the scanner when it is no longer required.

Public function Language: AParsedLanguage; virtual;

Retrieve the language definition associated with the source stream.

This value is set when the stream is constructed by a call to ASourceInputStream.using and cannot be changed.


Generated by PasDoc 0.13.0 on 2015-01-10 17:13:18