kalevala v0.1.0 Kalevala.Character.Command.RouterMacros View Source

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

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

Link to this macro

command(command)

View Source (macro)

Wraps NimbleParsec macros to generate a tagged command

Link to this macro

dynamic(arg, command, arguments)

View Source (macro)

Handle dynamic parsing

This runs the parse/2 function on the given module at runtime. This enables parsing things against runtime only data.

Link to this function

generate_parse_function(command, command_alias, fun, parse_fun, module \\ nil)

View Source
Link to this macro

module(arg, list)

View Source (macro)

Sets the @module tag for parse functions nested inside

Link to this macro

parse(command, fun, opts \\ [], parse_fun \\ nil)

View Source (macro)

Parse a new command

command starts out the parse and any whitespace afterwards will be ignored

Link to this function

parse_dynamic_text(module, arguments, text)

View Source
Link to this function

parse_text(module, fun, command, arg)

View Source
Link to this macro

spaces(parsec)

View Source (macro)

Wraps NimbleParsec macros to allow for grabbing spaces

Grabs between other pieces of the command

Link to this macro

symbol(parsec \\ NimbleParsec.empty(), character)

View Source (macro)
Link to this macro

text(parsec, tag)

View Source (macro)

Wraps NimbleParsec macros to generate tagged text

This grabs as much as it can

Link to this macro

word(parsec, tag)

View Source (macro)

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"