loc pragma
loc pragma?
ECR.def_to_s calls run macro with ecr/process and given ECR file.ecr/process prints Crystal source code generated from given ECR file.ECR.def_to_s result.
ecr/process at hand.$ echo 'require "ecr/process"' |
crystal run --stdin-filename process.cr -- ecr-sample.ecr ___io___
(MEMO: the second command-line argument of ecr/process means a variable name to write output.)
loc pragma syntax#<loc:"filename",line_number,column_number>loc pragma is also parsed.loc pragma syntax (push and pop)#<loc:push> and #<loc:pop>#<loc:push> saves current location.#<loc:pop> restores the location saved by previous #<loc:push>.It is useful to distinguish between macro generated code and original code.
Then, it shows really clear error message.
loc pragma...loc pragma is just text, so it causes some issues. e.g.So, currently the compiler does not outputs loc pragma for macro argument.
I created a new Pull Request with new approach.

It does not outputs loc pragma directly, but it keeps loc pragmas as internal data.
Unfortunately it is not merged...