ADT
ast-experimental
Last change
on this file since c86b08d was bb7422a, checked in by Andrew Beach <ajbeach@…>, 3 years ago |
Translated parser to the new ast. This incuded a small fix in the resolver so larger expressions can be used in with statements and some updated tests. errors/declaration just is a formatting update. attributes now actually preserves more attributes (unknown if all versions work).
|
-
Property mode
set to
100644
|
File size:
1.1 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 | //
|
---|
[4b60b28] | 7 | // parserutility.h -- 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
|
---|
[51b73452] | 17 |
|
---|
[bb7422a] | 18 | #include "AST/Copy.hpp" // for shallowCopy
|
---|
| 19 | namespace ast {
|
---|
| 20 | class Expr;
|
---|
| 21 | }
|
---|
[51b73452] | 22 |
|
---|
[bb7422a] | 23 | ast::Expr * notZeroExpr( ast::Expr *orig );
|
---|
[51b73452] | 24 |
|
---|
[702e826] | 25 | template< typename T >
|
---|
| 26 | static inline auto maybeBuild( const T *orig ) -> decltype(orig->build()) {
|
---|
| 27 | return (orig) ? orig->build() : nullptr;
|
---|
[4b60b28] | 28 | }
|
---|
| 29 |
|
---|
[702e826] | 30 | template< typename T >
|
---|
| 31 | static inline auto maybeMoveBuild( const T *orig ) -> decltype(orig->build()) {
|
---|
| 32 | auto ret = maybeBuild<T>(orig);
|
---|
[4b60b28] | 33 | delete orig;
|
---|
| 34 | return ret;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
[bb7422a] | 37 | template<typename node_t>
|
---|
| 38 | node_t * maybeCopy( node_t const * node ) {
|
---|
| 39 | return node ? ast::shallowCopy( node ) : nullptr;
|
---|
| 40 | }
|
---|
| 41 |
|
---|
[b87a5ed] | 42 | // Local Variables: //
|
---|
| 43 | // tab-width: 4 //
|
---|
| 44 | // mode: c++ //
|
---|
| 45 | // compile-command: "make install" //
|
---|
| 46 | // End: //
|
---|
Note:
See
TracBrowser
for help on using the repository browser.