coderay 1.0.0.831pre → 1.0.0.835rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -231,9 +231,6 @@ module CodeRay
231
231
 
232
232
  # The current column position of the scanner, starting with 1.
233
233
  # See also: #line.
234
- #
235
- # Beware, this is implemented inefficiently. It should be used
236
- # for debugging only.
237
234
  def column pos = self.pos
238
235
  return 1 if pos <= 0
239
236
  pos - (binary_string.rindex(?\n, pos - 1) || -1)
@@ -15,9 +15,8 @@ module Scanners
15
15
 
16
16
  def scan_tokens encoder, options
17
17
 
18
- value_expected = nil
19
18
  state = :initial
20
- key_indent = indent = 0
19
+ key_indent = string_indent = 0
21
20
 
22
21
  until eos?
23
22
 
@@ -55,14 +54,14 @@ module Scanners
55
54
  when match = scan(/[|>][-+]?/)
56
55
  encoder.begin_group :string
57
56
  encoder.text_token match, :delimiter
58
- string_indent = key_indent || column(pos - match.size - 1)
57
+ string_indent = key_indent || column(pos - match.size) - 1
59
58
  encoder.text_token matched, :content if scan(/(?:\n+ {#{string_indent + 1}}.*)+/)
60
59
  encoder.end_group :string
61
60
  next
62
61
  when match = scan(/(?![!"*&]).+?(?=$|\s+#)/)
63
62
  encoder.begin_group :string
64
63
  encoder.text_token match, :content
65
- string_indent = key_indent || column(pos - match.size - 1)
64
+ string_indent = key_indent || column(pos - match.size) - 1
66
65
  encoder.text_token matched, :content if scan(/(?:\n+ {#{string_indent + 1}}.*)+/)
67
66
  encoder.end_group :string
68
67
  next
@@ -79,7 +78,7 @@ module Scanners
79
78
  next
80
79
  when state == :initial && match = scan(/[\w.() ]*\S(?= *:(?: |$))/)
81
80
  encoder.text_token match, :key
82
- key_indent = column(pos - match.size - 1)
81
+ key_indent = column(pos - match.size) - 1
83
82
  state = :colon
84
83
  next
85
84
  when match = scan(/(?:"[^"\n]*"|'[^'\n]*')(?= *:(?: |$))/)
@@ -88,7 +87,7 @@ module Scanners
88
87
  encoder.text_token match[1..-2], :content
89
88
  encoder.text_token match[-1,1], :delimiter
90
89
  encoder.end_group :key
91
- key_indent = column(pos - match.size - 1)
90
+ key_indent = column(pos - match.size) - 1
92
91
  state = :colon
93
92
  next
94
93
  when match = scan(/(![\w\/]+)(:([\w:]+))?/)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coderay
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.831pre
4
+ version: 1.0.0.835rc1
5
5
  prerelease: 9
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-23 00:00:00.000000000Z
12
+ date: 2011-08-29 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Fast and easy syntax highlighting for selected languages, written in
15
15
  Ruby. Comes with RedCloth integration and LOC counter.