ADT
ast-experimental
Last change
on this file since 34ed17b was 60a8062, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago |
rewrite most of OperatorTable and change caller modules to use new interface
|
-
Property mode
set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | //
|
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
|
---|
3 | //
|
---|
4 | // The contents of this file are covered under the licence agreement in the
|
---|
5 | // file "LICENCE" distributed with Cforall.
|
---|
6 | //
|
---|
7 | // OperatorTable.h --
|
---|
8 | //
|
---|
9 | // Author : Richard C. Bilson
|
---|
10 | // Created On : Mon May 18 07:44:20 2015
|
---|
11 | // Last Modified By : Peter A. Buhr
|
---|
12 | // Last Modified On : Sun Feb 16 08:13:34 2020
|
---|
13 | // Update Count : 26
|
---|
14 | //
|
---|
15 |
|
---|
16 | #pragma once
|
---|
17 |
|
---|
18 | #include <string>
|
---|
19 | #include <map>
|
---|
20 |
|
---|
21 | namespace CodeGen {
|
---|
22 | enum OperatorType {
|
---|
23 | OT_CTOR,
|
---|
24 | OT_DTOR,
|
---|
25 | OT_CONSTRUCTOR = OT_DTOR,
|
---|
26 | OT_PREFIXASSIGN,
|
---|
27 | OT_POSTFIXASSIGN,
|
---|
28 | OT_INFIXASSIGN,
|
---|
29 | OT_ASSIGNMENT = OT_INFIXASSIGN,
|
---|
30 | OT_CALL,
|
---|
31 | OT_PREFIX,
|
---|
32 | OT_INFIX,
|
---|
33 | OT_POSTFIX,
|
---|
34 | OT_INDEX,
|
---|
35 | OT_LABELADDRESS,
|
---|
36 | OT_CONSTANT
|
---|
37 | };
|
---|
38 |
|
---|
39 | struct OperatorInfo {
|
---|
40 | std::string inputName;
|
---|
41 | std::string symbol;
|
---|
42 | std::string outputName;
|
---|
43 | std::string friendlyName;
|
---|
44 | OperatorType type;
|
---|
45 | };
|
---|
46 |
|
---|
47 | class CodeGen {
|
---|
48 | friend const OperatorInfo * operatorLookup( const std::string & funcName );
|
---|
49 |
|
---|
50 | static const OperatorInfo tableValues[];
|
---|
51 | static std::map< std::string, OperatorInfo > table;
|
---|
52 | public:
|
---|
53 | CodeGen();
|
---|
54 | }; // CodeGen
|
---|
55 |
|
---|
56 | bool isOperator( const std::string & funcName );
|
---|
57 | const OperatorInfo * operatorLookup( const std::string & funcName );
|
---|
58 | std::string operatorFriendlyName( const std::string & funcName );
|
---|
59 |
|
---|
60 | bool isConstructor( const std::string & );
|
---|
61 | bool isDestructor( const std::string & );
|
---|
62 | bool isAssignment( const std::string & );
|
---|
63 | bool isCtorDtor( const std::string & );
|
---|
64 | bool isCtorDtorAssign( const std::string & );
|
---|
65 | } // namespace CodeGen
|
---|
66 |
|
---|
67 | // Local Variables: //
|
---|
68 | // tab-width: 4 //
|
---|
69 | // mode: c++ //
|
---|
70 | // compile-command: "make install" //
|
---|
71 | // End: //
|
---|
Note:
See
TracBrowser
for help on using the repository browser.