From efd1bdf5576ddcff21fecc0ff5efa4d53aa8d08d Mon Sep 17 00:00:00 2001 From: dec05eba <0xdec05eba@gmail.com> Date: Thu, 20 Sep 2018 14:55:58 +0200 Subject: Add raw arg type, validate names --- include/ninja/Ninja.hpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/ninja/Ninja.hpp b/include/ninja/Ninja.hpp index cd9be0a..e2b4ab5 100644 --- a/include/ninja/Ninja.hpp +++ b/include/ninja/Ninja.hpp @@ -12,7 +12,7 @@ namespace ninja NONE, VARIABLE_ALREADY_DEFINED, RULE_ALREADY_DEFINED, - RULE_AREADY_BUILT + INVALID_NAME }; class NinjaException : public std::runtime_error @@ -30,6 +30,7 @@ namespace ninja struct NinjaVariable { + NinjaVariable(const std::string &name); const std::string name; }; @@ -42,13 +43,22 @@ namespace ninja { NONE, VALUE, - VARIABLE + VARIABLE, + RAW }; NinjaArg() : type(Type::NONE) {} NinjaArg(const std::string &value) : type(Type::VALUE), arg(value) {} NinjaArg(const NinjaVariable &var) : type(Type::VARIABLE), arg(var.name) {} + static NinjaArg createRaw(const std::string &value) + { + NinjaArg arg; + arg.type = Type::RAW; + arg.arg = value; + return arg; + } + Type type; std::string arg; }; -- cgit v1.2.3