Closed pietroppeter closed 2 years ago
In addition to this I think this also breaks:
nbCode: someTemplate:
code block
so the problem in general is multi-line blocks that start on the same line as the command
Here's a preliminary plan for how to determine the form of the code:
startLine == endLine and lines[startLine].isCommandLine
, it is either a single line expression or it contains a multiline-string
lines[startLine].count("\"\"\"") mod 2 == 0
, it is a single line expression as the number of opening and closing strings match.else
, it ends with a multiline stringelif startLine == endLine
, it starts on a new line and could contain either a single line expression or a multiline string. same checks as above.else
, it is a multiline expression which might or might not end with a multiline stringAll branches share a lot of code so I'll try and come up with a way of splitting the logic into reusable functions more.
Compiling and running this file:
last line of output is (when using
CodeAsInSource
now default):while it should be (as it is when using
-d:nimibCodeFromAst
)fix to be done in code in
src/nimib/sources.nim