allow minus/underscore in command names and single-word strings

This commit is contained in:
yuni 2024-03-20 21:38:25 +01:00
parent 4c30563ac0
commit 8b9d7d4afa
2 changed files with 5 additions and 5 deletions

View file

@ -13,7 +13,7 @@ actor -2300 10 0 pizzeria
actor -50 0 0 suit
name Icarus
chatid "hi_icarus"
chatid hi_icarus
alive yes
pronoun it
@ -25,11 +25,11 @@ actor -2265 10 0 suit
actor 0 0 0 error
chat "error"
chat error
name "ERROR"
msg 0 "INIT" "EXIT" "Unspecified conversation ID"
chat "hi_icarus"
chat hi_icarus
name "Icarus"
msg 2 "INIT" "hi" "Requesting permission to communicate..."
lvl "info"

View file

@ -361,8 +361,8 @@ pub fn load_defs(
mut commands: Commands,
asset_server: Res<AssetServer>,
) {
let re1 = Regex::new(r"^\s*([a-z]+)\s+(.*)$").unwrap();
let re2 = Regex::new("\"([^\"]*)\"|(-?[0-9]+(?:\\.[0-9]+)?)|([a-zA-Z][a-zA-Z0-9]*)").unwrap();
let re1 = Regex::new(r"^\s*([a-z_-]+)\s+(.*)$").unwrap();
let re2 = Regex::new("\"([^\"]*)\"|(-?[0-9]+(?:\\.[0-9]+)?)|([a-zA-Z_-][a-zA-Z0-9_-]*)").unwrap();
let defs_string = include_str!("defs.txt");
let mut lines = defs_string.lines();
let mut state = ParserState::default();