Karya, built on 2022-03-21T01:30:44 (patch 89d1651424c35e564138d93424a157ff87457245)
Safe HaskellSafe-Inferred



Tracklang parsers. Many of the parsers in here should be inverses of the ShowVal.ShowVal class.



parse_val :: Text -> Either Text DeriveT.Val Source #

Parse a single Val.

parse_attrs :: String -> Either Text Attrs.Attributes Source #

Parse attributes in the form +a+b.

parse_num :: Text -> Either Text Signal.Y Source #

Parse a number or hex code, without a type suffix.

parse_call :: Text -> Maybe Text Source #

Extract only the call part of the text.

lex1 :: Text -> (Text, Text) Source #

Lex out a single expression. This isn't really a traditional lex, because it will extract a whole parenthesized expression instead of a token. Also, this leaves on trailing whitespace, so you can concatenate the lexed out words and get the original input back.

lex :: Text -> [Text] Source #

Like lex1, but get all of them.

split_pipeline :: Text -> [[Text]] Source #

Take an expression and lex it into words, where each sublist corresponds to one expression in the pipeline. Like lex1, this corresponds to call name and arguments, not tokens. The final word could be a comment.

This preserves trailing spaces on the words, because track editors use that to infer edits in progress.

unparsed_call :: Expr.Symbol Source #

This is a magic call name that suppresses normal parsing. Instead, the rest of the event expression is passed as a string. The only characters that can't be used are ) and |, so an unparsed call can still be included in a sub expression.


p_pcontrol :: A.Parser ScoreT.PControl Source #

Unlike p_control_ref, this doesn't parse a comma and a default value, because pitches don't have literals. Instead, use the pitch-control val call.

p_identifier :: Bool -> String -> A.Parser Text Source #

Identifiers are somewhat more strict than usual. They must be lowercase, and the only non-letter allowed is hyphen. This means words must be separated with hyphens, and leaves me free to give special meanings to underscores or caps if I want.

until gives additional chars that stop parsing, for idents that are embedded in another lexeme.

p_symbol Source #


:: Bool

A call at the top level can allow a ).

-> A.Parser Expr.Symbol 

Any word in call position is considered a Str. This means that you can have calls like 4 and >, which are useful names for notes or ornaments.

expand macros

expand_macros :: (Text -> Text) -> Text -> Either Text Text Source #

Map the identifiers after a "@" through the given function. Used to implement ID macros for the REPL.

A macro looks like @valid-id-chars.

for Parse.Ky

spaces :: A.Parser () Source #

Skip spaces, including a newline as long as the next line, skipping empty lines, is indented.