aboutsummaryrefslogtreecommitdiff
path: root/include/ninja/Ninja.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-09-20 14:55:58 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:28:02 +0200
commit28ebe56853d4ec2d08dcbd5559d3d62bce3295c6 (patch)
treebf7bdd6293cb9270ad719965fff1496030568f44 /include/ninja/Ninja.hpp
parent51816fb672101335a48718b1177805725a2babe0 (diff)
Add raw arg type, validate names
Diffstat (limited to 'include/ninja/Ninja.hpp')
-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;
};