32 "This object defines a beamline list with arguments.\n"
49 "You cannot use this object without attributes.");
61 throw ParseError(
"LineTemplate::makeInstance()",
62 "Inconsistent number of macro arguments.");
69 while(! token.
isEOF()) {
72 std::string word = token.
getWord();
74 for(std::vector<std::string>::size_type i = 0;
77 std::vector<Token> act =
actuals[i];
86 if(! found) expansion.
append(token);
92 instance = model->
clone(name);
95 instance->
parse(expansion);
113 assert(statement.
keyword(
"LINE"));
117 if(token.isDel(
'=')) {
120 while(! statement.
atEnd()) {
122 if(token.isDel(
'(')) {
124 }
else if(token.isDel(
')')) {
126 if(--level == 0)
break;
132 "Equals sign '=' expected.");
bool isEOF() const
Test for end of file.
bool keyword(const char *s)
Test for keyword.
void copyAttributes(const Object &)
Copy attributes from another object.
Abstract interface for a stream of input tokens.
virtual void parseActuals(Statement &)
Parse actual arguments.
bool isWord() const
Test for word.
bool atEnd() const
Test for end of command.
virtual Object * makeInstance(const std::string &name, Statement &stat, const Parser *)
Make line instance.
std::vector< std::vector< Token > > actuals
The actual argument list.
virtual Line * clone(const std::string &name)
Make clone.
Interface for abstract language parser.
static OpalData * getInstance()
const std::string & getOpalName() const
Return object name.
virtual Token readToken()
Read a token from the stream.
virtual void parseFormals(Statement &)
Parse formal arguments.
Interface for statements.
Representation of a single input token.
void start()
Reset stream to start.
void start()
Return to start.
void append(Token &)
Append a token to the stream.
virtual Object * makeTemplate(const std::string &, TokenStream &, Statement &)
Make a line template.
void append(const Token &)
Append a token.
void parseTemplate(TokenStream &is, Statement &stat)
Parse the line template.
Abstract base class for macros.
An ``archetype'' for a OPAL beam line with arguments.
Object * find(const std::string &name)
Find entry.
The base class for all OPAL objects.
A simple input statement in token form.
virtual void parse(Statement &stat)
Parse the line object.
Token & getCurrent()
Return current token and skip it.
virtual LineTemplate * clone(const std::string &name)
Make clone.
std::vector< std::string > formals
The formal argument list.
std::string getWord() const
Return word value.