Cadabra
Computer algebra system for field theory problems
Loading...
Searching...
No Matches
CdbPython.hh
Go to the documentation of this file.
1
2#pragma once
3
4#include <string>
5#include <set>
6#include <pybind11/pybind11.h>
7
8namespace cadabra {
9
10 std::string escape_quotes(const std::string&);
11
18
19 std::string cdb2python(const std::string&, bool display);
20
21 std::string cdb2python_string(const std::string&, bool display, std::string& error);
22
29
30 int is_python_code_complete(const std::string&, std::string& error);
31
34 bool code_contains_variable(const std::string& code, const std::string& variable);
35
39 bool variables_in_code(const std::string& code, std::set<std::string>& variables);
40
46 bool variables_to_pull_in(const std::string& code, std::set<std::string>& variables);
47
50 std::string remove_variable_assignments(const std::string& code, const std::string& variable);
51
57 public:
59 ConvertData(const std::string&, const std::string&, const std::string&, const std::string&);
60
61 std::string lhs, rhs, op, indent;
62 };
63
78
79 std::pair<std::string, std::string> convert_line(const std::string&, ConvertData& cv, bool display);
80
89
90 #ifndef CDBPYTHON_NO_NOTEBOOK
91
92 std::string cnb2python(const std::string&, bool for_standalone);
93
94 #endif
95 }
Object to store pre-parsing intermediate results.
Definition CdbPython.hh:56
std::string op
Definition CdbPython.hh:61
std::string lhs
Definition CdbPython.hh:61
std::string indent
Definition CdbPython.hh:61
ConvertData()
Definition CdbPython.cc:392
std::string rhs
Definition CdbPython.hh:61
std::string cnb2python(const std::string &, bool for_standalone)
Convert a Cadabra notebook file to pure Python.
Definition CdbPython.cc:555
std::string cdb2python(const std::string &, bool display)
Convert a block of Cadabra notation into pure Python.
Definition CdbPython.cc:26
std::pair< std::string, std::string > convert_line(const std::string &, ConvertData &cv, bool display)
Detect Cadabra expression statements and rewrite to Python form.
Definition CdbPython.cc:402
Functions to handle the exchange properties of two or more symbols in a product.
Definition Adjform.cc:83
bool variables_in_code(const std::string &code, std::set< std::string > &variables)
Fill a set with all variables references in the given piece of Python code.
Definition CdbPython.cc:316
std::string remove_variable_assignments(const std::string &code, const std::string &variable)
Given a piece of Python code, remove all lines which assign a value to the given variable.
Definition CdbPython.cc:216
std::string cdb2python_string(const std::string &, bool display, std::string &error)
Definition CdbPython.cc:61
int is_python_code_complete(const std::string &, std::string &error)
Test whether a block of Python code is complete or requires more input lines.
Definition CdbPython.cc:167
bool variables_to_pull_in(const std::string &code, std::set< std::string > &variables)
Fill a set with all variables references inside of Cadabra pull-in constructions, that is,...
Definition CdbPython.cc:301
bool code_contains_variable(const std::string &code, const std::string &variable)
Determine if the python code code contains a reference to the variable variable by parsing it into an...
Definition CdbPython.cc:264
std::string escape_quotes(const std::string &)
Definition CdbPython.cc:18
void set(rset_t::iterator &num, multiplier_t fac)
Definition Storage.cc:1064