OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
Macro.h
Go to the documentation of this file.
1#ifndef OPALX_Macro_HH
2#define OPALX_Macro_HH
3
4// ------------------------------------------------------------------------
5// $RCSfile: Macro.h,v $
6// ------------------------------------------------------------------------
7// $Revision: 1.1.1.1 $
8// ------------------------------------------------------------------------
9// Copyright: see Copyright.readme
10// ------------------------------------------------------------------------
11//
12// Class: Macro
13//
14// ------------------------------------------------------------------------
15//
16// $Date: 2000/03/27 09:33:43 $
17// $Author: Andreas Adelmann $
18//
19// ------------------------------------------------------------------------
20
21#include <vector>
23#include "OpalParser/Token.h"
24
25class Statement;
26class TokenStream;
27
28// Class Macro
29// ------------------------------------------------------------------------
31// The base class for storing the ``archetype'' for all macro-like commands.
32
33class Macro : public Object {
34public:
36 Macro(int size, const char* name, const char* help);
37
39 Macro(const std::string& name, Object* parent);
40
41 virtual ~Macro();
42
44 // Throw ParseError, since for macro we must make a template and not
45 // a clone.
46 virtual Macro* clone(const std::string& name);
47
49 // Return the string "MACRO".
50 virtual const std::string getCategory() const;
51
53 // If true, the object's execute() function should be traced.
54 // Always false for macros.
55 virtual bool shouldTrace() const;
56
58 // If true, the data structure should be updated before calling execute().
59 // Always false for macros.
60 virtual bool shouldUpdate() const;
61
63 // Expects parse pointer in the statement to be set on the first argument.
64 virtual void parseActuals(Statement&);
65
67 // Expects parse pointer in the statement to be set on the first argument.
68 virtual void parseFormals(Statement&);
69
70protected:
72 // Each formal argument is represented as a name and stored as a string.
73 std::vector<std::string> formals;
74
76 // Each actual argument is stored as a vector of tokens.
77 std::vector<std::vector<Token> > actuals;
78
79private:
80 // Not implemented.
82 Macro(const Macro&);
83 void operator=(const Macro&);
84};
85
86#endif // OPALX_Macro_HH
Abstract base class for macros.
Definition Macro.h:33
std::vector< std::vector< Token > > actuals
The actual argument list.
Definition Macro.h:77
virtual const std::string getCategory() const
Return the object category as a string.
Definition Macro.cpp:41
virtual Macro * clone(const std::string &name)
Make clone.
Definition Macro.cpp:35
virtual bool shouldUpdate() const
Update flag.
Definition Macro.cpp:45
virtual ~Macro()
Definition Macro.cpp:33
void operator=(const Macro &)
Macro(const Macro &)
virtual void parseFormals(Statement &)
Parse formal arguments.
Definition Macro.cpp:82
std::vector< std::string > formals
The formal argument list.
Definition Macro.h:73
virtual void parseActuals(Statement &)
Parse actual arguments.
Definition Macro.cpp:47
virtual bool shouldTrace() const
Trace flag.
Definition Macro.cpp:43
The base class for all OPAL objects.
Definition Object.h:45
Interface for statements.
Definition Statement.h:37
Abstract interface for a stream of input tokens.
Definition TokenStream.h:30