🛰️航天仿真算法库 SpaceAST
0.0.1
载入中...
搜索中...
未找到
Interpreter.hpp
浏览该文件的文档.
1
20
21
#pragma once
22
23
#include "AstGlobal.h"
24
#include "
SymbolTable.hpp
"
25
#include "
SymbolScope.hpp
"
26
#include "
CallStack.hpp
"
27
#include "
ScriptContext.hpp
"
28
#include <string>
29
30
AST_NAMESPACE_BEGIN
31
32
37
class
AST_SCRIPT_API
Interpreter
38
{
39
public
:
40
Interpreter
() =
default
;
41
~Interpreter
();
42
47
SymbolScope
*
currentScope
() {
return
&symbolScope_; }
48
54
void
interpret(
StringView
code);
55
56
61
const
std::string&
errString
()
const
{
return
errString_; }
62
63
68
void
setErrString
(
StringView
err) { errString_ = std::string(err); }
69
70
74
void
clearErrString
() { errString_.clear(); }
75
76
protected
:
77
SymbolScope
symbolScope_
;
78
std::string
errString_
;
79
};
80
85
class
InterpreterContext
{
86
public
:
87
InterpreterContext
(
Interpreter
& interpreter)
88
:
InterpreterContext
(&interpreter)
89
{
90
}
91
InterpreterContext
(
Interpreter
* interpreter)
92
: interpreter_(interpreter)
93
{
94
aScript_SetInterpreter
(interpreter);
95
}
96
~InterpreterContext
()
97
{
98
aScript_RemoveInterpreter
(interpreter_);
99
}
100
private
:
101
Interpreter
* interpreter_;
102
};
103
104
105
106
AST_NAMESPACE_END
CallStack.hpp
~
ScriptContext.hpp
SymbolScope.hpp
~
SymbolTable.hpp
~
ast::InterpreterContext
解释器上下文守卫
定义
Interpreter.hpp:85
ast::Interpreter
解释器
定义
Interpreter.hpp:38
ast::Interpreter::currentScope
SymbolScope * currentScope()
获取当前作用域
定义
Interpreter.hpp:47
ast::Interpreter::clearErrString
void clearErrString()
清除错误字符串
定义
Interpreter.hpp:74
ast::Interpreter::setErrString
void setErrString(StringView err)
设置错误字符串
定义
Interpreter.hpp:68
ast::Interpreter::errString_
std::string errString_
错误字符串
定义
Interpreter.hpp:78
ast::Interpreter::errString
const std::string & errString() const
获取错误字符串
定义
Interpreter.hpp:61
ast::Interpreter::symbolScope_
SymbolScope symbolScope_
当前作用域
定义
Interpreter.hpp:77
ast::StringViewBasic< char >
ast::SymbolScope
符号作用域
定义
SymbolScope.hpp:38
ast::aScript_RemoveInterpreter
void aScript_RemoveInterpreter(Interpreter *interpreter)
移除解释器指针
定义
ScriptContext.cpp:82
ast::aScript_SetInterpreter
void aScript_SetInterpreter(Interpreter *interpreter)
设置解释器指针
定义
ScriptContext.cpp:77
src
AstScript
Interpreter
Interpreter.hpp
制作者
1.12.0