[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 | |
---|
[257a8f5] | 18 | #include <iosfwd> |
---|
[461046f] | 19 | |
---|
[257a8f5] | 20 | #include "AST/Fwd.hpp" |
---|
[c92bdcc] | 21 | #include "Common/Indenter.hpp" |
---|
[461046f] | 22 | |
---|
| 23 | namespace ast { |
---|
| 24 | |
---|
[6f4b7f2] | 25 | /// Print a node with the given indenter |
---|
[461046f] | 26 | void print( std::ostream & os, const ast::Node * node, Indenter indent = {} ); |
---|
| 27 | |
---|
[6f4b7f2] | 28 | /// Print a declaration in its short form |
---|
| 29 | void printShort( std::ostream & os, const ast::Decl * node, Indenter indent = {} ); |
---|
| 30 | |
---|
[432ce7a] | 31 | /// Print a collection of items |
---|
| 32 | template< typename Coll > |
---|
| 33 | void printAll( std::ostream & os, const Coll & c, Indenter indent = {} ) { |
---|
[0351e9f] | 34 | for ( const auto & i : c ) { |
---|
| 35 | if ( ! i ) continue; |
---|
| 36 | |
---|
| 37 | os << indent; |
---|
| 38 | print( os, i, indent ); |
---|
| 39 | os << std::endl; |
---|
| 40 | } |
---|
[6f4b7f2] | 41 | } |
---|
| 42 | |
---|
[257a8f5] | 43 | /// Print each cv-qualifier used in the set, followed by a space. |
---|
| 44 | void print( std::ostream & os, CV::Qualifiers ); |
---|
| 45 | /// Print each function specifier used in the set, followed by a space. |
---|
| 46 | void print( std::ostream & os, Function::Specs ); |
---|
| 47 | /// Print each storage class used in the set, followed by a space. |
---|
| 48 | void print( std::ostream & os, Storage::Classes ); |
---|
| 49 | |
---|
[0351e9f] | 50 | } |
---|