Class TScanner (unit FPScanner) |
TComponent
decralation of the main scanner component
Constructors |
known white spaces this is create constructor of the scanner.
Functions |
this is the main analysis method
this is destructor of the scanner.
the following methods are characterizing the internal state machine process a char if the state machine has the state 0 state 0 is the starting state
process a char if the state machine has the state 1.
process a char if the state machine has the state 11 in this state the state machines tries to read a comment.
process a char if the state machine has the state 13 in this state a zero is already read and it is possible that it is an integer, a real or a hex number
process a char if the state machine has the state 14 in this state a hex number is read
process a char if the state machine has the state 14 in this state a hex number is read
process a char if the state machine has the state 3.
process a char if the state machine has the state 5.
process a char if the state machine has the state 7 in this state string enclosed in ' is read
process a char if the state machine has the state 9 in this state string enclosed in " is read
get the number of read token
internal the specail char are stored in a set of char this method converts the set of char into a string
get the already read token at index Index
this method tests if a string is a keyword.
this method reads a char from the source file and adds it to the actual token text
read a new char from the input file the char #10 is used as global linefeed; MAC file has only #13 as linefeed, havn't they? Sorry! this procedure count the actual row and colum of the input file.
read the next token with a state machine
this method seems to be unnecessary, but it is very important for the correct work of TStringList in the object inspector
the user defines the special char in a string.
Properties |
Events |
Variables |
Constructors |
Public-Deklarationen
known white spaces this is create constructor of the scanner. no changes to the inherited create, only initialization of internal and external variables
Functions |
destroy the scanner component
this is the main analysis method
create the scanner component
this is destructor of the scanner. it is neccessary to free the internal dynamic data structures
actual column within source file
the following methods are characterizing the internal state machine process a char if the state machine has the state 0 state 0 is the starting state
process a char at state 0 ( start
process a char if the state machine has the state 1. in this state the state machines tries to read an identifier. an identifier consists of a leading char and any following number or char
process a char at state 9
process a char if the state machine has the state 11 in this state the state machines tries to read a comment. a comment begins with the introducing user defined comment string. the first char of the comment is already read by the state 0. it is possible that the first char of the comment string is a special char. the state machine can handle this in state 11.
process a char at state 11
process a char if the state machine has the state 13 in this state a zero is already read and it is possible that it is an integer, a real or a hex number
process a char at state 13
process a char if the state machine has the state 14 in this state a hex number is read
process a char at state 14
process a char if the state machine has the state 14 in this state a hex number is read
process a char at state 1
process a char if the state machine has the state 3. in this state a integer or a floating point number is read
process a char at state 3
process a char if the state machine has the state 5. in this state floating point number is read
process a char at state 5
process a char if the state machine has the state 7 in this state string enclosed in ' is read
process a char at state 7
process a char if the state machine has the state 9 in this state string enclosed in " is read
process a char at state 16
get the number of read token
read method for property Token
internal the specail char are stored in a set of char this method converts the set of char into a string
read method for property Count
get the already read token at index Index
read method for property SpecialChars
this method tests if a string is a keyword. the keywords are defined in the list Keywords
test if a string is a keyword
this method reads a char from the source file and adds it to the actual token text
process the available char
read a new char from the input file the char #10 is used as global linefeed; MAC file has only #13 as linefeed, havn't they? Sorry! this procedure count the actual row and colum of the input file.
read a char from file
read the next token with a state machine
read the next token
this method seems to be unnecessary, but it is very important for the correct work of TStringList in the object inspector
write method for property Keywords
the user defines the special char in a string. this string must be converted into a set of char. working with a set of char is much easier, but i do not want to implement a new property editor for die usage with the object inspector
Properties |
Published-Deklarationen
analyze the input file
number of found token
Events |
Variables |
user defined event if a new token is read
Row of the first token char
recognized token
list of read token
condition of the state machine
string that belongs to a token
next not processed char in source file
allow identifiers
detecting keywords case sensitive
allowed special chars
Private-Decarations
introducing comment chars
list of defined keywords
Column of the first token char
index for comment recognition
actual row within source file
file for lexical analysis
filename of source file