source:
src/Parser/ParserUtility.hpp
@
2ac78a1
Last change on this file since 2ac78a1 was c92bdcc, checked in by , 6 months ago | |
---|---|
|
|
File size: 1.0 KB |
Rev | Line | |
---|---|---|
[b87a5ed] | 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 | // | |
[c92bdcc] | 7 | // ParserUtility.hpp -- Collected utilities for the parser. |
[b87a5ed] | 8 | // |
9 | // Author : Rodolfo G. Esteves | |
10 | // Created On : Sat May 16 15:31:46 2015 | |
[4b60b28] | 11 | // Last Modified By : Andrew Beach |
[bb7422a] | 12 | // Last Modified On : Tue Apr 4 14:03:00 2023 |
13 | // Update Count : 7 | |
[b87a5ed] | 14 | // |
15 | ||
[6b0b624] | 16 | #pragma once |
[51b7345] | 17 | |
[bb7422a] | 18 | #include "AST/Copy.hpp" // for shallowCopy |
[51b7345] | 19 | |
[702e826] | 20 | template< typename T > |
[6611177] | 21 | static inline auto maybeBuild( T * orig ) -> decltype(orig->build()) { |
[702e826] | 22 | return (orig) ? orig->build() : nullptr; |
[4b60b28] | 23 | } |
24 | ||
[702e826] | 25 | template< typename T > |
[6611177] | 26 | static inline auto maybeMoveBuild( T * orig ) -> decltype(orig->build()) { |
[702e826] | 27 | auto ret = maybeBuild<T>(orig); |
[4b60b28] | 28 | delete orig; |
29 | return ret; | |
30 | } | |
31 | ||
[bb7422a] | 32 | template<typename node_t> |
[5bf685f] | 33 | static inline node_t * maybeCopy( node_t const * node ) { |
[bb7422a] | 34 | return node ? ast::shallowCopy( node ) : nullptr; |
35 | } | |
36 | ||
[b87a5ed] | 37 | // Local Variables: // |
38 | // tab-width: 4 // | |
39 | // mode: c++ // | |
40 | // compile-command: "make install" // | |
41 | // End: // |
Note: See TracBrowser
for help on using the repository browser.