Karya, built on 2018-02-23T20:23:55 (patch cf8565b7ac832266878af99a942555d139065f12)

Safe HaskellNone

Derive.ParseTitle

Contents

Description

Utilities to deal with block and track titles.

This module is used by both Cmd and Derive since Cmd also wants to know track types for track specific cmds.

Note track titles are just tracklang expressions, so no extra code is needed. Control tracks titles are just a hardcoded list of special cases, though they are parsed as tracklang Vals.

Synopsis

blocks

parse_block :: Text -> Either Text BaseTypes.Expr Source #

A block title is a normal expression, applied as a transform.

tracks

data Type Source #

Instances

Eq Type # 

Methods

(==) :: Type -> Type -> Bool #

(/=) :: Type -> Type -> Bool #

Show Type # 

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Pretty Type # 

note track

control track

parse_control_type :: Text -> Either Text ControlType Source #

Parse the first part of the control track title. This is special syntax, and is not the usual call plus list of argument values.

data ControlType Source #

Constructors

Tempo (Maybe Expr.Symbol)

Tempo track with an optional modifying symbol.

Pitch Pitch.ScaleId (Either TrackCall Score.PControl)

Pitch track that sets a ScaleId (unless it's Pitch.empty_scale), and sets the given pitch signal.

Control (Either TrackCall (Score.Typed Score.Control)) (Maybe Merge)

Control track with an optional combining operator.

p_pitch :: A.Parser ControlType Source #

  • twelve (#name | !track-call) merge

p_control :: A.Parser ControlType Source #

(!track-call | % | control:typ) merge

unparse

control_to_title :: Score.Typed Score.Control -> Text Source #

This is different from ShowVal (Typed Control) because the control doesn't need a % in the control track title.

parse util

p_scale_id :: A.Parser Pitch.ScaleId Source #

This is special syntax that's only allowed in control track titles.

util

title_to_control :: Text -> Maybe Score.Control Source #

Convert a track title to its control.

is_control_track :: Text -> Bool Source #

A pitch track is also considered a control track.

is_signal_track :: Text -> Bool Source #

This is like is_control_track but doesn't include pitch tracks.

note

parse_note :: Text -> Either Text BaseTypes.Expr Source #

Parse a note track like >inst as note-track inst. Other than this, note track titles are normal expressions.

title_to_instrument :: Text -> Maybe Score.Instrument Source #

Convert a track title into its instrument.

instrument_to_title :: Score.Instrument -> Text Source #

Convert from an instrument to the title of its instrument track.

pitch