Class TScanner

Unit

Declaration

type TScanner = class(TObject)

Description

Scanner for Pascal, producing tokens and interpreting conditionals

Returns tokens from a Pascal language source code input stream. Uses the PasDoc_Tokenizer unit to get tokens, processes directives that might lead to

Effectively this is a combined tokenizer and pre-processor.

Single TScanner instance scans one unit using one or more TTokenizer instances (to scan the unit and all nested include files).

Source: source/component/PasDoc_Scanner.pas (line 83).

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, AStreamAbsoluteFileName: 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);

This item has no description.

Source: source/component/PasDoc_Scanner.pas (line 157).

Protected procedure DoMessage(const AVerbosity: Cardinal; const MessageType: TPasDocMessageType; const AMessage: string; const AArguments: array of const);

This item has no description.

Source: source/component/PasDoc_Scanner.pas (line 159).

Public constructor Create( const s: TStream; const OnMessageEvent: TPasDocMessageEvent; const VerbosityLevel: Cardinal; const AStreamName, AStreamAbsoluteFileName: 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.

Source: source/component/PasDoc_Scanner.pas (line 168).

Public destructor Destroy; override;

This item has no description.

Source: source/component/PasDoc_Scanner.pas (line 174).

Public procedure AddSymbol(const Name: string);

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

Source: source/component/PasDoc_Scanner.pas (line 177).

Public procedure AddSymbols(const NewSymbols: TStringVector);

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

Source: source/component/PasDoc_Scanner.pas (line 181).

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

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

Source: source/component/PasDoc_Scanner.pas (line 184).

Public procedure ConsumeToken;

Gets next token and throws it away.

Source: source/component/PasDoc_Scanner.pas (line 187).

Public function GetToken: TToken;

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

Source: source/component/PasDoc_Scanner.pas (line 191).

Public function GetStreamInfo: string;

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

Source: source/component/PasDoc_Scanner.pas (line 195).

Public function PeekToken: TToken;

This item has no description.

Source: source/component/PasDoc_Scanner.pas (line 202).

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.

Source: source/component/PasDoc_Scanner.pas (line 210).

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.

Source: source/component/PasDoc_Scanner.pas (line 200).

Public property OnMessage: TPasDocMessageEvent read FOnMessage write FOnMessage;

This item has no description.

Source: source/component/PasDoc_Scanner.pas (line 212).

Public property Verbosity: Cardinal read FVerbosity write FVerbosity;

This item has no description.

Source: source/component/PasDoc_Scanner.pas (line 213).

Public property SwitchOptions: TSwitchOptions read FSwitchOptions;

This item has no description.

Source: source/component/PasDoc_Scanner.pas (line 214).

Public property HandleMacros: boolean read FHandleMacros;

This item has no description.

Source: source/component/PasDoc_Scanner.pas (line 216).


Generated by PasDoc 0.17.0.snapshot.