| Crates.io | rpg-chat-command-parser |
| lib.rs | rpg-chat-command-parser |
| version | 0.1.0 |
| created_at | 2024-11-24 18:08:40.249615+00 |
| updated_at | 2024-11-24 18:08:40.249615+00 |
| description | 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. |
| homepage | https://github.com/Emril44/rpg-chat-command-parser |
| repository | https://github.com/Emril44/rpg-chat-command-parser |
| max_upload_size | |
| id | 1459483 |
| size | 28,345 |
rpg-chat-command-parser is a Rust library and CLI for parsing and validating RPG-style chat commands. It processes commands in the format commonly used in role-playing games, ensuring correct syntax and extracting useful data for integration into games or simulation systems.
The parser processes commands like:
/cast fireball --power=high/equip sword/heal Player1 --boost=strongThe grammar is defined using Pest and follows these rules:
/.cast, equip).fireball, sword).--power=high).command:

command ::= '/' 'alphanumeric word' 'space' target 'space' flag*
target:

target ::= 'alphanumeric word'
| quoted_string
referenced by:
flag:

flag ::= '--' 'alphanumeric word' '=' value?
| bad_flag
referenced by:
value:

value ::= 'alphanumeric word'
| quoted_string
referenced by:
quoted_string:

quoted_string
::= '"' 'text without double-quotes' '"'
referenced by:

Parsed commands produce a structured output:
{
"verb": "cast",
"target": "fireball",
"flags": {
"power": "high"
}
}