rouge 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d3e680acd54b6dc00269cb0a68721463fa898e6
4
- data.tar.gz: 704addb88b523c80da72a59db3999e01ac502282
3
+ metadata.gz: f82ff03bdf4a459c29452a02d4e3b220f5153588
4
+ data.tar.gz: a4d96c1f9407192aa7df705eb4d8d6925b0e85fd
5
5
  SHA512:
6
- metadata.gz: d5ac2591c06af1cc03516c314af662998dce6de22cf97be2b021f72e9aaa897c3662e01085c97cb806dfcea3737c7ca7d899dc194969438250eb3af4daa44367
7
- data.tar.gz: 031632f8628d96c61f4ad3ce771f32676a0021a00cfa35c7521d3849085669b43a7a1cf5174efcf7fd148310a0ba84f03e66fa14fcce558e9268d429f6043a2c
6
+ metadata.gz: b630dfbb83ed9a4913f2bf427a8d410348ec82c36f4d950209921ca08df736a473051da8b31cc9dfb3927941adbd2584e6adf2db40dad39d8f8f4ce392babdad
7
+ data.tar.gz: 1165e7a648cd8b0e112b31ce9889256b4c41cde6cdee8d74de302225caf14af8d022cc2a5aa348aee31c08d89249a7515078fd6d0cc223c62b783a6e7b817120
@@ -24,7 +24,13 @@ module Rouge
24
24
 
25
25
  def self.declarations
26
26
  @declarations ||= Set.new %w(
27
- class deinit enum extension func import init let protocol static struct subscript typealias var
27
+ class deinit enum extension final func import init internal lazy let optional private protocol public required static struct subscript typealias var dynamic
28
+ )
29
+ end
30
+
31
+ def self.at_keywords
32
+ @at_keywords ||= %w(
33
+ autoclosure IBAction IBDesignable IBInspectable IBOutlet noreturn NSCopying NSManaged objc UIApplicationMain
28
34
  )
29
35
  end
30
36
 
@@ -34,6 +40,7 @@ module Rouge
34
40
  Double Float
35
41
  Bool
36
42
  String Character
43
+ AnyObject Any
37
44
  )
38
45
  end
39
46
 
@@ -64,7 +71,7 @@ module Rouge
64
71
  rule /0b[01]+(?:_[01]+)*/, Num::Bin
65
72
  rule %r{[\d]+(?:_\d+)*}, Num::Integer
66
73
 
67
- rule /(?!\b(if|while|for)\b)\b#{id}(?=\s*[(])/, Name::Function
74
+ rule /(?!\b(if|while|for|private|internal|@objc)\b)\b#{id}(?=\s*[(])/, Name::Function
68
75
 
69
76
  rule /(#?#{id})(\s*)(:)/ do
70
77
  groups Name::Variable, Text, Punctuation
@@ -74,11 +81,27 @@ module Rouge
74
81
  groups Keyword, Text, Name::Variable
75
82
  end
76
83
 
84
+ rule /@(#{id})/ do |m|
85
+ if m[1] == 'objc'
86
+ token Keyword::Declaration
87
+ push :objc_setting
88
+ elsif self.class.at_keywords.include? m[1]
89
+ token Keyword
90
+ else
91
+ token Error
92
+ end
93
+ end
94
+
77
95
  rule id do |m|
78
96
  if self.class.keywords.include? m[0]
79
97
  token Keyword
80
98
  elsif self.class.declarations.include? m[0]
81
99
  token Keyword::Declaration
100
+ if %w(private internal).include? m[0]
101
+ push :access_control_setting
102
+ elsif %w(protocol class extension).include? m[0]
103
+ push :type_definition
104
+ end
82
105
  elsif self.class.types.include? m[0]
83
106
  token Keyword::Type
84
107
  elsif self.class.constants.include? m[0]
@@ -89,13 +112,31 @@ module Rouge
89
112
  end
90
113
  rule id, Name
91
114
  end
115
+
116
+ state :access_control_setting do
117
+ rule /\( *(\w+) *\)/ do |m|
118
+ if m[1] == 'set'
119
+ token Keyword::Declaration
120
+ else
121
+ token Error
122
+ end
123
+ end
124
+ rule //, Keyword::Declaration, :pop!
125
+ end
126
+
127
+ state :objc_setting do
128
+ rule /(\( *)(\w+)( *\))/ do |m|
129
+ token Keyword::Declaration, m[1]
130
+ token Name::Class, m[2]
131
+ token Keyword::Declaration, m[3]
132
+ end
133
+ rule //, Keyword::Declaration, :pop!
134
+ end
92
135
 
93
136
  state :dq do
94
137
  rule /\\[\\0tnr'"]/, Str::Escape
95
138
  rule /\\[(]/, Str::Escape, :interp
96
- rule /\\x\h{2}/, Str::Escape
97
- rule /\\u\h{4}/, Str::Escape
98
- rule /\\U\h{8}/, Str::Escape
139
+ rule /\\u\{\h{1,8}\}/, Str::Escape
99
140
  rule /[^\\"]+/, Str
100
141
  rule /"/, Str, :pop!
101
142
  end
@@ -112,7 +153,7 @@ module Rouge
112
153
  mixin :root
113
154
  end
114
155
 
115
- state :class do
156
+ state :type_definition do
116
157
  mixin :whitespace
117
158
  rule id, Name::Class, :pop!
118
159
  end
@@ -122,7 +163,6 @@ module Rouge
122
163
  rule /(?=[(])/, Text, :pop!
123
164
  rule /(#{id}|[.])+/, Name::Namespace, :pop!
124
165
  end
125
-
126
166
  end
127
167
  end
128
168
  end
@@ -432,6 +432,7 @@ module Rouge
432
432
  private
433
433
  def yield_token(tok, val)
434
434
  return if val.nil? || val.empty?
435
+ puts " yielding #{tok.qualname}, #{val.inspect}" if @debug
435
436
  @output_stream.yield(tok, val)
436
437
  end
437
438
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rouge
4
4
  def self.version
5
- "1.6.1"
5
+ "1.6.2"
6
6
  end
7
7
  end
@@ -3,14 +3,14 @@ require './lib/rouge/version'
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rouge"
5
5
  s.version = Rouge.version
6
- s.authors = ["Jay Adkisson"]
7
- s.email = ["jjmadkisson@gmail.com"]
6
+ s.authors = ["Jeanine Adkisson"]
7
+ s.email = ["jneen@jneen.net"]
8
8
  s.summary = "A pure-ruby colorizer based on pygments"
9
9
  s.description = <<-desc.strip.gsub(/\s+/, ' ')
10
10
  Rouge aims to a be a simple, easy-to-extend drop-in replacement
11
11
  for pygments.
12
12
  desc
13
- s.homepage = "http://github.com/jayferd/rouge"
13
+ s.homepage = "http://github.com/jneen/rouge"
14
14
  s.rubyforge_project = "rouge"
15
15
  s.files = Dir['Gemfile', 'LICENSE', 'rouge.gemspec', 'lib/**/*.rb', 'bin/rougify', 'lib/rouge/demos/*']
16
16
  s.executables = %w(rougify)
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rouge
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
- - Jay Adkisson
7
+ - Jeanine Adkisson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-26 00:00:00.000000000 Z
11
+ date: 2014-08-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rouge aims to a be a simple, easy-to-extend drop-in replacement for pygments.
14
14
  email:
15
- - jjmadkisson@gmail.com
15
+ - jneen@jneen.net
16
16
  executables:
17
17
  - rougify
18
18
  extensions: []
@@ -184,7 +184,7 @@ files:
184
184
  - lib/rouge/util.rb
185
185
  - lib/rouge/version.rb
186
186
  - rouge.gemspec
187
- homepage: http://github.com/jayferd/rouge
187
+ homepage: http://github.com/jneen/rouge
188
188
  licenses:
189
189
  - MIT (see LICENSE file)
190
190
  metadata: {}