arm-ehcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 7e89526 was
7e89526,
checked in by Aaron Moss <a3moss@…>, 4 years ago
|
Add Attribute to new AST
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[7e89526] | 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 | // Attribute.hpp -- |
---|
| 8 | // |
---|
| 9 | // Author : Aaron B. Moss |
---|
| 10 | // Created On : Fri May 10 10:30:00 2019 |
---|
| 11 | // Last Modified By : Aaron B. Moss |
---|
| 12 | // Created On : Fri May 10 10:30:00 2019 |
---|
| 13 | // Update Count : 1 |
---|
| 14 | // |
---|
| 15 | |
---|
| 16 | #pragma once |
---|
| 17 | |
---|
| 18 | #include <string> |
---|
| 19 | #include <vector> |
---|
| 20 | |
---|
| 21 | #include "Node.hpp" // for ptr |
---|
| 22 | #include "Visitor.hpp" |
---|
| 23 | |
---|
| 24 | namespace ast { |
---|
| 25 | |
---|
| 26 | class Expr; |
---|
| 27 | |
---|
| 28 | class Attribute final : public Node { |
---|
| 29 | public: |
---|
| 30 | std::string name; |
---|
| 31 | std::vector<ptr<Expr>> parameters; |
---|
| 32 | |
---|
| 33 | Attribute( const std::string& name = "", std::vector<ptr<Expr>>&& params = {}) |
---|
| 34 | : name( name ), parameters( params ) {} |
---|
| 35 | |
---|
| 36 | bool empty() const { return name.empty(); } |
---|
| 37 | |
---|
| 38 | /// strip leading/trailing underscores and lowercase |
---|
| 39 | std::string normalizedName() const; |
---|
| 40 | |
---|
| 41 | /// true iff this attribute is allowed to appear attached to a function parameter |
---|
| 42 | bool isValidOnFuncParam() const; |
---|
| 43 | |
---|
| 44 | Attribute* accept( Visitor& v ) override { return v.visit( this ); } |
---|
| 45 | private: |
---|
| 46 | Attribute* clone() const override { return new Attribute{ *this }; } |
---|
| 47 | }; |
---|
| 48 | |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | // Local Variables: // |
---|
| 52 | // tab-width: 4 // |
---|
| 53 | // mode: c++ // |
---|
| 54 | // compile-command: "make install" // |
---|
| 55 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.