Class TScanner

Unit

Declaration

type TScanner = class(TObject)

Description

This class scans one unit using one or more TTokenizer objects to scan the unit and all nested include files.

Hierarchy

Overview

Methods

Protected procedure DoError(const AMessage: string; const AArguments: array of const);
Protected procedure DoMessage(const AVerbosity: Cardinal; const MessageType: TPasDocMessageType; const AMessage: string; const AArguments: array of const);
Public constructor Create( const s: TStream; const OnMessageEvent: TPasDocMessageEvent; const VerbosityLevel: Cardinal; const AStreamName, AStreamPath: string; const AHandleMacros: boolean);
Public destructor Destroy; override;
Public procedure AddSymbol(const Name: string);
Public procedure AddSymbols(const NewSymbols: TStringVector);
Public procedure AddMacro(const Name, Value: string);
Public procedure ConsumeToken;
Public function GetToken: TToken;
Public function GetStreamInfo: string;
Public function PeekToken: TToken;
Public procedure UnGetToken(var t: TToken);

Properties

Public property IncludeFilePaths: TStringVector read FIncludeFilePaths write SetIncludeFilePaths;
Public property OnMessage: TPasDocMessageEvent read FOnMessage write FOnMessage;
Public property Verbosity: Cardinal read FVerbosity write FVerbosity;
Public property SwitchOptions: TSwitchOptions read FSwitchOptions;
Public property HandleMacros: boolean read FHandleMacros;

Description

Methods

Protected procedure DoError(const AMessage: string; const AArguments: array of const);
 
Protected procedure DoMessage(const AVerbosity: Cardinal; const MessageType: TPasDocMessageType; const AMessage: string; const AArguments: array of const);
 
Public constructor Create( const s: TStream; const OnMessageEvent: TPasDocMessageEvent; const VerbosityLevel: Cardinal; const AStreamName, AStreamPath: string; const AHandleMacros: boolean);

Creates a TScanner object that scans the given input stream.

Note that the stream S will be freed by this object (at destruction or when we will read all it's tokens), so after creating TScanner you should leave the stream to be managed completely by this TScanner.

Public destructor Destroy; override;
 
Public procedure AddSymbol(const Name: string);

Adds Name to the list of symbols (as a normal symbol, not macro).

Public procedure AddSymbols(const NewSymbols: TStringVector);

Adds all symbols in the NewSymbols collection by calling AddSymbol for each of the strings in that collection.

Public procedure AddMacro(const Name, Value: string);

Adds Name as a symbol that is a macro, that expands to Value.

Public procedure ConsumeToken;

Gets next token and throws it away.

Public function GetToken: TToken;

Returns next token. Always non-nil (will raise exception in case of any problem).

Public function GetStreamInfo: string;

Returns the name of the file that is currently processed and the line number. Good for meaningful error messages.

Public function PeekToken: TToken;
 
Public procedure UnGetToken(var t: TToken);

Place T in the buffer. Next time you will call GetToken you will get T. This also sets T to nil (because you shouldn't free T anymore after ungetting it). Note that the buffer has room only for 1 token, so you have to make sure that you will never unget more than two tokens. Practically, always call UnGetToken right after some GetToken.

Properties

Public property IncludeFilePaths: TStringVector read FIncludeFilePaths write SetIncludeFilePaths;

Paths to search for include files. When you assign something to this property it causes Assign(Value) call, not a real reference copy.

Public property OnMessage: TPasDocMessageEvent read FOnMessage write FOnMessage;
 
Public property Verbosity: Cardinal read FVerbosity write FVerbosity;
 
Public property SwitchOptions: TSwitchOptions read FSwitchOptions;
 
Public property HandleMacros: boolean read FHandleMacros;
 

Generated by PasDoc 0.16.0.