Skip to content

fix(rust) ensure brackets are balanced within attributes #4237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ewwwin
Copy link

@ewwwin ewwwin commented Apr 7, 2025

Fixes #4032.

Changes

Rust attributes can contain nested brackets, braces, and parentheses. This PR adds sub-modes for these nested delimiter groups, ensuring that attribute matches ends only when nested square brackets and other delimiters are balanced.

Syntax reference: The Rust Reference: Attributes. (The actual set of recognized bracket types is derived from DelimTokenTree which is defined in Macros).

Checklist

  • Added markup tests
  • Updated the changelog at CHANGES.md

@ewwwin ewwwin force-pushed the fix/rust-attribute-ensure-bracket-balance branch from 31f7444 to 84bcd12 Compare April 24, 2025 22:17
Copy link

Build Size Report

Changes to minified artifacts in /build, after gzip compression.

5 files changed

Total change +80 B

View Changes
file base pr diff
es/core.min.js 8.19 KB 8.19 KB -1 B
es/highlight.min.js 8.19 KB 8.19 KB -1 B
es/languages/rust.min.js 1.51 KB 1.56 KB +42 B
highlight.min.js 8.23 KB 8.23 KB -2 B
languages/rust.min.js 1.52 KB 1.56 KB +42 B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Rust) Mismatched brackets in complex attribute
3 participants