aboutsummaryrefslogtreecommitdiff
path: root/code/src
diff options
context:
space:
mode:
Diffstat (limited to 'code/src')
-rw-r--r--code/src/syntax_highlight/grammar.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/code/src/syntax_highlight/grammar.rs b/code/src/syntax_highlight/grammar.rs
index 82ae243..18ba9e2 100644
--- a/code/src/syntax_highlight/grammar.rs
+++ b/code/src/syntax_highlight/grammar.rs
@@ -1,6 +1,6 @@
pub fn grammar_for(syntax: &str) -> &'static [(&'static str, &'static [&'static str])] {
match syntax {
- "rs" => &[
+ "rs" | "rust" => &[
(
"keyword",
&[
@@ -34,9 +34,22 @@ pub fn grammar_for(syntax: &str) -> &'static [(&'static str, &'static [&'static
("identifier", &["([a-z_][A-Za-z0-9_]*)\\s*\\("]),
("literal", &["\".*?\"", "\\d", "true", "false"]),
],
+ "py" | "python" => &[
+ ("type", &["bytes", "bool", "int", "str", "float"]),
+ (
+ "keyword",
+ &[
+ "from", "for", "def", "if", "else", "elif", "while", "with", "in", "as",
+ "import",
+ ],
+ ),
+ ("comment", &["(?m)(#.*)$"]),
+ ("identifier", &["([a-z_][A-Za-z0-9_]*)\\s*\\("]),
+ ("literal", &["b?\".*?\"", "\\d", "true", "false"]),
+ ],
"tree" => &[("keyword", &["[├─└│]+"])],
// makefile doesnt really match the token-kinds, i'll just use something that looks goo
- "makefile" => &[
+ "makefile" | "mk" => &[
("comment", &["(?m)(#.*)$"]),
("literal", &[".+: "]),
("macro", &["\\$\\(\\w+\\)"]),