Go to the documentation of this file.
58 Scanner(
const string& formatName, FILE* in);
74 void expect(
char expected);
78 void expect(
char a,
char b);
82 void expect(
const char* str);
141 bool peek(
char character);
193 if (!isalpha(
peek()))
197 str +=
static_cast<char>(
getChar());
198 }
while (isalnum(
peek()) ||
peek() ==
'_');
212 return peek() == EOF;
227 if (got != a && got != b)
259 return isalpha(
peek());
264 return peek() == character;
268 while (isspace(
peek()))
void readInteger(mpz_class &integer)
Read an arbitrary-precision integer.
unsigned long _lineNumber
void expectEOF()
Require that there is no more input.
This class offers an input interface which is more convenient and for some purposes more efficient th...
void expect(const string &str)
Require the following characters to be equal to str.
auto_ptr< IOHandler > createIOHandler() const
void errorReadIdentifier()
void errorExpectTwo(char a, char b, int got)
void reportErrorUnexpectedToken(const string &expected, int got)
size_t readVariable(const VarNames &names)
Reads an identifier and returns the index of that identifier as the index of a variable in names.
int peek()
Returns the next character or EOF.
void parseInteger(mpz_class &integer, size_t size)
bool match(char c)
Return true if the next character is c, and in that case skip past it.
unsigned int getLineNumber() const
Returns the number of newlines seen.
const char * readIdentifier()
The returned string is only valid until the next method on this object gets called.
size_t readIntegerStringNoSign()
Returns the size of the string.
void readIntegerAndNegativeAsZero(mpz_class &integer)
Read an integer and set it to zero if it is negative.
static const size_t invalidIndex
Returns a fixed variable offset that is always invalid.
void errorReadVariable(const char *name)
void errorExpectOne(char expected, int got)
bool matchEOF()
Return true if no more input.
vector< char >::iterator _bufferPos
size_t getIndex(const string &name) const
Returns VarNames::invalidIndex() if name is not known.
bool peekWhite()
Returns true if the next character is whitespace.
void expect(char expected)
Require the next character to be equal to expected.
Scanner(const string &formatName, FILE *in)
Construct a Scanner object.
void expectIntegerNoSign()
Read an arbitrary-precision integer.
void readSizeT(size_t &size)
Reads a size_t, where the representable range of that type determines when the number is too big.
An IOHandler implements input and output for some format in such a way that client code does not need...
size_t _tmpStringCapacity
void eatWhite()
Reads past any whitespace, where whitespace is defined by the standard function isspace().
bool peekIdentifier()
Skips whitespace and returns true if the next token is an identifier.
Defines the variables of a polynomial ring and facilities IO involving them.
void readIntegerNoSign(string &str)
Read an arbitrary-precision integer.
size_t readIntegerString()
Returns the size of the string.
const string & getFormat() const
void setFormat(const string &format)