aboutsummaryrefslogtreecommitdiff
path: root/src/amberscript/parser.cc
diff options
context:
space:
mode:
authoralan-baker <alanbaker@google.com>2021-01-14 15:26:09 -0500
committerGitHub <noreply@github.com>2021-01-14 15:26:09 -0500
commit508bc75eda4f7f8c942093d8c6a2bd0a621e2da4 (patch)
tree4b0360cceed3431b779344b1a5aaeafb4f65c4bf /src/amberscript/parser.cc
parentace2bdee2dbcc2f21ac823ea2f2a9d5698a6cc2c (diff)
downloadamber-508bc75eda4f7f8c942093d8c6a2bd0a621e2da4.tar.gz
Allow hex for values in expect commands (#937)
* Handled the same as parsing buffer data
Diffstat (limited to 'src/amberscript/parser.cc')
-rw-r--r--src/amberscript/parser.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/amberscript/parser.cc b/src/amberscript/parser.cc
index fc5c948..50760f0 100644
--- a/src/amberscript/parser.cc
+++ b/src/amberscript/parser.cc
@@ -2907,7 +2907,7 @@ Result Parser::ParseValues(const std::string& name,
}
if (type::Type::IsFloat(segs[seg_idx].GetFormatMode())) {
- if (!token->IsInteger() && !token->IsDouble()) {
+ if (!token->IsInteger() && !token->IsDouble() && !token->IsHex()) {
return Result(std::string("Invalid value provided to ") + name +
" command: " + token->ToOriginalString());
}
@@ -2918,12 +2918,13 @@ Result Parser::ParseValues(const std::string& name,
v.SetDoubleValue(token->AsDouble());
} else {
- if (!token->IsInteger()) {
+ if (!token->IsInteger() && !token->IsHex()) {
return Result(std::string("Invalid value provided to ") + name +
" command: " + token->ToOriginalString());
}
- v.SetIntValue(token->AsUint64());
+ uint64_t val = token->IsHex() ? token->AsHex() : token->AsUint64();
+ v.SetIntValue(val);
}
++seg_idx;
if (seg_idx >= segs.size())