CDBL, a JSON alternative, Curly Brackets Document Layout
C++
CBDL Curly Bracket Document Layout
DRAFT ISSUED ON: Sept 25 2020
FreeBSD License
Existent parser is for demo purposes. 400 lines parser
Please Join if you find it usefull. In need for parsers for: JS, PHP and C++
No-more quotes.
No difference between array and a single value, numbers or strings.
convertion at user hand
Has includes.
Has references.
Has comments
Like this
x{
# this is a comment
%include:./included.css;
long_string{"a long string with escape \" and \\ and \} and \{ and \, characters and spaces must go between \"\""}
a_string{a_string_with_no_spaces_or_escapes}
the_float{3.45}
the_hex{0xFFCD}
xi_object{
a_shape{
rect{10,
10,
1000,
1000}
with_color{355,255,0}
and_name{therect}
}
and_a_circle{
center{@../shape/rect[0],@../shape/rect[1]}
with_color{@x/x1/shape/rect/color}
and_name{tire}
}
}
pi{3.14159264}
css_style:333; # must end with ;
ini_style=has_column; # must end with ;
}
An Alternative to JSON
Work in progress.
syntax
<{>
KEY{ENTITY,<ENTITY>...}
KEY=STRING_VALUE;
KEY:STRING_VALUE;
<}>
where
ENTITY=string
ENTITY=@path/to/another/key/from_root
ENTITY=@../../relative_path_to_another_key
ENTITY=" a atring with \" \} \{ \, \= \# \} \: escapes and apsces string"
ENTITY=KEY{ENTITY}
keywords
%include:filename
# commented line
Lookup
floatpi = std::stof ( aj["x"]["pi"].value() );
const Cbdler::Node& pd = aka["x"]["xi_object"]["shape"];
size_t elems = pd.count();
for(size_t i=0;i<pd.count();i++)
{
const std::string& v = pd.value(i);
// know the type and convert it.
OOO << v.c_str() << "\n";
}