on-codemerge
Version:
A WYSIWYG editor for on-codemerge is a user-friendly interface that allows users to edit and view their code in real time, exactly as it will appear in the final product
60 lines (59 loc) • 1.21 kB
JavaScript
import { TokenType as e } from "../../../types.mjs";
const r = {
name: "rust",
patterns: {
[e.Comment]: /^\/\/.*$|^\/\*[\s\S]*?\*\//,
[e.String]: /^"(?:\\.|[^"\\])*"|^'(?:\\.|[^'\\])*'/,
[e.Number]: /^\b(?:0x[0-9a-fA-F]+|0o[0-7]+|0b[01]+|\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b/,
[e.Function]: /^\b[a-zA-Z_]\w*(?=\s*[({])/,
[e.Type]: /^\b(?:i8|i16|i32|i64|i128|isize|u8|u16|u32|u64|u128|usize|f32|f64|bool|char|str|String)\b/,
[e.Decorator]: /^#\[(?:[^\]\\]|\\.)*\]/,
[e.Lifetime]: /^'[a-zA-Z_]\w*/,
[e.Operator]: /^(?:->|=>|\+=|-=|\*=|\/=|%=|&=|\|=|\^=|<<=|>>=|=|\+|-|\*|\/|%|&|\||!|<|>|<=|>=|==|!=)/,
[e.Punctuation]: /^[{}[\]();,.]/
},
keywords: [
"as",
"async",
"await",
"break",
"const",
"continue",
"crate",
"dyn",
"else",
"enum",
"extern",
"false",
"fn",
"for",
"if",
"impl",
"in",
"let",
"loop",
"match",
"mod",
"move",
"mut",
"pub",
"ref",
"return",
"self",
"Self",
"static",
"struct",
"super",
"trait",
"true",
"type",
"unsafe",
"use",
"where",
"while",
"yield"
]
};
export {
r as rustDefinition
};