Skip to content

Commit

Permalink
Add "pattern" category
Browse files Browse the repository at this point in the history
Used for Regex and ABNF.
  • Loading branch information
spenserblack committed Jan 8, 2025
1 parent bf5ca9f commit 9f20abe
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions gengo/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let category = match category {
"data" => "Data",
"markup" => "Markup",
"pattern" => "Pattern",
"programming" => "Programming",
"prose" => "Prose",
"query" => "Query",
Expand Down
4 changes: 2 additions & 2 deletions gengo/languages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ABAP:
extensions:
- abap
ABNF:
category: data
category: pattern
color: "#ABFABF"
matchers:
extensions:
Expand Down Expand Up @@ -766,7 +766,7 @@ Raku:
- perl6
- raku
Regex:
category: data
category: pattern
color: "#44E03F"
nerd-font-glyph: "\U0000eb38"
matchers:
Expand Down
2 changes: 2 additions & 0 deletions gengo/src/language/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ pub enum Category {
Data,
/// Markup languages. Examples: HTML, Pug, etc.
Markup,
/// Languages that define text patterns. Examples: Regex, ABNF, etc.
Pattern,
/// Programming languages. Examples: Rust, C, C++, Java, etc.
Programming,
/// Prose. Examples: Plain text, Markdown, etc.
Expand Down
2 changes: 1 addition & 1 deletion gengo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl<FS: for<'fs> FileSource<'fs>> Gengo<FS> {

let detectable = match language.category() {
Category::Data | Category::Prose => false,
Category::Programming | Category::Markup | Category::Query => {
Category::Pattern | Category::Programming | Category::Markup | Category::Query => {

Check warning on line 117 in gengo/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

gengo/src/lib.rs#L117

Added line #L117 was not covered by tests
!(generated || documentation || vendored)
}
};
Expand Down

0 comments on commit 9f20abe

Please sign in to comment.