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

Make the code in scanner/groovy.rb robust. #228

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/coderay/scanners/groovy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def setup
def scan_tokens encoder, options
state = options[:state] || @state
inline_block_stack = []
inline_block_paren_depth = nil
inline_block_paren_depth = 0
string_delimiter = nil
import_clause = class_name_follows = last_token = after_def = false
value_expected = true
Expand Down Expand Up @@ -196,7 +196,8 @@ def scan_tokens encoder, options

elsif (state == :string || state == :multiline_string) &&
(match = scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox))
if string_delimiter[0] == ?' && !(match == "\\\\" || match == "\\'")
if !(string_delimiter.nil?) && string_delimiter.kind_of?(Array) \
&& string_delimiter[0] == ?' && !(match == "\\\\" || match == "\\'")
encoder.text_token match, :content
else
encoder.text_token match, :char
Expand Down