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

If statement incorrectly parses "end" as a keyword #14

Open
AnrichVS opened this issue Apr 20, 2021 · 0 comments
Open

If statement incorrectly parses "end" as a keyword #14

AnrichVS opened this issue Apr 20, 2021 · 0 comments

Comments

@AnrichVS
Copy link

Hi,

Consider this ERB content:

<% if 'This is a string with the end keyword in it' %>
Content
<% end %>

I would expect this to parse fine. However, it seems that the "end" within the string is detected as an actual end keyword.

Erbse::Engine.new.call("<% if 'This is a string with the end keyword in it' %> Content  <% end %>")
NoMethodError: undefined method `<<' for nil:NilClass
from /usr/local/bundle/gems/erbse-0.1.4/lib/erbse/parser.rb:38:in `block in call'

It's not just within strings, but anything with "end" in it, for example and object of a class that defines an end method:

<% if some_object.end %>
Content
<% end %>

The issue is that buffers is an empty array on this line:

buffers.last << [:static, "#{text}\n"] << [:newline]

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