[0dd3a2f] | 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 | // |
---|
[71f4e4f] | 7 | // Visitor.h -- |
---|
[0dd3a2f] | 8 | // |
---|
| 9 | // Author : Richard C. Bilson |
---|
| 10 | // Created On : Mon May 18 07:44:20 2015 |
---|
[033ff37] | 11 | // Last Modified By : Peter A. Buhr |
---|
[3b0bc16] | 12 | // Last Modified On : Tue Feb 1 09:26:57 2022 |
---|
| 13 | // Update Count : 17 |
---|
[0dd3a2f] | 14 | // |
---|
| 15 | |
---|
[6b0b624] | 16 | #pragma once |
---|
[51b7345] | 17 | |
---|
[ea6332d] | 18 | #include "Common/SemanticError.h" // for SemanticError |
---|
| 19 | #include "SynTree.h" // for AST nodes |
---|
[51b7345] | 20 | |
---|
[d9a0e76] | 21 | class Visitor { |
---|
| 22 | protected: |
---|
[a8a2b0a] | 23 | Visitor() = default; |
---|
| 24 | virtual ~Visitor() = default; |
---|
[d9a0e76] | 25 | public: |
---|
[dba6db9] | 26 | // visit: Default implementation of all functions visits the children |
---|
[8b11840] | 27 | // of the given syntax node, but performs no other action. |
---|
[dba6db9] | 28 | |
---|
[7870799] | 29 | virtual void visit( ObjectDecl * node ) { visit( const_cast<const ObjectDecl *>(node) ); } |
---|
| 30 | virtual void visit( const ObjectDecl * objectDecl ) = 0; |
---|
| 31 | virtual void visit( FunctionDecl * node ) { visit( const_cast<const FunctionDecl *>(node) ); } |
---|
| 32 | virtual void visit( const FunctionDecl * functionDecl ) = 0; |
---|
| 33 | virtual void visit( StructDecl * node ) { visit( const_cast<const StructDecl *>(node) ); } |
---|
| 34 | virtual void visit( const StructDecl * aggregateDecl ) = 0; |
---|
| 35 | virtual void visit( UnionDecl * node ) { visit( const_cast<const UnionDecl *>(node) ); } |
---|
| 36 | virtual void visit( const UnionDecl * aggregateDecl ) = 0; |
---|
[374cb117] | 37 | virtual void visit( EnumDecl * node ) { visit( const_cast<const EnumDecl *>(node) ); } |
---|
[7870799] | 38 | virtual void visit( const EnumDecl * aggregateDecl ) = 0; |
---|
| 39 | virtual void visit( TraitDecl * node ) { visit( const_cast<const TraitDecl *>(node) ); } |
---|
| 40 | virtual void visit( const TraitDecl * aggregateDecl ) = 0; |
---|
| 41 | virtual void visit( TypeDecl * node ) { visit( const_cast<const TypeDecl *>(node) ); } |
---|
| 42 | virtual void visit( const TypeDecl * typeDecl ) = 0; |
---|
| 43 | virtual void visit( TypedefDecl * node ) { visit( const_cast<const TypedefDecl *>(node) ); } |
---|
| 44 | virtual void visit( const TypedefDecl * typeDecl ) = 0; |
---|
| 45 | virtual void visit( AsmDecl * node ) { visit( const_cast<const AsmDecl *>(node) ); } |
---|
| 46 | virtual void visit( const AsmDecl * asmDecl ) = 0; |
---|
[2d019af] | 47 | virtual void visit( DirectiveDecl * node ) { visit( const_cast<const DirectiveDecl *>(node) ); } |
---|
| 48 | virtual void visit( const DirectiveDecl * directiveDecl ) = 0; |
---|
[7870799] | 49 | virtual void visit( StaticAssertDecl * node ) { visit( const_cast<const StaticAssertDecl *>(node) ); } |
---|
| 50 | virtual void visit( const StaticAssertDecl * assertDecl ) = 0; |
---|
[71806e0] | 51 | virtual void visit( InlineMemberDecl * node ) { visit( const_cast<const InlineMemberDecl *>(node) ); } |
---|
| 52 | virtual void visit( const InlineMemberDecl * valueDecl ) = 0; |
---|
[0dd3a2f] | 53 | |
---|
[7870799] | 54 | virtual void visit( CompoundStmt * node ) { visit( const_cast<const CompoundStmt *>(node) ); } |
---|
| 55 | virtual void visit( const CompoundStmt * compoundStmt ) = 0; |
---|
| 56 | virtual void visit( ExprStmt * node ) { visit( const_cast<const ExprStmt *>(node) ); } |
---|
| 57 | virtual void visit( const ExprStmt * exprStmt ) = 0; |
---|
| 58 | virtual void visit( AsmStmt * node ) { visit( const_cast<const AsmStmt *>(node) ); } |
---|
| 59 | virtual void visit( const AsmStmt * asmStmt ) = 0; |
---|
| 60 | virtual void visit( DirectiveStmt * node ) { visit( const_cast<const DirectiveStmt *>(node) ); } |
---|
| 61 | virtual void visit( const DirectiveStmt * directiveStmt ) = 0; |
---|
| 62 | virtual void visit( IfStmt * node ) { visit( const_cast<const IfStmt *>(node) ); } |
---|
| 63 | virtual void visit( const IfStmt * ifStmt ) = 0; |
---|
[3b0bc16] | 64 | virtual void visit( WhileDoStmt * node ) { visit( const_cast<const WhileDoStmt *>(node) ); } |
---|
| 65 | virtual void visit( const WhileDoStmt * whileDoStmt ) = 0; |
---|
[7870799] | 66 | virtual void visit( ForStmt * node ) { visit( const_cast<const ForStmt *>(node) ); } |
---|
| 67 | virtual void visit( const ForStmt * forStmt ) = 0; |
---|
| 68 | virtual void visit( SwitchStmt * node ) { visit( const_cast<const SwitchStmt *>(node) ); } |
---|
| 69 | virtual void visit( const SwitchStmt * switchStmt ) = 0; |
---|
| 70 | virtual void visit( CaseStmt * node ) { visit( const_cast<const CaseStmt *>(node) ); } |
---|
| 71 | virtual void visit( const CaseStmt * caseStmt ) = 0; |
---|
| 72 | virtual void visit( BranchStmt * node ) { visit( const_cast<const BranchStmt *>(node) ); } |
---|
| 73 | virtual void visit( const BranchStmt * branchStmt ) = 0; |
---|
| 74 | virtual void visit( ReturnStmt * node ) { visit( const_cast<const ReturnStmt *>(node) ); } |
---|
| 75 | virtual void visit( const ReturnStmt * returnStmt ) = 0; |
---|
| 76 | virtual void visit( ThrowStmt * node ) { visit( const_cast<const ThrowStmt *>(node) ); } |
---|
| 77 | virtual void visit( const ThrowStmt * throwStmt ) = 0; |
---|
| 78 | virtual void visit( TryStmt * node ) { visit( const_cast<const TryStmt *>(node) ); } |
---|
| 79 | virtual void visit( const TryStmt * tryStmt ) = 0; |
---|
| 80 | virtual void visit( CatchStmt * node ) { visit( const_cast<const CatchStmt *>(node) ); } |
---|
| 81 | virtual void visit( const CatchStmt * catchStmt ) = 0; |
---|
| 82 | virtual void visit( FinallyStmt * node ) { visit( const_cast<const FinallyStmt *>(node) ); } |
---|
| 83 | virtual void visit( const FinallyStmt * finallyStmt ) = 0; |
---|
[37cdd97] | 84 | virtual void visit( SuspendStmt * node ) { visit( const_cast<const SuspendStmt *>(node) ); } |
---|
| 85 | virtual void visit( const SuspendStmt * suspendStmt ) = 0; |
---|
[7870799] | 86 | virtual void visit( WaitForStmt * node ) { visit( const_cast<const WaitForStmt *>(node) ); } |
---|
| 87 | virtual void visit( const WaitForStmt * waitforStmt ) = 0; |
---|
| 88 | virtual void visit( WithStmt * node ) { visit( const_cast<const WithStmt *>(node) ); } |
---|
| 89 | virtual void visit( const WithStmt * withStmt ) = 0; |
---|
| 90 | virtual void visit( NullStmt * node ) { visit( const_cast<const NullStmt *>(node) ); } |
---|
| 91 | virtual void visit( const NullStmt * nullStmt ) = 0; |
---|
| 92 | virtual void visit( DeclStmt * node ) { visit( const_cast<const DeclStmt *>(node) ); } |
---|
| 93 | virtual void visit( const DeclStmt * declStmt ) = 0; |
---|
| 94 | virtual void visit( ImplicitCtorDtorStmt * node ) { visit( const_cast<const ImplicitCtorDtorStmt *>(node) ); } |
---|
| 95 | virtual void visit( const ImplicitCtorDtorStmt * impCtorDtorStmt ) = 0; |
---|
[6cebfef] | 96 | virtual void visit( MutexStmt * node ) { visit( const_cast<const MutexStmt *>(node) ); } |
---|
| 97 | virtual void visit( const MutexStmt * mutexStmt ) = 0; |
---|
[0dd3a2f] | 98 | |
---|
[7870799] | 99 | virtual void visit( ApplicationExpr * node ) { visit( const_cast<const ApplicationExpr *>(node) ); } |
---|
| 100 | virtual void visit( const ApplicationExpr * applicationExpr ) = 0; |
---|
| 101 | virtual void visit( UntypedExpr * node ) { visit( const_cast<const UntypedExpr *>(node) ); } |
---|
| 102 | virtual void visit( const UntypedExpr * untypedExpr ) = 0; |
---|
| 103 | virtual void visit( NameExpr * node ) { visit( const_cast<const NameExpr *>(node) ); } |
---|
| 104 | virtual void visit( const NameExpr * nameExpr ) = 0; |
---|
[b0d9ff7] | 105 | virtual void visit( QualifiedNameExpr * node ) { visit( const_cast<const QualifiedNameExpr*>(node) );} |
---|
| 106 | virtual void visit( const QualifiedNameExpr* qualifiednameExpr ) = 0; |
---|
[7870799] | 107 | virtual void visit( CastExpr * node ) { visit( const_cast<const CastExpr *>(node) ); } |
---|
| 108 | virtual void visit( const CastExpr * castExpr ) = 0; |
---|
| 109 | virtual void visit( KeywordCastExpr * node ) { visit( const_cast<const KeywordCastExpr *>(node) ); } |
---|
| 110 | virtual void visit( const KeywordCastExpr * castExpr ) = 0; |
---|
| 111 | virtual void visit( VirtualCastExpr * node ) { visit( const_cast<const VirtualCastExpr *>(node) ); } |
---|
| 112 | virtual void visit( const VirtualCastExpr * castExpr ) = 0; |
---|
| 113 | virtual void visit( AddressExpr * node ) { visit( const_cast<const AddressExpr *>(node) ); } |
---|
| 114 | virtual void visit( const AddressExpr * addressExpr ) = 0; |
---|
| 115 | virtual void visit( LabelAddressExpr * node ) { visit( const_cast<const LabelAddressExpr *>(node) ); } |
---|
| 116 | virtual void visit( const LabelAddressExpr * labAddressExpr ) = 0; |
---|
| 117 | virtual void visit( UntypedMemberExpr * node ) { visit( const_cast<const UntypedMemberExpr *>(node) ); } |
---|
| 118 | virtual void visit( const UntypedMemberExpr * memberExpr ) = 0; |
---|
| 119 | virtual void visit( MemberExpr * node ) { visit( const_cast<const MemberExpr *>(node) ); } |
---|
| 120 | virtual void visit( const MemberExpr * memberExpr ) = 0; |
---|
| 121 | virtual void visit( VariableExpr * node ) { visit( const_cast<const VariableExpr *>(node) ); } |
---|
| 122 | virtual void visit( const VariableExpr * variableExpr ) = 0; |
---|
| 123 | virtual void visit( ConstantExpr * node ) { visit( const_cast<const ConstantExpr *>(node) ); } |
---|
| 124 | virtual void visit( const ConstantExpr * constantExpr ) = 0; |
---|
| 125 | virtual void visit( SizeofExpr * node ) { visit( const_cast<const SizeofExpr *>(node) ); } |
---|
| 126 | virtual void visit( const SizeofExpr * sizeofExpr ) = 0; |
---|
| 127 | virtual void visit( AlignofExpr * node ) { visit( const_cast<const AlignofExpr *>(node) ); } |
---|
| 128 | virtual void visit( const AlignofExpr * alignofExpr ) = 0; |
---|
| 129 | virtual void visit( UntypedOffsetofExpr * node ) { visit( const_cast<const UntypedOffsetofExpr *>(node) ); } |
---|
| 130 | virtual void visit( const UntypedOffsetofExpr * offsetofExpr ) = 0; |
---|
| 131 | virtual void visit( OffsetofExpr * node ) { visit( const_cast<const OffsetofExpr *>(node) ); } |
---|
| 132 | virtual void visit( const OffsetofExpr * offsetofExpr ) = 0; |
---|
| 133 | virtual void visit( OffsetPackExpr * node ) { visit( const_cast<const OffsetPackExpr *>(node) ); } |
---|
| 134 | virtual void visit( const OffsetPackExpr * offsetPackExpr ) = 0; |
---|
| 135 | virtual void visit( LogicalExpr * node ) { visit( const_cast<const LogicalExpr *>(node) ); } |
---|
| 136 | virtual void visit( const LogicalExpr * logicalExpr ) = 0; |
---|
| 137 | virtual void visit( ConditionalExpr * node ) { visit( const_cast<const ConditionalExpr *>(node) ); } |
---|
| 138 | virtual void visit( const ConditionalExpr * conditionalExpr ) = 0; |
---|
| 139 | virtual void visit( CommaExpr * node ) { visit( const_cast<const CommaExpr *>(node) ); } |
---|
| 140 | virtual void visit( const CommaExpr * commaExpr ) = 0; |
---|
| 141 | virtual void visit( TypeExpr * node ) { visit( const_cast<const TypeExpr *>(node) ); } |
---|
| 142 | virtual void visit( const TypeExpr * typeExpr ) = 0; |
---|
[6e50a6b] | 143 | virtual void visit( DimensionExpr * node ) { visit( const_cast<const DimensionExpr *>(node) ); } |
---|
| 144 | virtual void visit( const DimensionExpr * typeExpr ) = 0; |
---|
[7870799] | 145 | virtual void visit( AsmExpr * node ) { visit( const_cast<const AsmExpr *>(node) ); } |
---|
| 146 | virtual void visit( const AsmExpr * asmExpr ) = 0; |
---|
| 147 | virtual void visit( ImplicitCopyCtorExpr * node ) { visit( const_cast<const ImplicitCopyCtorExpr *>(node) ); } |
---|
| 148 | virtual void visit( const ImplicitCopyCtorExpr * impCpCtorExpr ) = 0; |
---|
| 149 | virtual void visit( ConstructorExpr * node ) { visit( const_cast<const ConstructorExpr *>(node) ); } |
---|
| 150 | virtual void visit( const ConstructorExpr * ctorExpr ) = 0; |
---|
| 151 | virtual void visit( CompoundLiteralExpr * node ) { visit( const_cast<const CompoundLiteralExpr *>(node) ); } |
---|
| 152 | virtual void visit( const CompoundLiteralExpr * compLitExpr ) = 0; |
---|
| 153 | virtual void visit( RangeExpr * node ) { visit( const_cast<const RangeExpr *>(node) ); } |
---|
| 154 | virtual void visit( const RangeExpr * rangeExpr ) = 0; |
---|
| 155 | virtual void visit( UntypedTupleExpr * node ) { visit( const_cast<const UntypedTupleExpr *>(node) ); } |
---|
| 156 | virtual void visit( const UntypedTupleExpr * tupleExpr ) = 0; |
---|
| 157 | virtual void visit( TupleExpr * node ) { visit( const_cast<const TupleExpr *>(node) ); } |
---|
| 158 | virtual void visit( const TupleExpr * tupleExpr ) = 0; |
---|
| 159 | virtual void visit( TupleIndexExpr * node ) { visit( const_cast<const TupleIndexExpr *>(node) ); } |
---|
| 160 | virtual void visit( const TupleIndexExpr * tupleExpr ) = 0; |
---|
| 161 | virtual void visit( TupleAssignExpr * node ) { visit( const_cast<const TupleAssignExpr *>(node) ); } |
---|
| 162 | virtual void visit( const TupleAssignExpr * assignExpr ) = 0; |
---|
| 163 | virtual void visit( StmtExpr * node ) { visit( const_cast<const StmtExpr *>(node) ); } |
---|
| 164 | virtual void visit( const StmtExpr * stmtExpr ) = 0; |
---|
| 165 | virtual void visit( UniqueExpr * node ) { visit( const_cast<const UniqueExpr *>(node) ); } |
---|
| 166 | virtual void visit( const UniqueExpr * uniqueExpr ) = 0; |
---|
| 167 | virtual void visit( UntypedInitExpr * node ) { visit( const_cast<const UntypedInitExpr *>(node) ); } |
---|
| 168 | virtual void visit( const UntypedInitExpr * initExpr ) = 0; |
---|
| 169 | virtual void visit( InitExpr * node ) { visit( const_cast<const InitExpr *>(node) ); } |
---|
| 170 | virtual void visit( const InitExpr * initExpr ) = 0; |
---|
| 171 | virtual void visit( DeletedExpr * node ) { visit( const_cast<const DeletedExpr *>(node) ); } |
---|
| 172 | virtual void visit( const DeletedExpr * delExpr ) = 0; |
---|
| 173 | virtual void visit( DefaultArgExpr * node ) { visit( const_cast<const DefaultArgExpr *>(node) ); } |
---|
| 174 | virtual void visit( const DefaultArgExpr * argExpr ) = 0; |
---|
| 175 | virtual void visit( GenericExpr * node ) { visit( const_cast<const GenericExpr *>(node) ); } |
---|
| 176 | virtual void visit( const GenericExpr * genExpr ) = 0; |
---|
[0dd3a2f] | 177 | |
---|
[7870799] | 178 | virtual void visit( VoidType * node ) { visit( const_cast<const VoidType *>(node) ); } |
---|
| 179 | virtual void visit( const VoidType * basicType ) = 0; |
---|
| 180 | virtual void visit( BasicType * node ) { visit( const_cast<const BasicType *>(node) ); } |
---|
| 181 | virtual void visit( const BasicType * basicType ) = 0; |
---|
| 182 | virtual void visit( PointerType * node ) { visit( const_cast<const PointerType *>(node) ); } |
---|
| 183 | virtual void visit( const PointerType * pointerType ) = 0; |
---|
| 184 | virtual void visit( ArrayType * node ) { visit( const_cast<const ArrayType *>(node) ); } |
---|
| 185 | virtual void visit( const ArrayType * arrayType ) = 0; |
---|
| 186 | virtual void visit( ReferenceType * node ) { visit( const_cast<const ReferenceType *>(node) ); } |
---|
| 187 | virtual void visit( const ReferenceType * refType ) = 0; |
---|
| 188 | virtual void visit( QualifiedType * node ) { visit( const_cast<const QualifiedType *>(node) ); } |
---|
| 189 | virtual void visit( const QualifiedType * qualType ) = 0; |
---|
| 190 | virtual void visit( FunctionType * node ) { visit( const_cast<const FunctionType *>(node) ); } |
---|
| 191 | virtual void visit( const FunctionType * functionType ) = 0; |
---|
| 192 | virtual void visit( StructInstType * node ) { visit( const_cast<const StructInstType *>(node) ); } |
---|
| 193 | virtual void visit( const StructInstType * aggregateUseType ) = 0; |
---|
| 194 | virtual void visit( UnionInstType * node ) { visit( const_cast<const UnionInstType *>(node) ); } |
---|
| 195 | virtual void visit( const UnionInstType * aggregateUseType ) = 0; |
---|
[374cb117] | 196 | virtual void visit( EnumInstType * node ) { visit( const_cast<const EnumInstType *>(node) ); } |
---|
[7870799] | 197 | virtual void visit( const EnumInstType * aggregateUseType ) = 0; |
---|
| 198 | virtual void visit( TraitInstType * node ) { visit( const_cast<const TraitInstType *>(node) ); } |
---|
| 199 | virtual void visit( const TraitInstType * aggregateUseType ) = 0; |
---|
| 200 | virtual void visit( TypeInstType * node ) { visit( const_cast<const TypeInstType *>(node) ); } |
---|
| 201 | virtual void visit( const TypeInstType * aggregateUseType ) = 0; |
---|
| 202 | virtual void visit( TupleType * node ) { visit( const_cast<const TupleType *>(node) ); } |
---|
| 203 | virtual void visit( const TupleType * tupleType ) = 0; |
---|
| 204 | virtual void visit( TypeofType * node ) { visit( const_cast<const TypeofType *>(node) ); } |
---|
| 205 | virtual void visit( const TypeofType * typeofType ) = 0; |
---|
[7ff35e0e] | 206 | virtual void visit( VTableType * node ) { visit( const_cast<const VTableType *>(node) ); } |
---|
| 207 | virtual void visit( const VTableType * vtableType ) = 0; |
---|
[7870799] | 208 | virtual void visit( AttrType * node ) { visit( const_cast<const AttrType *>(node) ); } |
---|
| 209 | virtual void visit( const AttrType * attrType ) = 0; |
---|
| 210 | virtual void visit( VarArgsType * node ) { visit( const_cast<const VarArgsType *>(node) ); } |
---|
| 211 | virtual void visit( const VarArgsType * varArgsType ) = 0; |
---|
| 212 | virtual void visit( ZeroType * node ) { visit( const_cast<const ZeroType *>(node) ); } |
---|
| 213 | virtual void visit( const ZeroType * zeroType ) = 0; |
---|
| 214 | virtual void visit( OneType * node ) { visit( const_cast<const OneType *>(node) ); } |
---|
| 215 | virtual void visit( const OneType * oneType ) = 0; |
---|
| 216 | virtual void visit( GlobalScopeType * node ) { visit( const_cast<const GlobalScopeType *>(node) ); } |
---|
| 217 | virtual void visit( const GlobalScopeType * globalType ) = 0; |
---|
[0dd3a2f] | 218 | |
---|
[7870799] | 219 | virtual void visit( Designation * node ) { visit( const_cast<const Designation *>(node) ); } |
---|
| 220 | virtual void visit( const Designation * designation ) = 0; |
---|
| 221 | virtual void visit( SingleInit * node ) { visit( const_cast<const SingleInit *>(node) ); } |
---|
| 222 | virtual void visit( const SingleInit * singleInit ) = 0; |
---|
| 223 | virtual void visit( ListInit * node ) { visit( const_cast<const ListInit *>(node) ); } |
---|
| 224 | virtual void visit( const ListInit * listInit ) = 0; |
---|
| 225 | virtual void visit( ConstructorInit * node ) { visit( const_cast<const ConstructorInit *>(node) ); } |
---|
| 226 | virtual void visit( const ConstructorInit * ctorInit ) = 0; |
---|
[0dd3a2f] | 227 | |
---|
[7870799] | 228 | virtual void visit( Constant * node ) { visit( const_cast<const Constant *>(node) ); } |
---|
| 229 | virtual void visit( const Constant * constant ) = 0; |
---|
[5ea7a22] | 230 | |
---|
[7870799] | 231 | virtual void visit( Attribute * node ) { visit( const_cast<const Attribute *>(node) ); } |
---|
| 232 | virtual void visit( const Attribute * attribute ) = 0; |
---|
[51b7345] | 233 | }; |
---|
| 234 | |
---|
| 235 | template< typename TreeType, typename VisitorType > |
---|
[6f096d2] | 236 | inline void maybeAccept( TreeType * tree, VisitorType & visitor ) { |
---|
[0dd3a2f] | 237 | if ( tree ) { |
---|
| 238 | tree->accept( visitor ); |
---|
| 239 | } |
---|
[51b7345] | 240 | } |
---|
| 241 | |
---|
[6f096d2] | 242 | template< typename TreeType, typename VisitorType > |
---|
| 243 | inline void maybeAccept( const TreeType * tree, VisitorType & visitor ) { |
---|
| 244 | if ( tree ) { |
---|
| 245 | tree->accept( visitor ); |
---|
| 246 | } |
---|
| 247 | } |
---|
| 248 | |
---|
| 249 | template< typename Container, typename VisitorType > |
---|
| 250 | inline void acceptAll( Container & container, VisitorType & visitor ) { |
---|
| 251 | SemanticErrorException errors; |
---|
[ce12e2b] | 252 | for ( auto * i : container ) { |
---|
[6f096d2] | 253 | try { |
---|
| 254 | if ( i ) { |
---|
| 255 | i->accept( visitor ); |
---|
| 256 | } |
---|
| 257 | } catch( SemanticErrorException & e ) { |
---|
| 258 | errors.append( e ); |
---|
| 259 | } |
---|
| 260 | } |
---|
| 261 | if ( ! errors.isEmpty() ) { |
---|
| 262 | throw errors; |
---|
| 263 | } |
---|
| 264 | } |
---|
| 265 | |
---|
[51b7345] | 266 | template< typename Container, typename VisitorType > |
---|
[6f096d2] | 267 | inline void acceptAll( const Container & container, VisitorType & visitor ) { |
---|
[a16764a6] | 268 | SemanticErrorException errors; |
---|
[6f096d2] | 269 | for ( const auto * i : container ) { |
---|
[0dd3a2f] | 270 | try { |
---|
[6f096d2] | 271 | if ( i ) { |
---|
| 272 | i->accept( visitor ); |
---|
[0dd3a2f] | 273 | } |
---|
[a16764a6] | 274 | } catch( SemanticErrorException &e ) { |
---|
[0dd3a2f] | 275 | errors.append( e ); |
---|
| 276 | } |
---|
| 277 | } |
---|
| 278 | if ( ! errors.isEmpty() ) { |
---|
| 279 | throw errors; |
---|
[51b7345] | 280 | } |
---|
| 281 | } |
---|
| 282 | |
---|
[0dd3a2f] | 283 | // Local Variables: // |
---|
| 284 | // tab-width: 4 // |
---|
| 285 | // mode: c++ // |
---|
| 286 | // compile-command: "make install" // |
---|
| 287 | // End: // |
---|