source: src/Parser/ParseNode.h@ 064e3ff

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 064e3ff was 064e3ff, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

add new type for ranges and refactor parser code

  • Property mode set to 100644
File size: 21.7 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// ParseNode.h --
8//
9// Author : Rodolfo G. Esteves
10// Created On : Sat May 16 13:28:16 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Thu Aug 4 16:34:16 2016
13// Update Count : 277
14//
15
16#ifndef PARSENODE_H
17#define PARSENODE_H
18
19#include <string>
20#include <list>
21#include <iterator>
22#include <memory>
23
24#include "Common/utility.h"
25#include "Parser/LinkageSpec.h"
26#include "SynTree/Type.h"
27#include "SynTree/Expression.h"
28//#include "SynTree/Declaration.h"
29#include "Common/UniqueName.h"
30#include "SynTree/Label.h"
31
32class ExpressionNode;
33class CompositeExprNode;
34class CommaExprNode;
35class StatementNode;
36class CompoundStmtNode;
37class DeclarationNode;
38class InitializerNode;
39
40// Builder
41class ParseNode {
42 public:
43 ParseNode();
44 ParseNode( const std::string * );
45 ParseNode( const std::string & ); // for copy constructing subclasses
46 virtual ~ParseNode();
47
48 ParseNode *get_link() const { return next; }
49 ParseNode *get_last();
50 ParseNode *set_link( ParseNode * );
51 void set_next( ParseNode *newlink ) { next = newlink; }
52
53 virtual ParseNode *clone() const { return 0; };
54
55 const std::string &get_name() const { return name; }
56 void set_name( const std::string &newValue ) { name = newValue; }
57
58 virtual void print( std::ostream &, int indent = 0 ) const;
59 virtual void printList( std::ostream &, int indent = 0 ) const;
60
61 ParseNode &operator,( ParseNode &);
62 protected:
63 std::string name;
64 static int indent_by;
65 ParseNode *next;
66};
67
68ParseNode *mkList( ParseNode & );
69
70class ExpressionNode : public ParseNode {
71 public:
72 ExpressionNode();
73 ExpressionNode( const std::string * );
74 ExpressionNode( const ExpressionNode &other );
75 virtual ~ExpressionNode() { delete argName; } // cannot delete argName because it might be referenced elsewhere
76
77 virtual ExpressionNode *clone() const = 0;
78
79 virtual CommaExprNode *add_to_list( ExpressionNode * );
80
81 ExpressionNode *get_argName() const { return argName; }
82 ExpressionNode *set_argName( const std::string *aName );
83 ExpressionNode *set_argName( ExpressionNode *aDesignator );
84 bool get_extension() const { return extension; }
85 ExpressionNode *set_extension( bool exten ) { extension = exten; return this; }
86
87 virtual void print( std::ostream &, int indent = 0) const = 0;
88 virtual void printOneLine( std::ostream &, int indent = 0) const = 0;
89
90 virtual Expression *build() const = 0;
91 protected:
92 void printDesignation ( std::ostream &, int indent = 0) const;
93 private:
94 ExpressionNode *argName = 0;
95 bool extension = false;
96};
97
98template< typename T >
99struct maybeBuild_t<Expression, T> {
100 static inline Expression * doit( const T *orig ) {
101 if ( orig ) {
102 Expression *p = orig->build();
103 p->set_extension( orig->get_extension() );
104 return p;
105 } else {
106 return 0;
107 } // if
108 }
109};
110
111// NullExprNode is used in tuples as a place-holder where a tuple component is omitted e.g., [ 2, , 3 ]
112class NullExprNode : public ExpressionNode {
113 public:
114 NullExprNode();
115
116 virtual NullExprNode *clone() const;
117
118 virtual void print( std::ostream &, int indent = 0) const;
119 virtual void printOneLine( std::ostream &, int indent = 0) const;
120
121 virtual Expression *build() const;
122};
123
124class ConstantNode : public ExpressionNode {
125 public:
126 enum Type { Integer, Float, Character, String };
127
128 ConstantNode( ConstantExpr * );
129 ConstantNode( const ConstantNode &other ) : expr( other.expr->clone() ) {};
130 ~ConstantNode() { delete expr; }
131
132 virtual ConstantNode *clone() const { return new ConstantNode( *this ); }
133 virtual void print( std::ostream &, int indent = 0) const;
134 virtual void printOneLine( std::ostream &, int indent = 0) const;
135
136 ConstantNode *appendstr( const std::string *newValue );
137
138 Expression *build() const;
139 private:
140 ConstantExpr *expr;
141};
142
143ConstantNode *makeConstantInteger( std::string & );
144ConstantNode *makeConstantFloat( std::string & );
145ConstantNode *makeConstantChar( std::string & );
146ConstantNode *makeConstantStr( std::string & );
147
148class VarRefNode : public ExpressionNode {
149 public:
150 VarRefNode();
151 VarRefNode( const std::string *, bool isLabel = false );
152 VarRefNode( const VarRefNode &other );
153
154 virtual Expression *build() const ;
155
156 virtual VarRefNode *clone() const { return new VarRefNode( *this ); }
157
158 virtual void print( std::ostream &, int indent = 0 ) const;
159 virtual void printOneLine( std::ostream &, int indent = 0 ) const;
160 private:
161 bool isLabel;
162};
163
164class DesignatorNode : public ExpressionNode {
165 public:
166 DesignatorNode( ExpressionNode *expr, bool isArrayIndex = false );
167 DesignatorNode( const DesignatorNode &other );
168
169 virtual Expression *build() const ;
170 virtual DesignatorNode *clone() const { return new DesignatorNode( *this ); }
171
172 virtual void print( std::ostream &, int indent = 0 ) const;
173 virtual void printOneLine( std::ostream &, int indent = 0 ) const;
174 private:
175 bool isArrayIndex;
176};
177
178class TypeValueNode : public ExpressionNode {
179 public:
180 TypeValueNode( DeclarationNode * );
181 TypeValueNode( const TypeValueNode &other );
182
183 DeclarationNode *get_decl() const { return decl; }
184
185 virtual Expression *build() const ;
186
187 virtual TypeValueNode *clone() const { return new TypeValueNode( *this ); }
188
189 virtual void print( std::ostream &, int indent = 0) const;
190 virtual void printOneLine( std::ostream &, int indent = 0) const;
191 private:
192 DeclarationNode *decl;
193};
194
195class OperatorNode : public ExpressionNode {
196 public:
197 enum Type { TupleC, Comma, TupleFieldSel, // n-adic
198 // triadic
199 Cond, NCond,
200 // diadic
201 SizeOf, AlignOf, OffsetOf, Attr, Plus, Minus, Mul, Div, Mod, Or, And,
202 BitOr, BitAnd, Xor, Cast, LShift, RShift, LThan, GThan, LEThan, GEThan, Eq, Neq,
203 Assign, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn,
204 Index, FieldSel, PFieldSel, Range,
205 // monadic
206 UnPlus, UnMinus, AddressOf, PointTo, Neg, BitNeg, Incr, IncrPost, Decr, DecrPost, LabelAddress,
207 Ctor, Dtor,
208 };
209
210 OperatorNode( Type t );
211 OperatorNode( const OperatorNode &other );
212 virtual ~OperatorNode();
213
214 virtual OperatorNode *clone() const { return new OperatorNode( *this ); }
215
216 Type get_type() const;
217 const char *get_typename() const;
218
219 virtual void print( std::ostream &, int indent = 0) const;
220 virtual void printOneLine( std::ostream &, int indent = 0) const;
221
222 virtual Expression *build() const { return 0; }
223 private:
224 Type type;
225};
226
227Expression *build_cast( TypeValueNode * arg, ExpressionNode *expr_node );
228Expression *build_fieldSel( ExpressionNode *expr_node, VarRefNode *member );
229Expression *build_pfieldSel( ExpressionNode *expr_node, VarRefNode *member );
230Expression *build_addressOf( ExpressionNode *expr_node );
231Expression *build_sizeOf( ExpressionNode *expr_node );
232Expression *build_alignOf( ExpressionNode *expr_node );
233Expression *build_offsetOf( TypeValueNode * arg, VarRefNode *member );
234
235class CompositeExprNode : public ExpressionNode {
236 public:
237 CompositeExprNode();
238 CompositeExprNode( const std::string * );
239 CompositeExprNode( ExpressionNode *f, ExpressionNode *args = 0 );
240 CompositeExprNode( ExpressionNode *f, ExpressionNode *arg1, ExpressionNode *arg2 );
241 CompositeExprNode( const CompositeExprNode &other );
242 virtual ~CompositeExprNode();
243
244 virtual CompositeExprNode *clone() const { return new CompositeExprNode( *this ); }
245 virtual Expression *build() const;
246
247 virtual void print( std::ostream &, int indent = 0) const;
248 virtual void printOneLine( std::ostream &, int indent = 0) const;
249
250 void set_function( ExpressionNode * );
251 void set_args( ExpressionNode * );
252
253 void add_arg( ExpressionNode * );
254
255 ExpressionNode *get_function() const;
256 ExpressionNode *get_args() const;
257 private:
258 ExpressionNode *function;
259 ExpressionNode *arguments;
260};
261
262class CompositeExprNode2 : public ExpressionNode {
263 public:
264 CompositeExprNode2( Expression *expr );
265 CompositeExprNode2( const CompositeExprNode2 &other );
266 virtual ~CompositeExprNode2();
267
268 virtual CompositeExprNode2 *clone() const { return new CompositeExprNode2( *this ); }
269 virtual Expression *build() const { return expr->clone(); }
270
271 virtual void print( std::ostream &, int indent = 0) const;
272 virtual void printOneLine( std::ostream &, int indent = 0) const;
273 private:
274 Expression *expr;
275};
276
277class AsmExprNode : public ExpressionNode {
278 public:
279 AsmExprNode();
280 AsmExprNode( ExpressionNode *inout, ConstantNode *constraint, ExpressionNode *operand ) : inout( inout ), constraint( constraint ), operand( operand ) {}
281 virtual ~AsmExprNode() { delete inout; delete constraint; delete operand; }
282
283 virtual AsmExprNode *clone() const { return new AsmExprNode( *this ); }
284 virtual Expression *build() const;
285
286 virtual void print( std::ostream &, int indent = 0) const;
287 virtual void printOneLine( std::ostream &, int indent = 0) const;
288
289 ExpressionNode *get_inout() const { return inout; };
290 void set_inout( ExpressionNode *newValue ) { inout = newValue; }
291
292 ConstantNode *get_constraint() const { return constraint; };
293 void set_constraint( ConstantNode *newValue ) { constraint = newValue; }
294
295 ExpressionNode *get_operand() const { return operand; };
296 void set_operand( ExpressionNode *newValue ) { operand = newValue; }
297 private:
298 ExpressionNode *inout;
299 ConstantNode *constraint;
300 ExpressionNode *operand;
301};
302
303class LabelNode : public ExpressionNode {
304 public:
305 virtual Expression *build() const { return NULL; }
306 virtual LabelNode *clone() const { return new LabelNode( *this ); }
307
308 virtual void print( std::ostream &, int indent = 0) const;
309 virtual void printOneLine( std::ostream &, int indent = 0) const;
310
311 const std::list< Label > &get_labels() const { return labels; };
312 void append_label( std::string *label ) { labels.push_back( *label ); delete label; }
313 private:
314 std::list< Label > labels;
315};
316
317class CommaExprNode : public CompositeExprNode {
318 public:
319 CommaExprNode();
320 CommaExprNode( ExpressionNode * );
321 CommaExprNode( ExpressionNode *, ExpressionNode * );
322 CommaExprNode( const CommaExprNode &other );
323
324 virtual CommaExprNode *add_to_list( ExpressionNode * );
325 virtual CommaExprNode *clone() const { return new CommaExprNode( *this ); }
326};
327
328class ForCtlExprNode : public ExpressionNode {
329 public:
330 ForCtlExprNode( ParseNode *, ExpressionNode *, ExpressionNode * ) throw ( SemanticError );
331 ForCtlExprNode( const ForCtlExprNode &other );
332 ~ForCtlExprNode();
333
334 StatementNode *get_init() const { return init; }
335 ExpressionNode *get_condition() const { return condition; }
336 ExpressionNode *get_change() const { return change; }
337
338 virtual ForCtlExprNode *clone() const { return new ForCtlExprNode( *this ); }
339 virtual Expression *build() const;
340
341 virtual void print( std::ostream &, int indent = 0 ) const;
342 virtual void printOneLine( std::ostream &, int indent = 0 ) const;
343 private:
344 StatementNode *init;
345 ExpressionNode *condition;
346 ExpressionNode *change;
347};
348
349class ValofExprNode : public ExpressionNode {
350 public:
351 ValofExprNode();
352 ValofExprNode( StatementNode *s = 0 );
353 ValofExprNode( const ValofExprNode &other );
354 ~ValofExprNode();
355
356 virtual ValofExprNode *clone() const { return new ValofExprNode( *this ); }
357
358 StatementNode *get_body() const { return body; }
359 void print( std::ostream &, int indent = 0 ) const;
360 void printOneLine( std::ostream &, int indent = 0 ) const;
361 Expression *build() const;
362
363 private:
364 StatementNode *body;
365};
366
367class TypeData;
368
369class DeclarationNode : public ParseNode {
370 public:
371 enum Qualifier { Const, Restrict, Volatile, Lvalue, Atomic };
372 enum StorageClass { Extern, Static, Auto, Register, Inline, Fortran, Noreturn, Threadlocal, NoStorageClass, };
373 enum BasicType { Char, Int, Float, Double, Void, Bool, Complex, Imaginary };
374 enum Modifier { Signed, Unsigned, Short, Long };
375 enum Aggregate { Struct, Union, Trait };
376 enum TypeClass { Type, Dtype, Ftype };
377 enum BuiltinType { Valist };
378
379 static const char *storageName[];
380 static const char *qualifierName[];
381 static const char *basicTypeName[];
382 static const char *modifierName[];
383 static const char *aggregateName[];
384 static const char *typeClassName[];
385 static const char *builtinTypeName[];
386
387 static DeclarationNode *newFunction( std::string *name, DeclarationNode *ret, DeclarationNode *param, StatementNode *body, bool newStyle = false );
388 static DeclarationNode *newQualifier( Qualifier );
389 static DeclarationNode *newStorageClass( StorageClass );
390 static DeclarationNode *newBasicType( BasicType );
391 static DeclarationNode *newModifier( Modifier );
392 static DeclarationNode *newForall( DeclarationNode *);
393 static DeclarationNode *newFromTypedef( std::string *);
394 static DeclarationNode *newAggregate( Aggregate kind, const std::string *name, ExpressionNode *actuals, DeclarationNode *fields, bool body );
395 static DeclarationNode *newEnum( std::string *name, DeclarationNode *constants );
396 static DeclarationNode *newEnumConstant( std::string *name, ExpressionNode *constant );
397 static DeclarationNode *newName( std::string *);
398 static DeclarationNode *newFromTypeGen( std::string *, ExpressionNode *params );
399 static DeclarationNode *newTypeParam( TypeClass, std::string *);
400 static DeclarationNode *newTrait( std::string *name, DeclarationNode *params, DeclarationNode *asserts );
401 static DeclarationNode *newTraitUse( std::string *name, ExpressionNode *params );
402 static DeclarationNode *newTypeDecl( std::string *name, DeclarationNode *typeParams );
403 static DeclarationNode *newPointer( DeclarationNode *qualifiers );
404 static DeclarationNode *newArray( ExpressionNode *size, DeclarationNode *qualifiers, bool isStatic );
405 static DeclarationNode *newVarArray( DeclarationNode *qualifiers );
406 static DeclarationNode *newBitfield( ExpressionNode *size );
407 static DeclarationNode *newTuple( DeclarationNode *members );
408 static DeclarationNode *newTypeof( ExpressionNode *expr );
409 static DeclarationNode *newAttr( std::string *, ExpressionNode *expr );
410 static DeclarationNode *newAttr( std::string *, DeclarationNode *type );
411 static DeclarationNode *newBuiltinType( BuiltinType );
412
413 DeclarationNode *addQualifiers( DeclarationNode *);
414 DeclarationNode *copyStorageClasses( DeclarationNode *);
415 DeclarationNode *addType( DeclarationNode *);
416 DeclarationNode *addTypedef();
417 DeclarationNode *addAssertions( DeclarationNode *);
418 DeclarationNode *addName( std::string *);
419 DeclarationNode *addBitfield( ExpressionNode *size );
420 DeclarationNode *addVarArgs();
421 DeclarationNode *addFunctionBody( StatementNode *body );
422 DeclarationNode *addOldDeclList( DeclarationNode *list );
423 DeclarationNode *addPointer( DeclarationNode *qualifiers );
424 DeclarationNode *addArray( DeclarationNode *array );
425 DeclarationNode *addNewPointer( DeclarationNode *pointer );
426 DeclarationNode *addNewArray( DeclarationNode *array );
427 DeclarationNode *addParamList( DeclarationNode *list );
428 DeclarationNode *addIdList( DeclarationNode *list ); // old-style functions
429 DeclarationNode *addInitializer( InitializerNode *init );
430
431 DeclarationNode *cloneType( std::string *newName );
432 DeclarationNode *cloneType( DeclarationNode *existing );
433 DeclarationNode *cloneType( int ) { return cloneType( ( std::string *)0 ); }
434 DeclarationNode *cloneBaseType( std::string *newName );
435 DeclarationNode *cloneBaseType( DeclarationNode *newdecl );
436
437 DeclarationNode *appendList( DeclarationNode * );
438
439 DeclarationNode *clone() const;
440 void print( std::ostream &, int indent = 0 ) const;
441 void printList( std::ostream &, int indent = 0 ) const;
442
443 Declaration *build() const;
444 ::Type *buildType() const;
445
446 bool get_hasEllipsis() const;
447 const std::string &get_name() const { return name; }
448 LinkageSpec::Type get_linkage() const { return linkage; }
449 DeclarationNode *extractAggregate() const;
450 ExpressionNode *get_enumeratorValue() const { return enumeratorValue; }
451
452 bool get_extension() const { return extension; }
453 DeclarationNode *set_extension( bool exten ) { extension = exten; return this; }
454
455 DeclarationNode();
456 ~DeclarationNode();
457 private:
458 StorageClass buildStorageClass() const;
459 bool buildFuncSpecifier( StorageClass key ) const;
460
461 TypeData *type;
462 std::string name;
463 std::list< StorageClass > storageClasses;
464 std::list< std::string > attributes;
465 ExpressionNode *bitfieldWidth;
466 ExpressionNode *enumeratorValue;
467 InitializerNode *initializer;
468 bool hasEllipsis;
469 LinkageSpec::Type linkage;
470 bool extension = false;
471
472 static UniqueName anonymous;
473}; // DeclarationNode
474
475class StatementNode : public ParseNode {
476 public:
477 enum Type { Exp, If, Switch, Case, Default, Choose, Fallthru,
478 While, Do, For,
479 Goto, Continue, Break, Return, Throw,
480 Try, Catch, Finally, Asm,
481 Decl
482 };
483
484 StatementNode();
485 StatementNode( const std::string *name );
486 StatementNode( Type t, ExpressionNode *control = 0, StatementNode *block = 0 );
487 StatementNode( Type t, std::string *target );
488 StatementNode( DeclarationNode *decl );
489
490 ~StatementNode();
491
492 static StatementNode *newCatchStmt( DeclarationNode *d = 0, StatementNode *s = 0, bool catchRestP = false );
493
494 StatementNode *set_block( StatementNode *b ) { block = b; return this; }
495 StatementNode *get_block() const { return block; }
496
497 void set_control( ExpressionNode *c ) { control = c; }
498 ExpressionNode *get_control() const { return control; }
499
500 StatementNode::Type get_type() const { return type; }
501
502 StatementNode *add_label( const std::string * );
503 const std::list<std::string> &get_labels() const { return labels; }
504
505 void addDeclaration( DeclarationNode *newDecl ) { decl = newDecl; }
506 void setCatchRest( bool newVal ) { isCatchRest = newVal; }
507
508 std::string get_target() const;
509
510 StatementNode *add_controlexp( ExpressionNode * );
511 StatementNode *append_block( StatementNode * );
512 StatementNode *append_last_case( StatementNode * );
513
514 void print( std::ostream &, int indent = 0) const;
515 virtual StatementNode *clone() const;
516 virtual Statement *build() const;
517 private:
518 static const char *StType[];
519 Type type;
520 ExpressionNode *control;
521 StatementNode *block;
522 std::list<std::string> labels;
523 std::string *target; // target label for jump statements
524 DeclarationNode *decl;
525 bool isCatchRest;
526}; // StatementNode
527
528class CompoundStmtNode : public StatementNode {
529 public:
530 CompoundStmtNode();
531 CompoundStmtNode( const std::string * );
532 CompoundStmtNode( StatementNode * );
533 ~CompoundStmtNode();
534
535 void add_statement( StatementNode * );
536
537 void print( std::ostream &, int indent = 0 ) const;
538 virtual Statement *build() const;
539 private:
540 StatementNode *first, *last;
541};
542
543class AsmStmtNode : public StatementNode {
544 public:
545 AsmStmtNode( Type, bool voltile, ConstantNode *instruction, ExpressionNode *output = 0, ExpressionNode *input = 0, ConstantNode *clobber = 0, LabelNode *gotolabels = 0 );
546 ~AsmStmtNode();
547
548 void print( std::ostream &, int indent = 0 ) const;
549 Statement *build() const;
550 private:
551 bool voltile;
552 ConstantNode *instruction;
553 ExpressionNode *output, *input;
554 ConstantNode *clobber;
555 std::list< Label > gotolabels;
556};
557
558class NullStmtNode : public CompoundStmtNode {
559 public:
560 Statement *build() const;
561 void print( std::ostream &, int indent = 0 ) const;
562};
563
564class InitializerNode : public ParseNode {
565 public:
566 InitializerNode( ExpressionNode *, bool aggrp = false, ExpressionNode *des = 0 );
567 InitializerNode( InitializerNode *, bool aggrp = false, ExpressionNode *des = 0 );
568 ~InitializerNode();
569
570 ExpressionNode *get_expression() const { return expr; }
571
572 InitializerNode *set_designators( ExpressionNode *des ) { designator = des; return this; }
573 ExpressionNode *get_designators() const { return designator; }
574
575 InitializerNode *set_maybeConstructed( bool value ) { maybeConstructed = value; return this; }
576 bool get_maybeConstructed() const { return maybeConstructed; }
577
578 InitializerNode *next_init() const { return kids; }
579
580 void print( std::ostream &, int indent = 0 ) const;
581 void printOneLine( std::ostream & ) const;
582
583 virtual Initializer *build() const;
584 private:
585 ExpressionNode *expr;
586 bool aggregate;
587 ExpressionNode *designator; // may be list
588 InitializerNode *kids;
589 bool maybeConstructed;
590};
591
592class CompoundLiteralNode : public ExpressionNode {
593 public:
594 CompoundLiteralNode( DeclarationNode *type, InitializerNode *kids );
595 CompoundLiteralNode( const CompoundLiteralNode &type );
596 ~CompoundLiteralNode();
597
598 virtual CompoundLiteralNode *clone() const;
599
600 DeclarationNode *get_type() const { return type; }
601 CompoundLiteralNode *set_type( DeclarationNode *t ) { type = t; return this; }
602
603 InitializerNode *get_initializer() const { return kids; }
604 CompoundLiteralNode *set_initializer( InitializerNode *k ) { kids = k; return this; }
605
606 void print( std::ostream &, int indent = 0 ) const;
607 void printOneLine( std::ostream &, int indent = 0 ) const;
608
609 virtual Expression *build() const;
610 private:
611 DeclarationNode *type;
612 InitializerNode *kids;
613};
614
615template< typename SynTreeType, typename NodeType >
616void buildList( const NodeType *firstNode, std::list< SynTreeType *> &outputList ) {
617 SemanticError errors;
618 std::back_insert_iterator< std::list< SynTreeType *> > out( outputList );
619 const NodeType *cur = firstNode;
620
621 while ( cur ) {
622 try {
623// SynTreeType *result = dynamic_cast< SynTreeType *>( maybeBuild<typename std::result_of<decltype(&NodeType::build)(NodeType)>::type>( cur ) );
624 SynTreeType *result = dynamic_cast< SynTreeType *>( maybeBuild<typename std::pointer_traits<decltype(cur->build())>::element_type>( cur ) );
625 if ( result ) {
626 *out++ = result;
627 } else {
628 } // if
629 } catch( SemanticError &e ) {
630 errors.append( e );
631 } // try
632 cur = dynamic_cast< NodeType *>( cur->get_link() );
633 } // while
634 if ( ! errors.isEmpty() ) {
635 throw errors;
636 } // if
637}
638
639// in DeclarationNode.cc
640void buildList( const DeclarationNode *firstNode, std::list< Declaration * > &outputList );
641void buildList( const DeclarationNode *firstNode, std::list< DeclarationWithType *> &outputList );
642void buildTypeList( const DeclarationNode *firstNode, std::list< Type * > &outputList );
643
644// in ExpressionNode.cc
645ExpressionNode *flattenCommas( ExpressionNode *list );
646ExpressionNode *tupleContents( ExpressionNode *tuple );
647
648#endif // PARSENODE_H
649
650// Local Variables: //
651// tab-width: 4 //
652// mode: c++ //
653// compile-command: "make install" //
654// End: //
Note: See TracBrowser for help on using the repository browser.