summaryrefslogtreecommitdiffstats
path: root/src/cppvalue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cppvalue.cpp')
-rw-r--r--src/cppvalue.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cppvalue.cpp b/src/cppvalue.cpp
index 31f0ab5..b6e7f65 100644
--- a/src/cppvalue.cpp
+++ b/src/cppvalue.cpp
@@ -51,6 +51,16 @@ CPPValue parseHexadecimal(const std::string& token)
return CPPValue(val);
}
+CPPValue parseBinary(const std::string& token)
+{
+ long val = 0;
+ for (const char *p = token.c_str(); *p != 0; p++)
+ {
+ if (*p >= '0' && *p <= '1') val = val * 2 + *p - '0';
+ }
+ return CPPValue(val);
+}
+
CPPValue parseCharacter(const std::string& token) // does not work for '\n' and the alike
{
if (token[1]=='\\')