From 5f135be37ca68780bba53e0de29ea6e2123c8a99 Mon Sep 17 00:00:00 2001 From: Erin Date: Tue, 22 Feb 2022 22:39:03 +0100 Subject: [PATCH] Changed string delimiters You know what could be cursed? Using Rust's block comment syntax as String delimiters! --- ablescript/src/lexer.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ablescript/src/lexer.rs b/ablescript/src/lexer.rs index 729a016..2029bf1 100644 --- a/ablescript/src/lexer.rs +++ b/ablescript/src/lexer.rs @@ -122,7 +122,7 @@ pub enum Token { Abool(Abool), /// String - #[regex("\"(\\.|[^\"])*\"", get_string)] + #[regex("/\\*(\\.|[^\\*/])*\\*/", get_string)] String(String), /// Integer @@ -149,7 +149,11 @@ fn get_value(lexer: &mut Lexer) -> Option { } fn get_string(lexer: &mut Lexer) -> String { - lexer.slice().trim_matches('"').to_owned() + lexer + .slice() + .trim_start_matches("/*") + .trim_end_matches("*/") + .to_owned() } fn get_abool(lexer: &mut Lexer) -> Option {