From 4fa1259020bb720b1a9f87159bc09c578abc2b84 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Sun, 20 Jun 2021 10:18:29 +0200 Subject: [PATCH] Added support for - _ chars in filenames/folders --- src/config.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config.rs b/src/config.rs index 3be34d4..165793e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -19,7 +19,7 @@ impl FileType { // (\n|[\r\n]+) is a fix for the EOL symbol ($) not working on Windows CRLF // Regex for `include "my.module"` - let regex = Regex::new(r#"(?m)^include "([a-zA-Z\.]+)"(\n|[\r\n]+)"#).unwrap(); + let regex = Regex::new(r#"(?m)^include "([a-zA-Z\-_\.]+)"(\n|[\r\n]+)"#).unwrap(); let ext = filename.extension().unwrap().to_str().unwrap(); let extension = ext.to_string(); @@ -32,7 +32,7 @@ impl FileType { "fnl" => FileType { extension, // Regex for `(include "my.module")` - regex: Regex::new(r#"(?m)^\(include "([a-zA-Z\.]+)"\)(\n|[\r\n]+)"#).unwrap(), + regex: Regex::new(r#"(?m)^\(include "([a-zA-Z\-_\.]+)"\)(\n|[\r\n]+)"#).unwrap(), comment: ";;".to_string(), }, "wren" => FileType { @@ -43,7 +43,7 @@ impl FileType { "nut" | "js" => FileType { extension, // Regex for `include("my.module")` - regex: Regex::new(r#"(?m)^include\("([a-zA-Z\.]+)"\)(\n|[\r\n]+)"#).unwrap(), + regex: Regex::new(r#"(?m)^include\("([a-zA-Z\-_\.]+)"\)(\n|[\r\n]+)"#).unwrap(), comment: "//".to_string(), }, _ => {