Files
asarium ca27ae16f2 Use Antlr for generating argument list parser
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.
2020-06-11 21:57:52 +02:00

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