Heredocs have proven to create much more readable syntax especially inside compilers. I've hacked them a bit with the following effects:

1) single-quote-delimitted heredocs are valid now

These wprk like single-quoted strings, that is: no backslash substitutions.

2) heredocs are now valid inside statements too, not just at end of line:

.sub main :main
    .local string code
    code = ''
    emit(code, <<"HERE", 10)
line 1
line %d
line 2
HERE
.end
.sub emit
    .param string code
    .param string more
    .param pmc args  :slurpy
    $S0 = sprintf more, args
    code .= $S0
    print code
.end

Thanks to Patrick for the hint. Please note that only one heredoc can be active at one time.

Have fun,
leo

Reply via email to