aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <0xdec05eba@gmail.com>2018-09-20 14:55:58 +0200
committerdec05eba <0xdec05eba@gmail.com>2018-09-20 14:56:00 +0200
commitefd1bdf5576ddcff21fecc0ff5efa4d53aa8d08d (patch)
tree66a3b4df93927cf89648a5534e4b0429b355d812 /include
parent64104c32c09d56a3a60aed2ac9096f0985f15e15 (diff)
Add raw arg type, validate names
Diffstat (limited to 'include')
-rw-r--r--include/ninja/Ninja.hpp14
1 files changed, 12 insertions, 2 deletions
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;
};