summaryrefslogtreecommitdiff
path: root/tools/common/toml.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2018-06-03 14:57:05 +0800
committerJohn Hodge <tpg@ucc.asn.au>2018-06-03 14:57:05 +0800
commitbf8f8b4b4a9fe273451be59f68acafbe61968b83 (patch)
tree82993550cb3c88de0edbd55d79e4ea8e8cefffac /tools/common/toml.cpp
parent39b3cf53798683e496804f8322da2254b10850f4 (diff)
parenta7fb27789a2b34543851d207120e2c0001ee9c27 (diff)
downloadmrust-bf8f8b4b4a9fe273451be59f68acafbe61968b83.tar.gz
Merge branch 'master' of https://github.com/thepowersgang/mrustc
Diffstat (limited to 'tools/common/toml.cpp')
-rw-r--r--tools/common/toml.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/common/toml.cpp b/tools/common/toml.cpp
index 9fad0ec4..75a93810 100644
--- a/tools/common/toml.cpp
+++ b/tools/common/toml.cpp
@@ -170,9 +170,11 @@ TomlKeyValue TomlFile::get_next_value()
throw ::std::runtime_error(::format("Unexpected token after key - ", t));
t = Token::lex_from(m_if);
+ // --- Value ---
TomlKeyValue rv;
switch(t.m_type)
{
+ // String: Return the string value
case Token::Type::String:
rv.path = m_current_block;
rv.path.insert(rv.path.end(), m_current_composite.begin(), m_current_composite.end());
@@ -180,6 +182,7 @@ TomlKeyValue TomlFile::get_next_value()
rv.value = TomlValue { t.m_data };
break;
+ // Array: Parse the entire list and return as Type::List
case Token::Type::SquareOpen:
rv.path = m_current_block;
rv.path.insert(rv.path.end(), m_current_composite.begin(), m_current_composite.end());
@@ -193,7 +196,8 @@ TomlKeyValue TomlFile::get_next_value()
if( t.m_type == Token::Type::SquareClose )
break;
- // TODO: Recurse parse a value
+ // TODO: Recursively parse a value
+ // TODO: OR, support other value types
switch(t.m_type)
{
case Token::Type::String: