We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 162ccf9 commit 864a7b2Copy full SHA for 864a7b2
lib/coderay/scanners/lua.rb
@@ -148,10 +148,9 @@ def scan_tokens(tokens, options)
148
# We use the block form of gsub instead of the StringScanner capabilities because StringScanner does not support named captures in 1.9
149
remainder_index = 0
150
151
- boring_kinds = [:space,:content]
152
add_boring = ->(fluff) do
153
- fluff.split(/(\S+)/).each.with_index do |text,i|
154
- tokens.text_token(text, boring_kinds[i%2]) unless text.empty?
+ fluff.scan(/((\s+)|(\S+))/).each do |text,ws,nws|
+ tokens.text_token(text, ws ? :space : :content)
155
end
156
157
0 commit comments