diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-05-26 02:42:30 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2020-05-26 02:42:30 -0500 |
commit | 8b00a5779ace2b919f6d9f31fb50d37086a78914 (patch) | |
tree | ae07a14086aead37138c494207515e8e2ee914c4 /hscript/meta.cc | |
parent | 441543b73cffd6c589e4c848113dd126d984e07f (diff) | |
download | horizon-8b00a5779ace2b919f6d9f31fb50d37086a78914.tar.gz horizon-8b00a5779ace2b919f6d9f31fb50d37086a78914.tar.bz2 horizon-8b00a5779ace2b919f6d9f31fb50d37086a78914.tar.xz horizon-8b00a5779ace2b919f6d9f31fb50d37086a78914.zip |
hscript: Implement (undocumented, untested) 'version' key
Diffstat (limited to 'hscript/meta.cc')
-rw-r--r-- | hscript/meta.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/hscript/meta.cc b/hscript/meta.cc index fd3e69b..ab8bdb5 100644 --- a/hscript/meta.cc +++ b/hscript/meta.cc @@ -655,3 +655,21 @@ bool SvcEnable::execute() const { #endif /* HAS_INSTALL_ENV */ return true; /* LCOV_EXCL_LINE */ } + +Key *Version::parseFromData(const std::string &data, + const ScriptLocation &pos, int *errors, int *, + const Script *script) { + const static std::string valid_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890.-_"; + + if(data.find_first_not_of(valid_chars) != std::string::npos) { + if(errors) *errors += 1; + output_error(pos, "version: invalid version", data); + return nullptr; + } + + return new Version(script, pos, data); +} + +bool Version::execute() const { + return true; +} |