class
Statement
(Return to index)
Interface for statements.
The statement is stored as a list of Token's.
Type: |
Abstract |
Include file: |
./Parser/Statement.hh |
Inheritance
Synopsis (including inherited members):
- Public members:
- Protected Members:
-
int stat_line
;
-
string buffer_name
;
-
TokenList tokens
;
-
TokenList::iterator curr
;
-
TokenList::iterator keep
;
Documentation:
- Public members:
-
Statement
(const string&,int)
;
- Constructor.
Store the stream name and the line where the statement begins.
-
Statement
(const string&,TokenList&)
;
- Constructor.
Stores a name (e.g. for a macro) and the token list.
-
typedef std::list<Token> TokenList
;
- The type of the enclosed token list.
-
void append
(const Token&)
;
- Append a token.
-
bool atEnd
()const
;
- Test for end of command.
This method is called by the parser in order to find out wether
the end of the statement has been reached.
-
bool boolean
(bool&)
;
- Return boolean value.
If the next item is a boolean literal:
- Set valu" to its value.
- Skip the value in the token list.
- Return true.
Otherwise return false.
-
bool delimiter
(char)
;
- Test for delimiter.
If the next item is the given character,
skip it and return true, otherwise return false.
-
bool delimiter
(const char*)
;
- Test for delimiter choice.
If the next item is one of the characters in the given string,
skip it and return true, otherwise return false.
-
virtual void execute
(const Parser&)
= 0
;
- Execute.
This method must be specially defined in conditional or loop
statements. Normally it just calls the parser to execute the
statement.
-
Token& getCurrent
()
;
- Return current token and skip it.
-
bool integer
(int&)
;
- Return signed integer.
If the next item is an integer:
- Set value to its value.
- Skip the value in the token list.
- Return true.
Otherwise return false.
-
bool integer
(unsigned&)
;
- Return unsigned integer.
If the next item is an integer:
- Set value to its value.
- Skip the value in the token list.
- Return true.
Otherwise return false.
-
bool keyword
(const char*)
;
- Test for keyword.
If the next item is the keyword s, skip it and return true,
otherwise return false.
-
void mark
()
;
- Mark position in command.
Parsing can later be resumed by calling restore().
-
virtual void print
(std::ostream&)const
;
- Print statement.
Print the statement on os.
-
virtual void printWhere
(std::ostream&,bool)const
;
- Print position.
Print a message, containing the stream name and its line in the input
stream. If withToken is true, print also the last token parsed.
-
bool real
(double&)
;
- Return real value.
If the next item is a real number:
- Set value to its value.
- Skip the value in the token list.
- Return true.
Otherwise return false.
-
void restore
()
;
- Return to marked position.
Resume parsing at the position wher mark() was last called.
-
void skip
()
;
- Skip.
Skip tokens up to next comma or end of statement, whichever comes first.
-
void start
()
;
- Return to start.
Resume parsing at the beginning of the statement.
-
bool str
(string&)
;
- Return string value.
If the next item is a string literal:
- Set value to its value.
- Skip the value in the token list.
- Return true.
Otherwise return false.
-
bool word
(string&)
;
- Return word value.
If the next item is a word:
- Set value to its value.
- Skip the value in the token list.
- Return true.
Otherwise return false.
- Protected members:
Documentation generated by fci on Mon Feb 7 11:41:53 2000