Karya, built on 2020-11-26T21:03:17 (patch 23b5be2d53a9e8e7d6136cda5aae2849abe5cded)
Safe HaskellNone

Cmd.NoteTrackParse

Description

Ad-hoc parsing for note tracks. This is a bit hacky because it's trying to guess syntactically how an expression will be evaluated, but it's convenient to do it this way, because otherwise I need to either have a special kind of evaluation, or I need to have evaluate emit metadata, and then wait for a full derive to complete. In addition, expressions that are being edited might not parse, or their caller might fail, or something.

Synopsis

Documentation

block_calls_of Source #

Arguments

:: Bool

If True, and the call wasn't a block, see if any of the arguments name blocks. This is for calls like alt, which take blocks as arguments.

-> (Text -> Maybe a) 
-> Text 
-> [a] 

Try to to figure out any blocks that are referenced in the expression.

This doesn't use the full Derive.Parse machinery, but is simple and doesn't require the text to be fully parseable.

to_block_id :: Map Id.BlockId a -> Id.Namespace -> Maybe Id.BlockId -> Text -> Maybe Id.BlockId Source #

If the first word names a block, then it's probably a block call with args, so return just that. Otherwise, return any argument that names a block.