Skip to content
Snippets Groups Projects
Select Git revision
  • c49a94cea294117dbc8ae7be94692354302a8c25
  • master default protected
  • noelp-master-patch-87404
  • disable-view
  • experimental_rel
  • test_quiggeldy_service
  • update-arbor-0.10.0
  • image_build
  • spack_v0.22.1
  • ebrains-24-04
  • update-readme
  • create-module-file
  • add-nestml-tests
  • feat_add_py-norse
  • update-libneuroml
  • update-bluebrain-packages
  • feat_arbor_install_all_binaries
  • ebrains-23.09-jsc-site-config
  • spack-v0.20.0
  • ebrains-23-09-spack-v0.19.2
  • ebrains-23-09
21 results

load_sim_tools.sh

Blame
  • astmanip.hpp 1.21 KiB
    #pragma once
    
    // Helper utilities for manipulating/modifying AST.
    
    #include <string>
    
    #include "expression.hpp"
    #include "location.hpp"
    #include "scope.hpp"
    
    // Create new local variable symbol and local declaration expression in current scope.
    // Returns the local declaration expression.
    
    struct local_declaration {
        expression_ptr local_decl;
        expression_ptr id;
        scope_ptr scope;
    };
    
    local_declaration make_unique_local_decl(
        scope_ptr scope,
        Location loc,
        std::string const& prefix="ll");
    
    // Create a local declaration as for `make_unique_local_decl`, together with an
    // assignment to it from the given expression, using the location of that expression.
    // Returns local declaration expression, assignment expression, new identifier id and
    // consequent scope.
    
    struct local_assignment {
        expression_ptr local_decl;
        expression_ptr assignment;
        expression_ptr id;
        scope_ptr scope;
    };
    
    local_assignment make_unique_local_assign(
        scope_ptr scope,
        Expression* e,
        std::string const& prefix="ll");
    
    inline local_assignment make_unique_local_assign(
        scope_ptr scope,
        expression_ptr& e,
        std::string const& prefix="ll")
    {
        return make_unique_local_assign(scope, e.get(), prefix);
    }