OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
MacroCmd.h
Go to the documentation of this file.
1//
2// Class MacroCmd
3//
4// This class parses the MACRO command.
5// Encapsulate the buffer for the ``archetypes'' of all macros.
6// The macro is stored as a MacroStream. For execution, first the
7// parameters are replaced, then the resulting stream is sent to the parser.
8//
9// Copyright (c) 2008 - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
10//
11// All rights reserved
12//
13// This file is part of OPAL.
14//
15// OPAL is free software: you can redistribute it and/or modify
16// it under the terms of the GNU General Public License as published by
17// the Free Software Foundation, either version 3 of the License, or
18// (at your option) any later version.
19//
20// You should have received a copy of the GNU General Public License
21// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
22//
23#ifndef OPALX_MacroCmd_HH
24#define OPALX_MacroCmd_HH
25
26#include <iosfwd>
27#include <memory>
28#include <string>
29#include "OpalParser/Macro.h"
31
32// Class MacroCmd
33// ------------------------------------------------------------------------
34
35class MacroCmd : public Macro {
36public:
37 MacroCmd();
38 MacroCmd(const std::string& name, MacroCmd* parent);
39 virtual ~MacroCmd();
40
42 virtual void execute();
43
45 // Expects parse pointer in the statement to be set on the first argument.
46 // The parser is used to determine the parse mode
47 // (normal, error, match, edit, track).
48 virtual Object* makeInstance(const std::string& name, Statement&, const Parser*);
49
51 // Expects parse pointer in the statement to be set on the first argument.
52 virtual Object* makeTemplate(const std::string&, TokenStream&, Statement&);
53
54private:
55 // Not implemented.
57 void operator=(const MacroCmd&);
58
59 // The stream of tokens representing the macro command.
60 std::shared_ptr<MacroStream> body;
61
62 // Pointer to the parser to be used in execution.
64};
65
66#endif // OPALX_MacroCmd_HH
virtual Object * makeInstance(const std::string &name, Statement &, const Parser *)
Make a macro instance.
Definition MacroCmd.cpp:51
virtual Object * makeTemplate(const std::string &, TokenStream &, Statement &)
Make a macro template.
Definition MacroCmd.cpp:91
void operator=(const MacroCmd &)
std::shared_ptr< MacroStream > body
Definition MacroCmd.h:60
const Parser * itsParser
Definition MacroCmd.h:63
virtual ~MacroCmd()
Definition MacroCmd.cpp:44
virtual void execute()
Execute the macro command.
Definition MacroCmd.cpp:46
MacroCmd(const MacroCmd &)
Abstract base class for macros.
Definition Macro.h:33
The base class for all OPAL objects.
Definition Object.h:45
Interface for abstract language parser.
Definition Parser.h:30
Interface for statements.
Definition Statement.h:37
Abstract interface for a stream of input tokens.
Definition TokenStream.h:30