diff --git a/CHANGELOG.md b/CHANGELOG.md index afdaa9174..afb7a2733 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/crates/parser/src/bibtex.rs b/crates/parser/src/bibtex.rs index 193203016..d74254b2c 100644 --- a/crates/parser/src/bibtex.rs +++ b/crates/parser/src/bibtex.rs @@ -181,7 +181,9 @@ fn accent(mut ptr: TokenPtr) -> TokenPtr { 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); diff --git a/crates/parser/src/snapshots/parser__bibtex__tests__parse@issue_945.txt.snap b/crates/parser/src/snapshots/parser__bibtex__tests__parse@issue_945.txt.snap new file mode 100644 index 000000000..11a2955b1 --- /dev/null +++ b/crates/parser/src/snapshots/parser__bibtex__tests__parse@issue_945.txt.snap @@ -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 "}" + diff --git a/crates/parser/src/test_data/bibtex/issue_945.txt b/crates/parser/src/test_data/bibtex/issue_945.txt new file mode 100644 index 000000000..e50835d51 --- /dev/null +++ b/crates/parser/src/test_data/bibtex/issue_945.txt @@ -0,0 +1 @@ +@article{test, author = {\"{\i}}} \ No newline at end of file