View Source Kalevala.Character.Command.RouterMacros (kalevala v0.1.0)
Set of macros to build a command router using NimbleParsec
Link to this section Summary
Functions
Wraps NimbleParsec macros to generate a tagged command
Handle dynamic parsing
Sets the @module
tag for parse functions nested inside
Parse a new command
Sets up a prepositional phrase
Wraps NimbleParsec macros to allow for grabbing spaces
Wraps NimbleParsec macros to generate tagged text
Wraps NimbleParsec macros to generate a tagged word
Link to this section Functions
Wraps NimbleParsec macros to generate a tagged command
Handle dynamic parsing
This runs the parse/2
function on the given module at runtime. This enables
parsing things against runtime only data.
generate_parse_function(command, command_alias, fun, parse_fun, module \\ nil)
View SourceSets the @module
tag for parse functions nested inside
Parse a new command
command
starts out the parse and any whitespace afterwards will be ignored
preposition(parsec \\ NimbleParsec.empty(), preposition, tag, opts \\ [])
View Source (macro)Sets up a prepositional phrase
Example:
command
|> text(:item)
|> preposition("to", :character)
Wraps NimbleParsec macros to allow for grabbing spaces
Grabs between other pieces of the command
Wraps NimbleParsec macros to generate tagged text
This grabs as much as it can, or until the stop
combinator is triggered
Wraps NimbleParsec macros to generate a tagged word
Words are codepoints that don't include a space, or everything inside of quotes.
Both of the following count as a word:
- villager
- "town crier"