blob: 9420bf91e30026dbd71251d792f2dbb9342ac53b (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#ifndef SWIG_REAL_TYPE_HH
#define SWIG_REAL_TYPE_HH
#include "helper.hh"
namespace {
using namespace ast;
class SwigAstTypeVisitor : public ConstVisitor
{
public:
PyObject *result;
SwigAstTypeVisitor() : GenVisitor<misc::constify_traits>() {}
~SwigAstTypeVisitor() {}
#define STHELPER(TYPE) STCONVERT(TYPE, p_ast__ ## TYPE)
STHELPER(ArrayExp)
STHELPER(ArrayTy)
STHELPER(AssignExp)
STHELPER(Ast)
STHELPER(BreakExp)
STHELPER(CallExp)
STHELPER(CastExp)
STHELPER(ChunkList)
STHELPER(ClassTy)
STHELPER(Field)
STHELPER(FieldInit)
STHELPER(FieldVar)
STHELPER(ForExp)
STHELPER(FunctionDec)
STHELPER(IfExp)
STHELPER(IntExp)
STHELPER(LetExp)
STHELPER(MethodCallExp)
STHELPER(MethodDec)
STHELPER(NameTy)
STHELPER(NilExp)
STHELPER(ObjectExp)
STHELPER(OpExp)
STHELPER(RecordExp)
STHELPER(RecordTy)
STHELPER(SeqExp)
STHELPER(SimpleVar)
STHELPER(StringExp)
STHELPER(SubscriptVar)
STHELPER(TypeDec)
STHELPER(VarDec)
STHELPER(WhileExp)
#undef STHELPER
#define STCHUNKHELPER(TYPE) \
STCONVERT(TYPE ## Chunk, p_ast__ChunkT_ast__ ## TYPE ## Dec_t)
STCHUNKHELPER(Function)
STCHUNKHELPER(Method)
STCHUNKHELPER(Type)
STCHUNKHELPER(Var)
#undef STCHUNKHELPER
};
} // namespace
PyObject *get_swig_real_ast_type(const ast::Ast& e)
{
SwigAstTypeVisitor stv;
e.accept(stv);
return stv.result;
}
#endif /* ! SWIG_REAL_TYPE_HH */
|