OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
TokenListArray.cpp
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2// $RCSfile: TokenListArray.cpp,v $
3// ------------------------------------------------------------------------
4// $Revision: 1.1.1.1 $
5// ------------------------------------------------------------------------
6// Copyright: see Copyright.readme
7// ------------------------------------------------------------------------
8//
9// Class TokenListArray:
10// A class used to parse a "token list array" attribute.
11//
12// ------------------------------------------------------------------------
13//
14// $Date: 2000/03/27 09:33:36 $
15// $Author: Andreas Adelmann $
16//
17// ------------------------------------------------------------------------
18
20#include <vector>
23#include "Expressions/AValue.h"
25
26using namespace Expressions;
27
28// Class TokenListArray
29// ------------------------------------------------------------------------
30
31namespace Attributes {
32
33 TokenListArray::TokenListArray(const std::string& name, const std::string& help)
34 : AttributeHandler(name, help, 0) {}
35
37
38 const std::string& TokenListArray::getType() const {
39 static const std::string type("token list array");
40 return type;
41 }
42
43 void TokenListArray::parse(Attribute& attr, Statement& stat, bool) const {
45 }
46
48 Attribute& attr, Statement& statement, bool, int index) const {
49 std::vector<std::list<Token> > array;
50
51 if (AttributeBase* base = &attr.getBase()) {
52 array = dynamic_cast<AValue<std::list<Token> >*>(base)->evaluate();
53 }
54
55 while (int(array.size()) < index) {
56 array.push_back(std::list<Token>());
57 }
58
59 array[index - 1] = Expressions::parseTokenList(statement);
61 }
62
63}; // namespace Attributes
Abstract base class for attribute values of different types.
Abstract base class for attribute parsers.
A representation of an Object attribute.
Definition Attribute.h:52
AttributeBase & getBase() const
Return reference to polymorphic value.
Definition Attribute.cpp:52
virtual void parseComponent(Attribute &, Statement &, bool, int) const
Parse a component.
virtual void parse(Attribute &, Statement &, bool) const
Parse the attribute.
virtual const std::string & getType() const
Return attribute type string `‘token list array’'.
Object attribute with a constant array value.
Definition AValue.h:35
Interface for statements.
Definition Statement.h:37
A collection of routines to construct object Attributes and retrieve.
void setTokenListArray(Attribute &attr, const std::vector< std::list< Token > > &value)
Set token list array value.
Representation objects and parsers for attribute expressions.
std::vector< std::list< Token > > parseTokenListArray(Statement &)
Parse a token list array (for LIST commands).
std::list< Token > parseTokenList(Statement &)
Parse a token list (for macro argument and the like).