mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Implemented adjacent key:value pairs when the key is JSON-like
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
namespace YAML
|
||||
{
|
||||
Scanner::Scanner(std::istream& in)
|
||||
: INPUT(in), m_startedStream(false), m_endedStream(false), m_simpleKeyAllowed(false)
|
||||
: INPUT(in), m_startedStream(false), m_endedStream(false), m_simpleKeyAllowed(false), m_canBeJSONFlow(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace YAML
|
||||
if((InBlockContext() ? Exp::Key : Exp::KeyInFlow).Matches(INPUT))
|
||||
return ScanKey();
|
||||
|
||||
if((InBlockContext() ? Exp::Value : Exp::ValueInFlow).Matches(INPUT))
|
||||
if(GetValueRegex().Matches(INPUT))
|
||||
return ScanValue();
|
||||
|
||||
// alias/anchor
|
||||
@@ -226,6 +226,16 @@ namespace YAML
|
||||
return false;
|
||||
}
|
||||
|
||||
// GetValueRegex
|
||||
// . Get the appropriate regex to check if it's a value token
|
||||
const RegEx& Scanner::GetValueRegex() const
|
||||
{
|
||||
if(InBlockContext())
|
||||
return Exp::Value;
|
||||
|
||||
return m_canBeJSONFlow ? Exp::ValueInJSONFlow : Exp::ValueInFlow;
|
||||
}
|
||||
|
||||
// StartStream
|
||||
// . Set the initial conditions for starting a stream.
|
||||
void Scanner::StartStream()
|
||||
@@ -410,3 +420,4 @@ namespace YAML
|
||||
m_anchors.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user