From d5a1bcd9cd7347db9aa01424f78be47ee4c9350d Mon Sep 17 00:00:00 2001 From: Aidan Bleser Date: Thu, 28 Mar 2024 10:30:34 -0500 Subject: [PATCH] Forgot to implement this original - Now when comments are added they are ignore properly - Fixes #8 - Fixes multiline arrays and strings --- .vnv | 6 +++++- src/parsing/mod.rs | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.vnv b/.vnv index f102aa8..72fae47 100644 --- a/.vnv +++ b/.vnv @@ -4,7 +4,11 @@ @startsWith("https://") # Must be min 10 for name of domain and domain postfix Ex: (https://d.t) @min(10) -ALLOWED_ORIGINS=["https://github.com", "https://aidanbleser.com"] +# ALLOWED_ORIGINS=["https://github.com", "http://aidanbleser.com"] +ALLOWED_ORIGINS=[ + "https://github.com", + "https://aidanbleser.com" +] @min(1000) @public POLLING_INTERVAL=5000 diff --git a/src/parsing/mod.rs b/src/parsing/mod.rs index 3efcb82..cb644ac 100644 --- a/src/parsing/mod.rs +++ b/src/parsing/mod.rs @@ -127,8 +127,9 @@ pub fn parse(content: &str) -> ParseResult { is_array = true; } else if c == ']' && is_value && is_array && !is_string { is_array = false; - } else if !is_comment { - // no need to add comments to current + } else if c == '#' && !is_value && !is_array && !is_string { + is_comment = true; + } else if !is_comment && !(c == '\n' && !is_string) { current.push_str(&c.to_string()); } @@ -199,6 +200,8 @@ pub fn parse(content: &str) -> ParseResult { current_key = (String::new(), FilePosition::new()); current_decorators = Vec::new(); is_value = false; + is_array = false; + is_string = false; } // clear no matter what