-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMatch.cpp
More file actions
38 lines (31 loc) · 963 Bytes
/
Copy pathMatch.cpp
File metadata and controls
38 lines (31 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "Match.hpp"
#include "memory/Heap.hpp"
#include "runtime/PyDict.hpp"
#include "runtime/PyInteger.hpp"
#include "runtime/PyList.hpp"
#include "runtime/PyMappingProxy.hpp"
#include "runtime/PyObject.hpp"
#include "runtime/PyTuple.hpp"
#include "runtime/types/api.hpp"
#include "runtime/types/builtin.hpp"
#include "utilities.hpp"
#include "vm/VM.hpp"
using namespace py;
using namespace py::sre;
namespace {
static PyType *s_sre_match = nullptr;
}
Match::Match(PyType *type) : PyBaseObject(type) {}
Match::Match() : PyBaseObject(s_sre_match) {}
PyResult<Match *> Match::create()
{
auto obj = VirtualMachine::the().heap().allocate<Match>();
if (!obj) { return Err(memory_error(sizeof(Match))); }
return Ok(obj);
}
void Match::visit_graph(Visitor &visitor) { PyObject::visit_graph(visitor); }
PyType *Match::register_type(PyModule *module)
{
if (!s_sre_match) { s_sre_match = klass<Match>(module, "_sre.Match").finalize(); }
return s_sre_match;
}