36 "This object defines a beamline list with arguments.\n"
53 "You cannot use this object without attributes.");
65 throw ParseError(
"LineTemplate::makeInstance()",
66 "Inconsistent number of macro arguments.");
73 while(! token.
isEOF()) {
76 std::string word = token.
getWord();
78 for(std::vector<std::string>::size_type i = 0;
81 std::vector<Token> act =
actuals[i];
90 if(! found) expansion.
append(token);
99 instance->
parse(expansion);
117 bool isLine = statement.
keyword(
"LINE");
122 if(token.
isDel(
'=')) {
125 while(! statement.
atEnd()) {
127 if(token.
isDel(
'(')) {
129 }
else if(token.
isDel(
')')) {
131 if(--level == 0)
break;
136 throw ParseError(
"LineTemplate::parseTemplate()",
137 "Equals sign '=' expected.");
The base class for all OPAL objects.
const std::string & getOpalName() const
Return object name.
void copyAttributes(const Object &)
Copy attributes from another object.
Object * find(const std::string &name)
Find entry.
static OpalData * getInstance()
Interface for abstract language parser.
A simple input statement in token form.
Interface for statements.
Token & getCurrent()
Return current token and skip it.
void append(const Token &)
Append a token.
bool keyword(const char *s)
Test for keyword.
bool atEnd() const
Test for end of command.
void start()
Return to start.
Representation of a single input token.
bool isDel(char del) const
Test for delimiter.
bool isWord() const
Test for word.
bool isEOF() const
Test for end of file.
std::string getWord() const
Return word value.
Abstract interface for a stream of input tokens.
virtual void parse(Statement &stat)
Parse the line object.
virtual Line * clone(const std::string &name)
Make clone.
void parseTemplate(TokenStream &is, Statement &stat)
Parse the line template.
virtual Object * makeInstance(const std::string &name, Statement &stat, const Parser *)
Make line instance.
virtual LineTemplate * clone(const std::string &name)
Make clone.
virtual Object * makeTemplate(const std::string &, TokenStream &, Statement &)
Make a line template.
Abstract base class for macros.
virtual void parseFormals(Statement &)
Parse formal arguments.
std::vector< std::string > formals
The formal argument list.
std::vector< std::vector< Token > > actuals
The actual argument list.
virtual void parseActuals(Statement &)
Parse actual arguments.
void append(Token &)
Append a token to the stream.
void start()
Reset stream to start.
virtual Token readToken()
Read a token from the stream.