Add Rust support - src-highlite.git - src-highlite

index : src-highlite.git
src-highlite
summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018年10月13日 15:56:05 -0600
committerTom Tromey <tom@tromey.com>2019年06月01日 09:26:44 -0600
commitf371f2c4a18788ca47e359cb00a7b7e7186992ee (patch)
tree59097d0d1762da49c0cece6538c59f7d4d2df0fa /src
parent58bb465ecb7ebec8514be7d1022f04f2fdd59381 (diff)
downloadsrc-highlite-f371f2c4a18788ca47e359cb00a7b7e7186992ee.tar.gz
Add Rust support
This adds a rust.lang and changes lang.map so that .rs is recognized as Rust source.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am 2
-rw-r--r--src/lang.map 1
-rw-r--r--src/rust.lang 34
3 files changed, 36 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 3053dc1..c8b7181 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -86,7 +86,7 @@ vbscript.lang awk.lang bat.lang clipper.lang cobol.lang d.lang \
errors.lang erlang.lang proto.lang vala.lang lisp.lang islisp.lang \
scheme.lang po.lang opa.lang javalog.lang upc.lang tml.lang \
lilypond.lang coffeescript.lang go.lang \
-r.lang s.lang zsh.lang groovy.lang json.lang feature.lang
+r.lang s.lang zsh.lang groovy.lang json.lang feature.lang rust.lang
LANGFILES_NOTTOCHECK= \
tml_formatting_all.lang tml_macrolinks.lang tml_macrosdelayed2.lang \
diff --git a/src/lang.map b/src/lang.map
index e84ded8..6a2ca0c 100644
--- a/src/lang.map
+++ b/src/lang.map
@@ -169,3 +169,4 @@ ly = lilypond.lang
groovy = groovy.lang
json = json.lang
feature = feature.lang
+rs = rust.lang
diff --git a/src/rust.lang b/src/rust.lang
new file mode 100644
index 0000000..bc74eb1
--- /dev/null
+++ b/src/rust.lang
@@ -0,0 +1,34 @@
+# Rust
+
+environment comment start "//" begin
+ include "url.lang"
+ include "todo.lang"
+end
+
+# Strings.
+string delim `(?<!r)b?\"` "\"" escape "\\"
+string delim `b?r(#*)\"` "\"" + @{1} multiline
+
+vardef common_escape = `(?:[\\nrt0']|x[a-fA-F0-9]{2})`
+vardef unicode_escape = `u\{[a-fA-F0-9]{6}\}`
+
+string = `b?'(?:[^\\']|\\(?:` + $common_escape + `|` + $unicode_escape + `))'`
+
+# Not exactly Rust syntax.
+include "number.lang"
+
+# Reserved keywords aren't listed.
+keyword = "as|box|break|const|continue|crate|else|enum|extern",
+ "false|fn|for|if|impl|in|let|loop",
+ "match|mod|move|mut|pub|ref|return",
+ "self|static|struct|super|trait|true|type",
+ "union|unsafe|use|where|while"
+
+type = "i8|u8|i16|u16|i32|u32|i64|u64|i128|u128|isize|usize",
+ "bool|char|Self|f32|f64|&str"
+
+include "symbols.lang"
+
+cbracket = "{|}"
+
+include "function.lang"
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月27日 01:29:14 +0000

AltStyle によって変換されたページ (->オリジナル) /