commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
96848f42c9e6df7e1b8d67689cf41bf23f4c683a | David Aguilar | 2024-03-17T07:47:11 | Emit multi-line string values as block scalars | diff --git a/src/char_traits.rs b/src/char_traits.rs
index 4a08da1..5965cc4 100644
--- a/src/char_traits.rs
+++ b/src/char_traits.rs
@@ -109,3 +109,16 @@ pub(crate) fn is_uri_char(c: char) -> bool {
pub(crate) fn is_tag_char(c: char) -> bool {
is_uri_char(c) && !is_flow(c) && c != '!'
}
+
+/// Check if the strin... | 3 | 92 | 2 |
3f6544ba4976e97c313958be946e3810d1ef43d0 | Ethiraric | 2024-03-15T16:34:39 | Prepare for benchmarks. | diff --git a/Cargo.toml b/Cargo.toml
index 15425df..a87b239 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -35,3 +35,7 @@ path = "tools/dump_events.rs"
[[bin]]
name = "time_parse"
path = "tools/time_parse.rs"
+
+[[bin]]
+name = "run_bench"
+path = "tools/run_bench.rs"
diff --git a/tools/run_bench.rs b/tools/run_bench.r... | 3 | 81 | 1 |
5c56b897ec31e1751a5e5193835d62e58ee00376 | Ethiraric | 2024-03-15T11:47:40 | Create a deeper YAML in `nested.yaml`.
This requires heavily reducing the number of nodes since they are on
average more indented. Leaving 5M nodes results in files larger than
1GB. | diff --git a/tools/gen_large_yaml/src/main.rs b/tools/gen_large_yaml/src/main.rs
index d478e8b..1c7ee6e 100644
--- a/tools/gen_large_yaml/src/main.rs
+++ b/tools/gen_large_yaml/src/main.rs
@@ -26,7 +26,7 @@ fn main() -> std::io::Result<()> {
println!("Generating nested.yaml");
let mut out = BufWriter::new(F... | 2 | 3 | 2 |
9a6c7e0e9d3210a796ed80a5b394a318347061f9 | Ethiraric | 2024-02-13T23:35:41 | Add a generator for nested objects. | diff --git a/examples/gen_large_yaml/main.rs b/examples/gen_large_yaml/main.rs
index 4ba7ad9..cfc8d70 100644
--- a/examples/gen_large_yaml/main.rs
+++ b/examples/gen_large_yaml/main.rs
@@ -1,6 +1,7 @@
#![allow(dead_code)]
mod gen;
+mod nested;
use std::collections::HashMap;
@@ -8,8 +9,9 @@ use rand::{rngs::Thr... | 2 | 112 | 2 |
40de686d2a73ec7b39c239c30d183a3914fbccd7 | Ethiraric | 2024-02-13T22:10:32 | Replace `VecDeque` with `ArrayDeque`.
This removes all allocations in the `Scanner` code. The downside is that
the buffer is now stored in the `Scanner` structure, making it 48 bytes
larger. This however makes the code much more performant. | diff --git a/Cargo.toml b/Cargo.toml
index bf409e1..a24c258 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,7 @@ readme = "README.md"
edition = "2018"
[dependencies]
+arraydeque = "0.5.1"
linked-hash-map = "0.5.3"
[dev-dependencies]
diff --git a/src/scanner.rs b/src/scanner.rs
index eb16a44..24a33dd 10064... | 2 | 36 | 7 |
92b6fd0e16a85fbafa65a56fbe4faa88cd2e759f | Ethiraric | 2024-02-13T22:10:17 | Fix some clippy lints. | diff --git a/src/scanner.rs b/src/scanner.rs
index 15cda9c..eb16a44 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -414,7 +414,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
/// clone of) the same error.
#[inline]
pub fn get_error(&self) -> Option<ScanError> {
- self.error.as_ref().map(std:... | 4 | 27 | 27 |
aa98cdedf7cb24e9dd77a769aba5afe79c31a7f6 | Ethiraric | 2024-02-08T06:04:38 | Improve comments. | diff --git a/examples/gen_large_yaml/main.rs b/examples/gen_large_yaml/main.rs
index 15d0c31..4ba7ad9 100644
--- a/examples/gen_large_yaml/main.rs
+++ b/examples/gen_large_yaml/main.rs
@@ -43,7 +43,7 @@ impl Generator {
self.gen_array(writer, items_lo, items_hi, Generator::gen_record_object)
}
- /// ... | 1 | 2 | 1 |
4c926f6f5b316d10adaa34e1db095e2927c0e176 | Ethiraric | 2024-01-31T21:02:53 | Minor improvements. | diff --git a/src/scanner.rs b/src/scanner.rs
index b30cc9d..15cda9c 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -452,9 +452,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
/// Consume the next characters. It is assumed none of the next characters are blanks.
#[inline]
fn skip_n_non_blank(&mut se... | 1 | 37 | 35 |
0f146408dd03e3d05d751fd6a4fa176bff9cb9be | Ethiraric | 2024-01-30T22:11:00 | Add big string array bench generation. | diff --git a/examples/gen_large_yaml/gen.rs b/examples/gen_large_yaml/gen.rs
index b687371..2a7dffe 100644
--- a/examples/gen_large_yaml/gen.rs
+++ b/examples/gen_large_yaml/gen.rs
@@ -120,6 +120,12 @@ pub fn name(rng: &mut ThreadRng, len_lo: usize, len_hi: usize) -> String {
ret
}
+/// Generate a set of words.... | 2 | 23 | 1 |
70a6f4e4c2d5bb96f71097347dc728f2acf31d1d | Ethiraric | 2024-01-30T21:37:32 | Rename generator tool. | diff --git a/examples/gen_large_yaml_array/gen.rs b/examples/gen_large_yaml/gen.rs
similarity index 100%
rename from examples/gen_large_yaml_array/gen.rs
rename to examples/gen_large_yaml/gen.rs
diff --git a/examples/gen_large_yaml_array/main.rs b/examples/gen_large_yaml/main.rs
similarity index 100%
rename from exampl... | 2 | 0 | 0 |
512f10405028a01c3063691db29ddb3b2e27b132 | Ethiraric | 2024-01-25T02:06:18 | Improve `scan_plain_scalar` readability.
Take whitespace checking out of the innermost loop for performance. | diff --git a/src/char_traits.rs b/src/char_traits.rs
index b95318c..4a08da1 100644
--- a/src/char_traits.rs
+++ b/src/char_traits.rs
@@ -28,7 +28,7 @@ pub(crate) fn is_blank(c: char) -> bool {
///
/// `\0`, ` `, `\t`, `\n`, `\r`
#[inline]
-pub(crate) fn is_blankz(c: char) -> bool {
+pub(crate) fn is_blank_or_breakz(... | 2 | 89 | 64 |
dda77c8c1e049c7fc5d36a8aa32d80aec91d03ec | Ethiraric | 2024-01-24T22:02:02 | Avoid a trip to `self.buffer`.
`self.buffer` is a `VecDeque<char>`, meaning that characters are stored
on 4B. When reading as we used to do, this means that every 1 byte
character we read was turned into 4 bytes, which was turned into 1 byte
in `String::extend`.
Instead of going through `self.buffer`, use a local `St... | diff --git a/src/scanner.rs b/src/scanner.rs
index 900b243..4b46cb6 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -503,15 +503,13 @@ impl<T: Iterator<Item = char>> Scanner<T> {
self.ch()
}
- /// Read a character from the input stream, place it in the buffer and return it.
+ /// Read a charac... | 1 | 59 | 35 |
09b8454cb01ad7e8b26dbf091c75dce8e8a0e3e2 | Ethiraric | 2024-01-24T20:45:18 | Buffer block scalar lines.
Instead of doing a loop that goes:
* fetch from input stream
* push char into string
Make a loop that fetches characters while they're not a breakz and
_then_ extend the string. This avoids a bunch of reallocations. | diff --git a/src/scanner.rs b/src/scanner.rs
index c79ee82..900b243 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -503,6 +503,17 @@ impl<T: Iterator<Item = char>> Scanner<T> {
self.ch()
}
+ /// Read a character from the input stream, place it in the buffer and return it.
+ ///
+ /// No ch... | 1 | 36 | 5 |
f7bed8ebf598e4d2b07784a21aee395b32712f7f | Ethiraric | 2024-01-24T19:20:52 | Split `skip` into more specific variants.
This function is a hotpath and sometimes removing the conditional jump
to detect line breaks saves a bunch of instructions. | diff --git a/src/scanner.rs b/src/scanner.rs
index f932ca2..c79ee82 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -430,32 +430,58 @@ impl<T: Iterator<Item = char>> Scanner<T> {
}
}
- /// Consume the next character, remove it from the buffer and update the mark.
+ /// Consume the next charact... | 1 | 121 | 114 |
bc8a6ed8dc59cab4c05df293706aaf18ef69812e | Ethiraric | 2024-01-24T18:42:18 | Doing this leads to worse performance. | diff --git a/src/scanner.rs b/src/scanner.rs
index 1dcc583..f932ca2 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -441,7 +441,6 @@ impl<T: Iterator<Item = char>> Scanner<T> {
self.mark.line += 1;
self.mark.col = 0;
} else {
- // TODO(ethiraric, 20/12/2023): change to ... | 1 | 0 | 1 |
b63fa6fff89f5faa9fb4e8c13e12492e93df659e | Ethiraric | 2024-01-24T18:31:45 | Pre-load chars in `skip_block_scalar_indent`. | diff --git a/src/scanner.rs b/src/scanner.rs
index 01fcfd4..1dcc583 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -1661,14 +1661,14 @@ impl<T: Iterator<Item = char>> Scanner<T> {
/// Skip the block scalar indentation and empty lines.
fn skip_block_scalar_indent(&mut self, indent: usize, breaks: &mut Str... | 1 | 3 | 3 |
370ebd33c3c3b44709c15ae7017cc41e5832000e | Ethiraric | 2024-01-24T16:14:52 | Help the compiler inline `read_break`. | diff --git a/src/scanner.rs b/src/scanner.rs
index a666269..01fcfd4 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -513,20 +513,18 @@ impl<T: Iterator<Item = char>> Scanner<T> {
//
// A `\n` is pushed into `s`.
//
- // # Panics
+ // # Panics (in debug)
// If the next characters do not cor... | 1 | 7 | 9 |
c8ca0e456df66bd37dbeb18354fbdb478da70703 | Ethiraric | 2024-01-24T01:22:02 | Remove debug prints code from release builds.
If building release mode, remove debug code. Now, the `debug_print!`
macro resolves to nothing in release build.
In debug build, don't check the environment for each print. This has a
huge overhead. The environment is only checked once and next checks are
made against a s... | diff --git a/src/debug.rs b/src/debug.rs
new file mode 100644
index 0000000..b43ea2e
--- /dev/null
+++ b/src/debug.rs
@@ -0,0 +1,41 @@
+//! Debugging helpers.
+//!
+//! Debugging is governed by two conditions:
+//! 1. The build mode. Debugging code is not emitted in release builds and thus not available.
+//! 2. Th... | 4 | 55 | 16 |
ad0f48723fd3c86ca8cdd9d0948413eae8db6e30 | Ethiraric | 2024-01-24T00:02:20 | Move char `is_xxx` fn to their own file. | diff --git a/src/char_traits.rs b/src/char_traits.rs
new file mode 100644
index 0000000..b95318c
--- /dev/null
+++ b/src/char_traits.rs
@@ -0,0 +1,111 @@
+//! Holds functions to determine if a character belongs to a specific character set.
+
+/// Check whether the character is nil (`\0`).
+#[inline]
+pub(crate) fn is_z... | 3 | 123 | 113 |
8f602cb3fcf896fe31750acc0a5b486c6f2dc485 | Ethiraric | 2024-01-23T21:48:20 | Add benchmarking tools. | diff --git a/Cargo.toml b/Cargo.toml
index 209b969..bf409e1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,6 +18,8 @@ linked-hash-map = "0.5.3"
[dev-dependencies]
libtest-mimic = "0.3.0"
quickcheck = "0.9"
+rand = "0.8.5"
+lipsum = "0.9.0"
[profile.release-lto]
inherits = "release"
diff --git a/examples/gen_lar... | 4 | 397 | 0 |
fd9b00c1c118456cc7da263d767ac119a9911415 | Ethiraric | 2024-01-23T14:20:12 | Use OR for dual licensing.
https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#adding-metadata-to-a-new-crate | diff --git a/Cargo.toml b/Cargo.toml
index 845c80c..209b969 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ authors = [
"Ethiraric <ethiraric@gmail.com>"
]
documentation = "https://docs.rs/yaml-rust2"
-license = "MIT/Apache-2.0"
+license = "MIT OR Apache-2.0"
description = "A fully YAML 1.2 compliant YAM... | 1 | 1 | 1 |
d66f0d34714eab7a8913eba2b863f59f7f699946 | Ethiraric | 2024-01-22T23:08:05 | Fix null nodes with tags in flow constructs. | diff --git a/src/scanner.rs b/src/scanner.rs
index 6379234..ebbe35a 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -1188,7 +1188,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
}
}
- if is_blankz(self.look_ch()) {
+ if is_blankz(self.look_ch()) || (self.flow_level > 0 && is_f... | 2 | 4 | 27 |
691e83889ee210c6e7d874ec2c449d18a1885ae1 | Ethiraric | 2024-01-22T23:04:46 | Fix tag scanning. | diff --git a/src/scanner.rs b/src/scanner.rs
index 3f1b199..6379234 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -465,6 +465,24 @@ fn is_anchor_char(c: char) -> bool {
is_yaml_non_space(c) && !is_flow(c) && !is_z(c)
}
+/// Check whether the character is a valid word character.
+#[inline]
+fn is_word_char... | 2 | 89 | 36 |
96478b814bae7c9eca612786c5de42e33af9d995 | Ethiraric | 2024-01-22T22:09:20 | Fix indent in block scalars. | diff --git a/src/scanner.rs b/src/scanner.rs
index ef4986a..3f1b199 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -1643,8 +1643,14 @@ impl<T: Iterator<Item = char>> Scanner<T> {
return Ok(Token(start_mark, TokenType::Scalar(style, contents)));
}
- let start_mark = self.mark;
+ ... | 2 | 11 | 3 |
12eb78fca10108678454f4edeec6b561def10b53 | Ethiraric | 2024-01-22T22:03:02 | Fix dquote indentation. | diff --git a/src/scanner.rs b/src/scanner.rs
index 57a4295..ef4986a 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -1816,6 +1816,10 @@ impl<T: Iterator<Item = char>> Scanner<T> {
));
}
+ if (self.mark.col as isize) < self.indent {
+ return Err(ScanError::ne... | 2 | 8 | 2 |
c8a937d07bcb3c754beb0528e2eeb74d5995d23b | Ethiraric | 2024-01-22T21:56:18 | Fix dquote string escape sequences. | diff --git a/src/scanner.rs b/src/scanner.rs
index b9d0f16..57a4295 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -1986,7 +1986,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
'e' => ret = '\x1b',
' ' => ret = '\x20',
'"' => ret = '"',
- '\'' => ret = '\'',
+ ... | 2 | 1 | 3 |
37fd8b171a7800583d35f0b636e8a3ef80c63df7 | Ethiraric | 2024-01-22T20:33:18 | Fix tests related to anchor/alias indentation.
I have no idea what I'm doing. | diff --git a/src/scanner.rs b/src/scanner.rs
index 4a49666..b9d0f16 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -1463,6 +1463,13 @@ impl<T: Iterator<Item = char>> Scanner<T> {
));
}
+ // ???, fixes test G9HC.
+ if let Some(Token(mark, TokenType::Anchor(..) | TokenType::Tag(... | 2 | 13 | 4 |
bfd7539e23013d7fce2b4461dac0a7d8d889339f | Ethiraric | 2024-01-19T21:38:06 | Fix flow adjacent value with complex key. | diff --git a/src/scanner.rs b/src/scanner.rs
index 528fd8e..4a49666 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -311,6 +311,8 @@ pub struct Scanner<T> {
stream_start_produced: bool,
/// Whether we have already emitted the `StreamEnd` token.
stream_end_produced: bool,
+ /// In some flow context... | 2 | 11 | 1 |
75e0f0fb7bde80abc1cbcc239c9e3f6750d03388 | Ethiraric | 2024-01-19T21:15:41 | Lint and improve formatting. | diff --git a/tests/yaml-test-suite.rs b/tests/yaml-test-suite.rs
index 3637689..0933a59 100644
--- a/tests/yaml-test-suite.rs
+++ b/tests/yaml-test-suite.rs
@@ -37,12 +37,11 @@ fn main() -> Result<()> {
.iter()
.filter(|&&test| !tests.iter().any(|t| t.name == test))
.collect();
- if !missi... | 1 | 42 | 25 |
8c5dbfb1b656e0072b8c9dbf97825bd3391d389f | Ethiraric | 2024-01-19T20:57:39 | Fix use of dashes in flow contexts. | diff --git a/src/scanner.rs b/src/scanner.rs
index 6b3572f..528fd8e 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -2030,6 +2030,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
Ok(())
}
+ #[allow(clippy::too_many_lines)]
fn scan_plain_scalar(&mut self) -> Result<Token, ScanError> {
... | 2 | 10 | 5 |
750a9c8c54b051db4a7e5c85f60c5d733b29a18c | Ethiraric | 2024-01-19T19:21:36 | Fix block scalar / eof interactions. | diff --git a/src/scanner.rs b/src/scanner.rs
index 18a681f..6b3572f 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -18,7 +18,7 @@ pub enum TScalarStyle {
DoubleQuoted,
Literal,
- Foled,
+ Folded,
}
/// A location in a yaml document.
@@ -1508,15 +1508,21 @@ impl<T: Iterator<Item = char>> Scann... | 2 | 59 | 26 |
5942ed3a9213a41cbf952b704aec3131b526bb3a | Ethiraric | 2024-01-19T18:33:26 | Fix block scalars and document end interaction. | diff --git a/src/scanner.rs b/src/scanner.rs
index c0a7cef..18a681f 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -612,6 +612,16 @@ impl<T: Iterator<Item = char>> Scanner<T> {
}
}
+ /// Check whether the next characters correspond to an end of document.
+ ///
+ /// [`Self::lookahead`] mus... | 2 | 17 | 3 |
5f88cf2ebaf1a18f7921cc4c56bc5955890cd302 | Ethiraric | 2024-01-19T17:37:38 | Fix duplicate version directive. | diff --git a/src/parser.rs b/src/parser.rs
index b0b3188..d8c1009 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -498,15 +498,20 @@ impl<T: Iterator<Item = char>> Parser<T> {
}
fn parser_process_directives(&mut self) -> Result<(), ScanError> {
+ let mut version_directive_received = false;
... | 2 | 6 | 2 |
8304663b61ff0d75b9a6066e8b4b8ba29aacaca8 | Ethiraric | 2024-01-19T17:33:09 | Fixes towards implicit document end. | diff --git a/src/parser.rs b/src/parser.rs
index 658ffd5..b0b3188 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -271,9 +271,11 @@ impl<T: Iterator<Item = char>> Parser<T> {
self.token = None;
//self.peek_token();
}
+ /// Pops the top-most state and make it the current state.
fn pop_st... | 2 | 11 | 4 |
ca6d41880679a9373f6d59b7dd7dc32d9ffe4105 | Ethiraric | 2024-01-19T15:21:56 | Fixes towards spaces before comments. | diff --git a/src/scanner.rs b/src/scanner.rs
index 60a3d5b..c0a7cef 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -679,7 +679,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
&& is_blankz(self.buffer[3])
{
self.fetch_document_indicator(TokenType::DocumentEnd)?;
- self... | 2 | 25 | 31 |
722fc4517914603bf4229b8cdff347bc695e1ae9 | Ethiraric | 2024-01-19T13:55:06 | Fix possible misindent in block scalar. | diff --git a/src/scanner.rs b/src/scanner.rs
index cd139f4..60a3d5b 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -681,7 +681,10 @@ impl<T: Iterator<Item = char>> Scanner<T> {
self.fetch_document_indicator(TokenType::DocumentEnd)?;
self.skip_ws_to_eol(SkipTabs::Yes);
if !is_... | 2 | 16 | 7 |
f106469249f626837269328823f63d46bbfe6120 | Ethiraric | 2024-01-18T18:16:17 | Fix towards multiple documents in a single stream. | diff --git a/src/parser.rs b/src/parser.rs
index 41dc8b0..658ffd5 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -555,8 +555,10 @@ impl<T: Iterator<Item = char>> Parser<T> {
}
fn document_end(&mut self) -> ParseResult {
+ let mut explicit_end = false;
let marker: Marker = match *self.peek... | 2 | 7 | 2 |
a78e417dabbb593d16e9d15b4bcaabea95012db8 | Ethiraric | 2024-01-18T18:16:02 | Fix towards invalid trailing characters. | diff --git a/src/scanner.rs b/src/scanner.rs
index c9da122..cd139f4 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -679,6 +679,10 @@ impl<T: Iterator<Item = char>> Scanner<T> {
&& is_blankz(self.buffer[3])
{
self.fetch_document_indicator(TokenType::DocumentEnd)?;
+ sel... | 2 | 34 | 1 |
c672c20fdcf8b5db057cd27f7fbdddd8138e860c | Ethiraric | 2024-01-18T18:15:19 | Split `fetch_flow_scalar`. | diff --git a/src/scanner.rs b/src/scanner.rs
index 57ee8c8..c9da122 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -1741,98 +1741,15 @@ impl<T: Iterator<Item = char>> Scanner<T> {
));
}
- self.lookahead(2);
-
leading_blanks = false;
+ self.consume_... | 1 | 138 | 99 |
0aa75db5ce941d25aec87568f27163876f71ebb5 | Ethiraric | 2024-01-18T14:46:15 | Fix towards flow mapping and colons. | diff --git a/src/scanner.rs b/src/scanner.rs
index 8f2be8c..57ee8c8 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -1697,6 +1697,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
// From spec: To ensure JSON compatibility, if a key inside a flow mapping is JSON-like,
// YAML allows the following... | 2 | 1 | 3 |
9477a77045a160be4b1255cd690c520816e35f93 | Ethiraric | 2023-12-30T02:37:17 | Finally grasped how `SimpleKey` works.
This is a huge commit that cannot easily be broken down as it contains
fixes for the next ignored test in the suite which, one fixed, broke
tests that used to pass and were only then fixed.
There is also a substantial amount of comments that were added,
especially around `Simple... | diff --git a/src/scanner.rs b/src/scanner.rs
index a155108..8f2be8c 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -106,6 +106,7 @@ impl fmt::Display for ScanError {
}
}
+/// The contents of a scanner token.
#[derive(Clone, PartialEq, Debug, Eq)]
pub enum TokenType {
NoToken,
@@ -170,18 +171,79 @@ p... | 2 | 137 | 34 |
40ee35150b36bea79a28e75d1a8e024230df753a | Ethiraric | 2023-12-30T02:35:43 | Minor improvement to debug prints. | diff --git a/examples/dump_events.rs b/examples/dump_events.rs
index 49c564c..452eb69 100644
--- a/examples/dump_events.rs
+++ b/examples/dump_events.rs
@@ -16,7 +16,7 @@ struct EventSink {
impl MarkedEventReceiver for EventSink {
fn on_event(&mut self, ev: Event, mark: Marker) {
- eprintln!(" \x1B[;3... | 3 | 16 | 3 |
f2142e3a2754540b0928c80ceca2c1126b4a6fc6 | Ethiraric | 2023-12-28T00:48:19 | Fix anchor names' character set. | diff --git a/src/scanner.rs b/src/scanner.rs
index 75cc1ab..ce3ed86 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -351,6 +351,31 @@ fn is_flow(c: char) -> bool {
matches!(c, ',' | '[' | ']' | '{' | '}')
}
+/// Check whether the character is the BOM character.
+#[inline]
+fn is_bom(c: char) -> bool {
+ ... | 2 | 36 | 13 |
6371aa65b301886cf65f042ef7569aa1f10554d1 | Ethiraric | 2023-12-28T00:12:38 | Fix empty documents tests. | diff --git a/src/parser.rs b/src/parser.rs
index f55e4e3..a6f80a4 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -3,6 +3,7 @@ use std::collections::HashMap;
#[derive(Clone, Copy, PartialEq, Debug, Eq)]
enum State {
+ /// We await the start of the stream.
StreamStart,
ImplicitDocumentStart,
Docu... | 2 | 5 | 8 |
bcf32b8eac2cb1a69acf556143077d2b57368585 | Ethiraric | 2023-12-26T18:11:17 | Fix empty keys in implicit mappings. | diff --git a/src/scanner.rs b/src/scanner.rs
index 07c76b5..75cc1ab 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -251,6 +251,15 @@ pub struct Scanner<T> {
token_available: bool,
/// Whether all characters encountered since the last newline were whitespace.
leading_whitespace: bool,
+ /// Whethe... | 2 | 43 | 2 |
cf3e002793a45a9bb60b74c369f09e71a9e43404 | Ethiraric | 2023-12-26T17:27:47 | Add comments to `TokenType` and `Scanner`. | diff --git a/src/scanner.rs b/src/scanner.rs
index 9de8771..07c76b5 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -147,15 +147,26 @@ pub enum TokenType {
FlowMappingStart,
/// End of an inline mapping.
FlowMappingEnd,
+ /// An entry in a block sequence (c.f.: [`TokenType::BlockSequenceStart`]).
... | 1 | 18 | 2 |
27012589ba32e54466a0802391952bf6221c1f90 | Ethiraric | 2023-12-26T17:08:21 | Add debugging helpers. | diff --git a/examples/dump_events.rs b/examples/dump_events.rs
index 876902c..49c564c 100644
--- a/examples/dump_events.rs
+++ b/examples/dump_events.rs
@@ -16,6 +16,7 @@ struct EventSink {
impl MarkedEventReceiver for EventSink {
fn on_event(&mut self, ev: Event, mark: Marker) {
+ eprintln!(" \x1B[;3... | 3 | 10 | 2 |
91dbf4a6506594f24d5324ddfc6c552973bf06d6 | Ethiraric | 2023-12-26T17:06:20 | More fixes towards invalid tabs. | diff --git a/src/parser.rs b/src/parser.rs
index 62ffd6f..f55e4e3 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -234,6 +234,7 @@ impl<T: Iterator<Item = char>> Parser<T> {
}
}
+ /// Peek at the next token from the scanner.
fn peek_token(&mut self) -> Result<&Token, ScanError> {
matc... | 3 | 46 | 28 |
66b76209e7416047f907623c77b5b50c692178ea | Ethiraric | 2023-12-25T23:48:36 | More fixes towards invalid tabs? | diff --git a/src/scanner.rs b/src/scanner.rs
index 423a930..6da43bd 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -1915,7 +1915,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
self.skip();
if self.look_ch() == '\t'
&& !self.skip_ws_to_eol(SkipTabs::Yes).has_valid_yaml_ws()
- ... | 2 | 1 | 2 |
f3cf46f0416c546e12d34157fbf3695ab062c663 | Ethiraric | 2023-12-25T23:34:29 | More fixes towards invalid tabs. | diff --git a/src/scanner.rs b/src/scanner.rs
index 03e2a1a..423a930 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -718,9 +718,13 @@ impl<T: Iterator<Item = char>> Scanner<T> {
/// Skip yaml whitespace at most up to eol. Also skips comments.
fn skip_ws_to_eol(&mut self, skip_tabs: SkipTabs) -> SkipTabs {... | 2 | 31 | 5 |
2ffeea95c690f5c65db91e6554b698b799051237 | Ethiraric | 2023-12-25T22:48:32 | More fixes towards invalid tabs. | diff --git a/src/scanner.rs b/src/scanner.rs
index 4d31447..03e2a1a 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -1819,6 +1819,12 @@ impl<T: Iterator<Item = char>> Scanner<T> {
while is_blank(self.look_ch()) || is_break(self.ch()) {
if is_blank(self.ch()) {
if l... | 2 | 6 | 3 |
24013ae799293f42dc465bc29e36b4b180008aca | Ethiraric | 2023-12-23T23:02:42 | More fixes towards invalid tabs. | diff --git a/src/scanner.rs b/src/scanner.rs
index dc3a314..4d31447 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -648,7 +648,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
&& self.leading_whitespace
&& (self.mark.col as isize) < self.indent =>
{
- ... | 1 | 40 | 13 |
ac176ee10ff1dbfe219f9eca1075bcfc90b4913e | Ethiraric | 2023-12-23T22:25:14 | Fix towards invalid tabs. | diff --git a/src/scanner.rs b/src/scanner.rs
index be639a1..dc3a314 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -680,8 +680,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
/// Skip over YAML whitespace (` `, `\n`, `\r`).
///
/// # Errors
- /// This function returns an error if the character a... | 1 | 18 | 7 |
7b3bfafc100307352432f4f7ec68c1c733e17213 | Ethiraric | 2023-12-23T22:01:06 | Fix indent when `-` & entry have `\n` in-between. | diff --git a/src/scanner.rs b/src/scanner.rs
index 964a580..be639a1 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -181,6 +181,31 @@ impl SimpleKey {
}
}
+/// An indentation level on the stack of indentations.
+#[derive(Clone, Debug, Default)]
+struct Indent {
+ /// The former indentation level.
+ in... | 2 | 123 | 31 |
13463dc9bac6615107707a572083707f835051a4 | Ethiraric | 2023-12-22T15:11:07 | More fixes towards invalid tabs. | diff --git a/src/scanner.rs b/src/scanner.rs
index 23c56ba..964a580 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -638,6 +638,50 @@ impl<T: Iterator<Item = char>> Scanner<T> {
Ok(())
}
+ /// Skip over YAML whitespace (` `, `\n`, `\r`).
+ ///
+ /// # Errors
+ /// This function returns a... | 2 | 45 | 2 |
cbd00e6af3a8450adeb270dd61a080ef4b2134e9 | Ethiraric | 2023-12-22T14:43:28 | Fix DK95-00, I guess. | diff --git a/src/scanner.rs b/src/scanner.rs
index de22531..23c56ba 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -595,6 +595,11 @@ impl<T: Iterator<Item = char>> Scanner<T> {
Ok(())
}
+ /// Skip over all whitespace and comments until the next token.
+ ///
+ /// # Errors
+ /// This fun... | 2 | 18 | 9 |
39691204560b59622bfe22921c203ecfd0640bd3 | Ethiraric | 2023-12-21T19:02:56 | Rework block scalar indent skipping. | diff --git a/src/scanner.rs b/src/scanner.rs
index 3c2690c..de22531 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -1274,8 +1274,13 @@ impl<T: Iterator<Item = char>> Scanner<T> {
increment
}
}
+
// Scan the leading line breaks and determine the indentation level if n... | 1 | 39 | 14 |
919d99f830c20f58b1d2be5213a99d3278911b67 | Ethiraric | 2023-12-20T23:14:08 | Minor improvements. | diff --git a/src/scanner.rs b/src/scanner.rs
index 2cda77c..3c2690c 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -129,8 +129,15 @@ pub enum TokenType {
DocumentStart,
/// The end of a YAML document (`...`).
DocumentEnd,
+ /// The start of a sequence block.
+ ///
+ /// Sequence blocks are ... | 3 | 27 | 12 |
4e8624fda7012b714b342a46d64f7172de1d2803 | Ethiraric | 2023-12-20T23:13:53 | More fixes towards tabulations. | diff --git a/src/scanner.rs b/src/scanner.rs
index 3fdd98d..2cda77c 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -1585,7 +1585,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
let mut leading_break = String::new();
let mut trailing_breaks = String::new();
let mut whitespaces = String::... | 2 | 2 | 7 |
7b7ab26f8c6f18f547b20d5cf19deb99db7a1b92 | Ethiraric | 2023-12-20T22:14:22 | Fix more inappropriate use of tabs. | diff --git a/src/scanner.rs b/src/scanner.rs
index 4643368..3fdd98d 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -193,6 +193,8 @@ pub struct Scanner<T> {
flow_level: u8,
tokens_parsed: usize,
token_available: bool,
+ /// Whether all characters encountered since the last newline were whitespace.... | 2 | 31 | 9 |
9382e2cc2d21fdf66f58946159630e6ef3d764db | Ethiraric | 2023-11-19T20:16:52 | Use type aliases where appropriate. | diff --git a/src/scanner.rs b/src/scanner.rs
index 4da5515..4643368 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -1780,7 +1780,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
}
}
- fn save_simple_key(&mut self) -> Result<(), ScanError> {
+ fn save_simple_key(&mut self) -> ScanResult {
... | 1 | 1 | 1 |
2020903c959368b493460c77b6adc715b8842bf3 | Ethiraric | 2023-11-19T18:13:01 | Doccomment `is_` series of functions. | diff --git a/src/scanner.rs b/src/scanner.rs
index ae77813..4da5515 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -211,38 +211,55 @@ impl<T: Iterator<Item = char>> Iterator for Scanner<T> {
}
}
+/// Check whether the character is nil (`\0`).
#[inline]
fn is_z(c: char) -> bool {
c == '\0'
}
+
+/// ... | 1 | 19 | 0 |
bd65bd0c866e8e25c20f9a65c520f8ce05439093 | Ethiraric | 2023-11-19T16:08:28 | Fix tab used as indentation checks. | diff --git a/src/scanner.rs b/src/scanner.rs
index a271602..ae77813 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -378,6 +378,12 @@ impl<T: Iterator<Item = char>> Scanner<T> {
self.mark
}
+ // Read and consume a line break (either `\r`, `\n` or `\r\n`).
+ //
+ // A `\n` is pushed into `s`... | 2 | 16 | 27 |
a1805ac3b04b59579c36572a7ce35992875da3bc | Ethiraric | 2023-11-19T15:36:04 | Handle "!!" tag overriding. | diff --git a/src/parser.rs b/src/parser.rs
index 433de60..62ffd6f 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -948,14 +948,20 @@ impl<T: Iterator<Item = char>> Parser<T> {
/// Resolve a tag from the handle and the suffix.
fn resolve_tag(&self, mark: Marker, handle: &str, suffix: String) -> Result<Tag, S... | 2 | 13 | 11 |
8df8bd1b1d41c0364ad45259c1796ede36c1e9e5 | Ethiraric | 2023-11-19T15:28:05 | Remove stale tag handling code. | diff --git a/tests/yaml-test-suite.rs b/tests/yaml-test-suite.rs
index d1e32d3..bd57d15 100644
--- a/tests/yaml-test-suite.rs
+++ b/tests/yaml-test-suite.rs
@@ -203,11 +203,7 @@ fn escape_text(text: &str) -> String {
fn format_tag(tag: &Option<Tag>) -> String {
if let Some(tag) = tag {
- let ns = match t... | 1 | 1 | 5 |
e0872e2880830531d9928e8743e1fad70ffcdc61 | Ethiraric | 2023-11-19T15:22:04 | Don't inherit tag directives between documents. | diff --git a/src/parser.rs b/src/parser.rs
index ed07e64..433de60 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -510,7 +510,6 @@ impl<T: Iterator<Item = char>> Parser<T> {
self.tags = tags;
self.skip();
}
- // TODO tag directive
Ok(())
}
@@ -557,7 +556,7 @@ ... | 2 | 1 | 3 |
9e18d7e9ebdab5ecd93ab1cef68f4e57b58185ae | Ethiraric | 2023-11-19T15:00:19 | Reslove tag directives. | diff --git a/src/parser.rs b/src/parser.rs
index aa5a35e..ed07e64 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -100,6 +100,10 @@ pub struct Parser<T> {
current: Option<(Event, Marker)>,
anchors: HashMap<String, usize>,
anchor_id: usize,
+ /// The tag directives (`%TAG`) the parser has encountered... | 3 | 64 | 18 |
1957a4a5add38468a392395a581562c5fa778ee8 | Ethiraric | 2023-11-19T13:52:21 | Remove `_` prefix to used method. | diff --git a/src/parser.rs b/src/parser.rs
index 85bd252..aa5a35e 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -468,7 +468,7 @@ impl<T: Iterator<Item = char>> Parser<T> {
| TokenType::DocumentStart,
) => {
// explicit document
- self._explicit_document_... | 1 | 3 | 3 |
30bceec0435db910189269a00daba1e92239dba9 | Ethiraric | 2023-11-19T13:40:01 | Propagate tag to SequenceStart event. | diff --git a/src/parser.rs b/src/parser.rs
index a83bdc4..85bd252 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -55,6 +55,8 @@ pub enum Event {
SequenceStart(
/// The anchor ID of the start of the squence.
usize,
+ /// An optional tag
+ Option<Tag>,
),
SequenceEnd,
... | 3 | 16 | 13 |
4c82594e0be56f130ab1156af34c4a8b8d93fe52 | Ethiraric | 2023-11-19T00:09:41 | Propagate tag to MappingStart event. | diff --git a/src/parser.rs b/src/parser.rs
index c885856..a83bdc4 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -51,7 +51,7 @@ pub enum Event {
usize,
),
/// Value, style, anchor_id, tag
- Scalar(String, TScalarStyle, usize, Option<TokenType>),
+ Scalar(String, TScalarStyle, usize, Option<T... | 4 | 55 | 29 |
a999a7ea45ccf5ca7d2e93ef27c82fddebbc5147 | Ethiraric | 2023-11-18T19:29:40 | Minor improvements.
* Doc comments
* Helper functions
* Line breaks for readability | diff --git a/src/scanner.rs b/src/scanner.rs
index ed8c592..9f42cc1 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -264,11 +264,15 @@ impl<T: Iterator<Item = char>> Scanner<T> {
token_available: false,
}
}
+
#[inline]
pub fn get_error(&self) -> Option<ScanError> {
self... | 2 | 50 | 22 |
2f9b229eb59e44b8879bc1e0367712e304209bcc | Ethiraric | 2023-08-18T00:09:56 | Rustfmt + clippy. | diff --git a/tests/yaml-test-suite.rs b/tests/yaml-test-suite.rs
index 6b3bf29..f32e8a3 100644
--- a/tests/yaml-test-suite.rs
+++ b/tests/yaml-test-suite.rs
@@ -1,17 +1,14 @@
use std::fs::{self, DirEntry};
-use libtest_mimic::{Arguments, Test, Outcome, run_tests};
+use libtest_mimic::{run_tests, Arguments, Outcome, ... | 1 | 48 | 35 |
78eaca57824bd1225fcd8d9e49ebf219a1dd0982 | Ethiraric | 2023-08-18T00:04:21 | Move emitter/scanner tests to their folder.
Change scanner's complex test:
```diff
- *coffee:
+ *coffee :
amount: 4
- *cookies:
+ *cookies :
amount: 4
```
According to https://play.yaml.io/main/parser, this example was invalid
in the first place. Adding a space makes it so that the colon is not
part of ... | diff --git a/src/emitter.rs b/src/emitter.rs
index bf1bbaa..081654a 100644
--- a/src/emitter.rs
+++ b/src/emitter.rs
@@ -334,302 +334,3 @@ fn need_quotes(string: &str) -> bool {
|| string.parse::<i64>().is_ok()
|| string.parse::<f64>().is_ok()
}
-
-#[cfg(test)]
-#[allow(clippy::similar_names)]
-mod t... | 5 | 737 | 745 |
bbe4c670d900f9f7f7a4aff00deba1637f7df5c8 | Denis Lisov | 2022-01-19T00:03:53 | yaml-test-suite: print the YAML text on failure | diff --git a/tests/yaml-test-suite.rs b/tests/yaml-test-suite.rs
index 9048ebe..61f54b6 100644
--- a/tests/yaml-test-suite.rs
+++ b/tests/yaml-test-suite.rs
@@ -14,6 +14,7 @@ use yaml_rust::{
type Result<T, E=Box<dyn std::error::Error>> = std::result::Result<T, E>;
struct YamlTest {
+ yaml_visual: String,
y... | 1 | 7 | 1 |
f0090a7698d8de0ebb899e567fbbd8a2fbebf470 | Denis Lisov | 2022-01-18T10:47:16 | yaml-test-suite: print the names of missing XFAILs | diff --git a/tests/yaml-test-suite.rs b/tests/yaml-test-suite.rs
index 0972e26..49f74d7 100644
--- a/tests/yaml-test-suite.rs
+++ b/tests/yaml-test-suite.rs
@@ -35,8 +35,11 @@ fn main() -> Result<()> {
let mut tests: Vec<_> = tests.into_iter().flatten().collect();
tests.sort_by_key(|t| t.name.clone());
- ... | 1 | 5 | 2 |
c822dd0d77e0297bc588bbc281974ecb60e44b19 | Denis Lisov | 2022-01-18T00:59:58 | yaml-test-suite: ensure all XFAILs do exist as tests | diff --git a/tests/yaml-test-suite.rs b/tests/yaml-test-suite.rs
index 8316e7a..0972e26 100644
--- a/tests/yaml-test-suite.rs
+++ b/tests/yaml-test-suite.rs
@@ -34,6 +34,11 @@ fn main() -> Result<()> {
.collect::<Result<_>>()?;
let mut tests: Vec<_> = tests.into_iter().flatten().collect();
tests.sort... | 1 | 5 | 0 |
4a6cd8d120218a92fe07c06dfa53f6358ff40c8a | Denis Lisov | 2022-01-18T00:57:40 | yaml-test-suite: add ignores and classify failures | diff --git a/tests/yaml-test-suite.rs b/tests/yaml-test-suite.rs
index 06433bd..8316e7a 100644
--- a/tests/yaml-test-suite.rs
+++ b/tests/yaml-test-suite.rs
@@ -291,4 +291,83 @@ static EXPECTED_FAILURES: &[&str] = &[
"U3C3",
"Z9M4",
"P76L", // overriding the `!!` namespace!
+
+ // These seem to be pla... | 1 | 79 | 0 |
b6c03671adcff034d6de849a0868c5bfa0e1e768 | Denis Lisov | 2022-01-17T23:44:29 | yaml-test-suite: move to libtest-mimic | diff --git a/Cargo.toml b/Cargo.toml
index b779cfc..bd8aa94 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,8 +14,13 @@ edition = "2018"
linked-hash-map = "0.5.3"
[dev-dependencies]
+libtest-mimic = "0.3.0"
quickcheck = "0.9"
[profile.release-lto]
inherits = "release"
lto = true
+
+[[test]]
+name = "yaml-test... | 2 | 106 | 84 |
242c28eb5c0d04d0daacbbc8480280f4080e0a55 | Ethiraric | 2023-08-17T21:43:15 | Expose `ScanError::info`.
From https://github.com/chyh1990/yaml-rust/pull/190. | diff --git a/src/scanner.rs b/src/scanner.rs
index c352df8..d5ce224 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -21,6 +21,7 @@ pub enum TScalarStyle {
Foled,
}
+/// A location in a yaml document.
#[derive(Clone, Copy, PartialEq, Debug, Eq)]
pub struct Marker {
index: usize,
@@ -33,22 +34,26 @@ im... | 2 | 22 | 1 |
632421541c090574afb02b18c32000e49d5e8f0e | Ethiraric | 2023-08-17T00:18:07 | Add a dump_events example to aid debugging. | diff --git a/examples/dump_events.rs b/examples/dump_events.rs
new file mode 100644
index 0000000..876902c
--- /dev/null
+++ b/examples/dump_events.rs
@@ -0,0 +1,38 @@
+extern crate yaml_rust;
+
+use std::env;
+use std::fs::File;
+use std::io::prelude::*;
+use yaml_rust::{
+ parser::{MarkedEventReceiver, Parser},
+ ... | 1 | 38 | 0 |
a7b9b04e4f8503e98373c5359bf78a6dcbbf90f9 | Ethiraric | 2023-08-17T00:17:53 | Add a release-lto cargo profile. | diff --git a/Cargo.toml b/Cargo.toml
index 91d7da4..b779cfc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,3 +15,7 @@ linked-hash-map = "0.5.3"
[dev-dependencies]
quickcheck = "0.9"
+
+[profile.release-lto]
+inherits = "release"
+lto = true | 1 | 4 | 0 |
01051797b0456c9e3c74ef5d0a0a574e53c943c4 | Ethiraric | 2023-08-17T00:17:40 | Add documentation and move tests to their folder. | diff --git a/src/lib.rs b/src/lib.rs
index ee432ca..7ccd4db 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,21 +13,14 @@
//! yaml-rust = "0.4"
//! ```
//!
-//! And this in your crate root:
-//!
-//! ```rust
-//! extern crate yaml_rust;
-//! ```
-//!
-//! Parse a string into `Vec<Yaml>` and then serialize it as a YAM... | 4 | 597 | 478 |
1d71a23b151dcc12b289d0f06d8207dd9c764216 | Ethiraric | 2023-08-11T23:54:46 | Clippy set to pedantic. | diff --git a/examples/dump_yaml.rs b/examples/dump_yaml.rs
index 8fce0f3..3455a9a 100644
--- a/examples/dump_yaml.rs
+++ b/examples/dump_yaml.rs
@@ -21,13 +21,13 @@ fn dump_node(doc: &yaml::Yaml, indent: usize) {
yaml::Yaml::Hash(ref h) => {
for (k, v) in h {
print_indent(indent);... | 8 | 271 | 267 |
da52a68615f2ecdd6b7e4567019f280c433c1521 | Alexander Kjäll | 2021-07-12T07:48:17 | library is now in the crates repo (#164) | diff --git a/src/lib.rs b/src/lib.rs
index 6cf87c7..ae95e0f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -9,8 +9,8 @@
//! used by adding `yaml-rust` to the dependencies in your project's `Cargo.toml`.
//!
//! ```toml
-//! [dependencies.yaml-rust]
-//! git = "https://github.com/chyh1990/yaml-rust.git"
+//! [dependenci... | 1 | 2 | 2 |
6cd3ce4abe6894443645c48bdc375808ec911493 | Yuheng Chen | 2020-06-01T13:02:16 | Bump to v0.4.5 | diff --git a/Cargo.toml b/Cargo.toml
index 9444efa..91d7da4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yaml-rust"
-version = "0.4.4" # remember to update html_root_url
+version = "0.4.5" # remember to update html_root_url
authors = ["Yuheng Chen <yuhengchen@sensetime.com>"]
homepage ... | 2 | 2 | 2 |
ae83114350e100bd86a4783111930ea45098d408 | Dylan DPC | 2020-07-10T05:44:57 | Update Cargo.toml (#162) | diff --git a/Cargo.toml b/Cargo.toml
index ec52263..9444efa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,7 @@ readme = "README.md"
edition = "2018"
[dependencies]
-linked-hash-map = ">=0.0.9, <0.6"
+linked-hash-map = "0.5.3"
[dev-dependencies]
quickcheck = "0.9" | 1 | 1 | 1 |
4fffe95cddbcf444f8a3f080364caf16a6c11ca6 | Yuheng Chen | 2020-06-01T13:02:16 | Bump to v0.4.4 | diff --git a/Cargo.toml b/Cargo.toml
index aac5d4a..ec52263 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yaml-rust"
-version = "0.4.3" # remember to update html_root_url
+version = "0.4.4" # remember to update html_root_url
authors = ["Yuheng Chen <yuhengchen@sensetime.com>"]
homepage ... | 2 | 2 | 2 |
f918e84828c1533e477f29721b14bc6f6180d2fb | Anton Kochkov | 2020-05-27T06:25:59 | Update quickcheck to 0.9 | diff --git a/Cargo.toml b/Cargo.toml
index 282de92..aac5d4a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,4 +14,4 @@ edition = "2018"
linked-hash-map = ">=0.0.9, <0.6"
[dev-dependencies]
-quickcheck = "0.7"
+quickcheck = "0.9"
diff --git a/tests/quickcheck.rs b/tests/quickcheck.rs
index c2c89bc..0efd679 100644
--... | 2 | 2 | 3 |
0c0f84c092a56a024b032ef64ef9ba272f98fa5d | Anton Kochkov | 2020-05-27T06:19:22 | Remove deprecated API | diff --git a/Cargo.toml b/Cargo.toml
index 7bc449a..282de92 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,6 +8,7 @@ license = "MIT/Apache-2.0"
description = "The missing YAML 1.2 parser for rust"
repository = "https://github.com/chyh1990/yaml-rust"
readme = "README.md"
+edition = "2018"
[dependencies]
linked-ha... | 2 | 1 | 7 |
e72769d396363745ee04e6e1c11a7d6a525e53e3 | Anton Kochkov | 2020-05-27T06:15:28 | Rust 2018 transition | diff --git a/src/emitter.rs b/src/emitter.rs
index 872d1c8..d461001 100644
--- a/src/emitter.rs
+++ b/src/emitter.rs
@@ -1,7 +1,7 @@
use std::convert::From;
use std::error::Error;
use std::fmt::{self, Display};
-use yaml::{Hash, Yaml};
+use crate::yaml::{Hash, Yaml};
#[derive(Copy, Clone, Debug)]
pub enum EmitEr... | 5 | 22 | 22 |
7b7762e918ac8f9b0ce411ad8f846312f6a0cef0 | Hendrik Sollich | 2019-07-24T14:36:15 | Fix emitting hexlike strings without quotes
The emitter omitted quotes for strings that start with `0x` those would
subsequently be parsed as strings again. This should fix #133. | diff --git a/src/emitter.rs b/src/emitter.rs
index 09e9f87..872d1c8 100644
--- a/src/emitter.rs
+++ b/src/emitter.rs
@@ -336,6 +336,7 @@ fn need_quotes(string: &str) -> bool {
]
.contains(&string)
|| string.starts_with('.')
+ || string.starts_with("0x")
|| string.parse::<i64>(... | 2 | 49 | 6 |
1d29d211e9214f2fe0efaf9379efd998fafdb2de | Yuheng Chen | 2019-03-07T06:27:03 | Bump to v0.4.3 | diff --git a/Cargo.toml b/Cargo.toml
index d251b41..7bc449a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yaml-rust"
-version = "0.4.2" # remember to update html_root_url
+version = "0.4.3" # remember to update html_root_url
authors = ["Yuheng Chen <yuhengchen@sensetime.com>"]
homepage ... | 2 | 2 | 2 |
a5c17a20b0917a88f234a46ecb489a203ba9eecd | Robin Stocker | 2019-02-20T07:23:31 | Fix handling of indicators in plain scalars to conform to YAML 1.2
YAML 1.2 has special handling of indicators to be compatible with JSON.
The following is equivalent to `{"a": "b"}` (note, no space after `:`):
{"a":b}
But without the quoted key, a space is required. So the `:` here is part
of the plain scalar:
... | diff --git a/src/scanner.rs b/src/scanner.rs
index 4eb7912..6f4fa58 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -146,6 +146,7 @@ pub struct Scanner<T> {
stream_start_produced: bool,
stream_end_produced: bool,
+ adjacent_value_allowed_at: usize,
simple_key_allowed: bool,
simple_keys: Vec... | 2 | 93 | 12 |
2cd7ae9f5a049adf97fdbffe94cef7f6140cffdf | Tibo Delor | 2018-12-13T07:35:01 | Format using rustfmt 1.0 | diff --git a/src/emitter.rs b/src/emitter.rs
index 8a0b60a..09e9f87 100644
--- a/src/emitter.rs
+++ b/src/emitter.rs
@@ -334,7 +334,7 @@ fn need_quotes(string: &str) -> bool {
// http://yaml.org/type/null.html
"null", "Null", "NULL", "~",
]
- .contains(&string)
+ .co... | 3 | 24 | 15 |
606729fee21b0a2c8927ec04c5e4fdd15740a9e7 | David Tolnay | 2018-09-16T07:00:48 | Address write_with_newline lint | diff --git a/src/emitter.rs b/src/emitter.rs
index 7806922..8a0b60a 100644
--- a/src/emitter.rs
+++ b/src/emitter.rs
@@ -139,7 +139,7 @@ impl<'a> YamlEmitter<'a> {
pub fn dump(&mut self, doc: &Yaml) -> EmitResult {
// write DocumentStart
- write!(self.writer, "---\n")?;
+ writeln!(self.wri... | 1 | 6 | 6 |
5d91abeb62885e9268363831d13f75161b90d37f | David Tolnay | 2018-09-16T06:58:48 | Replace try! with question mark | diff --git a/src/emitter.rs b/src/emitter.rs
index 10f43ab..7806922 100644
--- a/src/emitter.rs
+++ b/src/emitter.rs
@@ -49,7 +49,7 @@ pub type EmitResult = Result<(), EmitError>;
// from serialize::json
fn escape_str(wr: &mut fmt::Write, v: &str) -> Result<(), fmt::Error> {
- try!(wr.write_str("\""));
+ wr.w... | 5 | 138 | 138 |
ca8c11abfe1e9d3711b1ab343f145a8accd1d443 | David Tolnay | 2018-09-15T20:09:48 | Release 0.4.2 | diff --git a/Cargo.toml b/Cargo.toml
index cdab262..d251b41 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yaml-rust"
-version = "0.4.1" # remember to update html_root_url
+version = "0.4.2" # remember to update html_root_url
authors = ["Yuheng Chen <yuhengchen@sensetime.com>"]
homepage ... | 2 | 2 | 2 |
be21b8b9c87c66557e87bd7ad48e370cc4c5a77a | David Tolnay | 2018-09-15T20:09:07 | Lowercase the recursion limit error message
To be consistent with the other errors in this crate. | diff --git a/src/scanner.rs b/src/scanner.rs
index da7e4ef..d4b8774 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -989,7 +989,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
self.flow_level = self
.flow_level
.checked_add(1)
- .ok_or_else(|| ScanError::new(self.mark,... | 1 | 1 | 1 |
bac6e1094dded4959cf9515236997893d31c8a47 | David Tolnay | 2018-09-15T19:31:11 | Release 0.4.1 | diff --git a/Cargo.toml b/Cargo.toml
index c389dea..cdab262 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yaml-rust"
-version = "0.4.0" # remember to update html_root_url
+version = "0.4.1" # remember to update html_root_url
authors = ["Yuheng Chen <yuhengchen@sensetime.com>"]
homepage ... | 2 | 2 | 2 |
be2e5fc0abd0a8a07abbc1b44deb11aece5775c8 | David Tolnay | 2018-09-15T19:30:27 | Set html_root_url | diff --git a/Cargo.toml b/Cargo.toml
index a0f8559..c389dea 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yaml-rust"
-version = "0.4.0"
+version = "0.4.0" # remember to update html_root_url
authors = ["Yuheng Chen <yuhengchen@sensetime.com>"]
homepage = "http://chyh1990.github.io/yaml-r... | 2 | 2 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.