29 stat_line(line), buffer_name(
name), tokens()
34 stat_line(1), buffer_name(
name), tokens() {
51 return TokenList::const_iterator(
curr) ==
tokens.end();
63 }
else if(
word ==
"FALSE") {
81 value =
curr->getInteger();
92 value =
curr->getInteger();
112 if(
curr !=
tokens.end() && (*curr).isDel(s)) {
122 if(
curr !=
tokens.end() && (*curr).isKey(key)) {
134 value =
curr->getReal();
137 }
else if(
curr->isInteger()) {
138 value = double(
curr->getInteger());
150 value =
curr->getLex();
161 value =
curr->getLex();
186 while(!
atEnd() && !(*curr).isDel(
','))
191 std::ostringstream os;
194 for(TokenList::const_iterator
c =
tokens.begin();
c !=
curr; ++
c) {
195 if(white && !
c->isDel()) os <<
' ';
199 if(white && !std::next(
curr)->isDel()) os <<
' ';
201 return os.str().length() - 1;
207 for(TokenList::const_iterator
c =
tokens.begin();
c !=
tokens.end(); ++
c) {
208 if(white && !
c->isDel()) msg <<
' ';
222 if(TokenList::const_iterator(
curr) ==
tokens.end()) {
223 msg <<
" at end of statement:" <<
endl;
225 msg <<
" before token \"" << *
curr <<
"\":" <<
endl;
233 std::ostringstream
str;
Inform & endl(Inform &inf)
constexpr double c
The velocity of light in m/s.
Statement(const std::string &name, int line)
Constructor.
Token & getCurrent()
Return current token and skip it.
void append(const Token &)
Append a token.
std::list< Token > TokenList
The type of the enclosed token list.
unsigned int position() const
Return current character number in line.
void restore()
Return to marked position.
virtual void printWhere(Inform &msg, bool withToken) const
Print position.
bool keyword(const char *s)
Test for keyword.
void mark()
Mark position in command.
bool integer(int &value)
Return signed integer.
bool word(std::string &value)
Return word value.
bool boolean(bool &value)
Return boolean value.
bool real(double &value)
Return real value.
virtual void print(std::ostream &os) const
Print statement.
bool atEnd() const
Test for end of command.
bool delimiter(char c)
Test for delimiter.
void start()
Return to start.
Representation of a single input token.