Files
asarium bb0631ab6e Support vararg specifiers in Lua documentation
This was the last thing that was missing for complete support of all
function parameter declarations.

To ensure parameter lists stay valid a unit test was added that will
validate the argument lists and cause the test to fail if they cannot be
parsed.
2020-10-12 17:59:57 +02:00

35 lines
649 B
C++

#pragma once
#include "globalincs/pstypes.h"
#include "ade_doc.h"
namespace scripting {
struct argument_def {
ade_type_info type;
SCP_string name;
SCP_string def_val;
bool optional = false;
SCP_string comment;
};
class argument_list_parser {
public:
explicit argument_list_parser(const SCP_vector<SCP_string>& validTypeNames);
bool parse(const SCP_string& argumentList);
const SCP_vector<scripting::argument_def>& getArgList() const;
const SCP_string& getErrorMessage() const;
private:
SCP_unordered_set<SCP_string> _validTypeNames;
SCP_vector<argument_def> _argList;
SCP_string _errorMessage;
};
} // namespace scripting