ADT
ast-experimental
|
Last change
on this file since 13f066d was 4b60b28, checked in by Andrew Beach <ajbeach@…>, 3 years ago |
|
Moved parser utility from common utility file to the parserutility file.
|
-
Property mode
set to
100644
|
|
File size:
1.1 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 | // parserutility.h -- Collected utilities for the parser.
|
|---|
| 8 | //
|
|---|
| 9 | // Author : Rodolfo G. Esteves
|
|---|
| 10 | // Created On : Sat May 16 15:31:46 2015
|
|---|
| 11 | // Last Modified By : Andrew Beach
|
|---|
| 12 | // Last Modified On : Thr Feb 16 12:34:00 2023
|
|---|
| 13 | // Update Count : 5
|
|---|
| 14 | //
|
|---|
| 15 |
|
|---|
| 16 | #pragma once
|
|---|
| 17 |
|
|---|
| 18 | class Expression;
|
|---|
| 19 |
|
|---|
| 20 | Expression *notZeroExpr( Expression *orig );
|
|---|
| 21 |
|
|---|
| 22 | template< typename T, typename U >
|
|---|
| 23 | struct maybeBuild_t {
|
|---|
| 24 | static T * doit( const U *orig ) {
|
|---|
| 25 | if ( orig ) {
|
|---|
| 26 | return orig->build();
|
|---|
| 27 | } else {
|
|---|
| 28 | return 0;
|
|---|
| 29 | }
|
|---|
| 30 | }
|
|---|
| 31 | };
|
|---|
| 32 |
|
|---|
| 33 | template< typename T, typename U >
|
|---|
| 34 | static inline T * maybeBuild( const U *orig ) {
|
|---|
| 35 | return maybeBuild_t<T,U>::doit(orig);
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | template< typename T, typename U >
|
|---|
| 39 | static inline T * maybeMoveBuild( const U *orig ) {
|
|---|
| 40 | T* ret = maybeBuild<T>(orig);
|
|---|
| 41 | delete orig;
|
|---|
| 42 | return ret;
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | // Local Variables: //
|
|---|
| 46 | // tab-width: 4 //
|
|---|
| 47 | // mode: c++ //
|
|---|
| 48 | // compile-command: "make install" //
|
|---|
| 49 | // End: //
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.