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



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.



block_calls_of Source #


:: 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.