aboutsummaryrefslogtreecommitdiff
path: root/bbot/manifest.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bbot/manifest.cxx')
-rw-r--r--bbot/manifest.cxx38
1 files changed, 35 insertions, 3 deletions
diff --git a/bbot/manifest.cxx b/bbot/manifest.cxx
index 0f7a053..1d164db 100644
--- a/bbot/manifest.cxx
+++ b/bbot/manifest.cxx
@@ -16,6 +16,7 @@
#include <butl/utility> // digit()
#include <butl/tab-parser>
+#include <butl/string-parser>
#include <butl/manifest-parser>
#include <butl/manifest-serializer>
@@ -442,14 +443,16 @@ namespace bbot
{
try
{
- config.emplace_back (variable (move (tf.value)));
+ check_config (tf.value);
}
- catch (const invalid_variable& e)
+ catch (const invalid_argument& e)
{
bad_value (string ("invalid task configuration: ") + e.what (),
- tf.column - 1 + e.pos,
+ tf.column - 1,
tl.line - 1);
}
+
+ config.emplace_back (move (tf.value));
}
}
}
@@ -520,6 +523,35 @@ namespace bbot
s.next ("", ""); // End of manifest.
}
+ strings task_manifest::
+ unquoted_config ()
+ {
+ return string_parser::unquote (config);
+ }
+
+ void task_manifest::
+ check_config (const string& s)
+ {
+ auto i (s.begin ());
+ auto e (s.end ());
+
+ // Iterate until the variable name end and check that it contains no
+ // whitespaces.
+ //
+ for (; i != e; ++i)
+ {
+ char c (*i);
+
+ if (c == ' ' || c == '\t') // Whitespace in name.
+ throw invalid_argument ("expected variable assignment");
+ else if (c == '=')
+ break;
+ }
+
+ if (i == e)
+ throw invalid_argument ("no variable value");
+ }
+
// task_response_manifest
//
task_response_manifest::