vue-files-preview-inno
Version:
A tool for previewing files such as doc, excel, pdf, image, markdown, txt, audio, and video and so on.
303 lines (302 loc) • 5.69 kB
JavaScript
var r, c;
function E() {
if (c) return r;
c = 1;
function l(e) {
const n = e.regex, i = /(r#)?/, t = n.concat(i, e.UNDERSCORE_IDENT_RE), u = n.concat(i, e.IDENT_RE), b = {
className: "title.function.invoke",
relevance: 0,
begin: n.concat(
/\b/,
/(?!let|for|while|if|else|match\b)/,
u,
n.lookahead(/\s*\(/)
)
}, a = "([ui](8|16|32|64|128|size)|f(32|64))?", _ = [
"abstract",
"as",
"async",
"await",
"become",
"box",
"break",
"const",
"continue",
"crate",
"do",
"dyn",
"else",
"enum",
"extern",
"false",
"final",
"fn",
"for",
"if",
"impl",
"in",
"let",
"loop",
"macro",
"match",
"mod",
"move",
"mut",
"override",
"priv",
"pub",
"ref",
"return",
"self",
"Self",
"static",
"struct",
"super",
"trait",
"true",
"try",
"type",
"typeof",
"union",
"unsafe",
"unsized",
"use",
"virtual",
"where",
"while",
"yield"
], d = [
"true",
"false",
"Some",
"None",
"Ok",
"Err"
], s = [
// functions
"drop ",
// traits
"Copy",
"Send",
"Sized",
"Sync",
"Drop",
"Fn",
"FnMut",
"FnOnce",
"ToOwned",
"Clone",
"Debug",
"PartialEq",
"PartialOrd",
"Eq",
"Ord",
"AsRef",
"AsMut",
"Into",
"From",
"Default",
"Iterator",
"Extend",
"IntoIterator",
"DoubleEndedIterator",
"ExactSizeIterator",
"SliceConcatExt",
"ToString",
// macros
"assert!",
"assert_eq!",
"bitflags!",
"bytes!",
"cfg!",
"col!",
"concat!",
"concat_idents!",
"debug_assert!",
"debug_assert_eq!",
"env!",
"eprintln!",
"panic!",
"file!",
"format!",
"format_args!",
"include_bytes!",
"include_str!",
"line!",
"local_data_key!",
"module_path!",
"option_env!",
"print!",
"println!",
"select!",
"stringify!",
"try!",
"unimplemented!",
"unreachable!",
"vec!",
"write!",
"writeln!",
"macro_rules!",
"assert_ne!",
"debug_assert_ne!"
], o = [
"i8",
"i16",
"i32",
"i64",
"i128",
"isize",
"u8",
"u16",
"u32",
"u64",
"u128",
"usize",
"f32",
"f64",
"str",
"char",
"bool",
"Box",
"Option",
"Result",
"String",
"Vec"
];
return {
name: "Rust",
aliases: ["rs"],
keywords: {
$pattern: e.IDENT_RE + "!?",
type: o,
keyword: _,
literal: d,
built_in: s
},
illegal: "</",
contains: [
e.C_LINE_COMMENT_MODE,
e.COMMENT("/\\*", "\\*/", { contains: ["self"] }),
e.inherit(e.QUOTE_STRING_MODE, {
begin: /b?"/,
illegal: null
}),
{
className: "string",
variants: [
{ begin: /b?r(#*)"(.|\n)*?"\1(?!#)/ },
{ begin: /b?'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/ }
]
},
{
className: "symbol",
begin: /'[a-zA-Z_][a-zA-Z0-9_]*/
},
{
className: "number",
variants: [
{ begin: "\\b0b([01_]+)" + a },
{ begin: "\\b0o([0-7_]+)" + a },
{ begin: "\\b0x([A-Fa-f0-9_]+)" + a },
{ begin: "\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)" + a }
],
relevance: 0
},
{
begin: [
/fn/,
/\s+/,
t
],
className: {
1: "keyword",
3: "title.function"
}
},
{
className: "meta",
begin: "#!?\\[",
end: "\\]",
contains: [
{
className: "string",
begin: /"/,
end: /"/,
contains: [
e.BACKSLASH_ESCAPE
]
}
]
},
{
begin: [
/let/,
/\s+/,
/(?:mut\s+)?/,
t
],
className: {
1: "keyword",
3: "keyword",
4: "variable"
}
},
// must come before impl/for rule later
{
begin: [
/for/,
/\s+/,
t,
/\s+/,
/in/
],
className: {
1: "keyword",
3: "variable",
5: "keyword"
}
},
{
begin: [
/type/,
/\s+/,
t
],
className: {
1: "keyword",
3: "title.class"
}
},
{
begin: [
/(?:trait|enum|struct|union|impl|for)/,
/\s+/,
t
],
className: {
1: "keyword",
3: "title.class"
}
},
{
begin: e.IDENT_RE + "::",
keywords: {
keyword: "Self",
built_in: s,
type: o
}
},
{
className: "punctuation",
begin: "->"
},
b
]
};
}
return r = l, r;
}
export {
E as __require
};
//# sourceMappingURL=rust.mjs.map