From 1a22fed4bd7f4626b4d73f9d805842e7e1b6e8fa Mon Sep 17 00:00:00 2001 From: Jos512 Date: Sat, 2 Feb 2019 10:24:34 +0100 Subject: [PATCH] Fix Rust raw string literals --- lexers/r/rust.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lexers/r/rust.go b/lexers/r/rust.go index 3d05cd534..5e18b8fb6 100644 --- a/lexers/r/rust.go +++ b/lexers/r/rust.go @@ -28,6 +28,8 @@ var Rust = internal.Register(MustNewLexer( {`/\*\*(\n|[^/*])`, LiteralStringDoc, Push("doccomment")}, {`/\*!`, LiteralStringDoc, Push("doccomment")}, {`/\*`, CommentMultiline, Push("comment")}, + {`r#*"(?:\\.|[^\\\r\n;])*"#*`, LiteralString, nil}, + {`"(?:\\.|[^\\\r\n"])*"`, LiteralString, nil}, {`\$([a-zA-Z_]\w*|\(,?|\),?|,?)`, CommentPreproc, nil}, {Words(``, `\b`, `as`, `box`, `const`, `crate`, `else`, `extern`, `for`, `if`, `impl`, `in`, `loop`, `match`, `move`, `mut`, `pub`, `ref`, `return`, `static`, `super`, `trait`, `unsafe`, `use`, `where`, `while`), Keyword, nil}, {Words(``, `\b`, `abstract`, `alignof`, `become`, `do`, `final`, `macro`, `offsetof`, `override`, `priv`, `proc`, `pure`, `sizeof`, `typeof`, `unsized`, `virtual`, `yield`), KeywordReserved, nil}, @@ -51,7 +53,6 @@ var Rust = internal.Register(MustNewLexer( {`[0-9][0-9_]*(\.[0-9_]+[eE][+\-]?[0-9_]+|\.[0-9_]*(?!\.)|[eE][+\-]?[0-9_]+)`, LiteralNumberFloat, Push("number_lit")}, {`[0-9][0-9_]*`, LiteralNumberInteger, Push("number_lit")}, {`b"`, LiteralString, Push("bytestring")}, - {`"`, LiteralString, Push("string")}, {`b?r(#*)".*?"\1`, LiteralString, nil}, {`'static`, NameBuiltin, nil}, {`'[a-zA-Z_]\w*`, NameAttribute, nil},