diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-09-20 14:55:58 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:28:02 +0200 |
commit | 28ebe56853d4ec2d08dcbd5559d3d62bce3295c6 (patch) | |
tree | bf7bdd6293cb9270ad719965fff1496030568f44 /include/ninja | |
parent | 51816fb672101335a48718b1177805725a2babe0 (diff) |
Add raw arg type, validate names
Diffstat (limited to 'include/ninja')
-rw-r--r-- | include/ninja/Ninja.hpp | 14 |
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; }; |