31 stat_line(line), buffer_name(name), tokens()
36 stat_line(1), buffer_name(name), tokens() {
53 return TokenList::const_iterator(
curr) ==
tokens.end();
65 }
else if(word ==
"FALSE") {
83 value =
curr->getInteger();
94 value =
curr->getInteger();
104 if(
curr !=
tokens.end() && (*curr).isDel(c)) {
114 if(
curr !=
tokens.end() && (*curr).isDel(s)) {
124 if(
curr !=
tokens.end() && (*curr).isKey(key)) {
136 value =
curr->getReal();
139 }
else if(
curr->isInteger()) {
140 value = double(
curr->getInteger());
152 value =
curr->getLex();
163 value =
curr->getLex();
188 while(!
atEnd() && !(*curr).isDel(
','))
193 std::ostringstream os;
196 for(TokenList::const_iterator
c =
tokens.begin();
c !=
curr; ++
c) {
197 if(white && !
c->isDel()) os <<
' ';
201 if(white && !std::next(
curr)->isDel()) os <<
' ';
203 return os.str().length() - 1;
209 for(TokenList::const_iterator
c =
tokens.begin();
c !=
tokens.end(); ++
c) {
210 if(white && !
c->isDel()) msg <<
' ';
224 if(TokenList::const_iterator(
curr) ==
tokens.end()) {
225 msg <<
" at end of statement:" <<
endl;
227 msg <<
" before token \"" << *
curr <<
"\":" <<
endl;
bool integer(int &value)
Return signed integer.
Statement(const std::string &name, int line)
Constructor.
bool keyword(const char *s)
Test for keyword.
void mark()
Mark position in command.
bool atEnd() const
Test for end of command.
void restore()
Return to marked position.
bool real(double &value)
Return real value.
bool word(std::string &value)
Return word value.
std::list< Token > TokenList
The type of the enclosed token list.
bool boolean(bool &value)
Return boolean value.
constexpr double c
The velocity of light in m/s.
Representation of a single input token.
virtual void printWhere(Inform &msg, bool withToken) const
Print position.
void start()
Return to start.
virtual void print(std::ostream &os) const
Print statement.
void append(const Token &)
Append a token.
bool str(std::string &value)
Return string value.
Token & getCurrent()
Return current token and skip it.
bool delimiter(char c)
Test for delimiter.
Inform & endl(Inform &inf)
unsigned int position() const
Return current character number in line.