Skip to content

Commit

Permalink
Fix parsing BibTeX accents with command inside
Browse files Browse the repository at this point in the history
Fixes #945.
  • Loading branch information
pfoerster committed Nov 4, 2023
1 parent a67d340 commit a67e104
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Moving the build logs to the recycle bin will now clear the diagnostics ([texlab-vscode/#825](https://github.com/latex-lsp/texlab-vscode/issues/825))
- Fix false positive when reporting syntax errors for BibTeX accents ([#945](https://github.com/latex-lsp/texlab/issues/945))

## [5.10.1] - 2023-10-10

Expand Down
4 changes: 3 additions & 1 deletion crates/parser/src/bibtex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ fn accent(mut ptr: TokenPtr<ContentToken>) -> TokenPtr<ContentToken> {
ptr.expect(ContentToken::Whitespace);
}

ptr.expect(ContentToken::Word);
if ptr.at(ContentToken::Word) || ptr.at(ContentToken::CommandName) {
ptr.bump();
}

if group {
ptr.expect(ContentToken::Whitespace);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
source: crates/parser/src/bibtex.rs
expression: root
input_file: crates/parser/src/test_data/bibtex/issue_945.txt
---
ROOT@0..33
ENTRY@0..33
TYPE@0..8 "@article"
L_DELIM@8..9 "{"
NAME@9..13 "test"
COMMA@13..14 ","
WHITESPACE@14..15 " "
FIELD@15..32
NAME@15..21 "author"
WHITESPACE@21..22 " "
EQ@22..23 "="
WHITESPACE@23..24 " "
CURLY_GROUP@24..32
L_CURLY@24..25 "{"
ACCENT@25..31
ACCENT_NAME@25..27 "\\\""
L_CURLY@27..28 "{"
COMMAND_NAME@28..30 "\\i"
R_CURLY@30..31 "}"
R_CURLY@31..32 "}"
R_DELIM@32..33 "}"

1 change: 1 addition & 0 deletions crates/parser/src/test_data/bibtex/issue_945.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@article{test, author = {\"{\i}}}

0 comments on commit a67e104

Please sign in to comment.