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
including other files
define / undefine symbols
processes conditional directives
handles FPC macros (when HandleMacros is true).
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
- TObject
- TScanner
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. | |
| Protected | procedure DoMessage(const AVerbosity: Cardinal; const MessageType: TPasDocMessageType; const AMessage: string; const AArguments: array of const); |
|
This item has no description. | |
| 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. | |
| Public | destructor Destroy; override; |
|
This item has no description. | |
| 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; |
|
This item has no description. | |
| 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; |
|
This item has no description. | |
| Public | property Verbosity: Cardinal read FVerbosity write FVerbosity; |
|
This item has no description. | |
| Public | property SwitchOptions: TSwitchOptions read FSwitchOptions; |
|
This item has no description. | |
| Public | property HandleMacros: boolean read FHandleMacros; |
|
This item has no description. | |
Generated by PasDoc 0.17.0.snapshot.