ADTast-experimental
Last change
on this file since 1c80f20 was
0351e9f,
checked in by Andrew Beach <ajbeach@…>, 3 years ago
|
Clean-up white-space and comments in the AST/Print module.
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[461046f] | 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 | // |
---|
[0351e9f] | 7 | // Print.hpp -- Print an AST (or sub-tree) to a stream. |
---|
[461046f] | 8 | // |
---|
| 9 | // Author : Thierry Delisle |
---|
| 10 | // Created On : Tue May 21 16:20:15 2019 |
---|
| 11 | // Last Modified By : |
---|
| 12 | // Last Modified On : |
---|
| 13 | // Update Count : |
---|
| 14 | // |
---|
| 15 | |
---|
| 16 | #pragma once |
---|
| 17 | |
---|
[432ce7a] | 18 | #include <iostream> |
---|
| 19 | #include <utility> // for forward |
---|
[461046f] | 20 | |
---|
| 21 | #include "AST/Node.hpp" |
---|
| 22 | #include "Common/Indenter.h" |
---|
| 23 | |
---|
| 24 | namespace ast { |
---|
| 25 | |
---|
[6f4b7f2] | 26 | class Decl; |
---|
| 27 | |
---|
| 28 | /// Print a node with the given indenter |
---|
[461046f] | 29 | void print( std::ostream & os, const ast::Node * node, Indenter indent = {} ); |
---|
| 30 | |
---|
[6f4b7f2] | 31 | /// Print a declaration in its short form |
---|
| 32 | void printShort( std::ostream & os, const ast::Decl * node, Indenter indent = {} ); |
---|
| 33 | |
---|
[432ce7a] | 34 | /// Print a collection of items |
---|
| 35 | template< typename Coll > |
---|
| 36 | void printAll( std::ostream & os, const Coll & c, Indenter indent = {} ) { |
---|
[0351e9f] | 37 | for ( const auto & i : c ) { |
---|
| 38 | if ( ! i ) continue; |
---|
| 39 | |
---|
| 40 | os << indent; |
---|
| 41 | print( os, i, indent ); |
---|
| 42 | os << std::endl; |
---|
| 43 | } |
---|
[6f4b7f2] | 44 | } |
---|
| 45 | |
---|
[0351e9f] | 46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.