NEURON
ast.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2023 Blue Brain Project, EPFL.
3  * See the top-level LICENSE file for details.
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 ///
9 /// THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
10 ///
11 
12 #pragma once
13 
14 /**
15  * \dir
16  * \brief Auto generated AST Implementations
17  *
18  * \file
19  * \brief Auto generated AST classes declaration
20  */
21 
22 #include <string>
23 #include <vector>
24 #include <unordered_set>
25 
26 #include "ast/ast_decl.hpp"
27 #include "ast/ast_common.hpp"
28 #include "lexer/modtoken.hpp"
29 #include "utils/common_utils.hpp"
30 #include "visitors/visitor.hpp"
31 
32 namespace nmodl::ast {
33 
34 /**
35  * \defgroup ast_class AST Classes
36  * \ingroup ast
37  * \brief Classes for implementing Abstract Syntax Tree (AST)
38  * \{
39  */
40 
41 /**
42  * \brief Base class for all Abstract Syntax Tree node types
43  *
44  * Every node in the Abstract Syntax Tree is inherited from base class
45  * ast::Ast. This class provides base properties and pure virtual
46  * functions that must be implemented by base classes. We inherit from
47  * std::enable_shared_from_this to get a `shared_ptr` from `this` pointer.
48  *
49  * \todo With the ast::Node as another top level node, this can be removed
50  * in the future.
51  */
52 struct Ast: public std::enable_shared_from_this<Ast> {
53  private:
54  /**
55  * \brief Generic pointer to the parent
56  *
57  * Children types can be known at compile time. Conversely, many parents
58  * can have the same children type. Thus, this is just a pointer to
59  * the base class. The pointer to the parent cannot have ownership
60  * (circular ownership problem). weak_ptr you say? Yes, however weak_ptr
61  * can be instantiated from shared_ptr (not this). Whys is this a problem?
62  * In bison things must be passed around as raw pointers (because it uses
63  * unions etc.) and there are cases where the shared_ptr to the parent
64  * was not yet created while the child is added (throwing a bad_weak_ptr
65  * exception).
66  *
67  * i.e. in bison the lines:
68  *
69  * ast::WatchStatement* a = new ast::WatchStatement();
70  * yylhs.value.as< ast::WatchStatement* > ()->add_watch(a);
71  *
72  * would throw a bad_weak_ptr exception because when you call add_watch
73  * the shared_ptr_from_this to "a" is not yet created.
74  */
75  Ast* parent = nullptr;
76 
77  public:
78 
79  /// \name Ctor & dtor
80  /// \{
81 
82  Ast() = default;
83 
84  virtual ~Ast() = default;
85 
86  /// \}
87 
88 
89  /// \name Pure Virtual Functions
90  /// \{
91 
92  /**
93  * \brief Return type (ast::AstNodeType) of AST node
94  *
95  * Every node in the ast has a type defined in ast::AstNodeType.
96  * This type is can be used to check/compare node types.
97  */
98  virtual AstNodeType get_node_type() const = 0;
99 
100  /**
101  * \brief Return type (ast::AstNodeType) of ast node as std::string
102  *
103  * Every node in the ast has a type defined in ast::AstNodeType.
104  * This type name can be returned as a std::string for printing
105  * ast to text/json form.
106  *
107  * \return name of the node type as a string
108  *
109  * \sa Ast::get_node_name
110  */
111  virtual std::string get_node_type_name() const = 0;
112 
113  /**
114  * \brief Return NMODL statement of ast node as std::string
115  *
116  * Every node is related to a special statement in the NMODL. This
117  * statement can be returned as a std::string for printing to
118  * text/json form.
119  *
120  * \return name of the statement as a string
121  *
122  * \sa Ast::get_nmodl_name
123  */
124  virtual std::string get_nmodl_name() const {
125  throw std::runtime_error("get_nmodl_name not implemented");
126  }
127 
128  /**
129  * \brief Accept (or visit) the AST node using current visitor
130  *
131  * Instead of visiting children of AST node, like Ast::visit_children,
132  * accept allows to visit the current node itself using the concrete
133  * visitor provided.
134  *
135  * \param v Concrete visitor that will be used to recursively visit children
136  *
137  * \note Below is an example of `accept` method implementation which shows how
138  * visitor method corresponding to ast::IndexedName node is called allowing
139  * to visit the node itself in the visitor.
140  *
141  * \code{.cpp}
142  * void IndexedName::accept(visitor::Visitor& v) override {
143  * v.visit_indexed_name(this);
144  * }
145  * \endcode
146  *
147  */
148  virtual void accept(visitor::Visitor& v) = 0;
149 
150  /**
151  * \brief Accept (or visit) the AST node using a given visitor
152  * \param v constant visitor visiting the AST node
153  * \ref accept(visitor::Visitor&);
154  */
155  virtual void accept(visitor::ConstVisitor& v) const = 0;
156 
157  /**
158  * \brief Visit children i.e. member of AST node using provided visitor
159  *
160  * Different nodes in the AST have different members (i.e. children). This method
161  * recursively visits children using provided concrete visitor.
162  *
163  * \param v Concrete visitor that will be used to recursively visit node
164  *
165  * \note Below is an example of `visit_children` method implementation which shows
166  * ast::IndexedName node children are visited instead of node itself.
167  *
168  * \code{.cpp}
169  * void IndexedName::visit_children(visitor::Visitor& v) {
170  * name->accept(v);
171  * length->accept(v);
172  * }
173  * \endcode
174  */
175  virtual void visit_children(visitor::Visitor& v) = 0;
176 
177  /**
178  * \copydoc visit_children(visitor::Visitor& v)
179  */
180  virtual void visit_children(visitor::ConstVisitor& v) const = 0;
181 
182  /**
183  * \brief Create a copy of the current node
184  *
185  * Recursively make a new copy/clone of the current node including
186  * all members and return a pointer to the node. This is used for
187  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
188  * ast.
189  *
190  * \return pointer to the clone/copy of the current node
191  */
192  virtual Ast* clone() const;
193 
194  /// \}
195 
196  /// \name Not implemented
197  /// \{
198 
199  /**
200  * \brief Return name of of the node
201  *
202  * Some ast nodes have a member marked designated as node name. For example,
203  * in case of ast::FunctionCall, name of the function is returned as a node
204  * name. Note that this is different from ast node type name and not every
205  * ast node has name.
206  *
207  * \return name of the node as std::string
208  *
209  * \sa Ast::get_node_type_name
210  */
211  virtual std::string get_node_name() const;
212 
213  /**
214  * \brief Return associated token for the AST node
215  *
216  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
217  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
218  * nullptr to store in the nmodl::symtab::SymbolTable.
219  *
220  * \return pointer to token if exist otherwise nullptr
221  */
222  virtual const ModToken* get_token() const;
223 
224  /**
225  * \brief Return associated symbol table for the AST node
226  *
227  * Certain ast nodes (e.g. inherited from ast::Block) have associated
228  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
229  * and it can be accessed using this method.
230  *
231  * \return pointer to the symbol table
232  *
233  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
234  */
235  virtual symtab::SymbolTable* get_symbol_table() const;
236 
237  /**
238  * \brief Return associated statement block for the AST node
239  *
240  * Top level block nodes encloses all statements in the ast::StatementBlock.
241  * For example, ast::BreakpointBlock has all statements in curly brace (`{ }`)
242  * stored in ast::StatementBlock :
243  *
244  * \code
245  * BREAKPOINT {
246  * SOLVE states METHOD cnexp
247  * gNaTs2_t = gNaTs2_tbar*m*m*m*h
248  * ina = gNaTs2_t*(v-ena)
249  * }
250  * \endcode
251  *
252  * This method return enclosing statement block.
253  *
254  * \return pointer to the statement block if exist
255  *
256  * \sa ast::StatementBlock
257  */
258  virtual std::shared_ptr<StatementBlock> get_statement_block() const;
259 
260  /**
261  * \brief Set symbol table for the AST node
262  *
263  * Top level, block scoped nodes store symbol table in the ast node.
264  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
265  * for every node in the ast.
266  *
267  * \sa nmodl::visitor::SymtabVisitor
268  */
269  virtual void set_symbol_table(symtab::SymbolTable* symtab);
270 
271  /**
272  * \brief Set name for the AST node
273  *
274  * Some ast nodes have a member marked designated as node name (e.g. nodes
275  * derived from ast::Identifier). This method is used to set new name for those
276  * nodes. This useful for passes like nmodl::visitor::RenameVisitor.
277  *
278  * \sa Ast::get_node_type_name Ast::get_node_name
279  */
280  virtual void set_name(const std::string& name);
281 
282  /**
283  * \brief Negate the value of AST node
284  *
285  * Parser parse `-x` in two parts : `x` and then `-`. Once second token
286  * `-` is encountered, the corresponding value of ast node needs to be
287  * multiplied by `-1` for ast::Number node types or apply `!` operator
288  for the nodes of type ast::Boolean.
289  */
290  virtual void negate();
291  /// \}
292 
293  /// get std::shared_ptr from `this` pointer of the AST node
294  virtual std::shared_ptr<Ast> get_shared_ptr();
295 
296  /// get std::shared_ptr from `this` pointer of the AST node
297  virtual std::shared_ptr<const Ast> get_shared_ptr() const;
298 
299  /**
300  *\brief Check if the ast node is an instance of ast::Ast
301  * \return true if object of type ast::Ast
302  */
303  virtual bool is_ast() const noexcept;
304 
305  /**
306  * \brief Check if the ast node is an instance of ast::Node
307  * \return true if object of type ast::OntologyStatement
308  */
309  virtual bool is_node () const noexcept;
310 
311  /**
312  * \brief Check if the ast node is an instance of ast::Statement
313  * \return true if object of type ast::OntologyStatement
314  */
315  virtual bool is_statement () const noexcept;
316 
317  /**
318  * \brief Check if the ast node is an instance of ast::Expression
319  * \return true if object of type ast::OntologyStatement
320  */
321  virtual bool is_expression () const noexcept;
322 
323  /**
324  * \brief Check if the ast node is an instance of ast::Block
325  * \return true if object of type ast::OntologyStatement
326  */
327  virtual bool is_block () const noexcept;
328 
329  /**
330  * \brief Check if the ast node is an instance of ast::Identifier
331  * \return true if object of type ast::OntologyStatement
332  */
333  virtual bool is_identifier () const noexcept;
334 
335  /**
336  * \brief Check if the ast node is an instance of ast::Number
337  * \return true if object of type ast::OntologyStatement
338  */
339  virtual bool is_number () const noexcept;
340 
341  /**
342  * \brief Check if the ast node is an instance of ast::String
343  * \return true if object of type ast::OntologyStatement
344  */
345  virtual bool is_string () const noexcept;
346 
347  /**
348  * \brief Check if the ast node is an instance of ast::Integer
349  * \return true if object of type ast::OntologyStatement
350  */
351  virtual bool is_integer () const noexcept;
352 
353  /**
354  * \brief Check if the ast node is an instance of ast::Float
355  * \return true if object of type ast::OntologyStatement
356  */
357  virtual bool is_float () const noexcept;
358 
359  /**
360  * \brief Check if the ast node is an instance of ast::Double
361  * \return true if object of type ast::OntologyStatement
362  */
363  virtual bool is_double () const noexcept;
364 
365  /**
366  * \brief Check if the ast node is an instance of ast::Boolean
367  * \return true if object of type ast::OntologyStatement
368  */
369  virtual bool is_boolean () const noexcept;
370 
371  /**
372  * \brief Check if the ast node is an instance of ast::Name
373  * \return true if object of type ast::OntologyStatement
374  */
375  virtual bool is_name () const noexcept;
376 
377  /**
378  * \brief Check if the ast node is an instance of ast::PrimeName
379  * \return true if object of type ast::OntologyStatement
380  */
381  virtual bool is_prime_name () const noexcept;
382 
383  /**
384  * \brief Check if the ast node is an instance of ast::IndexedName
385  * \return true if object of type ast::OntologyStatement
386  */
387  virtual bool is_indexed_name () const noexcept;
388 
389  /**
390  * \brief Check if the ast node is an instance of ast::VarName
391  * \return true if object of type ast::OntologyStatement
392  */
393  virtual bool is_var_name () const noexcept;
394 
395  /**
396  * \brief Check if the ast node is an instance of ast::Argument
397  * \return true if object of type ast::OntologyStatement
398  */
399  virtual bool is_argument () const noexcept;
400 
401  /**
402  * \brief Check if the ast node is an instance of ast::ReactVarName
403  * \return true if object of type ast::OntologyStatement
404  */
405  virtual bool is_react_var_name () const noexcept;
406 
407  /**
408  * \brief Check if the ast node is an instance of ast::ReadIonVar
409  * \return true if object of type ast::OntologyStatement
410  */
411  virtual bool is_read_ion_var () const noexcept;
412 
413  /**
414  * \brief Check if the ast node is an instance of ast::WriteIonVar
415  * \return true if object of type ast::OntologyStatement
416  */
417  virtual bool is_write_ion_var () const noexcept;
418 
419  /**
420  * \brief Check if the ast node is an instance of ast::NonspecificCurVar
421  * \return true if object of type ast::OntologyStatement
422  */
423  virtual bool is_nonspecific_cur_var () const noexcept;
424 
425  /**
426  * \brief Check if the ast node is an instance of ast::ElectrodeCurVar
427  * \return true if object of type ast::OntologyStatement
428  */
429  virtual bool is_electrode_cur_var () const noexcept;
430 
431  /**
432  * \brief Check if the ast node is an instance of ast::RangeVar
433  * \return true if object of type ast::OntologyStatement
434  */
435  virtual bool is_range_var () const noexcept;
436 
437  /**
438  * \brief Check if the ast node is an instance of ast::GlobalVar
439  * \return true if object of type ast::OntologyStatement
440  */
441  virtual bool is_global_var () const noexcept;
442 
443  /**
444  * \brief Check if the ast node is an instance of ast::PointerVar
445  * \return true if object of type ast::OntologyStatement
446  */
447  virtual bool is_pointer_var () const noexcept;
448 
449  /**
450  * \brief Check if the ast node is an instance of ast::RandomVar
451  * \return true if object of type ast::OntologyStatement
452  */
453  virtual bool is_random_var () const noexcept;
454 
455  /**
456  * \brief Check if the ast node is an instance of ast::BbcorePointerVar
457  * \return true if object of type ast::OntologyStatement
458  */
459  virtual bool is_bbcore_pointer_var () const noexcept;
460 
461  /**
462  * \brief Check if the ast node is an instance of ast::ExternVar
463  * \return true if object of type ast::OntologyStatement
464  */
465  virtual bool is_extern_var () const noexcept;
466 
467  /**
468  * \brief Check if the ast node is an instance of ast::ParamBlock
469  * \return true if object of type ast::OntologyStatement
470  */
471  virtual bool is_param_block () const noexcept;
472 
473  /**
474  * \brief Check if the ast node is an instance of ast::IndependentBlock
475  * \return true if object of type ast::OntologyStatement
476  */
477  virtual bool is_independent_block () const noexcept;
478 
479  /**
480  * \brief Check if the ast node is an instance of ast::AssignedBlock
481  * \return true if object of type ast::OntologyStatement
482  */
483  virtual bool is_assigned_block () const noexcept;
484 
485  /**
486  * \brief Check if the ast node is an instance of ast::StateBlock
487  * \return true if object of type ast::OntologyStatement
488  */
489  virtual bool is_state_block () const noexcept;
490 
491  /**
492  * \brief Check if the ast node is an instance of ast::InitialBlock
493  * \return true if object of type ast::OntologyStatement
494  */
495  virtual bool is_initial_block () const noexcept;
496 
497  /**
498  * \brief Check if the ast node is an instance of ast::ConstructorBlock
499  * \return true if object of type ast::OntologyStatement
500  */
501  virtual bool is_constructor_block () const noexcept;
502 
503  /**
504  * \brief Check if the ast node is an instance of ast::DestructorBlock
505  * \return true if object of type ast::OntologyStatement
506  */
507  virtual bool is_destructor_block () const noexcept;
508 
509  /**
510  * \brief Check if the ast node is an instance of ast::StatementBlock
511  * \return true if object of type ast::OntologyStatement
512  */
513  virtual bool is_statement_block () const noexcept;
514 
515  /**
516  * \brief Check if the ast node is an instance of ast::DerivativeBlock
517  * \return true if object of type ast::OntologyStatement
518  */
519  virtual bool is_derivative_block () const noexcept;
520 
521  /**
522  * \brief Check if the ast node is an instance of ast::LinearBlock
523  * \return true if object of type ast::OntologyStatement
524  */
525  virtual bool is_linear_block () const noexcept;
526 
527  /**
528  * \brief Check if the ast node is an instance of ast::NonLinearBlock
529  * \return true if object of type ast::OntologyStatement
530  */
531  virtual bool is_non_linear_block () const noexcept;
532 
533  /**
534  * \brief Check if the ast node is an instance of ast::DiscreteBlock
535  * \return true if object of type ast::OntologyStatement
536  */
537  virtual bool is_discrete_block () const noexcept;
538 
539  /**
540  * \brief Check if the ast node is an instance of ast::FunctionTableBlock
541  * \return true if object of type ast::OntologyStatement
542  */
543  virtual bool is_function_table_block () const noexcept;
544 
545  /**
546  * \brief Check if the ast node is an instance of ast::FunctionBlock
547  * \return true if object of type ast::OntologyStatement
548  */
549  virtual bool is_function_block () const noexcept;
550 
551  /**
552  * \brief Check if the ast node is an instance of ast::ProcedureBlock
553  * \return true if object of type ast::OntologyStatement
554  */
555  virtual bool is_procedure_block () const noexcept;
556 
557  /**
558  * \brief Check if the ast node is an instance of ast::NetReceiveBlock
559  * \return true if object of type ast::OntologyStatement
560  */
561  virtual bool is_net_receive_block () const noexcept;
562 
563  /**
564  * \brief Check if the ast node is an instance of ast::SolveBlock
565  * \return true if object of type ast::OntologyStatement
566  */
567  virtual bool is_solve_block () const noexcept;
568 
569  /**
570  * \brief Check if the ast node is an instance of ast::BreakpointBlock
571  * \return true if object of type ast::OntologyStatement
572  */
573  virtual bool is_breakpoint_block () const noexcept;
574 
575  /**
576  * \brief Check if the ast node is an instance of ast::BeforeBlock
577  * \return true if object of type ast::OntologyStatement
578  */
579  virtual bool is_before_block () const noexcept;
580 
581  /**
582  * \brief Check if the ast node is an instance of ast::AfterBlock
583  * \return true if object of type ast::OntologyStatement
584  */
585  virtual bool is_after_block () const noexcept;
586 
587  /**
588  * \brief Check if the ast node is an instance of ast::BABlock
589  * \return true if object of type ast::OntologyStatement
590  */
591  virtual bool is_ba_block () const noexcept;
592 
593  /**
594  * \brief Check if the ast node is an instance of ast::ForNetcon
595  * \return true if object of type ast::OntologyStatement
596  */
597  virtual bool is_for_netcon () const noexcept;
598 
599  /**
600  * \brief Check if the ast node is an instance of ast::KineticBlock
601  * \return true if object of type ast::OntologyStatement
602  */
603  virtual bool is_kinetic_block () const noexcept;
604 
605  /**
606  * \brief Check if the ast node is an instance of ast::UnitBlock
607  * \return true if object of type ast::OntologyStatement
608  */
609  virtual bool is_unit_block () const noexcept;
610 
611  /**
612  * \brief Check if the ast node is an instance of ast::ConstantBlock
613  * \return true if object of type ast::OntologyStatement
614  */
615  virtual bool is_constant_block () const noexcept;
616 
617  /**
618  * \brief Check if the ast node is an instance of ast::NeuronBlock
619  * \return true if object of type ast::OntologyStatement
620  */
621  virtual bool is_neuron_block () const noexcept;
622 
623  /**
624  * \brief Check if the ast node is an instance of ast::Unit
625  * \return true if object of type ast::OntologyStatement
626  */
627  virtual bool is_unit () const noexcept;
628 
629  /**
630  * \brief Check if the ast node is an instance of ast::DoubleUnit
631  * \return true if object of type ast::OntologyStatement
632  */
633  virtual bool is_double_unit () const noexcept;
634 
635  /**
636  * \brief Check if the ast node is an instance of ast::LocalVar
637  * \return true if object of type ast::OntologyStatement
638  */
639  virtual bool is_local_var () const noexcept;
640 
641  /**
642  * \brief Check if the ast node is an instance of ast::Limits
643  * \return true if object of type ast::OntologyStatement
644  */
645  virtual bool is_limits () const noexcept;
646 
647  /**
648  * \brief Check if the ast node is an instance of ast::NumberRange
649  * \return true if object of type ast::OntologyStatement
650  */
651  virtual bool is_number_range () const noexcept;
652 
653  /**
654  * \brief Check if the ast node is an instance of ast::ConstantVar
655  * \return true if object of type ast::OntologyStatement
656  */
657  virtual bool is_constant_var () const noexcept;
658 
659  /**
660  * \brief Check if the ast node is an instance of ast::BinaryOperator
661  * \return true if object of type ast::OntologyStatement
662  */
663  virtual bool is_binary_operator () const noexcept;
664 
665  /**
666  * \brief Check if the ast node is an instance of ast::UnaryOperator
667  * \return true if object of type ast::OntologyStatement
668  */
669  virtual bool is_unary_operator () const noexcept;
670 
671  /**
672  * \brief Check if the ast node is an instance of ast::ReactionOperator
673  * \return true if object of type ast::OntologyStatement
674  */
675  virtual bool is_reaction_operator () const noexcept;
676 
677  /**
678  * \brief Check if the ast node is an instance of ast::ParenExpression
679  * \return true if object of type ast::OntologyStatement
680  */
681  virtual bool is_paren_expression () const noexcept;
682 
683  /**
684  * \brief Check if the ast node is an instance of ast::BinaryExpression
685  * \return true if object of type ast::OntologyStatement
686  */
687  virtual bool is_binary_expression () const noexcept;
688 
689  /**
690  * \brief Check if the ast node is an instance of ast::DiffEqExpression
691  * \return true if object of type ast::OntologyStatement
692  */
693  virtual bool is_diff_eq_expression () const noexcept;
694 
695  /**
696  * \brief Check if the ast node is an instance of ast::UnaryExpression
697  * \return true if object of type ast::OntologyStatement
698  */
699  virtual bool is_unary_expression () const noexcept;
700 
701  /**
702  * \brief Check if the ast node is an instance of ast::NonLinEquation
703  * \return true if object of type ast::OntologyStatement
704  */
705  virtual bool is_non_lin_equation () const noexcept;
706 
707  /**
708  * \brief Check if the ast node is an instance of ast::LinEquation
709  * \return true if object of type ast::OntologyStatement
710  */
711  virtual bool is_lin_equation () const noexcept;
712 
713  /**
714  * \brief Check if the ast node is an instance of ast::FunctionCall
715  * \return true if object of type ast::OntologyStatement
716  */
717  virtual bool is_function_call () const noexcept;
718 
719  /**
720  * \brief Check if the ast node is an instance of ast::Watch
721  * \return true if object of type ast::OntologyStatement
722  */
723  virtual bool is_watch () const noexcept;
724 
725  /**
726  * \brief Check if the ast node is an instance of ast::BABlockType
727  * \return true if object of type ast::OntologyStatement
728  */
729  virtual bool is_ba_block_type () const noexcept;
730 
731  /**
732  * \brief Check if the ast node is an instance of ast::UnitDef
733  * \return true if object of type ast::OntologyStatement
734  */
735  virtual bool is_unit_def () const noexcept;
736 
737  /**
738  * \brief Check if the ast node is an instance of ast::FactorDef
739  * \return true if object of type ast::OntologyStatement
740  */
741  virtual bool is_factor_def () const noexcept;
742 
743  /**
744  * \brief Check if the ast node is an instance of ast::Valence
745  * \return true if object of type ast::OntologyStatement
746  */
747  virtual bool is_valence () const noexcept;
748 
749  /**
750  * \brief Check if the ast node is an instance of ast::UnitState
751  * \return true if object of type ast::OntologyStatement
752  */
753  virtual bool is_unit_state () const noexcept;
754 
755  /**
756  * \brief Check if the ast node is an instance of ast::LocalListStatement
757  * \return true if object of type ast::OntologyStatement
758  */
759  virtual bool is_local_list_statement () const noexcept;
760 
761  /**
762  * \brief Check if the ast node is an instance of ast::Model
763  * \return true if object of type ast::OntologyStatement
764  */
765  virtual bool is_model () const noexcept;
766 
767  /**
768  * \brief Check if the ast node is an instance of ast::Define
769  * \return true if object of type ast::OntologyStatement
770  */
771  virtual bool is_define () const noexcept;
772 
773  /**
774  * \brief Check if the ast node is an instance of ast::Include
775  * \return true if object of type ast::OntologyStatement
776  */
777  virtual bool is_include () const noexcept;
778 
779  /**
780  * \brief Check if the ast node is an instance of ast::ParamAssign
781  * \return true if object of type ast::OntologyStatement
782  */
783  virtual bool is_param_assign () const noexcept;
784 
785  /**
786  * \brief Check if the ast node is an instance of ast::AssignedDefinition
787  * \return true if object of type ast::OntologyStatement
788  */
789  virtual bool is_assigned_definition () const noexcept;
790 
791  /**
792  * \brief Check if the ast node is an instance of ast::ConductanceHint
793  * \return true if object of type ast::OntologyStatement
794  */
795  virtual bool is_conductance_hint () const noexcept;
796 
797  /**
798  * \brief Check if the ast node is an instance of ast::ExpressionStatement
799  * \return true if object of type ast::OntologyStatement
800  */
801  virtual bool is_expression_statement () const noexcept;
802 
803  /**
804  * \brief Check if the ast node is an instance of ast::ProtectStatement
805  * \return true if object of type ast::OntologyStatement
806  */
807  virtual bool is_protect_statement () const noexcept;
808 
809  /**
810  * \brief Check if the ast node is an instance of ast::FromStatement
811  * \return true if object of type ast::OntologyStatement
812  */
813  virtual bool is_from_statement () const noexcept;
814 
815  /**
816  * \brief Check if the ast node is an instance of ast::WhileStatement
817  * \return true if object of type ast::OntologyStatement
818  */
819  virtual bool is_while_statement () const noexcept;
820 
821  /**
822  * \brief Check if the ast node is an instance of ast::IfStatement
823  * \return true if object of type ast::OntologyStatement
824  */
825  virtual bool is_if_statement () const noexcept;
826 
827  /**
828  * \brief Check if the ast node is an instance of ast::ElseIfStatement
829  * \return true if object of type ast::OntologyStatement
830  */
831  virtual bool is_else_if_statement () const noexcept;
832 
833  /**
834  * \brief Check if the ast node is an instance of ast::ElseStatement
835  * \return true if object of type ast::OntologyStatement
836  */
837  virtual bool is_else_statement () const noexcept;
838 
839  /**
840  * \brief Check if the ast node is an instance of ast::WatchStatement
841  * \return true if object of type ast::OntologyStatement
842  */
843  virtual bool is_watch_statement () const noexcept;
844 
845  /**
846  * \brief Check if the ast node is an instance of ast::MutexLock
847  * \return true if object of type ast::OntologyStatement
848  */
849  virtual bool is_mutex_lock () const noexcept;
850 
851  /**
852  * \brief Check if the ast node is an instance of ast::MutexUnlock
853  * \return true if object of type ast::OntologyStatement
854  */
855  virtual bool is_mutex_unlock () const noexcept;
856 
857  /**
858  * \brief Check if the ast node is an instance of ast::Conserve
859  * \return true if object of type ast::OntologyStatement
860  */
861  virtual bool is_conserve () const noexcept;
862 
863  /**
864  * \brief Check if the ast node is an instance of ast::Compartment
865  * \return true if object of type ast::OntologyStatement
866  */
867  virtual bool is_compartment () const noexcept;
868 
869  /**
870  * \brief Check if the ast node is an instance of ast::LonDiffuse
871  * \return true if object of type ast::OntologyStatement
872  */
873  virtual bool is_lon_diffuse () const noexcept;
874 
875  /**
876  * \brief Check if the ast node is an instance of ast::ReactionStatement
877  * \return true if object of type ast::OntologyStatement
878  */
879  virtual bool is_reaction_statement () const noexcept;
880 
881  /**
882  * \brief Check if the ast node is an instance of ast::LagStatement
883  * \return true if object of type ast::OntologyStatement
884  */
885  virtual bool is_lag_statement () const noexcept;
886 
887  /**
888  * \brief Check if the ast node is an instance of ast::ConstantStatement
889  * \return true if object of type ast::OntologyStatement
890  */
891  virtual bool is_constant_statement () const noexcept;
892 
893  /**
894  * \brief Check if the ast node is an instance of ast::TableStatement
895  * \return true if object of type ast::OntologyStatement
896  */
897  virtual bool is_table_statement () const noexcept;
898 
899  /**
900  * \brief Check if the ast node is an instance of ast::Suffix
901  * \return true if object of type ast::OntologyStatement
902  */
903  virtual bool is_suffix () const noexcept;
904 
905  /**
906  * \brief Check if the ast node is an instance of ast::Useion
907  * \return true if object of type ast::OntologyStatement
908  */
909  virtual bool is_useion () const noexcept;
910 
911  /**
912  * \brief Check if the ast node is an instance of ast::Nonspecific
913  * \return true if object of type ast::OntologyStatement
914  */
915  virtual bool is_nonspecific () const noexcept;
916 
917  /**
918  * \brief Check if the ast node is an instance of ast::ElectrodeCurrent
919  * \return true if object of type ast::OntologyStatement
920  */
921  virtual bool is_electrode_current () const noexcept;
922 
923  /**
924  * \brief Check if the ast node is an instance of ast::Range
925  * \return true if object of type ast::OntologyStatement
926  */
927  virtual bool is_range () const noexcept;
928 
929  /**
930  * \brief Check if the ast node is an instance of ast::Global
931  * \return true if object of type ast::OntologyStatement
932  */
933  virtual bool is_global () const noexcept;
934 
935  /**
936  * \brief Check if the ast node is an instance of ast::RandomVarList
937  * \return true if object of type ast::OntologyStatement
938  */
939  virtual bool is_random_var_list () const noexcept;
940 
941  /**
942  * \brief Check if the ast node is an instance of ast::Pointer
943  * \return true if object of type ast::OntologyStatement
944  */
945  virtual bool is_pointer () const noexcept;
946 
947  /**
948  * \brief Check if the ast node is an instance of ast::BbcorePointer
949  * \return true if object of type ast::OntologyStatement
950  */
951  virtual bool is_bbcore_pointer () const noexcept;
952 
953  /**
954  * \brief Check if the ast node is an instance of ast::External
955  * \return true if object of type ast::OntologyStatement
956  */
957  virtual bool is_external () const noexcept;
958 
959  /**
960  * \brief Check if the ast node is an instance of ast::ThreadSafe
961  * \return true if object of type ast::OntologyStatement
962  */
963  virtual bool is_thread_safe () const noexcept;
964 
965  /**
966  * \brief Check if the ast node is an instance of ast::Verbatim
967  * \return true if object of type ast::OntologyStatement
968  */
969  virtual bool is_verbatim () const noexcept;
970 
971  /**
972  * \brief Check if the ast node is an instance of ast::LineComment
973  * \return true if object of type ast::OntologyStatement
974  */
975  virtual bool is_line_comment () const noexcept;
976 
977  /**
978  * \brief Check if the ast node is an instance of ast::BlockComment
979  * \return true if object of type ast::OntologyStatement
980  */
981  virtual bool is_block_comment () const noexcept;
982 
983  /**
984  * \brief Check if the ast node is an instance of ast::OntologyStatement
985  * \return true if object of type ast::OntologyStatement
986  */
987  virtual bool is_ontology_statement () const noexcept;
988 
989  /**
990  * \brief Check if the ast node is an instance of ast::Program
991  * \return true if object of type ast::OntologyStatement
992  */
993  virtual bool is_program () const noexcept;
994 
995  /**
996  * \brief Check if the ast node is an instance of ast::NrnStateBlock
997  * \return true if object of type ast::OntologyStatement
998  */
999  virtual bool is_nrn_state_block () const noexcept;
1000 
1001  /**
1002  * \brief Check if the ast node is an instance of ast::EigenNewtonSolverBlock
1003  * \return true if object of type ast::OntologyStatement
1004  */
1005  virtual bool is_eigen_newton_solver_block () const noexcept;
1006 
1007  /**
1008  * \brief Check if the ast node is an instance of ast::EigenLinearSolverBlock
1009  * \return true if object of type ast::OntologyStatement
1010  */
1011  virtual bool is_eigen_linear_solver_block () const noexcept;
1012 
1013  /**
1014  * \brief Check if the ast node is an instance of ast::CvodeBlock
1015  * \return true if object of type ast::OntologyStatement
1016  */
1017  virtual bool is_cvode_block () const noexcept;
1018 
1019  /**
1020  * \brief Check if the ast node is an instance of ast::LongitudinalDiffusionBlock
1021  * \return true if object of type ast::OntologyStatement
1022  */
1023  virtual bool is_longitudinal_diffusion_block () const noexcept;
1024 
1025  /**
1026  * \brief Check if the ast node is an instance of ast::WrappedExpression
1027  * \return true if object of type ast::OntologyStatement
1028  */
1029  virtual bool is_wrapped_expression () const noexcept;
1030 
1031  /**
1032  * \brief Check if the ast node is an instance of ast::DerivimplicitCallback
1033  * \return true if object of type ast::OntologyStatement
1034  */
1035  virtual bool is_derivimplicit_callback () const noexcept;
1036 
1037  /**
1038  * \brief Check if the ast node is an instance of ast::SolutionExpression
1039  * \return true if object of type ast::OntologyStatement
1040  */
1041  virtual bool is_solution_expression () const noexcept;
1042 
1043  /**
1044  * \brief Check if the ast node is an instance of ast::UpdateDt
1045  * \return true if object of type ast::OntologyStatement
1046  */
1047  virtual bool is_update_dt () const noexcept;
1048 
1049 
1050  /**
1051  *\brief Parent getter
1052  *
1053  * returning a raw pointer may create less problems that the
1054  * shared_from_this from the parent.
1055  *
1056  * Check \ref Ast::parent for more information
1057  */
1058  virtual Ast* get_parent() const;
1059 
1060  /**
1061  *\brief Parent setter
1062  *
1063  * Usually, the parent pointer cannot be set in the constructor
1064  * because children are generally build BEFORE the parent. Conversely,
1065  * we set children parents directly in the parent constructor using
1066  * set_parent_in_children()
1067  *
1068  * Check \ref Ast::parent for more information
1069  */
1070  virtual void set_parent(Ast* p);
1071 };
1072 
1073 } // namespace nmodl::ast
Implementation of AST base class and it's properties.
THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
Represent token returned by scanner.
Definition: modtoken.hpp:50
Represent symbol table for a NMODL block.
Abstract base class for all constant visitors implementation.
Definition: visitor.hpp:302
Abstract base class for all visitors implementation.
Definition: visitor.hpp:39
Common utility functions for file/dir manipulation.
#define v
Definition: md1redef.h:11
virtual bool is_while_statement() const noexcept
Check if the ast node is an instance of ast::WhileStatement.
Definition: ast.cpp:232
virtual bool is_constant_var() const noexcept
Check if the ast node is an instance of ast::ConstantVar.
Definition: ast.cpp:178
virtual bool is_for_netcon() const noexcept
Check if the ast node is an instance of ast::ForNetcon.
Definition: ast.cpp:158
virtual bool is_watch() const noexcept
Check if the ast node is an instance of ast::Watch.
Definition: ast.cpp:200
virtual bool is_wrapped_expression() const noexcept
Check if the ast node is an instance of ast::WrappedExpression.
Definition: ast.cpp:302
virtual bool is_function_block() const noexcept
Check if the ast node is an instance of ast::FunctionBlock.
Definition: ast.cpp:142
virtual bool is_electrode_cur_var() const noexcept
Check if the ast node is an instance of ast::ElectrodeCurVar.
Definition: ast.cpp:102
virtual bool is_external() const noexcept
Check if the ast node is an instance of ast::External.
Definition: ast.cpp:278
virtual bool is_table_statement() const noexcept
Check if the ast node is an instance of ast::TableStatement.
Definition: ast.cpp:258
virtual std::string get_nmodl_name() const
Return NMODL statement of ast node as std::string.
Definition: ast.hpp:124
virtual bool is_nonspecific() const noexcept
Check if the ast node is an instance of ast::Nonspecific.
Definition: ast.cpp:264
virtual bool is_update_dt() const noexcept
Check if the ast node is an instance of ast::UpdateDt.
Definition: ast.cpp:308
virtual bool is_number() const noexcept
Check if the ast node is an instance of ast::Number.
Definition: ast.cpp:72
virtual bool is_param_block() const noexcept
Check if the ast node is an instance of ast::ParamBlock.
Definition: ast.cpp:116
virtual bool is_lin_equation() const noexcept
Check if the ast node is an instance of ast::LinEquation.
Definition: ast.cpp:196
virtual bool is_random_var_list() const noexcept
Check if the ast node is an instance of ast::RandomVarList.
Definition: ast.cpp:272
virtual bool is_useion() const noexcept
Check if the ast node is an instance of ast::Useion.
Definition: ast.cpp:262
virtual bool is_after_block() const noexcept
Check if the ast node is an instance of ast::AfterBlock.
Definition: ast.cpp:154
virtual bool is_verbatim() const noexcept
Check if the ast node is an instance of ast::Verbatim.
Definition: ast.cpp:282
virtual bool is_conductance_hint() const noexcept
Check if the ast node is an instance of ast::ConductanceHint.
Definition: ast.cpp:224
virtual bool is_constant_statement() const noexcept
Check if the ast node is an instance of ast::ConstantStatement.
Definition: ast.cpp:256
virtual bool is_solution_expression() const noexcept
Check if the ast node is an instance of ast::SolutionExpression.
Definition: ast.cpp:306
virtual bool is_string() const noexcept
Check if the ast node is an instance of ast::String.
Definition: ast.cpp:74
virtual bool is_global_var() const noexcept
Check if the ast node is an instance of ast::GlobalVar.
Definition: ast.cpp:106
virtual bool is_mutex_lock() const noexcept
Check if the ast node is an instance of ast::MutexLock.
Definition: ast.cpp:242
virtual bool is_react_var_name() const noexcept
Check if the ast node is an instance of ast::ReactVarName.
Definition: ast.cpp:94
virtual bool is_unary_expression() const noexcept
Check if the ast node is an instance of ast::UnaryExpression.
Definition: ast.cpp:192
virtual bool is_ontology_statement() const noexcept
Check if the ast node is an instance of ast::OntologyStatement.
Definition: ast.cpp:288
virtual bool is_expression_statement() const noexcept
Check if the ast node is an instance of ast::ExpressionStatement.
Definition: ast.cpp:226
virtual bool is_indexed_name() const noexcept
Check if the ast node is an instance of ast::IndexedName.
Definition: ast.cpp:88
virtual bool is_else_statement() const noexcept
Check if the ast node is an instance of ast::ElseStatement.
Definition: ast.cpp:238
virtual bool is_function_table_block() const noexcept
Check if the ast node is an instance of ast::FunctionTableBlock.
Definition: ast.cpp:140
virtual bool is_discrete_block() const noexcept
Check if the ast node is an instance of ast::DiscreteBlock.
Definition: ast.cpp:138
virtual bool is_range_var() const noexcept
Check if the ast node is an instance of ast::RangeVar.
Definition: ast.cpp:104
virtual bool is_integer() const noexcept
Check if the ast node is an instance of ast::Integer.
Definition: ast.cpp:76
virtual bool is_ast() const noexcept
Check if the ast node is an instance of ast::Ast.
Definition: ast.cpp:60
virtual const ModToken * get_token() const
Return associated token for the AST node.
Definition: ast.cpp:36
virtual bool is_derivimplicit_callback() const noexcept
Check if the ast node is an instance of ast::DerivimplicitCallback.
Definition: ast.cpp:304
virtual bool is_random_var() const noexcept
Check if the ast node is an instance of ast::RandomVar.
Definition: ast.cpp:110
virtual bool is_unary_operator() const noexcept
Check if the ast node is an instance of ast::UnaryOperator.
Definition: ast.cpp:182
virtual bool is_name() const noexcept
Check if the ast node is an instance of ast::Name.
Definition: ast.cpp:84
virtual bool is_var_name() const noexcept
Check if the ast node is an instance of ast::VarName.
Definition: ast.cpp:90
virtual bool is_pointer_var() const noexcept
Check if the ast node is an instance of ast::PointerVar.
Definition: ast.cpp:108
virtual bool is_derivative_block() const noexcept
Check if the ast node is an instance of ast::DerivativeBlock.
Definition: ast.cpp:132
virtual AstNodeType get_node_type() const =0
Return type (ast::AstNodeType) of AST node.
virtual Ast * clone() const
Create a copy of the current node.
Definition: ast.cpp:26
virtual bool is_independent_block() const noexcept
Check if the ast node is an instance of ast::IndependentBlock.
Definition: ast.cpp:118
virtual bool is_watch_statement() const noexcept
Check if the ast node is an instance of ast::WatchStatement.
Definition: ast.cpp:240
virtual bool is_protect_statement() const noexcept
Check if the ast node is an instance of ast::ProtectStatement.
Definition: ast.cpp:228
virtual bool is_range() const noexcept
Check if the ast node is an instance of ast::Range.
Definition: ast.cpp:268
virtual symtab::SymbolTable * get_symbol_table() const
Return associated symbol table for the AST node.
Definition: ast.cpp:38
virtual std::shared_ptr< StatementBlock > get_statement_block() const
Return associated statement block for the AST node.
Definition: ast.cpp:32
virtual bool is_extern_var() const noexcept
Check if the ast node is an instance of ast::ExternVar.
Definition: ast.cpp:114
virtual bool is_block_comment() const noexcept
Check if the ast node is an instance of ast::BlockComment.
Definition: ast.cpp:286
virtual bool is_nrn_state_block() const noexcept
Check if the ast node is an instance of ast::NrnStateBlock.
Definition: ast.cpp:292
virtual void set_symbol_table(symtab::SymbolTable *symtab)
Set symbol table for the AST node.
Definition: ast.cpp:42
virtual bool is_eigen_linear_solver_block() const noexcept
Check if the ast node is an instance of ast::EigenLinearSolverBlock.
Definition: ast.cpp:296
virtual bool is_suffix() const noexcept
Check if the ast node is an instance of ast::Suffix.
Definition: ast.cpp:260
virtual bool is_paren_expression() const noexcept
Check if the ast node is an instance of ast::ParenExpression.
Definition: ast.cpp:186
virtual void accept(visitor::Visitor &v)=0
Accept (or visit) the AST node using current visitor.
virtual bool is_local_list_statement() const noexcept
Check if the ast node is an instance of ast::LocalListStatement.
Definition: ast.cpp:212
virtual bool is_solve_block() const noexcept
Check if the ast node is an instance of ast::SolveBlock.
Definition: ast.cpp:148
virtual bool is_statement_block() const noexcept
Check if the ast node is an instance of ast::StatementBlock.
Definition: ast.cpp:130
virtual bool is_net_receive_block() const noexcept
Check if the ast node is an instance of ast::NetReceiveBlock.
Definition: ast.cpp:146
virtual bool is_pointer() const noexcept
Check if the ast node is an instance of ast::Pointer.
Definition: ast.cpp:274
virtual bool is_state_block() const noexcept
Check if the ast node is an instance of ast::StateBlock.
Definition: ast.cpp:122
virtual bool is_write_ion_var() const noexcept
Check if the ast node is an instance of ast::WriteIonVar.
Definition: ast.cpp:98
virtual void negate()
Negate the value of AST node.
Definition: ast.cpp:50
virtual Ast * get_parent() const
Parent getter.
Definition: ast.cpp:311
virtual bool is_bbcore_pointer_var() const noexcept
Check if the ast node is an instance of ast::BbcorePointerVar.
Definition: ast.cpp:112
virtual bool is_nonspecific_cur_var() const noexcept
Check if the ast node is an instance of ast::NonspecificCurVar.
Definition: ast.cpp:100
virtual bool is_initial_block() const noexcept
Check if the ast node is an instance of ast::InitialBlock.
Definition: ast.cpp:124
virtual bool is_diff_eq_expression() const noexcept
Check if the ast node is an instance of ast::DiffEqExpression.
Definition: ast.cpp:190
virtual bool is_reaction_operator() const noexcept
Check if the ast node is an instance of ast::ReactionOperator.
Definition: ast.cpp:184
virtual bool is_longitudinal_diffusion_block() const noexcept
Check if the ast node is an instance of ast::LongitudinalDiffusionBlock.
Definition: ast.cpp:300
virtual bool is_double_unit() const noexcept
Check if the ast node is an instance of ast::DoubleUnit.
Definition: ast.cpp:170
virtual std::string get_node_type_name() const =0
Return type (ast::AstNodeType) of ast node as std::string.
virtual bool is_conserve() const noexcept
Check if the ast node is an instance of ast::Conserve.
Definition: ast.cpp:246
virtual bool is_cvode_block() const noexcept
Check if the ast node is an instance of ast::CvodeBlock.
Definition: ast.cpp:298
virtual bool is_lon_diffuse() const noexcept
Check if the ast node is an instance of ast::LonDiffuse.
Definition: ast.cpp:250
virtual bool is_node() const noexcept
Check if the ast node is an instance of ast::Node.
Definition: ast.cpp:62
virtual bool is_limits() const noexcept
Check if the ast node is an instance of ast::Limits.
Definition: ast.cpp:174
virtual bool is_if_statement() const noexcept
Check if the ast node is an instance of ast::IfStatement.
Definition: ast.cpp:234
virtual bool is_param_assign() const noexcept
Check if the ast node is an instance of ast::ParamAssign.
Definition: ast.cpp:220
virtual bool is_unit_block() const noexcept
Check if the ast node is an instance of ast::UnitBlock.
Definition: ast.cpp:162
virtual bool is_argument() const noexcept
Check if the ast node is an instance of ast::Argument.
Definition: ast.cpp:92
virtual bool is_expression() const noexcept
Check if the ast node is an instance of ast::Expression.
Definition: ast.cpp:66
virtual void visit_children(visitor::ConstVisitor &v) const =0
Visit children i.e.
virtual bool is_line_comment() const noexcept
Check if the ast node is an instance of ast::LineComment.
Definition: ast.cpp:284
virtual bool is_statement() const noexcept
Check if the ast node is an instance of ast::Statement.
Definition: ast.cpp:64
virtual bool is_binary_operator() const noexcept
Check if the ast node is an instance of ast::BinaryOperator.
Definition: ast.cpp:180
virtual bool is_function_call() const noexcept
Check if the ast node is an instance of ast::FunctionCall.
Definition: ast.cpp:198
virtual bool is_lag_statement() const noexcept
Check if the ast node is an instance of ast::LagStatement.
Definition: ast.cpp:254
virtual bool is_non_lin_equation() const noexcept
Check if the ast node is an instance of ast::NonLinEquation.
Definition: ast.cpp:194
virtual bool is_identifier() const noexcept
Check if the ast node is an instance of ast::Identifier.
Definition: ast.cpp:70
virtual bool is_define() const noexcept
Check if the ast node is an instance of ast::Define.
Definition: ast.cpp:216
virtual bool is_non_linear_block() const noexcept
Check if the ast node is an instance of ast::NonLinearBlock.
Definition: ast.cpp:136
virtual bool is_unit_state() const noexcept
Check if the ast node is an instance of ast::UnitState.
Definition: ast.cpp:210
virtual bool is_constant_block() const noexcept
Check if the ast node is an instance of ast::ConstantBlock.
Definition: ast.cpp:164
virtual bool is_unit_def() const noexcept
Check if the ast node is an instance of ast::UnitDef.
Definition: ast.cpp:204
virtual bool is_boolean() const noexcept
Check if the ast node is an instance of ast::Boolean.
Definition: ast.cpp:82
virtual std::string get_node_name() const
Return name of of the node.
Definition: ast.cpp:28
virtual bool is_neuron_block() const noexcept
Check if the ast node is an instance of ast::NeuronBlock.
Definition: ast.cpp:166
Ast * parent
Generic pointer to the parent.
Definition: ast.hpp:75
virtual bool is_block() const noexcept
Check if the ast node is an instance of ast::Block.
Definition: ast.cpp:68
virtual bool is_else_if_statement() const noexcept
Check if the ast node is an instance of ast::ElseIfStatement.
Definition: ast.cpp:236
virtual bool is_global() const noexcept
Check if the ast node is an instance of ast::Global.
Definition: ast.cpp:270
virtual bool is_reaction_statement() const noexcept
Check if the ast node is an instance of ast::ReactionStatement.
Definition: ast.cpp:252
virtual void accept(visitor::ConstVisitor &v) const =0
Accept (or visit) the AST node using a given visitor.
virtual bool is_program() const noexcept
Check if the ast node is an instance of ast::Program.
Definition: ast.cpp:290
virtual void visit_children(visitor::Visitor &v)=0
Visit children i.e.
virtual std::shared_ptr< Ast > get_shared_ptr()
get std::shared_ptr from this pointer of the AST node
Definition: ast.cpp:52
virtual bool is_procedure_block() const noexcept
Check if the ast node is an instance of ast::ProcedureBlock.
Definition: ast.cpp:144
virtual bool is_ba_block() const noexcept
Check if the ast node is an instance of ast::BABlock.
Definition: ast.cpp:156
virtual bool is_ba_block_type() const noexcept
Check if the ast node is an instance of ast::BABlockType.
Definition: ast.cpp:202
virtual void set_name(const std::string &name)
Set name for the AST node.
Definition: ast.cpp:46
virtual bool is_destructor_block() const noexcept
Check if the ast node is an instance of ast::DestructorBlock.
Definition: ast.cpp:128
virtual bool is_eigen_newton_solver_block() const noexcept
Check if the ast node is an instance of ast::EigenNewtonSolverBlock.
Definition: ast.cpp:294
virtual bool is_local_var() const noexcept
Check if the ast node is an instance of ast::LocalVar.
Definition: ast.cpp:172
virtual bool is_include() const noexcept
Check if the ast node is an instance of ast::Include.
Definition: ast.cpp:218
virtual bool is_breakpoint_block() const noexcept
Check if the ast node is an instance of ast::BreakpointBlock.
Definition: ast.cpp:150
virtual bool is_kinetic_block() const noexcept
Check if the ast node is an instance of ast::KineticBlock.
Definition: ast.cpp:160
virtual bool is_assigned_block() const noexcept
Check if the ast node is an instance of ast::AssignedBlock.
Definition: ast.cpp:120
virtual ~Ast()=default
virtual bool is_before_block() const noexcept
Check if the ast node is an instance of ast::BeforeBlock.
Definition: ast.cpp:152
virtual bool is_constructor_block() const noexcept
Check if the ast node is an instance of ast::ConstructorBlock.
Definition: ast.cpp:126
virtual void set_parent(Ast *p)
Parent setter.
Definition: ast.cpp:315
virtual bool is_number_range() const noexcept
Check if the ast node is an instance of ast::NumberRange.
Definition: ast.cpp:176
virtual bool is_from_statement() const noexcept
Check if the ast node is an instance of ast::FromStatement.
Definition: ast.cpp:230
virtual bool is_prime_name() const noexcept
Check if the ast node is an instance of ast::PrimeName.
Definition: ast.cpp:86
virtual bool is_model() const noexcept
Check if the ast node is an instance of ast::Model.
Definition: ast.cpp:214
virtual bool is_linear_block() const noexcept
Check if the ast node is an instance of ast::LinearBlock.
Definition: ast.cpp:134
virtual bool is_valence() const noexcept
Check if the ast node is an instance of ast::Valence.
Definition: ast.cpp:208
virtual bool is_float() const noexcept
Check if the ast node is an instance of ast::Float.
Definition: ast.cpp:78
virtual bool is_double() const noexcept
Check if the ast node is an instance of ast::Double.
Definition: ast.cpp:80
virtual bool is_unit() const noexcept
Check if the ast node is an instance of ast::Unit.
Definition: ast.cpp:168
virtual bool is_electrode_current() const noexcept
Check if the ast node is an instance of ast::ElectrodeCurrent.
Definition: ast.cpp:266
virtual bool is_read_ion_var() const noexcept
Check if the ast node is an instance of ast::ReadIonVar.
Definition: ast.cpp:96
virtual bool is_thread_safe() const noexcept
Check if the ast node is an instance of ast::ThreadSafe.
Definition: ast.cpp:280
virtual bool is_compartment() const noexcept
Check if the ast node is an instance of ast::Compartment.
Definition: ast.cpp:248
virtual bool is_mutex_unlock() const noexcept
Check if the ast node is an instance of ast::MutexUnlock.
Definition: ast.cpp:244
virtual bool is_factor_def() const noexcept
Check if the ast node is an instance of ast::FactorDef.
Definition: ast.cpp:206
virtual bool is_bbcore_pointer() const noexcept
Check if the ast node is an instance of ast::BbcorePointer.
Definition: ast.cpp:276
virtual bool is_assigned_definition() const noexcept
Check if the ast node is an instance of ast::AssignedDefinition.
Definition: ast.cpp:222
virtual bool is_binary_expression() const noexcept
Check if the ast node is an instance of ast::BinaryExpression.
Definition: ast.cpp:188
AstNodeType
Enum type for every AST node type.
Definition: ast_decl.hpp:166
const char * name
Definition: init.cpp:16
Abstract Syntax Tree (AST) related implementations.
Definition: ast_common.hpp:29
size_t p
Base class for all Abstract Syntax Tree node types.
Definition: ast.hpp:52