rpg-chat-command-parser 0.1.0

A command line parser for RPG-like chat commands. Processes commands such as '/heal Player1', '/equip sword', or '/party invite Player2', validates their structure, and produces structured output for integration into games.
Documentation
1
2
3
4
5
6
7
8
9
command = { "/" ~ verb ~ (whitespace ~ target)? ~ (whitespace ~ flag)* }
verb    = { ASCII_ALPHANUMERIC+ }
target  = { ASCII_ALPHANUMERIC+ | quoted_string }
flag = { "--" ~ valid_key ~ "=" ~ value | "--" ~ valid_key ~ "=" | bad_flag }
valid_key = { ASCII_ALPHANUMERIC+ }
value   = { ASCII_ALPHANUMERIC+ | quoted_string }
quoted_string = { "\"" ~ (!"\"" ~ ANY)* ~ "\"" }
bad_flag = { "--" ~ (!ASCII_ALPHANUMERIC ~ ANY)* } // Catch-all for invalid flags
whitespace = _{ " " }