simonask / libyaml-safer Goto Github PK
View Code? Open in Web Editor NEWThis project forked from dtolnay/unsafe-libyaml
YAML library, based on unsafe-libyaml
License: MIT License
This project forked from dtolnay/unsafe-libyaml
YAML library, based on unsafe-libyaml
License: MIT License
Minimal reproducer:
let mut data: &[u8] = b"[!,";
let mut parser = libyaml_safer::Parser::new();
parser.set_input_string(&mut data);
let _ = libyaml_safer::Document::load(&mut parser);
Minimal reproducer:
let mut data: &[u8] = b"a: ''|\n 0";
let mut parser = libyaml_safer::Parser::new();
parser.set_input_string(&mut data);
let _ = libyaml_safer::Document::load(&mut parser);
Thanks for creating this library! I've been working with it for a couple of months, mostly using the event-based Parser API.
One thing I've noticed is that CRLF line endings are not working (I work on a Windows machine), in that they are resulting in double-line feeds (\n\n
) in strings coming out of the library, and incorrect line numbers in Marks.
I believe the fix is very simple. Line 143 of scanner.rs
(in read_line_break
) should read:
if let ('\r', Some('\n')) = (front, self.buffer.get(1).copied()) {
Similar to line 111, and to the corresponding libyaml implementation (https://github.com/yaml/libyaml/blob/1e66c1e13a50577bd7ad76abec61ba436d0145bd/src/scanner.c#L533)
I cloned locally and made this change, and it did resolve my issue. I have not done any further testing. I'm happy to open a PR but I'm not sure if you're accepting contributions to this repo.
Now that serde_yaml
is unmaintained, add implementations of serde::Serializer/Deserializer
directly to libyaml-safer
to provide an alternative.
The initial implementation should be 1:1 compatible with the behavior of serde_yaml
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.