Skip to content

Commit 46a9475

Browse files
committed
Merge branch 'master' into sass-scanner
2 parents 2fd96c3 + 1a3f043 commit 46a9475

File tree

9 files changed

+10
-11
lines changed

9 files changed

+10
-11
lines changed

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ group :development do
1111
gem "shoulda-context", "~> 1.0.0"
1212
gem "json" if RUBY_VERSION < '1.9'
1313
gem "rdoc"
14-
gem "activesupport"
1514
end

lib/coderay/scanners/c.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def scan_tokens encoder, options
148148
encoder.text_token match, :char
149149
elsif match = scan(/ \\ | $ /x)
150150
encoder.end_group :string
151-
encoder.text_token match, :error
151+
encoder.text_token match, :error unless match.empty?
152152
state = :initial
153153
label_expected = false
154154
else

lib/coderay/scanners/cpp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def scan_tokens encoder, options
160160
encoder.text_token match, :char
161161
elsif match = scan(/ \\ | $ /x)
162162
encoder.end_group :string
163-
encoder.text_token match, :error
163+
encoder.text_token match, :error unless match.empty?
164164
state = :initial
165165
label_expected = false
166166
else

lib/coderay/scanners/java.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def scan_tokens encoder, options
147147
elsif match = scan(/ \\ | $ /x)
148148
encoder.end_group state
149149
state = :initial
150-
encoder.text_token match, :error
150+
encoder.text_token match, :error unless match.empty?
151151
else
152152
raise_inspect "else case \" reached; %p not handled." % peek(1), encoder
153153
end

lib/coderay/scanners/java_script.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,11 @@ def scan_tokens encoder, options
175175
encoder.text_token match, :content
176176
elsif match = scan(/ \\ | $ /x)
177177
encoder.end_group state
178-
encoder.text_token match, :error
178+
encoder.text_token match, :error unless match.empty?
179179
key_expected = value_expected = false
180180
state = :initial
181181
else
182-
raise_inspect "else case \" reached; %p not handled." % peek(1), encoder
182+
raise_inspect "else case #{string_delimiter} reached; %p not handled." % peek(1), encoder
183183
end
184184

185185
else

lib/coderay/scanners/json.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def scan_tokens encoder, options
7070
encoder.text_token match, :content
7171
elsif match = scan(/ \\ | $ /x)
7272
encoder.end_group state
73-
encoder.text_token match, :error
73+
encoder.text_token match, :error unless match.empty?
7474
state = :initial
7575
else
7676
raise_inspect "else case \" reached; %p not handled." % peek(1), encoder

lib/coderay/scanners/python.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def scan_tokens encoder, options
133133
elsif match = scan(/ \\ | $ /x)
134134
encoder.end_group string_type
135135
string_type = nil
136-
encoder.text_token match, :error
136+
encoder.text_token match, :error unless match.empty?
137137
state = :initial
138138
else
139139
raise_inspect "else case \" reached; %p not handled." % peek(1), encoder, state

lib/coderay/scanners/sql.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def scan_tokens encoder, options
148148
encoder.text_token string_content, :content
149149
string_content = ''
150150
end
151-
encoder.text_token match, :error
151+
encoder.text_token match, :error unless match.empty?
152152
state = :initial
153153
else
154154
raise "else case \" reached; %p not handled." % peek(1), encoder

rake_tasks/generator.rake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
namespace :generate do
2-
desc 'generates a new scanner NAME=lang [ALT=alternative,plugin,ids] [EXT=file,extensions] [BASE=base lang] '
2+
desc 'generates a new scanner NAME=lang [ALT=alternative,plugin,ids] [EXT=file,extensions] [BASE=base lang]'
33
task :scanner do
44
raise 'I need a scanner name; use NAME=lang' unless scanner_class_name = ENV['NAME']
55
raise "Invalid lang: #{scanner_class_name}; use NAME=lang." unless /\A\w+\z/ === scanner_class_name
@@ -52,7 +52,7 @@ namespace :generate do
5252
end
5353
end
5454

55-
if alternative_ids = ENV['ALT']
55+
if alternative_ids = ENV['ALT'] && alternative_ids != lang
5656
map_file = File.join(LIB_ROOT, 'coderay', 'scanners', '_map.rb')
5757
puts "Not automated. Remember to add your alternative plugin ids to #{map_file}:"
5858
for id in alternative_ids.split(',')

0 commit comments

Comments
 (0)