glirc-2.27: Console IRC client

Copyright(c) Eric Mertens 2016
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellSafe
LanguageHaskell2010

Client.Commands.Interpolation

Description

This module is able to parse commands with inline variables and then to evaluate those variables to produce a complete command that varies by the current context.

Synopsis

Documentation

data ExpansionChunk Source #

Parsed chunk of an expandable command

Constructors

LiteralChunk Text

regular text

VariableChunk Text

inline variable $x or ${x y}

IntegerChunk Integer

inline variable $1 or ${1}

DefaultChunk ExpansionChunk Text

bracketed variable with default ${x|lit}

parseExpansion :: Text -> Maybe [ExpansionChunk] Source #

Parse a Text searching for the expansions as specified in ExpansionChunk. $$ is used to escape a single $.

resolveMacroExpansions Source #

Arguments

:: (Text -> Maybe Text)

variable resolution

-> (Integer -> Maybe Text)

argument index resolution

-> [ExpansionChunk]

chunks

-> Maybe Text

concatenated, expanded chunks

Attempt to expand all of the elements in the given list using the two expansion functions. If the expansion of any chunk fails the whole expansion fails.

data Macro Source #

Constructors

Macro 
Instances
Show Macro Source # 
Instance details

Defined in Client.Commands.Interpolation

Methods

showsPrec :: Int -> Macro -> ShowS #

show :: Macro -> String #

showList :: [Macro] -> ShowS #

data MacroSpec where Source #

Constructors

MacroSpec :: (forall r. Args r [String]) -> MacroSpec 
Instances
Show MacroSpec Source # 
Instance details

Defined in Client.Commands.Interpolation

noMacroArguments :: MacroSpec Source #

Specification used when unspecified, no arguments.