rouge 1.7.2 → 1.7.3

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: 0067ef8e0292870cfae52690f8986b2be7cbc84a
4
- data.tar.gz: b5a1db51355599ab473aafe50c6610137711effe
3
+ metadata.gz: c6165cb71854f9cb227a8756b294a4f6a542ef15
4
+ data.tar.gz: 73602fe7ef811f2d14cab3f6391686303c47a1d5
5
5
  SHA512:
6
- metadata.gz: 7668435ddb3f59d24f1b9eddd6fdea65d937224f67804362830815a562de29e6eedc7d734327d254a55716d6102f1e5292c4b1b8533b252431fc79a08a618cbd
7
- data.tar.gz: 786971375f80a9c5e1f3750bace221bef64c5fc2f9d98c6185d3bd466fbeec8700ad75d9c4b25610c62936c237e56461264d6fb79ba86b0322fcaed7cb119a54
6
+ metadata.gz: 91766d5bae4afaa8f71ed2f3733625e6bb36441cc5f54f7e6e1b2267af4379e44ae916306d4c6f9f9ecd1ca5119989502b13f96da12c1e2f34efb40bd5b5e497
7
+ data.tar.gz: 88696d5ca424fe5c060c1771372943967acb6854f3be0363a9b8250eb8bf53d302b7786987f5b1e49876314d44ea76cf5181a4cde6590bdbfd86c30faa7de201
@@ -0,0 +1,6 @@
1
+ void main() {
2
+ var collection=[1,2,3,4,5];
3
+ for(var a in collection){
4
+ print(a);
5
+ }
6
+ }
@@ -10,7 +10,9 @@ module Rouge
10
10
  end
11
11
 
12
12
  def stream(tokens, &b)
13
- tokens.to_a
13
+ tokens.each do |tok, val|
14
+ yield "#{tok} #{val.inspect}\n"
15
+ end
14
16
  end
15
17
  end
16
18
  end
@@ -0,0 +1,103 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class Dart < RegexLexer
6
+ desc "The Dart programming language (dartlang.com)"
7
+
8
+ tag 'dart'
9
+ filenames '*.dart'
10
+ mimetypes 'text/x-dart'
11
+
12
+ keywords = %w(
13
+ as assert break case catch continue default do else finally for
14
+ if in is new rethrow return super switch this throw try while with
15
+ )
16
+
17
+ declarations = %w(
18
+ abstract dynamic const external extends factory final get implements
19
+ native operator set static typedef var
20
+ )
21
+
22
+ types = %w(bool double Dynamic enum int num Object Set String void)
23
+
24
+ imports = %w(import export library part\s*of part source)
25
+
26
+ id = /[a-zA-Z_]\w*/
27
+
28
+ state :root do
29
+ rule %r(^
30
+ (\s*(?:[a-zA-Z_][a-zA-Z\d_.\[\]]*\s+)+?) # return arguments
31
+ ([a-zA-Z_][\w]*) # method name
32
+ (\s*)(\() # signature start
33
+ )mx do |m|
34
+ # TODO: do this better, this shouldn't need a delegation
35
+ delegate Dart, m[1]
36
+ token Name::Function, m[2]
37
+ token Text, m[3]
38
+ token Punctuation, m[4]
39
+ end
40
+
41
+ rule /\s+/, Text
42
+ rule %r(//.*?$), Comment::Single
43
+ rule %r(/\*.*?\*/)m, Comment::Multiline
44
+ rule /"/, Str, :dqs
45
+ rule /'/, Str, :sqs
46
+ rule /r"[^"]*"/, Str::Other
47
+ rule /r'[^']*'/, Str::Other
48
+ rule /##{id}*/i, Str::Symbol
49
+ rule /@#{id}/, Name::Decorator
50
+ rule /(?:#{keywords.join('|')})\b/, Keyword
51
+ rule /(?:#{declarations.join('|')})\b/, Keyword::Declaration
52
+ rule /(?:#{types.join('|')})\b/, Keyword::Type
53
+ rule /(?:true|false|null)\b/, Keyword::Constant
54
+ rule /(?:class|interface)\b/, Keyword::Declaration, :class
55
+ rule /(?:#{imports.join('|')})\b/, Keyword::Namespace, :import
56
+ rule /(\.)(#{id})/ do
57
+ groups Operator, Name::Attribute
58
+ end
59
+
60
+ rule /#{id}:/, Name::Label
61
+ rule /\$?#{id}/, Name
62
+ rule /[~^*!%&\[\](){}<>\|+=:;,.\/?-]/, Operator
63
+ rule /\d*\.\d+([eE]\-?\d+)?/, Num::Float
64
+ rule /0x[\da-fA-F]+/, Num::Hex
65
+ rule /\d+L?/, Num::Integer
66
+ rule /\n/, Text
67
+ end
68
+
69
+ state :class do
70
+ rule /\s+/m, Text
71
+ rule id, Name::Class, :pop!
72
+ end
73
+
74
+ state :dqs do
75
+ rule /"/, Str, :pop!
76
+ rule /[^\\\$"]+/, Str
77
+ mixin :string
78
+ end
79
+
80
+ state :sqs do
81
+ rule /'/, Str, :pop!
82
+ rule /[^\\\$']+/, Str
83
+ mixin :string
84
+ end
85
+
86
+ state :import do
87
+ rule /;/, Operator, :pop!
88
+ rule /(?:show|hide)\b/, Keyword::Declaration
89
+ mixin :root
90
+ end
91
+
92
+ state :string do
93
+ mixin :interpolation
94
+ rule /\\[nrt\"\'\\]/, Str::Escape
95
+ end
96
+
97
+ state :interpolation do
98
+ rule /\$#{id}/, Str::Interpol
99
+ rule /\$\{[^\}]+\}/, Str::Interpol
100
+ end
101
+ end
102
+ end
103
+ end
@@ -7,7 +7,7 @@ module Rouge
7
7
  desc 'http requests and responses'
8
8
 
9
9
  def self.methods
10
- @methods ||= %w(GET POST PUT DELETE HEAD OPTIONS TRACE)
10
+ @methods ||= %w(GET POST PUT DELETE HEAD OPTIONS TRACE PATCH)
11
11
  end
12
12
 
13
13
  def content_lexer
@@ -16,7 +16,7 @@ module Rouge
16
16
  return 1 if text.shebang? 'ruby'
17
17
  end
18
18
 
19
- state :sigil_strings do
19
+ state :symbols do
20
20
  # symbols
21
21
  rule %r(
22
22
  : # initial :
@@ -30,7 +30,9 @@ module Rouge
30
30
 
31
31
  rule /:'(\\\\|\\'|[^'])*'/, Str::Symbol
32
32
  rule /:"/, Str::Symbol, :simple_sym
33
+ end
33
34
 
35
+ state :sigil_strings do
34
36
  # %-sigiled strings
35
37
  # %(abc), %[abc], %<abc>, %.abc., %r.abc., etc
36
38
  delimiter_map = { '{' => '}', '[' => ']', '(' => ')', '<' => '>' }
@@ -75,6 +77,7 @@ module Rouge
75
77
  end
76
78
 
77
79
  state :strings do
80
+ mixin :symbols
78
81
  rule /\b[a-z_]\w*?:\s+/, Str::Symbol, :expr_start
79
82
  rule /'(\\\\|\\'|[^'])*'/, Str::Single
80
83
  rule /"/, Str::Double, :simple_string
@@ -329,7 +332,7 @@ module Rouge
329
332
  end
330
333
 
331
334
  state :string_intp do
332
- rule /\#{/, Str::Interpol, :in_interp
335
+ rule /[#][{]/, Str::Interpol, :in_interp
333
336
  rule /#(@@?|\$)[a-z_]\w*/i, Str::Interpol
334
337
  end
335
338
 
@@ -362,6 +365,8 @@ module Rouge
362
365
  goto :slash_regex
363
366
  end
364
367
 
368
+ mixin :sigil_strings
369
+
365
370
  rule(%r((?=\s*/))) { pop! }
366
371
 
367
372
  rule(/\s+/) { token Text; goto :expr_start }
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rouge
4
4
  def self.version
5
- "1.7.2"
5
+ "1.7.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rouge
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeanine Adkisson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-05 00:00:00.000000000 Z
11
+ date: 2014-11-15 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:
@@ -32,6 +32,7 @@ files:
32
32
  - lib/rouge/demos/cpp
33
33
  - lib/rouge/demos/csharp
34
34
  - lib/rouge/demos/css
35
+ - lib/rouge/demos/dart
35
36
  - lib/rouge/demos/diff
36
37
  - lib/rouge/demos/elixir
37
38
  - lib/rouge/demos/erb
@@ -105,6 +106,7 @@ files:
105
106
  - lib/rouge/lexers/cpp.rb
106
107
  - lib/rouge/lexers/csharp.rb
107
108
  - lib/rouge/lexers/css.rb
109
+ - lib/rouge/lexers/dart.rb
108
110
  - lib/rouge/lexers/diff.rb
109
111
  - lib/rouge/lexers/elixir.rb
110
112
  - lib/rouge/lexers/erb.rb