Skip to content

Commit

Permalink
add Rust lang (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
dy-tea authored Oct 1, 2024
1 parent f90a28a commit 75a3cf7
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
1 change: 1 addition & 0 deletions highlight/langs.v
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ fn init_langs() []Lang {
langs_ << init_java()
langs_ << init_py()
langs_ << init_ts()
langs_ << init_rust()
return langs_
}
70 changes: 70 additions & 0 deletions highlight/rust.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
module highlight

// keywords suffixed with `reserved` are reserved by the compiler for future use

fn init_rust() Lang {
return Lang{
name: 'Rust'
lang_extensions: ['rs']
line_comments: '//'
mline_comments: ['/*', '*/']
string_start: ['"', '"']
color: '#DDA483'
keywords: [
"'static",
'abstract', // reserved
'as',
'async',
'await',
'become', // reserved
'box', // reserved
'break',
'const',
'continue',
'crate',
'do', // reserved
'dyn',
'else',
'enum',
'extern',
'false',
'final', // reserved
'fn',
'for',
'if',
'impl',
'in',
'let',
'loop',
'macro', // reserved
'macro_rules',
'match',
'mod',
'move',
'mut',
'override', // reserved
'pub',
'priv', // reserved
'ref',
'return',
'self',
'Self',
'static',
'struct',
'super',
'trait',
'true',
'try',
'type',
'typeof', // reserved
'union',
'unsafe',
'unsized', // reserved
'use',
'virtual', // reserved
'where',
'while',
'yield', // reserved
]
}
}

0 comments on commit 75a3cf7

Please sign in to comment.