Skip to content

Commit

Permalink
Update rust syntax: don't highlight lifetimes (#2164)
Browse files Browse the repository at this point in the history
Work-around rust lifetimes and character literals both using single quotes.
  • Loading branch information
pyfisch committed Jul 21, 2021
1 parent 42a9302 commit 84a490f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions runtime/syntax/rust.yaml
Expand Up @@ -34,12 +34,16 @@ rules:
rules: []

# Character literals
# NOTE: This is an ugly hack to work around the fact that rust uses
# single quotes both for character literals and lifetimes.
# Match all character literals.
- constant.string: "'(\\\\.|.)'"
# Match the '"' literal which would otherwise match
# as a double quoted string and destroy the highlighting.
- constant.string:
start: "'"
start: "'\""
end: "'"
skip: '\\.'
rules:
- constant.specialChar: '\\.'
rules: []

- comment:
start: "//"
Expand Down

0 comments on commit 84a490f

Please sign in to comment.