SourceText Class Reference
A smart class to hold the text for parsing.
More...
#include <parser.h>
List of all members.
Detailed Description
A smart class to hold the text for parsing.
A variable of this class can hold not only the text of the ARTS Control file, but also a position in the text. This is handy for parsing. There is also a function to return the current character and functions to advance the position. (AdvanceChar advances the position to the next character, doing a line break if necessary; AdvanceLine goes to the next line.)
mLine and mColumn are 0 based, but Line and Column are 1 based.
- Author:
- Stefan Buehler
Definition at line 74 of file parser.h.
Constructor & Destructor Documentation
SourceText::SourceText |
( |
|
) |
[inline] |
Default constructor.
Definition at line 78 of file parser.h.
Member Function Documentation
void SourceText::AppendFile |
( |
const String & |
name |
) |
|
char SourceText::Current |
( |
|
) |
[inline] |
Return the current character.
Definition at line 85 of file parser.h.
void SourceText::AdvanceChar |
( |
|
) |
|
Advance position pointer by one character.
Sets mLineBreak if a line break occured.
- Exceptions:
-
| Eot | The end of text is reached. |
Definition at line 36 of file parser.cc.
void SourceText::AdvanceLine |
( |
|
) |
|
Advances position pointer by one line.
- Exceptions:
-
| Eot | The end of the text is reached. |
Definition at line 65 of file parser.cc.
const String & SourceText::File |
( |
|
) |
|
Return the filename associated with the current position.
Definition at line 87 of file parser.cc.
Index SourceText::Line |
( |
|
) |
|
Return the line number, but for the file that is associated with the current position.
Definition at line 102 of file parser.cc.
Index SourceText::Column |
( |
|
) |
[inline] |
Return the current column.
Definition at line 108 of file parser.h.
void SourceText::Init |
( |
|
) |
|
This sets the pointer to the first existing character in the text.
(First few lines could be empty).
Definition at line 117 of file parser.cc.
bool& SourceText::LineBreak |
( |
|
) |
[inline] |
Read the line break flag.
Set this to false before an operation that you want to monitor and check it afterwards.
Definition at line 116 of file parser.h.
bool SourceText::LineBreak |
( |
|
) |
const [inline] |
Friends And Related Function Documentation
ostream& operator<< |
( |
ostream & |
os, |
|
|
const SourceText & |
text | |
|
) |
| | [friend] |
Member Data Documentation
Line position in the text.
(0 based!)
Definition at line 131 of file parser.h.
Column position in the text.
(0 based!)
Definition at line 134 of file parser.h.
Remember where which source file starts.
Definition at line 137 of file parser.h.
Is set to true if the last operation caused a line break.
Has to be cleared explicitly!
Definition at line 144 of file parser.h.
The documentation for this class was generated from the following files: