diff --git a/src/completion/quality.rs b/src/completion/quality.rs index 6462fe70..67bc3c14 100644 --- a/src/completion/quality.rs +++ b/src/completion/quality.rs @@ -51,9 +51,9 @@ impl OrderByQualityCompletionProvider { finder.visit_root(&tree.root); match finder.results.pop()? { BibtexNode::Root(_) => Some(""), - BibtexNode::Preamble(preamble) => get_type_query(&preamble.kind, position), - BibtexNode::String(string) => get_type_query(&string.kind, position), - BibtexNode::Entry(entry) => get_type_query(&entry.kind, position), + BibtexNode::Preamble(preamble) => get_type_query(&preamble.ty, position), + BibtexNode::String(string) => get_type_query(&string.ty, position), + BibtexNode::Entry(entry) => get_type_query(&entry.ty, position), BibtexNode::Comment(comment) => Some(comment.token.text()), BibtexNode::Field(field) => { if field.name.range().contains(position) { diff --git a/src/folding/bibtex_declaration.rs b/src/folding/bibtex_declaration.rs index ed5660aa..2e4c329e 100644 --- a/src/folding/bibtex_declaration.rs +++ b/src/folding/bibtex_declaration.rs @@ -18,9 +18,9 @@ impl BibtexDeclarationFoldingProvider { fn fold(declaration: &BibtexDeclaration) -> Option { let kind = match declaration { BibtexDeclaration::Comment(_) => None, - BibtexDeclaration::Preamble(preamble) => Some(&preamble.kind), - BibtexDeclaration::String(string) => Some(&string.kind), - BibtexDeclaration::Entry(entry) => Some(&entry.kind), + BibtexDeclaration::Preamble(preamble) => Some(&preamble.ty), + BibtexDeclaration::String(string) => Some(&string.ty), + BibtexDeclaration::Entry(entry) => Some(&entry.ty), }?; let right = match declaration { diff --git a/src/formatting.rs b/src/formatting.rs index d2c9bd59..835beb96 100644 --- a/src/formatting.rs +++ b/src/formatting.rs @@ -68,7 +68,7 @@ impl BibtexFormatter { } pub fn format_preamble(&mut self, preamble: &BibtexPreamble) { - self.format_token(&preamble.kind); + self.format_token(&preamble.ty); self.output.push('{'); if let Some(ref content) = preamble.content { self.format_content(content, self.output.chars().count()); @@ -77,7 +77,7 @@ impl BibtexFormatter { } pub fn format_string(&mut self, string: &BibtexString) { - self.format_token(&string.kind); + self.format_token(&string.ty); self.output.push('{'); if let Some(ref name) = string.name { self.output.push_str(name.text()); @@ -90,7 +90,7 @@ impl BibtexFormatter { } pub fn format_entry(&mut self, entry: &BibtexEntry) { - self.format_token(&entry.kind); + self.format_token(&entry.ty); self.output.push('{'); if let Some(ref key) = entry.key { self.output.push_str(key.text()); diff --git a/src/syntax/bibtex/ast.rs b/src/syntax/bibtex/ast.rs index 76da7bcc..98935a78 100644 --- a/src/syntax/bibtex/ast.rs +++ b/src/syntax/bibtex/ast.rs @@ -118,7 +118,7 @@ impl SyntaxNode for BibtexComment { #[derive(Debug, PartialEq, Eq, Clone)] pub struct BibtexPreamble { pub range: Range, - pub kind: BibtexToken, + pub ty: BibtexToken, pub left: Option, pub content: Option, pub right: Option, @@ -126,7 +126,7 @@ pub struct BibtexPreamble { impl BibtexPreamble { pub fn new( - kind: BibtexToken, + ty: BibtexToken, left: Option, content: Option, right: Option, @@ -138,11 +138,11 @@ impl BibtexPreamble { } else if let Some(ref left) = left { left.end() } else { - kind.end() + ty.end() }; BibtexPreamble { - range: Range::new(kind.start(), end), - kind, + range: Range::new(ty.start(), end), + ty, left, content, right, @@ -159,7 +159,7 @@ impl SyntaxNode for BibtexPreamble { #[derive(Debug, PartialEq, Eq, Clone)] pub struct BibtexString { pub range: Range, - pub kind: BibtexToken, + pub ty: BibtexToken, pub left: Option, pub name: Option, pub assign: Option, @@ -169,7 +169,7 @@ pub struct BibtexString { impl BibtexString { pub fn new( - kind: BibtexToken, + ty: BibtexToken, left: Option, name: Option, assign: Option, @@ -187,12 +187,12 @@ impl BibtexString { } else if let Some(ref left) = left { left.end() } else { - kind.end() + ty.end() }; BibtexString { - range: Range::new(kind.start(), end), - kind, + range: Range::new(ty.start(), end), + ty, left, name, assign, @@ -211,7 +211,7 @@ impl SyntaxNode for BibtexString { #[derive(Debug, PartialEq, Eq, Clone)] pub struct BibtexEntry { pub range: Range, - pub kind: BibtexToken, + pub ty: BibtexToken, pub left: Option, pub key: Option, pub comma: Option, @@ -221,7 +221,7 @@ pub struct BibtexEntry { impl BibtexEntry { pub fn new( - kind: BibtexToken, + ty: BibtexToken, left: Option, key: Option, comma: Option, @@ -239,12 +239,12 @@ impl BibtexEntry { } else if let Some(ref left) = left { left.end() } else { - kind.end() + ty.end() }; BibtexEntry { - range: Range::new(kind.start(), end), - kind, + range: Range::new(ty.start(), end), + ty, left, key, comma, @@ -254,7 +254,7 @@ impl BibtexEntry { } pub fn is_comment(&self) -> bool { - self.kind.text().to_lowercase() == "@comment" + self.ty.text().to_lowercase() == "@comment" } } diff --git a/src/syntax/bibtex/parser.rs b/src/syntax/bibtex/parser.rs index 975a374a..93c91b63 100644 --- a/src/syntax/bibtex/parser.rs +++ b/src/syntax/bibtex/parser.rs @@ -38,65 +38,65 @@ impl> BibtexParser { } fn preamble(&mut self) -> BibtexPreamble { - let kind = self.tokens.next().unwrap(); + let ty = self.tokens.next().unwrap(); let left = self.expect2(BibtexTokenKind::BeginBrace, BibtexTokenKind::BeginParen); if left.is_none() { - return BibtexPreamble::new(kind, None, None, None); + return BibtexPreamble::new(ty, None, None, None); } if !self.can_match_content() { - return BibtexPreamble::new(kind, left, None, None); + return BibtexPreamble::new(ty, left, None, None); } let content = self.content(); let right = self.expect2(BibtexTokenKind::EndBrace, BibtexTokenKind::EndParen); - BibtexPreamble::new(kind, left, Some(content), right) + BibtexPreamble::new(ty, left, Some(content), right) } fn string(&mut self) -> BibtexString { - let kind = self.tokens.next().unwrap(); + let ty = self.tokens.next().unwrap(); let left = self.expect2(BibtexTokenKind::BeginBrace, BibtexTokenKind::BeginParen); if left.is_none() { - return BibtexString::new(kind, None, None, None, None, None); + return BibtexString::new(ty, None, None, None, None, None); } let name = self.expect1(BibtexTokenKind::Word); if name.is_none() { - return BibtexString::new(kind, left, None, None, None, None); + return BibtexString::new(ty, left, None, None, None, None); } let assign = self.expect1(BibtexTokenKind::Assign); if assign.is_none() { - return BibtexString::new(kind, left, name, None, None, None); + return BibtexString::new(ty, left, name, None, None, None); } if !self.can_match_content() { - return BibtexString::new(kind, left, name, assign, None, None); + return BibtexString::new(ty, left, name, assign, None, None); } let value = self.content(); let right = self.expect2(BibtexTokenKind::EndBrace, BibtexTokenKind::EndParen); - BibtexString::new(kind, left, name, assign, Some(value), right) + BibtexString::new(ty, left, name, assign, Some(value), right) } fn entry(&mut self) -> BibtexEntry { - let kind = self.tokens.next().unwrap(); + let ty = self.tokens.next().unwrap(); let left = self.expect2(BibtexTokenKind::BeginBrace, BibtexTokenKind::BeginParen); if left.is_none() { - return BibtexEntry::new(kind, None, None, None, Vec::new(), None); + return BibtexEntry::new(ty, None, None, None, Vec::new(), None); } let name = self.expect1(BibtexTokenKind::Word); if name.is_none() { - return BibtexEntry::new(kind, left, None, None, Vec::new(), None); + return BibtexEntry::new(ty, left, None, None, Vec::new(), None); } let comma = self.expect1(BibtexTokenKind::Comma); if comma.is_none() { - return BibtexEntry::new(kind, left, name, None, Vec::new(), None); + return BibtexEntry::new(ty, left, name, None, Vec::new(), None); } let mut fields = Vec::new(); @@ -105,7 +105,7 @@ impl> BibtexParser { } let right = self.expect2(BibtexTokenKind::EndBrace, BibtexTokenKind::EndParen); - BibtexEntry::new(kind, left, name, comma, fields, right) + BibtexEntry::new(ty, left, name, comma, fields, right) } fn field(&mut self) -> BibtexField {