Spellcheck (#143)

* Spellcheck src

* Spellcheck README
This commit is contained in:
Evan Harvey 2020-06-01 22:59:27 +10:00 committed by GitHub
parent e35bbd7c5a
commit 35619eaa5c
5 changed files with 17 additions and 17 deletions

View file

@ -101,7 +101,7 @@ so it may not be a huge problem for most users.
* Encoder * Encoder
* Tag directive * Tag directive
* Alias while desearilization * Alias while deserialization
## Minimum Rust version policy ## Minimum Rust version policy

View file

@ -238,7 +238,7 @@ impl<'a> YamlEmitter<'a> {
/// Emit a yaml as a hash or array value: i.e., which should appear /// Emit a yaml as a hash or array value: i.e., which should appear
/// following a ":" or "-", either after a space, or on a new line. /// following a ":" or "-", either after a space, or on a new line.
/// If `inline` is true, then the preceeding characters are distinct /// If `inline` is true, then the preceding characters are distinct
/// and short enough to respect the compact flag. /// and short enough to respect the compact flag.
fn emit_val(&mut self, inline: bool, val: &Yaml) -> EmitResult { fn emit_val(&mut self, inline: bool, val: &Yaml) -> EmitResult {
match *val { match *val {
@ -320,7 +320,7 @@ fn need_quotes(string: &str) -> bool {
|| [ || [
// http://yaml.org/type/bool.html // http://yaml.org/type/bool.html
// Note: 'y', 'Y', 'n', 'N', is not quoted deliberately, as in libyaml. PyYAML also parse // Note: 'y', 'Y', 'n', 'N', is not quoted deliberately, as in libyaml. PyYAML also parse
// them as string, not booleans, although it is volating the YAML 1.1 specification. // them as string, not booleans, although it is violating the YAML 1.1 specification.
// See https://github.com/dtolnay/serde-yaml/pull/83#discussion_r152628088. // See https://github.com/dtolnay/serde-yaml/pull/83#discussion_r152628088.
"yes", "Yes", "YES", "no", "No", "NO", "True", "TRUE", "true", "False", "FALSE", "yes", "Yes", "YES", "no", "No", "NO", "True", "TRUE", "true", "False", "FALSE",
"false", "on", "On", "ON", "off", "Off", "OFF", "false", "on", "On", "ON", "off", "Off", "OFF",

View file

@ -349,7 +349,7 @@ impl<T: Iterator<Item = char>> Parser<T> {
| Token(_, TokenType::TagDirective(..)) | Token(_, TokenType::TagDirective(..))
| Token(_, TokenType::DocumentStart) => { | Token(_, TokenType::DocumentStart) => {
// explicit document // explicit document
self._explict_document_start() self._explicit_document_start()
} }
Token(mark, _) if implicit => { Token(mark, _) if implicit => {
self.parser_process_directives()?; self.parser_process_directives()?;
@ -359,7 +359,7 @@ impl<T: Iterator<Item = char>> Parser<T> {
} }
_ => { _ => {
// explicit document // explicit document
self._explict_document_start() self._explicit_document_start()
} }
} }
} }
@ -385,7 +385,7 @@ impl<T: Iterator<Item = char>> Parser<T> {
Ok(()) Ok(())
} }
fn _explict_document_start(&mut self) -> ParseResult { fn _explicit_document_start(&mut self) -> ParseResult {
self.parser_process_directives()?; self.parser_process_directives()?;
match *self.peek_token()? { match *self.peek_token()? {
Token(mark, TokenType::DocumentStart) => { Token(mark, TokenType::DocumentStart) => {
@ -433,7 +433,7 @@ impl<T: Iterator<Item = char>> Parser<T> {
} }
fn register_anchor(&mut self, name: String, _: &Marker) -> Result<usize, ScanError> { fn register_anchor(&mut self, name: String, _: &Marker) -> Result<usize, ScanError> {
// anchors can be overrided/reused // anchors can be overridden/reused
// if self.anchors.contains_key(name) { // if self.anchors.contains_key(name) {
// return Err(ScanError::new(*mark, // return Err(ScanError::new(*mark,
// "while parsing anchor, found duplicated anchor")); // "while parsing anchor, found duplicated anchor"));
@ -704,7 +704,7 @@ impl<T: Iterator<Item = char>> Parser<T> {
Token(mark, _) if !first => { Token(mark, _) if !first => {
return Err(ScanError::new( return Err(ScanError::new(
mark, mark,
"while parsing a flow sequence, expectd ',' or ']'", "while parsing a flow sequence, expected ',' or ']'",
)); ));
} }
_ => { /* next */ } _ => { /* next */ }

View file

@ -1100,7 +1100,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
if self.ch() == '0' { if self.ch() == '0' {
return Err(ScanError::new( return Err(ScanError::new(
start_mark, start_mark,
"while scanning a block scalar, found an intendation indicator equal to 0", "while scanning a block scalar, found an indentation indicator equal to 0",
)); ));
} }
increment = (self.ch() as usize) - ('0' as usize); increment = (self.ch() as usize) - ('0' as usize);
@ -1110,7 +1110,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
if self.ch() == '0' { if self.ch() == '0' {
return Err(ScanError::new( return Err(ScanError::new(
start_mark, start_mark,
"while scanning a block scalar, found an intendation indicator equal to 0", "while scanning a block scalar, found an indentation indicator equal to 0",
)); ));
} }
@ -1200,7 +1200,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
self.lookahead(2); self.lookahead(2);
self.read_break(&mut leading_break); self.read_break(&mut leading_break);
// Eat the following intendation spaces and line breaks. // Eat the following indentation spaces and line breaks.
self.block_scalar_breaks(&mut indent, &mut trailing_breaks)?; self.block_scalar_breaks(&mut indent, &mut trailing_breaks)?;
} }
@ -1239,10 +1239,10 @@ impl<T: Iterator<Item = char>> Scanner<T> {
max_indent = self.mark.col; max_indent = self.mark.col;
} }
// Check for a tab character messing the intendation. // Check for a tab character messing the indentation.
if (*indent == 0 || self.mark.col < *indent) && self.buffer[0] == '\t' { if (*indent == 0 || self.mark.col < *indent) && self.buffer[0] == '\t' {
return Err(ScanError::new(self.mark, return Err(ScanError::new(self.mark,
"while scanning a block scalar, found a tab character where an intendation space is expected")); "while scanning a block scalar, found a tab character where an indentation space is expected"));
} }
if !is_break(self.ch()) { if !is_break(self.ch()) {
@ -1384,7 +1384,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
for i in 0..code_length { for i in 0..code_length {
if !is_hex(self.buffer[i]) { if !is_hex(self.buffer[i]) {
return Err(ScanError::new(start_mark, return Err(ScanError::new(start_mark,
"while parsing a quoted scalar, did not find expected hexdecimal number")); "while parsing a quoted scalar, did not find expected hexadecimal number"));
} }
value = (value << 4) + as_hex(self.buffer[i]); value = (value << 4) + as_hex(self.buffer[i]);
} }
@ -1589,7 +1589,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
self.lookahead(1); self.lookahead(1);
} }
// check intendation level // check indentation level
if self.flow_level == 0 && (self.mark.col as isize) < indent { if self.flow_level == 0 && (self.mark.col as isize) < indent {
break; break;
} }
@ -1608,7 +1608,7 @@ impl<T: Iterator<Item = char>> Scanner<T> {
fn fetch_key(&mut self) -> ScanResult { fn fetch_key(&mut self) -> ScanResult {
let start_mark = self.mark; let start_mark = self.mark;
if self.flow_level == 0 { if self.flow_level == 0 {
// Check if we are allowed to start a new key (not nessesary simple). // Check if we are allowed to start a new key (not necessarily simple).
if !self.simple_key_allowed { if !self.simple_key_allowed {
return Err(ScanError::new( return Err(ScanError::new(
self.mark, self.mark,

View file

@ -528,7 +528,7 @@ a1: &DEFAULT
} }
#[test] #[test]
fn test_bad_hypen() { fn test_bad_hyphen() {
// See: https://github.com/chyh1990/yaml-rust/issues/23 // See: https://github.com/chyh1990/yaml-rust/issues/23
let s = "{-"; let s = "{-";
assert!(YamlLoader::load_from_str(&s).is_err()); assert!(YamlLoader::load_from_str(&s).is_err());