#include <ObjectFile.h>
Collaboration diagram for ObjectFile:

Public Methods | |
| ObjectFile () | |
| Default constructor. | |
| ObjectFile (const string &name) | |
| Constructs and opens an ObjectFile. | |
| void | open (const string &name) |
| Opens a new file. More... | |
| bool | eof () |
| True iff end of file has been reached. | |
| void | error (const string errorString) |
| Reports an error. More... | |
| void | warning (const string errorString) |
| Reports a warning. More... | |
| void | unexpected (const Token &t) |
| Reports that Token t was unexpected. More... | |
| void | next (Token &token) |
| Reads the next Token. More... | |
| void | check (TokenId type, const Token &token) |
| Checks that token if of type 'type' xor report an error. More... | |
| Token & | peek () |
| Peek one token ahead. More... | |
| Token | accept (TokenId type) |
| Accept and return a token of type 'type'. More... | |
Static Public Methods | |
| TokenId | findKeyword (const string &keyword) |
| Find and return the Token id of 'keyword'. More... | |
| TokenId | declareKeyword (const string &keyword) |
| Declares a new keyword. More... | |
Protected Methods | |
| void | readToken (Token &token) |
| Reads a single token from file. More... | |
| void | push (const string &name) |
| Push the file include stack. More... | |
| void | pop () |
| Pops the file include stack. More... | |
| void | getChar () |
| Read the next character. More... | |
| void | skipSpaces () |
| Skips all spaces, tabs and newlines. More... | |
Protected Attributes | |
| stack< TextFile > | file |
| Stack of included files. More... | |
| Token | peekToken |
| The token that was peeked. | |
| bool | peeked |
| True iff a token was peeked. | |
| int | ch |
| Next character. | |
Static Protected Attributes | |
| TokenId | lastToken = lastsym |
| TokenId of the first un-declared token. | |
| map< string, TokenId > | keywordTable |
| Keyword to TokenId table. | |
Related Functions | |
| (Note that these are not member functions.) | |
| ObjectFile & | operator>> (ObjectFile &f, Token &token) |
| Reads a token from ObjectFile. More... | |
| ObjectFile & | operator>> (ObjectFile &f, const TokenId token) |
| Checks a token read ObjectFile. More... | |
The ObjectFile implements a lexical scanner on TextFile. Textfiles may contain include directives.
|
|
Accept and return a token of type 'type'.
|
|
||||||||||||
|
Checks that token if of type 'type' xor report an error.
|
|
|
Declares a new keyword.
|
|
|
Reports an error.
|
|
|
Find and return the Token id of 'keyword'.
|
|
|
Read the next character.
|
|
|
Reads the next Token.
|
|
|
Opens a new file.
|
|
|
Peek one token ahead.
|
|
|
Pops the file include stack.
|
|
|
Push the file include stack.
|
|
|
Reads a single token from file.
|
|
|
Skips all spaces, tabs and newlines.
|
|
|
Reports that Token t was unexpected.
|
|
|
Reports a warning.
|
|
||||||||||||
|
Checks a token read ObjectFile.
|
|
||||||||||||
|
Reads a token from ObjectFile.
|
|
|
Stack of included files. Current file is on top. |