mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 07:28:22 -10:00
This adds an Antlr grammar for parsing argument lists instead of using a hand written parser. This allows to write much more complicated syntax constructs and have all the code being auto-generated. It will also produce a much more correct parser instead of having all those hacks in the hand-written one. This also adds (in addition to supporting the previous syntax) support for function types along with support for them in HTML and JSON output formats. The ANTLR generated parser is included in source form so that it is not necessary to have an ANTLR installation around if you are not going to change the grammar. Also includes the necessary runtime code from Antlr.
35 lines
767 B
C++
35 lines
767 B
C++
#include "tracing_category.h"
|
|
|
|
#include "tracing/tracing.h"
|
|
|
|
namespace scripting {
|
|
namespace api {
|
|
|
|
ADE_OBJ(l_TracingCategory, tracing::Category, "tracing_category", "A category for tracing engine performance");
|
|
|
|
ADE_FUNC(trace,
|
|
l_TracingCategory,
|
|
"function() => void body",
|
|
"Traces the run time of the specified function that will be invoked in this call.",
|
|
nullptr,
|
|
nullptr)
|
|
{
|
|
tracing::Category* category = nullptr;
|
|
luacpp::LuaFunction func;
|
|
if (!ade_get_args(L, "ou", l_TracingCategory.GetPtr(&category), &func)) {
|
|
return ADE_RETURN_NIL;
|
|
}
|
|
|
|
if (!func.isValid()) {
|
|
LuaError(L, "Invalid function reference passed!");
|
|
return ADE_RETURN_NIL;
|
|
}
|
|
|
|
TRACE_SCOPE(*category);
|
|
func(L);
|
|
return ADE_RETURN_NIL;
|
|
}
|
|
|
|
} // namespace api
|
|
} // namespace scripting
|