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);
96 instance = model->
clone(name);
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.");
static OpalData * getInstance()
bool isEOF() const
Test for end of file.
The base class for all OPAL objects.
virtual void parse(Statement &stat)
Parse the line object.
units but all components up to the maximum must be even if they are zero item[MAXFORDER] The order of the maximum function $f_n used in the field expansion(default:5).See the scalar magnetic potential below.This sets for example the maximum power of $z $in the field expansion of vertical component $B_z $to $2\cdot\text
void append(const Token &)
Append a token.
void copyAttributes(const Object &)
Copy attributes from another object.
void start()
Return to start.
Abstract base class for macros.
virtual Object * makeInstance(const std::string &name, Statement &stat, const Parser *)
Make line instance.
void start()
Reset stream to start.
bool atEnd() const
Test for end of command.
virtual LineTemplate * clone(const std::string &name)
Make clone.
void parseTemplate(TokenStream &is, Statement &stat)
Parse the line template.
Token & getCurrent()
Return current token and skip it.
std::string getWord() const
Return word value.
Abstract interface for a stream of input tokens.
void append(Token &)
Append a token to the stream.
virtual Token readToken()
Read a token from the stream.
Representation of a single input token.
virtual void parseActuals(Statement &)
Parse actual arguments.
Interface for statements.
virtual Line * clone(const std::string &name)
Make clone.
A simple input statement in token form.
const std::string & getOpalName() const
Return object name.
virtual void parseFormals(Statement &)
Parse formal arguments.
bool keyword(const char *s)
Test for keyword.
Object * find(const std::string &name)
Find entry.
virtual Object * makeTemplate(const std::string &, TokenStream &, Statement &)
Make a line template.
std::vector< std::string > formals
The formal argument list.
bool isDel(char del) const
Test for delimiter.
Interface for abstract language parser.
std::vector< std::vector< Token > > actuals
The actual argument list.
bool isWord() const
Test for word.