rouge 0.2.12 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'http://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  gem 'minitest'
6
- gem 'wrong', '~> 0.6.2'
6
+ gem 'wrong'
7
7
 
8
8
  gem 'rake'
9
9
 
@@ -6,7 +6,7 @@ module Rouge
6
6
  tag 'clojure'
7
7
  aliases 'clj'
8
8
 
9
- filenames '*.clj'
9
+ filenames '*.clj', '*.cljs'
10
10
 
11
11
  mimetypes 'text/x-clojure', 'application/x-clojure'
12
12
 
@@ -368,6 +368,3 @@ module Rouge
368
368
  end
369
369
  end
370
370
  end
371
-
372
- class Regexp
373
- end
@@ -98,6 +98,7 @@ module Rouge
98
98
  # XXX IMPORTANT XXX
99
99
  # For compatibility, this list must be kept in sync with
100
100
  # pygments.token.STANDARD_TYPES
101
+ # please see https://github.com/jayferd/rouge/wiki/List-of-tokens
101
102
  token 'Text', ''
102
103
  token 'Text.Whitespace', 'w'
103
104
  token 'Error', 'err'
@@ -1,5 +1,5 @@
1
1
  module Rouge
2
2
  def self.version
3
- "0.2.12"
3
+ "0.2.13"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rouge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
4
+ version: 0.2.13
5
5
  prerelease:
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: 2013-02-07 00:00:00.000000000 Z
12
+ date: 2013-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -37,110 +37,107 @@ extra_rdoc_files: []
37
37
  files:
38
38
  - Gemfile
39
39
  - rouge.gemspec
40
+ - lib/rouge/token.rb
41
+ - lib/rouge/version.rb
40
42
  - lib/rouge/util.rb
41
- - lib/rouge/lexers/nginx.rb
42
- - lib/rouge/lexers/python.rb
43
- - lib/rouge/lexers/sql.rb
44
- - lib/rouge/lexers/common_lisp.rb
45
- - lib/rouge/lexers/erb.rb
46
- - lib/rouge/lexers/conf.rb
47
- - lib/rouge/lexers/scheme.rb
43
+ - lib/rouge/theme.rb
44
+ - lib/rouge/lexer.rb
45
+ - lib/rouge/template_lexer.rb
46
+ - lib/rouge/formatter.rb
47
+ - lib/rouge/plugins/redcarpet.rb
48
+ - lib/rouge/cli.rb
49
+ - lib/rouge/formatters/html.rb
50
+ - lib/rouge/formatters/terminal256.rb
51
+ - lib/rouge/themes/thankful_eyes.rb
52
+ - lib/rouge/themes/base16.rb
53
+ - lib/rouge/themes/colorful.rb
54
+ - lib/rouge/text_analyzer.rb
55
+ - lib/rouge/regex_lexer.rb
56
+ - lib/rouge/lexers/html.rb
57
+ - lib/rouge/lexers/smalltalk.rb
48
58
  - lib/rouge/lexers/clojure.rb
49
- - lib/rouge/lexers/xml.rb
50
- - lib/rouge/lexers/shell.rb
51
- - lib/rouge/lexers/haml.rb
52
- - lib/rouge/lexers/ruby.rb
53
- - lib/rouge/lexers/make.rb
54
- - lib/rouge/lexers/scss.rb
55
- - lib/rouge/lexers/perl.rb
56
- - lib/rouge/lexers/javascript.rb
57
- - lib/rouge/lexers/diff.rb
58
- - lib/rouge/lexers/io.rb
59
- - lib/rouge/lexers/viml.rb
60
- - lib/rouge/lexers/rust.rb
59
+ - lib/rouge/lexers/sass.rb
60
+ - lib/rouge/lexers/factor.rb
61
61
  - lib/rouge/lexers/csharp.rb
62
- - lib/rouge/lexers/objective_c.rb
63
- - lib/rouge/lexers/smalltalk.rb
64
62
  - lib/rouge/lexers/php/builtins.rb
65
- - lib/rouge/lexers/asp.rb
66
- - lib/rouge/lexers/haskell.rb
67
- - lib/rouge/lexers/c.rb
63
+ - lib/rouge/lexers/nginx.rb
64
+ - lib/rouge/lexers/perl.rb
65
+ - lib/rouge/lexers/groovy.rb
68
66
  - lib/rouge/lexers/sed.rb
69
- - lib/rouge/lexers/handlebars.rb
70
- - lib/rouge/lexers/tex.rb
67
+ - lib/rouge/lexers/coffeescript.rb
71
68
  - lib/rouge/lexers/text.rb
72
- - lib/rouge/lexers/html.rb
73
- - lib/rouge/lexers/markdown.rb
74
- - lib/rouge/lexers/java.rb
69
+ - lib/rouge/lexers/diff.rb
70
+ - lib/rouge/lexers/viml/keywords.rb
71
+ - lib/rouge/lexers/css.rb
72
+ - lib/rouge/lexers/ruby.rb
73
+ - lib/rouge/lexers/xml.rb
74
+ - lib/rouge/lexers/handlebars.rb
75
75
  - lib/rouge/lexers/php.rb
76
- - lib/rouge/lexers/yaml.rb
77
- - lib/rouge/lexers/session.rb
78
- - lib/rouge/lexers/coffeescript.rb
79
76
  - lib/rouge/lexers/tcl.rb
80
- - lib/rouge/lexers/css.rb
77
+ - lib/rouge/lexers/tex.rb
78
+ - lib/rouge/lexers/rust.rb
79
+ - lib/rouge/lexers/scss.rb
80
+ - lib/rouge/lexers/javascript.rb
81
+ - lib/rouge/lexers/shell.rb
82
+ - lib/rouge/lexers/yaml.rb
83
+ - lib/rouge/lexers/make.rb
84
+ - lib/rouge/lexers/viml.rb
85
+ - lib/rouge/lexers/java.rb
86
+ - lib/rouge/lexers/common_lisp.rb
87
+ - lib/rouge/lexers/scheme.rb
88
+ - lib/rouge/lexers/haml.rb
89
+ - lib/rouge/lexers/erb.rb
90
+ - lib/rouge/lexers/c.rb
91
+ - lib/rouge/lexers/io.rb
92
+ - lib/rouge/lexers/python.rb
81
93
  - lib/rouge/lexers/cpp.rb
82
- - lib/rouge/lexers/factor.rb
83
- - lib/rouge/lexers/viml/keywords.rb
84
- - lib/rouge/lexers/groovy.rb
85
- - lib/rouge/lexers/sass.rb
86
- - lib/rouge/plugins/redcarpet.rb
87
- - lib/rouge/themes/thankful_eyes.rb
88
- - lib/rouge/themes/colorful.rb
89
- - lib/rouge/themes/base16.rb
90
- - lib/rouge/token.rb
91
- - lib/rouge/formatters/html.rb
92
- - lib/rouge/formatters/terminal256.rb
93
- - lib/rouge/text_analyzer.rb
94
- - lib/rouge/version.rb
95
- - lib/rouge/formatter.rb
96
- - lib/rouge/regex_lexer.rb
97
- - lib/rouge/cli.rb
98
- - lib/rouge/lexer.rb
99
- - lib/rouge/template_lexer.rb
100
- - lib/rouge/theme.rb
94
+ - lib/rouge/lexers/sql.rb
95
+ - lib/rouge/lexers/haskell.rb
96
+ - lib/rouge/lexers/markdown.rb
97
+ - lib/rouge/lexers/conf.rb
101
98
  - lib/rouge.rb
102
99
  - bin/rougify
103
- - lib/rouge/demos/coffeescript
104
- - lib/rouge/demos/haml
105
- - lib/rouge/demos/smalltalk
106
- - lib/rouge/demos/html
107
- - lib/rouge/demos/clojure
108
- - lib/rouge/demos/cpp
109
- - lib/rouge/demos/scss
110
- - lib/rouge/demos/xml
111
- - lib/rouge/demos/haskell
112
- - lib/rouge/demos/factor
113
- - lib/rouge/demos/erb
114
100
  - lib/rouge/demos/sass
115
- - lib/rouge/demos/tex
116
- - lib/rouge/demos/scheme
117
- - lib/rouge/demos/diff
118
- - lib/rouge/demos/markdown
119
- - lib/rouge/demos/io
120
- - lib/rouge/demos/javascript
121
- - lib/rouge/demos/json
122
- - lib/rouge/demos/css
123
101
  - lib/rouge/demos/ruby
124
- - lib/rouge/demos/php
125
- - lib/rouge/demos/shell
126
- - lib/rouge/demos/make
127
- - lib/rouge/demos/sed
128
- - lib/rouge/demos/java
102
+ - lib/rouge/demos/factor
103
+ - lib/rouge/demos/smalltalk
129
104
  - lib/rouge/demos/yaml
130
- - lib/rouge/demos/sql
131
- - lib/rouge/demos/groovy
132
- - lib/rouge/demos/conf
133
- - lib/rouge/demos/nginx
134
- - lib/rouge/demos/rust
105
+ - lib/rouge/demos/handlebars
106
+ - lib/rouge/demos/tex
107
+ - lib/rouge/demos/php
135
108
  - lib/rouge/demos/tcl
136
- - lib/rouge/demos/csharp
137
- - lib/rouge/demos/c
109
+ - lib/rouge/demos/html
110
+ - lib/rouge/demos/shell
138
111
  - lib/rouge/demos/perl
139
112
  - lib/rouge/demos/text
140
113
  - lib/rouge/demos/viml
141
- - lib/rouge/demos/handlebars
114
+ - lib/rouge/demos/haskell
115
+ - lib/rouge/demos/css
116
+ - lib/rouge/demos/conf
117
+ - lib/rouge/demos/haml
118
+ - lib/rouge/demos/io
119
+ - lib/rouge/demos/c
120
+ - lib/rouge/demos/scss
142
121
  - lib/rouge/demos/python
122
+ - lib/rouge/demos/make
123
+ - lib/rouge/demos/clojure
124
+ - lib/rouge/demos/java
125
+ - lib/rouge/demos/csharp
126
+ - lib/rouge/demos/javascript
127
+ - lib/rouge/demos/sed
143
128
  - lib/rouge/demos/common_lisp
129
+ - lib/rouge/demos/groovy
130
+ - lib/rouge/demos/nginx
131
+ - lib/rouge/demos/rust
132
+ - lib/rouge/demos/json
133
+ - lib/rouge/demos/markdown
134
+ - lib/rouge/demos/xml
135
+ - lib/rouge/demos/erb
136
+ - lib/rouge/demos/cpp
137
+ - lib/rouge/demos/coffeescript
138
+ - lib/rouge/demos/sql
139
+ - lib/rouge/demos/scheme
140
+ - lib/rouge/demos/diff
144
141
  homepage: http://github.com/jayferd/rouge
145
142
  licenses: []
146
143
  post_install_message:
@@ -1,17 +0,0 @@
1
- module Rouge
2
- module Lexers
3
- class ASP < TemplateLexer
4
- tag 'asp'
5
- aliases 'asp.net'
6
-
7
- default_options :parent => XML
8
-
9
- state :root do
10
- rule /(<%[@=#]?)(.*?)(%>)/ do
11
- group 'Name.Tag'
12
- group 'Other
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,104 +0,0 @@
1
- module Rouge
2
- module Lexers
3
- class ObjectiveC < RegexLexer
4
- tag 'objective_c'
5
- aliases 'objective-c', 'objectivec', 'obj_c', 'obj-c', 'objc'
6
- # XXX TODO: objc has .h files too
7
- filenames '*.m'
8
- mimetypes 'text/x-objective-c'
9
-
10
- id = /[a-zA-Z$_][a-zA-Z0-9$_]*/
11
-
12
- def self.decorators
13
- @decorators = Set.new %w(
14
- private protected public encode synchronized try throw catch
15
- finally end property synthesize dynamic selector
16
- )
17
- end
18
-
19
- def self.keywords_type
20
- @keywords_type ||= Set.new %w(
21
- int long float short double char unsigned signed void id BOOL
22
- IBOutlet IBAction SEL
23
- )
24
- end
25
-
26
- def self.keywords
27
- @keywords ||= Set.new %w(
28
- auto break case const continue default do else enum extern
29
- for goto if register restricted return sizeof static struct
30
- switch typedef union volatile virtual while in
31
- )
32
- end
33
-
34
- def self.reserved
35
- @reserved ||= Set.new %w(
36
- inline naked restrict thread typename
37
- _inline _naked _restrict _thread _typename
38
- __inline __naked __restrict __thread __typename
39
-
40
- __asm __int8 __based __except __int16 __stdcall __cdecl
41
- __fastcall __int32 __declspec __finally __int64 __try __leave
42
- )
43
- end
44
-
45
- state :whitespace do
46
- rule /^\s*#if\s+0/, 'Comment', :if0
47
- rule /^\s*#/, 'Comment.Preproc', :macro
48
- rule /\n/, 'Text'
49
- rule /\s+/, 'Text'
50
- rule /\\\n/, 'Literal.String.Escape'
51
- rule %r(//(\\.|.)*?\n), 'Comment.Single'
52
- rule %r(/[*].*?[*]/), 'Comment.Multiline'
53
- end
54
-
55
- state :statements do
56
- rule /[L@]?"/, 'Literal.String', :string
57
- rule /(L|@)?'(\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\'\n]|\\.)'/,
58
- 'Literal.String.Char'
59
- rule /(\d+[.]\d*|[.]\d+|\d+)e[+-]?\d+l?/i, 'Literal.Number.Float'
60
- rule /(\d+[.]\d*|[.]\d+)f?/i, 'Literal.Number.Float'
61
- rule /\d+f/i, 'Literal.Number.Float'
62
- rule /0x[0-9a-f]+l?/i, 'Literal.Number.Hex'
63
- rule /0[0-7]+l?/i, 'Literal.Number.Oct'
64
- rule /\d+l?/i, 'Literal.Number.Integer'
65
- rule %r([~!%^&*+=|?:<>/-]), 'Operator'
66
- rule /[()\[\],.]/, 'Punctuation'
67
-
68
- rule /#{id}:(?!:)/, 'Name.Label'
69
-
70
- rule /@(#{id})/ do |m|
71
- if self.class.decorators.include? m[1]
72
- token 'Keyword'
73
- else
74
- token 'Error'
75
- end
76
- end
77
-
78
- rule /(TRUE|FALSE|nil|NULL)\b/, 'Name.Builtin'
79
-
80
- rule id do |m|
81
- name = m[0]
82
-
83
- if self.class.keywords.include? name
84
- token 'Keyword'
85
- elsif self.class.keywords_type.include? name
86
- token 'Keyword.Type'
87
- elsif self.class.reserved.include? name
88
- token 'Keyword.Reserved'
89
- end
90
- end
91
- end
92
-
93
- state :root do
94
- mixin :whitespace
95
-
96
- rule %r(
97
- ([a-zA-Z0-9_*\s]+?[\s*]) # return arguments
98
- (#{id}) # method name
99
- (\s*[(][^;]*?[)]) # signature
100
- )x
101
- end
102
- end
103
- end
104
- end
@@ -1,47 +0,0 @@
1
- module Rouge
2
- module Lexers
3
- class Session < TemplateLexer
4
- desc 'an interactive session of another language'
5
- tag 'session'
6
-
7
- default_options :prompt => /(\A|\n)[^$#]+[$#]/
8
- default_options :parent => 'shell'
9
-
10
- def prompt_regex
11
- @prompt_regex ||= option(:prompt).tap do |prompt|
12
- Regexp === prompt ? prompt : Regexp.new(prompt)
13
- end
14
- end
15
-
16
- def stream_tokens(str, &b)
17
- scanner = StringScanner.new(str)
18
-
19
- until scanner.eos?
20
- if scanner.scan(prompt_regex)
21
- debug { "prompt: #{scanner[0].inspect}" }
22
- yield Token['Generic.Heading'], scanner[0]
23
-
24
- scanner.scan(line_regex)
25
- debug { "line: #{scanner[0].inspect}" }
26
-
27
- parent.lex(scanner[0], :continue => true, &b)
28
- end
29
-
30
- scanner.scan(until_prompt_regex)
31
- debug { "(#{until_prompt_regex.inspect}: #{scanner[0].inspect}" }
32
- yield Token['Generic.Output'], scanner[0]
33
- end
34
- end
35
-
36
- private
37
-
38
- def line_regex
39
- @line_regex ||= /(\\.|.)*?\n/
40
- end
41
-
42
- def until_prompt_regex
43
- @until_prompt_regex ||= /.*?(?=#{prompt_regex})|.*/m
44
- end
45
- end
46
- end
47
- end