Prep for multiline comments

This commit is contained in:
Timothy Warren 2021-03-16 13:21:28 -04:00
parent 10e4c7ddb8
commit 8169adcb2f
2 changed files with 8 additions and 1 deletions

View File

@ -9,6 +9,7 @@ pub struct HighlightingOptions {
strings: bool, strings: bool,
characters: bool, characters: bool,
comments: bool, comments: bool,
multiline_comments: bool,
primary_keywords: Vec<String>, primary_keywords: Vec<String>,
secondary_keywords: Vec<String>, secondary_keywords: Vec<String>,
} }
@ -40,6 +41,7 @@ impl FileType {
strings: true, strings: true,
characters: true, characters: true,
comments: true, comments: true,
multiline_comments: true,
primary_keywords: vec![ primary_keywords: vec![
"as".to_string(), "as".to_string(),
"break".to_string(), "break".to_string(),
@ -143,4 +145,8 @@ impl HighlightingOptions {
pub fn secondary_keywords(&self) -> &Vec<String> { pub fn secondary_keywords(&self) -> &Vec<String> {
&self.secondary_keywords &self.secondary_keywords
} }
pub fn multiline_comments(&self) -> bool {
&self.multiline_comments
}
} }

View File

@ -8,6 +8,7 @@ pub enum Type {
String, String,
Character, Character,
Comment, Comment,
MultilineComment,
PrimaryKeywords, PrimaryKeywords,
SecondaryKeywords, SecondaryKeywords,
} }
@ -19,7 +20,7 @@ impl Type {
Type::Match => color::Rgb(38, 139, 210), Type::Match => color::Rgb(38, 139, 210),
Type::String => color::Rgb(211, 54, 130), Type::String => color::Rgb(211, 54, 130),
Type::Character => color::Rgb(108, 113, 196), Type::Character => color::Rgb(108, 113, 196),
Type::Comment => color::Rgb(133, 153, 0), Type::Comment | Type::MultilineComment => color::Rgb(133, 153, 0),
Type::PrimaryKeywords => color::Rgb(181, 137, 0), Type::PrimaryKeywords => color::Rgb(181, 137, 0),
Type::SecondaryKeywords => color::Rgb(42, 161, 152), Type::SecondaryKeywords => color::Rgb(42, 161, 152),
_ => color::Rgb(255, 255, 255), _ => color::Rgb(255, 255, 255),