Update cspell for compiler

This commit is contained in:
Jeong YunWon 2023-03-16 21:27:02 +09:00
parent ef38eb6b1a
commit f9b5469642
27 changed files with 158 additions and 213 deletions

View file

@ -112,7 +112,7 @@ fn gen_phf(out_dir: &Path) {
.entry("False", "Tok::False")
.entry("None", "Tok::None")
.entry("True", "Tok::True")
// moreso "standard" keywords
// more so "standard" keywords
.entry("and", "Tok::And")
.entry("as", "Tok::As")
.entry("assert", "Tok::Assert")

View file

@ -241,6 +241,7 @@ where
lxr.window.slide();
lxr.window.slide();
// TODO: Handle possible mismatch between BOM and explicit encoding declaration.
// spell-checker:ignore feff
if let Some('\u{feff}') = lxr.window[0] {
lxr.window.slide();
}
@ -1085,7 +1086,7 @@ where
}
}
' ' | '\t' | '\x0C' => {
// Skip whitespaces
// Skip white-spaces
self.next_char();
while let Some(' ' | '\t' | '\x0C') = self.window[0] {
self.next_char();
@ -1327,7 +1328,7 @@ mod tests {
lexer.map(|x| x.unwrap().1).collect()
}
fn stok(s: &str) -> Tok {
fn str_tok(s: &str) -> Tok {
Tok::String {
value: s.to_owned(),
kind: StringKind::String,
@ -1335,7 +1336,7 @@ mod tests {
}
}
fn raw_stok(s: &str) -> Tok {
fn raw_str_tok(s: &str) -> Tok {
Tok::String {
value: s.to_owned(),
kind: StringKind::RawString,
@ -1434,13 +1435,13 @@ mod tests {
#[test]
fn test_assignment() {
let source = r"avariable = 99 + 2-0";
let source = r"a_variable = 99 + 2-0";
let tokens = lex_source(source);
assert_eq!(
tokens,
vec![
Tok::Name {
name: String::from("avariable"),
name: String::from("a_variable"),
},
Tok::Equal,
Tok::Int {
@ -1663,13 +1664,13 @@ mod tests {
vec![
Tok::Lpar,
Tok::NonLogicalNewline,
stok("a"),
str_tok("a"),
Tok::NonLogicalNewline,
stok("b"),
str_tok("b"),
Tok::NonLogicalNewline,
Tok::NonLogicalNewline,
stok("c"),
stok("d"),
str_tok("c"),
str_tok("d"),
Tok::NonLogicalNewline,
Tok::Rpar,
Tok::Newline,
@ -1716,15 +1717,15 @@ mod tests {
assert_eq!(
tokens,
vec![
stok("double"),
stok("single"),
stok(r"can\'t"),
stok(r#"\\\""#),
stok(r"\t\r\n"),
stok(r"\g"),
raw_stok(r"raw\'"),
stok(r"\420"),
stok(r"\200\0a"),
str_tok("double"),
str_tok("single"),
str_tok(r"can\'t"),
str_tok(r#"\\\""#),
str_tok(r"\t\r\n"),
str_tok(r"\g"),
raw_str_tok(r"raw\'"),
str_tok(r"\420"),
str_tok(r"\200\0a"),
Tok::Newline,
]
);
@ -1740,7 +1741,7 @@ mod tests {
assert_eq!(
tokens,
vec![
stok("abc\\\ndef"),
str_tok("abc\\\ndef"),
Tok::Newline,
]
)
@ -1759,7 +1760,7 @@ mod tests {
fn test_escape_unicode_name() {
let source = r#""\N{EN SPACE}""#;
let tokens = lex_source(source);
assert_eq!(tokens, vec![stok(r"\N{EN SPACE}"), Tok::Newline])
assert_eq!(tokens, vec![str_tok(r"\N{EN SPACE}"), Tok::Newline])
}
macro_rules! test_triple_quoted {

View file

@ -433,14 +433,14 @@ class Foo(A, B):
}
#[test]
fn test_parse_boolop_or() {
fn test_parse_bool_op_or() {
let source = "x or y";
let parse_ast = parse_expression(source, "<test>").unwrap();
insta::assert_debug_snapshot!(parse_ast);
}
#[test]
fn test_parse_boolop_and() {
fn test_parse_bool_op_and() {
let source = "x and y";
let parse_ast = parse_expression(source, "<test>").unwrap();
insta::assert_debug_snapshot!(parse_ast);
@ -513,10 +513,10 @@ with (0 as a, 1 as b,): pass
#[test]
fn test_star_index() {
let source = "\
array_slice = array[0, *idxs, -1]
array[0, *idxs, -1] = array_slice
array[*idxs_to_select, *idxs_to_select]
array[3:5, *idxs_to_select]
array_slice = array[0, *indexes, -1]
array[0, *indexes, -1] = array_slice
array[*indexes_to_select, *indexes_to_select]
array[3:5, *indexes_to_select]
";
let parse_ast = parse_program(source, "<test>").unwrap();
insta::assert_debug_snapshot!(parse_ast);

View file

@ -1,42 +0,0 @@
---
source: compiler/parser/src/context.rs
expression: parse_ast
---
[
Located {
location: Location {
row: 1,
column: 1,
},
custom: (),
node: Assign {
targets: [
Located {
location: Location {
row: 1,
column: 1,
},
custom: (),
node: Name {
id: "x",
ctx: Store,
},
},
],
value: Located {
location: Location {
row: 1,
column: 5,
},
custom: (),
node: Constant {
value: Int(
1,
),
kind: None,
},
},
type_comment: None,
},
},
]

View file

@ -1,6 +1,5 @@
---
source: compiler/parser/src/function.rs
assertion_line: 165
expression: parse_ast
---
Ok(

View file

@ -1,6 +1,5 @@
---
source: compiler/parser/src/function.rs
assertion_line: 165
expression: parse_ast
---
Ok(

View file

@ -1,5 +1,5 @@
---
source: parser/src/parser.rs
source: compiler/parser/src/parser.rs
expression: parse_ast
---
[]

View file

@ -11,7 +11,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 1,
column: 33,
column: 36,
},
),
custom: (),
@ -43,7 +43,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 1,
column: 33,
column: 36,
},
),
custom: (),
@ -73,7 +73,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 1,
column: 32,
column: 35,
},
),
custom: (),
@ -106,7 +106,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 1,
column: 28,
column: 31,
},
),
custom: (),
@ -119,12 +119,12 @@ expression: parse_ast
end_location: Some(
Location {
row: 1,
column: 28,
column: 31,
},
),
custom: (),
node: Name {
id: "idxs",
id: "indexes",
ctx: Load,
},
},
@ -134,12 +134,12 @@ expression: parse_ast
Located {
location: Location {
row: 1,
column: 30,
column: 33,
},
end_location: Some(
Location {
row: 1,
column: 32,
column: 35,
},
),
custom: (),
@ -148,12 +148,12 @@ expression: parse_ast
operand: Located {
location: Location {
row: 1,
column: 31,
column: 34,
},
end_location: Some(
Location {
row: 1,
column: 32,
column: 35,
},
),
custom: (),
@ -184,7 +184,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 2,
column: 33,
column: 36,
},
),
custom: (),
@ -198,7 +198,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 2,
column: 19,
column: 22,
},
),
custom: (),
@ -228,7 +228,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 2,
column: 18,
column: 21,
},
),
custom: (),
@ -261,7 +261,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 2,
column: 14,
column: 17,
},
),
custom: (),
@ -274,12 +274,12 @@ expression: parse_ast
end_location: Some(
Location {
row: 2,
column: 14,
column: 17,
},
),
custom: (),
node: Name {
id: "idxs",
id: "indexes",
ctx: Load,
},
},
@ -289,12 +289,12 @@ expression: parse_ast
Located {
location: Location {
row: 2,
column: 16,
column: 19,
},
end_location: Some(
Location {
row: 2,
column: 18,
column: 21,
},
),
custom: (),
@ -303,12 +303,12 @@ expression: parse_ast
operand: Located {
location: Location {
row: 2,
column: 17,
column: 20,
},
end_location: Some(
Location {
row: 2,
column: 18,
column: 21,
},
),
custom: (),
@ -332,12 +332,12 @@ expression: parse_ast
value: Located {
location: Location {
row: 2,
column: 22,
column: 25,
},
end_location: Some(
Location {
row: 2,
column: 33,
column: 36,
},
),
custom: (),
@ -357,7 +357,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 3,
column: 39,
column: 45,
},
),
custom: (),
@ -370,7 +370,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 3,
column: 39,
column: 45,
},
),
custom: (),
@ -400,7 +400,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 3,
column: 38,
column: 44,
},
),
custom: (),
@ -414,7 +414,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 3,
column: 21,
column: 24,
},
),
custom: (),
@ -427,12 +427,12 @@ expression: parse_ast
end_location: Some(
Location {
row: 3,
column: 21,
column: 24,
},
),
custom: (),
node: Name {
id: "idxs_to_select",
id: "indexes_to_select",
ctx: Load,
},
},
@ -442,12 +442,12 @@ expression: parse_ast
Located {
location: Location {
row: 3,
column: 23,
column: 26,
},
end_location: Some(
Location {
row: 3,
column: 38,
column: 44,
},
),
custom: (),
@ -455,17 +455,17 @@ expression: parse_ast
value: Located {
location: Location {
row: 3,
column: 24,
column: 27,
},
end_location: Some(
Location {
row: 3,
column: 38,
column: 44,
},
),
custom: (),
node: Name {
id: "idxs_to_select",
id: "indexes_to_select",
ctx: Load,
},
},
@ -489,7 +489,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 4,
column: 27,
column: 30,
},
),
custom: (),
@ -502,7 +502,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 4,
column: 27,
column: 30,
},
),
custom: (),
@ -532,7 +532,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 4,
column: 26,
column: 29,
},
),
custom: (),
@ -604,7 +604,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 4,
column: 26,
column: 29,
},
),
custom: (),
@ -617,12 +617,12 @@ expression: parse_ast
end_location: Some(
Location {
row: 4,
column: 26,
column: 29,
},
),
custom: (),
node: Name {
id: "idxs_to_select",
id: "indexes_to_select",
ctx: Load,
},
},

View file

@ -1,6 +1,5 @@
---
source: compiler/parser/src/string.rs
assertion_line: 690
expression: "parse_fstring(\"\").unwrap()"
---
[]

View file

@ -1,6 +1,5 @@
---
source: compiler/parser/src/string.rs
assertion_line: 669
expression: parse_ast
---
[

View file

@ -1,6 +1,5 @@
---
source: compiler/parser/src/string.rs
assertion_line: 766
expression: parse_ast
---
[

View file

@ -1,6 +1,5 @@
---
source: compiler/parser/src/string.rs
assertion_line: 677
expression: parse_ast
---
[

View file

@ -1,6 +1,5 @@
---
source: compiler/parser/src/string.rs
assertion_line: 759
expression: parse_ast
---
[

View file

@ -1,6 +1,5 @@
---
source: compiler/parser/src/string.rs
assertion_line: 685
expression: parse_ast
---
[

View file

@ -1,6 +1,5 @@
---
source: compiler/parser/src/string.rs
assertion_line: 787
expression: parse_ast
---
[

View file

@ -27,7 +27,7 @@ where
{
pub fn new(lexer: I, mode: Mode) -> Self {
Self {
underlying: lexer.multipeek(),
underlying: lexer.multipeek(), // spell-checker:ignore multipeek
start_of_line: matches!(mode, Mode::Interactive | Mode::Module),
}
}

View file

@ -179,7 +179,7 @@ impl<'a> StringParser<'a> {
let mut expression = String::new();
let mut spec = None;
let mut delims = Vec::new();
let mut delimiters = Vec::new();
let mut conversion = ConversionFlag::None;
let mut self_documenting = false;
let mut trailing_seq = String::new();
@ -194,7 +194,7 @@ impl<'a> StringParser<'a> {
expression.push('=');
self.next_char();
}
'!' if delims.is_empty() && self.peek() != Some(&'=') => {
'!' if delimiters.is_empty() && self.peek() != Some(&'=') => {
if expression.trim().is_empty() {
return Err(FStringError::new(EmptyExpression, self.get_pos()).into());
}
@ -223,11 +223,11 @@ impl<'a> StringParser<'a> {
// match a python 3.8 self documenting expression
// format '{' PYTHON_EXPRESSION '=' FORMAT_SPECIFIER? '}'
'=' if self.peek() != Some(&'=') && delims.is_empty() => {
'=' if self.peek() != Some(&'=') && delimiters.is_empty() => {
self_documenting = true;
}
':' if delims.is_empty() => {
':' if delimiters.is_empty() => {
let parsed_spec = self.parse_spec(nested)?;
spec = Some(Box::new(self.expr(ExprKind::JoinedStr {
@ -236,10 +236,10 @@ impl<'a> StringParser<'a> {
}
'(' | '{' | '[' => {
expression.push(ch);
delims.push(ch);
delimiters.push(ch);
}
')' => {
let last_delim = delims.pop();
let last_delim = delimiters.pop();
match last_delim {
Some('(') => {
expression.push(ch);
@ -257,7 +257,7 @@ impl<'a> StringParser<'a> {
}
}
']' => {
let last_delim = delims.pop();
let last_delim = delimiters.pop();
match last_delim {
Some('[') => {
expression.push(ch);
@ -274,8 +274,8 @@ impl<'a> StringParser<'a> {
}
}
}
'}' if !delims.is_empty() => {
let last_delim = delims.pop();
'}' if !delimiters.is_empty() => {
let last_delim = delimiters.pop();
match last_delim {
Some('{') => {
expression.push(ch);
@ -800,7 +800,7 @@ mod tests {
}
#[test]
fn test_fstring_parse_selfdocumenting_base() {
fn test_fstring_parse_self_documenting_base() {
let src = "{user=}";
let parse_ast = parse_fstring(src).unwrap();
@ -808,7 +808,7 @@ mod tests {
}
#[test]
fn test_fstring_parse_selfdocumenting_base_more() {
fn test_fstring_parse_self_documenting_base_more() {
let src = "mix {user=} with text and {second=}";
let parse_ast = parse_fstring(src).unwrap();
@ -816,7 +816,7 @@ mod tests {
}
#[test]
fn test_fstring_parse_selfdocumenting_format() {
fn test_fstring_parse_self_documenting_format() {
let src = "{user=:>10}";
let parse_ast = parse_fstring(src).unwrap();
@ -877,14 +877,14 @@ mod tests {
}
#[test]
fn test_parse_fstring_selfdoc_prec_space() {
fn test_parse_fstring_self_doc_prec_space() {
let source = "{x =}";
let parse_ast = parse_fstring(source).unwrap();
insta::assert_debug_snapshot!(parse_ast);
}
#[test]
fn test_parse_fstring_selfdoc_trailing_space() {
fn test_parse_fstring_self_doc_trailing_space() {
let source = "{x= }";
let parse_ast = parse_fstring(source).unwrap();
insta::assert_debug_snapshot!(parse_ast);
@ -979,7 +979,7 @@ mod tests {
#[test]
fn test_escape_char_in_byte_literal() {
// backslash does not escape
let source = r##"b"omkmok\Xaa""##;
let source = r##"b"omkmok\Xaa""##; // spell-checker:ignore omkmok
let parse_ast = parse_program(source, "<test>").unwrap();
insta::assert_debug_snapshot!(parse_ast);
}