Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Percent Literals Unsupported Inside Macros #9812

Closed
toddsundsted opened this issue Oct 8, 2020 · 2 comments
Closed

Percent Literals Unsupported Inside Macros #9812

toddsundsted opened this issue Oct 8, 2020 · 2 comments

Comments

@toddsundsted
Copy link
Contributor

Macros don't seem to permit percent literals aside from % and %q (including %Q, %i, %w and %x).

See https://play.crystal-lang.org/#/r/9rgn

macro foo_bar
  %q|#{test}|
end
 
test = "hello, world"
puts foo_bar

Outputs "#{test}".

While https://play.crystal-lang.org/#/r/9rgo

macro foo_bar
  %Q|#{test}|
end
 
test = "hello, world"
puts foo_bar

Prints

There was a problem expanding macro 'foo_bar'

Called macro defined in eval:1:1

Which expanded to:

 > 1 | __temp_24|#{test}|
     ^
Error: unexpected token: EOF

I'd expect it to output "hello, world".

I'm running:

$ crystal -v
Crystal 0.35.1 (2020-06-19)

LLVM: 10.0.0
Default target: x86_64-apple-macosx
@toddsundsted
Copy link
Contributor Author

Took a swing at a PR here: #9811

@toddsundsted
Copy link
Contributor Author

closing since #9811 has been merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant