Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

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.