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