Changed string delimiters

You know what could be cursed? Using Rust's block comment syntax as String delimiters!
This commit is contained in:
Erin 2022-02-22 22:39:03 +01:00 committed by ondra05
parent d1f18be279
commit f55f9e0512

View file

@ -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<T: std::str::FromStr>(lexer: &mut Lexer<Token>) -> Option<T> {
}
fn get_string(lexer: &mut Lexer<Token>) -> String {
lexer.slice().trim_matches('"').to_owned()
lexer
.slice()
.trim_start_matches("/*")
.trim_end_matches("*/")
.to_owned()
}
fn get_abool(lexer: &mut Lexer<Token>) -> Option<Abool> {