-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
If a yaml file contains number end with dot .
, for example score: 2.
, fkyaml::node::deserialize()
will throw exception:
test: /home/name/fkYAML/include/fkYAML/detail/input/scalar_scanner.hpp:188: static fkyaml::v0_3_10::detail::lexical_token_t fkyaml::v0_3_10::detail::scalar_scanner::scan_after_decimal_point(std::__cxx11::basic_string<char>::const_iterator, std::size_t, bool): Assertion `size > 0' failed.
Reproduction steps
To reproduce, use fkYAML to parse this yaml file:
score: 2.
Also, number in array will cause exception:
data: [1., 2.]
I parse yaml file use the following code:
#include <fstream>
#include "fkYAML/node.hpp"
int main(int argc, char* argv[])
{
std::ifstream ifs("example.yml");
fkyaml::node root = fkyaml::node::deserialize(ifs);
ifs.close();
return 0;
}
I add fkYAML into my cmake project use add_subdirectory()
.
Expected vs. actual results
Actual result: parse fail if number end with dot .
in yaml file.
Expect: parse as float or double number successfully.
Minimal code example
No response
Error messages
No response
Compiler and operating system
ubuntu 20.04, CXX compiler: c++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Library version
v0_3_10
Validation
- The bug also occurs if the latest version from the
develop
branch is used. - I can successfully compile and run the unit tests.
fktn-k
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working