Closed isnullxbh closed 3 years ago
Good question! You're right that the existing mechanism assumes that a line of code will turn into zero or one lines of blocks. I haven't touched this code in a while, but I don't think it'd be impossible to allow the convertBody function to handle chunks of code in special cases, though specifying it would be a bit tricky to figure out the first time.
That said, I'm nervous about the idea. From a pedagogical perspective, we still don't have much understanding of how novices understand the block/text conversion. There are times I regret implementing the idea of 1=>0 block conversion. In particular, import blocks "disappear" when they go from text to blocks. What will happen when we start swallowing more lines of code?
I'd be interested in specific ideas that you had for situations where you'd need to convert multiple linse of code into a single block!
BlockMirror could probably handle stuff like this now: https://github.com/blockpy-edu/BlockMirror/
I don't know for certain, though. It's not really designed around collapsing multiple statements, though it does handle multiple lines?
Is it possible to parse a source code, like:
into one block? As I understand it, the existing mechanism allows to parse source code for blocks that are consist of one row, like: