rouge 3.22.0 → 3.23.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 396a6131a5e69e3e00fb09222825549829caa264d19293cd6d02259bf95be12c
4
- data.tar.gz: f2fcad9f0b5c506b5ac0bce887d27aa92c8f3f13f174e11412de5d570a00ac2c
3
+ metadata.gz: abcc9751ef5e076b3765942693a8f098d83f746aa7527b683bf1b5772f700b48
4
+ data.tar.gz: 06074e941ba684cbe5871dfcaeb1dafca415cd228e7223c679847a137d937693
5
5
  SHA512:
6
- metadata.gz: b717c871bbc6182964e52a2d07ee3203003887d4a8ff68574a869e68c65032bfa59f58b71c66dd69046b16a4ec345ac5ff228166912a2869f1e1d04a9ab09d50
7
- data.tar.gz: 564109b16749415e78e218f60b6ff24e472da6c1e512e28df976c628ea3772374250c610e1ab9e46acccfdf24d7b07be63c40a0676b4e84971a37f6f8886c8c8
6
+ metadata.gz: 2db089d9c952c5d79a93659bcb95f008630a60ea35b756f905a51f6d583dc7ab17470faa1a17f77c1165fa0ecee495c0d890a2bebdcc4aef5f03465620691283
7
+ data.tar.gz: 8a161de0a32d5a3be6ae31d4112949bea3ffdbd9bd6408dc6b4a6fa3359d9b34c4b214c383c71f3927c9ed2f2431e1240de9cf0f4f02f9d098ebad1ba367dd66
@@ -0,0 +1,9 @@
1
+ %!PS
2
+ /Courier % name the desired font
3
+ 20 selectfont % choose the size in points and establish
4
+ % the font as the current one
5
+ 72 500 moveto % position the current point at
6
+ % coordinates 72, 500 (the origin is at the
7
+ % lower-left corner of the page)
8
+ (Hello world!) show % stroke the text in parentheses
9
+ showpage % print all on the page
@@ -0,0 +1,4 @@
1
+ [Unit]
2
+ Description=Snap Daemon
3
+ Requires=snapd.socket
4
+ OnFailure=snapd.failure.service
@@ -65,6 +65,9 @@ module Rouge
65
65
  rule %r'/[*].*[*]/', Comment::Multiline # single line block comment
66
66
  rule %r'/[*].*', Comment::Multiline, :comment # multiline block comment
67
67
  rule %r'\n', Text
68
+ rule %r'(::)(class)' do
69
+ groups Operator, Keyword
70
+ end
68
71
  rule %r'::|!!|\?[:.]', Operator
69
72
  rule %r"(\.\.)", Operator
70
73
  # Number literals
@@ -0,0 +1,93 @@
1
+ # -*- coding: utf-8 -*- #
2
+ # frozen_string_literal: true
3
+
4
+ # Adapted from pygments PostScriptLexer
5
+ module Rouge
6
+ module Lexers
7
+ class PostScript < RegexLexer
8
+ title "PostScript"
9
+ desc "The PostScript language (adobe.com/devnet/postscript.html)"
10
+ tag "postscript"
11
+ aliases "postscr", "postscript", "ps", "eps"
12
+ filenames "*.ps", "*.eps"
13
+ mimetypes "application/postscript"
14
+
15
+ def self.detect?(text)
16
+ return true if /^%!/ =~ text
17
+ end
18
+
19
+ delimiter = %s"()<>\[\]{}/%\s"
20
+ delimiter_end = Regexp.new("(?=[#{delimiter}])")
21
+ valid_name_chars = Regexp.new("[^#{delimiter}]")
22
+ valid_name = /#{valid_name_chars}+#{delimiter_end}/
23
+
24
+ # These keywords taken from
25
+ # <http://www.math.ubc.ca/~cass/graphics/manual/pdf/a1.pdf>
26
+ # Is there an authoritative list anywhere that doesn't involve
27
+ # trawling documentation?
28
+ keywords = %w/abs add aload arc arcn array atan begin
29
+ bind ceiling charpath clip closepath concat
30
+ concatmatrix copy cos currentlinewidth currentmatrix
31
+ currentpoint curveto cvi cvs def defaultmatrix
32
+ dict dictstackoverflow div dtransform dup end
33
+ exch exec exit exp fill findfont floor get
34
+ getinterval grestore gsave identmatrix idiv
35
+ idtransform index invertmatrix itransform length
36
+ lineto ln load log loop matrix mod moveto
37
+ mul neg newpath pathforall pathbbox pop print
38
+ pstack put quit rand rangecheck rcurveto repeat
39
+ restore rlineto rmoveto roll rotate round run
40
+ save scale scalefont setdash setfont setgray
41
+ setlinecap setlinejoin setlinewidth setmatrix
42
+ setrgbcolor shfill show showpage sin sqrt
43
+ stack stringwidth stroke strokepath sub syntaxerror
44
+ transform translate truncate typecheck undefined
45
+ undefinedfilename undefinedresult/
46
+
47
+ state :root do
48
+ # All comment types
49
+ rule %r'^%!.+?$', Comment::Preproc
50
+ rule %r'%%.*?$', Comment::Special
51
+ rule %r'(^%.*?$){2,}', Comment::Multiline
52
+ rule %r'%.*?$', Comment::Single
53
+
54
+ # String literals are awkward; enter separate state.
55
+ rule %r'\(', Str, :stringliteral
56
+
57
+ # References
58
+ rule %r'/#{valid_name}', Name::Variable
59
+
60
+ rule %r'[{}<>\[\]]', Punctuation
61
+
62
+ rule %r'(?:#{keywords.join('|')})#{delimiter_end}', Name::Builtin
63
+
64
+ # Conditionals / flow control
65
+ rule %r'(eq|ne|g[et]|l[et]|and|or|not|if(?:else)?|for(?:all)?)#{delimiter_end}', Keyword::Reserved
66
+ rule %r'(false|true)#{delimiter_end}', Keyword::Constant
67
+
68
+ # Numbers
69
+ rule %r'<[0-9A-Fa-f]+>#{delimiter_end}', Num::Hex
70
+ # Slight abuse: use Oct to signify any explicit base system
71
+ rule %r'[0-9]+\#(\-|\+)?([0-9]+\.?|[0-9]*\.[0-9]+|[0-9]+\.[0-9]*)((e|E)[0-9]+)?#{delimiter_end}', Num::Oct
72
+ rule %r'(\-|\+)?([0-9]+\.?|[0-9]*\.[0-9]+|[0-9]+\.[0-9]*)((e|E)[0-9]+)?#{delimiter_end}', Num::Float
73
+ rule %r'(\-|\+)?[0-9]+#{delimiter_end}', Num::Integer
74
+
75
+ # Names
76
+ rule valid_name, Name::Function # Anything else is executed
77
+
78
+ rule %r'\s+', Text
79
+ end
80
+
81
+ state :stringliteral do
82
+ rule %r'[^()\\]+', Str
83
+ rule %r'\\', Str::Escape, :escape
84
+ rule %r'\(', Str, :stringliteral
85
+ rule %r'\)', Str, :pop!
86
+ end
87
+
88
+ state :escape do
89
+ rule %r'[0-8]{3}|n|r|t|b|f|\\|\(|\)', Str::Escape, :pop!
90
+ end
91
+ end
92
+ end
93
+ end
@@ -374,7 +374,7 @@ module Rouge
374
374
  end
375
375
 
376
376
  state :method_call do
377
- rule %r(/) do
377
+ rule %r(/|%) do
378
378
  token Operator
379
379
  goto :expr_start
380
380
  end
@@ -100,6 +100,7 @@ module Rouge
100
100
 
101
101
  rule %r/([.]\s*)?#{id}(?=\s*[(])/m, Name::Function
102
102
  rule %r/[.]\s*#{id}/, Name::Property
103
+ rule %r/[.]\s*\d+/, Name::Attribute
103
104
  rule %r/(#{id})(::)/m do
104
105
  groups Name::Namespace, Punctuation
105
106
  end
@@ -167,7 +168,7 @@ module Rouge
167
168
  flt = /f32|f64/
168
169
 
169
170
  rule %r(
170
- [0-9]+
171
+ [0-9_]+
171
172
  (#{dot} #{exp}? #{flt}?
172
173
  |#{dot}? #{exp} #{flt}?
173
174
  |#{dot}? #{exp}? #{flt}
@@ -0,0 +1,34 @@
1
+ # -*- coding: utf-8 -*- #
2
+ # frozen_string_literal: true
3
+
4
+ module Rouge
5
+ module Lexers
6
+ class SystemD < RegexLexer
7
+ tag 'systemd'
8
+ aliases 'unit-file'
9
+ filenames '*.service'
10
+ mimetypes 'text/x-systemd-unit'
11
+ desc 'A lexer for systemd unit files'
12
+
13
+ state :root do
14
+ rule %r/\s+/, Text
15
+ rule %r/[;#].*/, Comment
16
+ rule %r/\[.*?\]$/, Keyword
17
+ rule %r/(.*?)(=)(.*)(\\\n)/ do
18
+ groups Name::Tag, Punctuation, Text, Str::Escape
19
+ push :continuation
20
+ end
21
+ rule %r/(.*?)(=)(.*)/ do
22
+ groups Name::Tag, Punctuation, Text
23
+ end
24
+ end
25
+
26
+ state :continuation do
27
+ rule %r/(.*?)(\\\n)/ do
28
+ groups Text, Str::Escape
29
+ end
30
+ rule %r/(.*)'/, Text, :pop!
31
+ end
32
+ end
33
+ end
34
+ end
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Rouge
5
5
  def self.version
6
- "3.22.0"
6
+ "3.23.0"
7
7
  end
8
8
  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: 3.22.0
4
+ version: 3.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeanine Adkisson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-11 00:00:00.000000000 Z
11
+ date: 2020-09-08 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:
@@ -158,6 +158,7 @@ files:
158
158
  - lib/rouge/demos/plaintext
159
159
  - lib/rouge/demos/plist
160
160
  - lib/rouge/demos/pony
161
+ - lib/rouge/demos/postscript
161
162
  - lib/rouge/demos/powershell
162
163
  - lib/rouge/demos/praat
163
164
  - lib/rouge/demos/prolog
@@ -195,6 +196,7 @@ files:
195
196
  - lib/rouge/demos/ssh
196
197
  - lib/rouge/demos/supercollider
197
198
  - lib/rouge/demos/swift
199
+ - lib/rouge/demos/systemd
198
200
  - lib/rouge/demos/tap
199
201
  - lib/rouge/demos/tcl
200
202
  - lib/rouge/demos/terraform
@@ -389,6 +391,7 @@ files:
389
391
  - lib/rouge/lexers/plain_text.rb
390
392
  - lib/rouge/lexers/plist.rb
391
393
  - lib/rouge/lexers/pony.rb
394
+ - lib/rouge/lexers/postscript.rb
392
395
  - lib/rouge/lexers/powershell.rb
393
396
  - lib/rouge/lexers/praat.rb
394
397
  - lib/rouge/lexers/prolog.rb
@@ -428,6 +431,7 @@ files:
428
431
  - lib/rouge/lexers/ssh.rb
429
432
  - lib/rouge/lexers/supercollider.rb
430
433
  - lib/rouge/lexers/swift.rb
434
+ - lib/rouge/lexers/systemd.rb
431
435
  - lib/rouge/lexers/tap.rb
432
436
  - lib/rouge/lexers/tcl.rb
433
437
  - lib/rouge/lexers/terraform.rb