Update procedures
[shapes.git] / source / astflow.h
blob2782c930ba0ee80a6e39294eda55e3155b3efcaa
1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * any later version.
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008, 2013, 2014 Henrik Tidefelt
19 #pragma once
21 #include "ast.h"
23 namespace Shapes
25 namespace Ast
28 // class IfExpr : public Expression
29 // {
30 // Ast::SourceLocation loc_; /* Note: Not a const reference. */
31 // Expression * predicate_;
32 // Expression * consequence_;
33 // Expression * alternative_;
34 // public:
35 // IfExpr( const Ast::SourceLocation & loc, Expression * predicate, Expression * consequence, Expression * alternative );
36 // IfExpr( const Ast::SourceLocation & loc, Expression * predicate, Expression * consequence );
37 // virtual ~IfExpr( );
38 // virtual void eval( Kernel::EvalState * evalState ) const;
39 // virtual const Ast::SourceLocation & firstLoc( ) const;
40 // virtual const Ast::SourceLocation & lastLoc( ) const;
41 // };
43 class ForceExpr : public Expression
45 Ast::Expression * expr_;
46 public:
47 ForceExpr( const Ast::SourceLocation & loc, Ast::Expression * expr );
48 virtual ~ForceExpr( );
49 virtual void analyze_impl( Ast::Node * parent, Ast::AnalysisEnvironment * env, Ast::StateIDSet * freeStatesDst );
50 virtual void eval( Kernel::EvalState * evalState ) const;
53 class LetDynamicECExpr : public Expression
55 Ast::SourceLocation idLoc_; /* Note: Not a const reference. */
56 const char * id_;
57 Expression * expr_;
58 public:
59 LetDynamicECExpr( const Ast::SourceLocation & loc, const Ast::SourceLocation & idLoc, const char * id, Expression * expr );
60 virtual ~LetDynamicECExpr( );
61 virtual void analyze_impl( Ast::Node * parent, Ast::AnalysisEnvironment * env, Ast::StateIDSet * freeStatesDst );
62 virtual void eval( Kernel::EvalState * evalState ) const;
65 /* This isn't a function in the sense that it returns.
67 class ContinueDynamicECFunction : public Lang::Function
69 Ast::SourceLocation idLoc_;
70 const char * id_;
71 Expression * expr_;
72 public:
73 ContinueDynamicECFunction( const Ast::SourceLocation & idLoc, const char * id, Expression * expr );
74 virtual ~ContinueDynamicECFunction( );
75 void push_exprs( Ast::ArgListExprs * args ) const;
76 virtual void analyze_impl( Ast::Node * parent, Ast::AnalysisEnvironment * env, Ast::StateIDSet * freeStatesDst );
77 virtual void call( Kernel::EvalState * evalState, Kernel::Arguments & args, const Ast::SourceLocation & callLoc ) const;
78 virtual void gcMark( Kernel::GCMarkedSet & marked ){ };
79 virtual bool isTransforming( ) const { return false; }
82 class GetECBacktraceExpr : public Expression
84 Ast::SourceLocation idLoc_; /* Note: Not a const reference. */
85 const char * id_;
86 public:
87 GetECBacktraceExpr( const Ast::SourceLocation & idLoc, const char * id );
88 virtual ~GetECBacktraceExpr( );
89 virtual void analyze_impl( Ast::Node * parent, Ast::AnalysisEnvironment * env, Ast::StateIDSet * freeStatesDst );
90 virtual void eval( Kernel::EvalState * evalState ) const;
93 // class IfChain : public Expression
94 // {
95 // Ast::SourceLocation loc_; /* Note: Not a const reference. */
96 // std::list< IfExpr * > * clauses_;
97 // Expression * elseexpr_;
98 // public:
99 // IfChain( const Ast::SourceLocation & loc, std::list< IfExpr * > * clauses, Expression * elseexpr );
100 // IfChain( const Ast::SourceLocation & loc, std::list< IfExpr * > * clauses );
101 // virtual ~IfChain( );
102 // virtual void eval( Kernel::EvalState * evalState ) const;
103 // virtual const Ast::SourceLocation & firstLoc( ) const;
104 // virtual const Ast::SourceLocation & lastLoc( ) const;
105 // };