Skip to content

Langdefs: Rust's string syntax breaks with b'"'

Output of highlight --version:

 highlight version 4.1
 Copyright (C) 2002-2021 Andre Simon <a dot simon at mailbox.org>

 Argparser class
 Copyright (C) 2006-2008 Antonio Diaz Diaz <ant_diaz at teleline.es>

 Artistic Style Classes (3.1 rev. 672)
 Copyright (C) 2006-2018 by Jim Pattee <jimp03 at email.com>
 Copyright (C) 1998-2002 by Tal Davidson

 Diluculum Lua wrapper (1.0)
 Copyright (C) 2005-2013 by Leandro Motta Barros

 xterm 256 color matching functions
 Copyright (C) 2006 Wolfgang Frisch <wf at frexx.de>

 PicoJSON library
 Copyright (C) 2009-2010 Cybozu Labs, Inc.
 Copyright (C) 2011-2014 Kazuho Oku

 This software is released under the terms of the GNU General Public License.
 For more information about these matters, see the file named COPYING.

The Rust programming Language allows you use the ascii-byte representation of a character using the following syntax: b'(Ascii character or escape sequence)'.

However when trying to use previous syntax with double quotes (b'"'), highlight assumes you attempted to start a string. The result is that remainder of the code is highlighted as a string until another quotation mark is encountered.

I attached some sample code and images of how it looks like unhighlighted, highlighted using highlight, and highlighted using vim.

hd-20210618-102409 hd-20210618-102448 hd-20210618-102503

Edited by Xev
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information