载入中...
搜索中...
未找到
eve::script 命名空间参考

struct  ScriptErrorContext
 Structured snapshot of a script error: message, throw site and stack. 更多...
 
struct  ScriptFrame
 One call-stack frame captured while the script error is still live. 更多...
 

函数

ScriptErrorContext captureScriptError (HSQUIRRELVM vm)
 Captures the pending runtime error from inside the Squirrel error handler.
 
ScriptErrorContext captureCompileError (HSQUIRRELVM vm)
 Captures the last compilation error recorded by the VM.
 
bool parseCompileError (const std::string &text, std::string *source, int *line, int *column, std::string *message)
 Parses the ssq compile message "Compile error at source:line:column msg".
 
std::string sourceLineText (const std::string &sourceText, int line)
 Extracts one 1-based line from script source text.
 
std::string formatStackTrace (const std::vector< ScriptFrame > &frames)
 Formats just the call-stack portion of a context.
 
std::string formatScriptError (const ScriptErrorContext &ctx)
 Formats a context into a human-readable multi-line report.
 
void setLastScriptError (HSQUIRRELVM vm, ScriptErrorContext ctx)
 Records the last error for a VM (thread-local, synchronous consumers).
 
ScriptErrorContext takeLastScriptError (HSQUIRRELVM vm)
 Consumes and clears the last recorded error for a VM.
 
const ScriptErrorContextpeekLastScriptError (HSQUIRRELVM vm)
 Peeks at the last recorded error for a VM without clearing it.
 
void clearLastScriptError (HSQUIRRELVM vm)
 Drops any recorded error for a VM.
 

函数说明

◆ captureCompileError()

ScriptErrorContext eve::script::captureCompileError ( HSQUIRRELVM  vm)

Captures the last compilation error recorded by the VM.

参数
vmVM whose compile just failed (ssq's compiler handler stores it).
返回
Context with message, source, line and column.

在文件 ScriptError.cpp103 行定义.

引用了 eve::script::ScriptErrorContext::column, eve::script::ScriptErrorContext::line, eve::script::ScriptErrorContext::message, parseCompileError(), eve::script::ScriptErrorContext::source , 以及 vm.

被这些函数引用 eve::dev::ConsolePanel::eval() , 以及 eve::dev::Debugger::evaluate().

◆ captureScriptError()

ScriptErrorContext eve::script::captureScriptError ( HSQUIRRELVM  vm)

Captures the pending runtime error from inside the Squirrel error handler.

参数
vmVM whose error handler is executing (error value at stack slot 2).
返回
Context with the message and the still-live call stack.

在文件 ScriptError.cpp80 行定义.

引用了 eve::script::ScriptFrame::function, eve::script::ScriptErrorContext::function, eve::script::ScriptFrame::line, eve::script::ScriptErrorContext::line, eve::script::ScriptErrorContext::message, eve::script::ScriptFrame::source, eve::script::ScriptErrorContext::source, eve::script::ScriptErrorContext::stack , 以及 vm.

◆ clearLastScriptError()

void eve::script::clearLastScriptError ( HSQUIRRELVM  vm)

Drops any recorded error for a VM.

参数
vmVM whose pending error should be forgotten.

在文件 ScriptError.cpp226 行定义.

引用了 vm.

被这些函数引用 eve::Runtime::shutdown().

◆ formatScriptError()

std::string eve::script::formatScriptError ( const ScriptErrorContext ctx)

◆ formatStackTrace()

std::string eve::script::formatStackTrace ( const std::vector< ScriptFrame > &  frames)

Formats just the call-stack portion of a context.

参数
framesFrames to render, innermost first.
返回
One "source:line in function" line per frame, newline separated.

在文件 ScriptError.cpp175 行定义.

被这些函数引用 formatScriptError().

◆ parseCompileError()

bool eve::script::parseCompileError ( const std::string &  text,
std::string *  source,
int *  line,
int *  column,
std::string *  message 
)

Parses the ssq compile message "Compile error at source:line:column msg".

参数
textMessage produced by ssq::CompileException::what().
sourceReceives the source name (may be nullptr).
lineReceives the 1-based line (may be nullptr).
columnReceives the 1-based column (may be nullptr).
messageReceives the raw compiler description (may be nullptr).
返回
True when the message matched the expected layout.

在文件 ScriptError.cpp120 行定义.

引用了 line.

被这些函数引用 captureCompileError().

◆ peekLastScriptError()

const ScriptErrorContext * eve::script::peekLastScriptError ( HSQUIRRELVM  vm)

Peeks at the last recorded error for a VM without clearing it.

参数
vmVM the error belongs to.
返回
Pointer to the stored context, or nullptr when none is pending.

在文件 ScriptError.cpp220 行定义.

引用了 vm.

◆ setLastScriptError()

void eve::script::setLastScriptError ( HSQUIRRELVM  vm,
ScriptErrorContext  ctx 
)

Records the last error for a VM (thread-local, synchronous consumers).

参数
vmVM the error belongs to.
ctxContext to store.

在文件 ScriptError.cpp206 行定义.

引用了 vm.

◆ sourceLineText()

std::string eve::script::sourceLineText ( const std::string &  sourceText,
int  line 
)

Extracts one 1-based line from script source text.

参数
sourceTextFull script source.
line1-based line number.
返回
The line without trailing newline, or empty when out of range.

在文件 ScriptError.cpp159 行定义.

引用了 line.

◆ takeLastScriptError()

ScriptErrorContext eve::script::takeLastScriptError ( HSQUIRRELVM  vm)

Consumes and clears the last recorded error for a VM.

参数
vmVM the error belongs to.
返回
The stored context, or an empty context when none is pending.

在文件 ScriptError.cpp211 行定义.

引用了 vm.

被这些函数引用 eve::dev::ConsolePanel::eval(), eve::dev::Debugger::evaluate() , 以及 eve::Runtime::execute().