Classes of GRP Parser defined in psrccl.h

TprsMacro
TprsSource

TprsMacro

TObject
   |
   +------TprsMacro

Method index of TprsMacro

TprsMacro
~TprsMacro
ShowData

Methods

TprsMacro(void)

Constructor of the macro object class.

virtual ~TprsMacro(void)

Destructor of the class.

virtual void ShowData(FILE *To, char *Pre)

This method prints out values of data fields to To file and prints Pre string at teh beginning of every lines.

TprsSource

TObject
   |
   +------TprsSource

Field index of TprsSource

SourceString
Size
Eof
Macros
CharPtr

Method index of TprsSource

TprsSource
TprsSource
~TprsSource
ShowData
AddChar
ShowData
SpaceOnly
fOpen
Getc
fClose
fPrintf

Fields

char *SourceString

This field points to a string. It can be a name of a file, if the C-source element is a file name, or it can be address of the C-source string itself stored in the memory. If Size is less then zero, then this field points to a file name.

int Size

Size of allocated space to store C-source string in the memory. It is increased if needed. It this field is less than zero, then the SourceString field points to a file name not the string itself.

int Eof

Number of characters stored in SourceString (index of trailing zero of the string).

PCollection Macros

Not used yet.

char *CharPtr

This variable emulates file pointer if the source string is stored in the mamory and the object is requested for characters.

Methods

TprsSource(void)

Constructor of the source object class. It sets up the object to store source string in the memory.

TprsSource(char *FileName)

Constructor of the source object class. It is used if the source string is already stored in a file named FileName.

virtual ~TprsSource(void)

Destructor of the class.

virtual bool AddChar(char c)

This method adds character c to the source string stored by the object. It extends allocated memory area if needed. It returns FALSE if there is not enough memory to complete the operation, otherwise TRUE is returned.

virtual void ShowData(FILE *To, char *Pre)

This method prints out values of data fields to To file and prints Pre string at teh beginning of every lines.

virtual bool SpaceOnly(void);

This functions checks if the source code handled by the object contains any non-whitespace character. If there are spaces, tabulators, or newline characters only, it returns TRUE. Note that this functions does not check if the source code is a comment!

virtual FILE *fOpen(const char *mode);

Opens the source object to read characters. It opens the real file or emulates the open function if the source string is stored in the memory.

virtual char Getc(FILE *fds);

This method can be used to read one character from the source string.

virtual int fClose(FILE *fds);

Finishing read operations. If the source string stored in a real file this method closes the file else it does nothing.

virtual int fPrintf(FILE *To);

This function prints out the text handled by the object to the file specified by To parameter. If any error occures the function returns FALSE else it returns TRUE.

Back to Grapnel Compiler.