rouge 1.7.4 → 1.7.7

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
  SHA1:
3
- metadata.gz: b1dffebb13fb9d02aaa2f68da411c2e723e1b88e
4
- data.tar.gz: ff408e0fe2ecd978aac9b7638ae75a80683f8233
3
+ metadata.gz: eed83627d9abcd8949888faeeb65f50cd9e58acf
4
+ data.tar.gz: d91dd66f2cd06ff6e51f357024cc94f4b4208ce6
5
5
  SHA512:
6
- metadata.gz: 8afffd0b26979e30bb14735f8b8236d1d63295ad9d9704788d414441d49ed05242164bb3c1ac5bc2c9e1ea308cf8446e0166f119dca611738d3cb2be8a4118e3
7
- data.tar.gz: 5242cfb257835a41fd9eca7323ec8ca4bf234511bd7d6e9ded6be750e54569cc4dd9e53ef655335257d1524e5ad6c253c0cb4cb96dcff78d65dcb4c878b274da
6
+ metadata.gz: 663f9107a981c45401d5b848a2df1dfbd6c7010872edb94f5037ba2817b3ca0450bbb288b4d9abaceea30ecdc79e16531eea2a8b52127f5deeda1d8911210b59
7
+ data.tar.gz: ca028582547991858de77a07be1d41a76dc4095199712d62289786ec1ef106beaad71c8f02e1764c3e6f4340561af079722a98bb0f4a7f82510bdd8b88dd8cc9
@@ -0,0 +1,21 @@
1
+ AddDefaultCharset UTF-8
2
+
3
+ RewriteEngine On
4
+
5
+ # Serve gzipped version if available and accepted
6
+ AddEncoding x-gzip .gz
7
+ RewriteCond %{HTTP:Accept-Encoding} gzip
8
+ RewriteCond %{REQUEST_FILENAME}.gz -f
9
+ RewriteRule ^(.*)$ $1.gz [QSA,L]
10
+ <FilesMatch \.css\.gz$>
11
+ ForceType text/css
12
+ Header append Vary Accept-Encoding
13
+ </FilesMatch>
14
+ <FilesMatch \.js\.gz$>
15
+ ForceType application/javascript
16
+ Header append Vary Accept-Encoding
17
+ </FilesMatch>
18
+ <FilesMatch \.html\.gz$>
19
+ ForceType text/html
20
+ Header append Vary Accept-Encoding
21
+ </FilesMatch>
@@ -0,0 +1,27 @@
1
+ import math,strutils
2
+
3
+ proc fixedWidth(input: string, minFieldSize: int):string {.inline.} =
4
+ # Note that field size is a minimum- will expand field if input
5
+ # string is larger
6
+ if input.startsWith("-"):
7
+ return(input & repeatchar(count=(abs(minFieldSize-len(input))),c=' '))
8
+ else:
9
+ return(" " & input & repeatchar(count=(abs(minFieldSize-len(input))-1),c=' '))
10
+
11
+ template mathOnInterval(lowbound,highbound:float,counts: int,p:proc) =
12
+ block:
13
+ var step: float = (highbound - lowbound)/(max(counts,1))
14
+ var current: float = lowbound
15
+ while current < highbound:
16
+ echo($fixedWidth($current,25) & ": " & $fixedWidth($p(current),25))
17
+ current += step
18
+
19
+ echo "Sine of theta from 0 to 2*PI by PI/12"
20
+ mathOnInterval(0.0,2.0*PI,12,sin)
21
+ echo("\n")
22
+ echo "Cosine of theta from 0 to 2*PI by PI/12"
23
+ mathOnInterval(0.0,2.0*PI,12,cos)
24
+
25
+ # The first example above is much the same as:
26
+ # for i in 1..100:
27
+ # echo($sin( (float(i)/100.0) * 2.0*PI ))
@@ -0,0 +1,67 @@
1
+ require 'yaml'
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class Apache < RegexLexer
6
+ desc 'configuration files for Apache web server'
7
+ tag 'apache'
8
+ mimetypes 'text/x-httpd-conf', 'text/x-apache-conf'
9
+ filenames '.htaccess', 'httpd.conf'
10
+
11
+ class << self
12
+ attr_reader :keywords
13
+ end
14
+ # Load Apache keywords from separate YML file
15
+ @keywords = ::YAML.load(File.open(Pathname.new(__FILE__).dirname.join('apache/keywords.yml')))
16
+
17
+ def name_for_token(token)
18
+ if self.class.keywords[:sections].include? token
19
+ Name::Class
20
+ elsif self.class.keywords[:directives].include? token
21
+ Name::Label
22
+ elsif self.class.keywords[:values].include? token
23
+ Literal::String::Symbol
24
+ end
25
+ end
26
+
27
+ state :whitespace do
28
+ rule /\#.*?\n/, Comment
29
+ rule /[\s\n]+/m, Text
30
+ end
31
+
32
+
33
+ state :root do
34
+ mixin :whitespace
35
+
36
+ rule /(<\/?)(\w+)/ do |m|
37
+ groups Punctuation, name_for_token(m[2])
38
+ push :section
39
+ end
40
+
41
+ rule /\w+/ do |m|
42
+ token name_for_token(m[0])
43
+ push :directive
44
+ end
45
+ end
46
+
47
+ state :section do
48
+ mixin :whitespace
49
+
50
+ # Match section arguments
51
+ rule /([^>]+)?(>\n)/ do |m|
52
+ groups Literal::String::Regex, Punctuation
53
+ pop!
54
+ end
55
+ end
56
+
57
+ state :directive do
58
+ # Match value literals and other directive arguments
59
+ rule /(\w+)*(.*?(\n|$))/ do |m|
60
+ token name_for_token(m[1]), m[1]
61
+ token Text, m[2]
62
+ pop!
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,453 @@
1
+ :sections:
2
+ - "DirectoryMatch"
3
+ - "Directory"
4
+ - "FilesMatch"
5
+ - "Files"
6
+ - "IfDefine"
7
+ - "IfModule"
8
+ - "LimitExcept"
9
+ - "Limit"
10
+ - "LocationMatch"
11
+ - "Location"
12
+ - "ProxyMatch"
13
+ - "Proxy"
14
+ - "VirtualHost"
15
+
16
+ :directives:
17
+ - "AcceptMutex"
18
+ - "AcceptPathInfo"
19
+ - "AccessConfig"
20
+ - "AccessFileName"
21
+ - "Action"
22
+ - "AddAlt"
23
+ - "AddAltByEncoding"
24
+ - "AddAltByType"
25
+ - "AddCharset"
26
+ - "AddDefaultCharset"
27
+ - "AddDescription"
28
+ - "AddEncoding"
29
+ - "AddHandler"
30
+ - "AddIcon"
31
+ - "AddIconByEncoding"
32
+ - "AddIconByType"
33
+ - "AddInputFilter"
34
+ - "AddLanguage"
35
+ - "AddModule"
36
+ - "AddModuleInfo"
37
+ - "AddOutputFilter"
38
+ - "AddOutputFilterByType"
39
+ - "AddType"
40
+ - "AgentLog"
41
+ - "Alias"
42
+ - "AliasMatch"
43
+ - "Allow from"
44
+ - "Allow"
45
+ - "AllowCONNECT"
46
+ - "AllowEncodedSlashes"
47
+ - "AllowOverride"
48
+ - "Anonymous"
49
+ - "Anonymous_Authoritative"
50
+ - "Anonymous_LogEmail"
51
+ - "Anonymous_MustGiveEmail"
52
+ - "Anonymous_NoUserID"
53
+ - "Anonymous_VerifyEmail"
54
+ - "AssignUserID"
55
+ - "AuthAuthoritative"
56
+ - "AuthDBAuthoritative"
57
+ - "AuthDBGroupFile"
58
+ - "AuthDBMAuthoritative"
59
+ - "AuthDBMGroupFile"
60
+ - "AuthDBMType"
61
+ - "AuthDBMUserFile"
62
+ - "AuthDBUserFile"
63
+ - "AuthDigestAlgorithm"
64
+ - "AuthDigestDomain"
65
+ - "AuthDigestFile"
66
+ - "AuthDigestGroupFile"
67
+ - "AuthDigestNcCheck"
68
+ - "AuthDigestNonceFormat"
69
+ - "AuthDigestNonceLifetime"
70
+ - "AuthDigestQop"
71
+ - "AuthDigestShmemSize"
72
+ - "AuthGroupFile"
73
+ - "AuthLDAPAuthoritative"
74
+ - "AuthLDAPBindDN"
75
+ - "AuthLDAPBindPassword"
76
+ - "AuthLDAPCharsetConfig"
77
+ - "AuthLDAPCompareDNOnServer"
78
+ - "AuthLDAPDereferenceAliases"
79
+ - "AuthLDAPEnabled"
80
+ - "AuthLDAPFrontPageHack"
81
+ - "AuthLDAPGroupAttribute"
82
+ - "AuthLDAPGroupAttributeIsDN"
83
+ - "AuthLDAPRemoteUserIsDN"
84
+ - "AuthLDAPUrl"
85
+ - "AuthName"
86
+ - "AuthType"
87
+ - "AuthUserFile"
88
+ - "BS2000Account"
89
+ - "BindAddress"
90
+ - "BrowserMatch"
91
+ - "BrowserMatchNoCase"
92
+ - "CGIMapExtension"
93
+ - "CacheDefaultExpire"
94
+ - "CacheDirLength"
95
+ - "CacheDirLevels"
96
+ - "CacheDisable"
97
+ - "CacheEnable"
98
+ - "CacheExpiryCheck"
99
+ - "CacheFile"
100
+ - "CacheForceCompletion"
101
+ - "CacheGcClean"
102
+ - "CacheGcDaily"
103
+ - "CacheGcInterval"
104
+ - "CacheGcMemUsage"
105
+ - "CacheGcUnused"
106
+ - "CacheIgnoreCacheControl"
107
+ - "CacheIgnoreNoLastMod"
108
+ - "CacheLastModifiedFactor"
109
+ - "CacheMaxExpire"
110
+ - "CacheMaxFileSize"
111
+ - "CacheMinFileSize"
112
+ - "CacheNegotiatedDocs"
113
+ - "CacheRoot"
114
+ - "CacheSize"
115
+ - "CacheTimeMargin"
116
+ - "CharsetDefault"
117
+ - "CharsetOptions"
118
+ - "CharsetSourceEnc"
119
+ - "CheckSpelling"
120
+ - "ChildPerUserID"
121
+ - "ClearModuleList"
122
+ - "ContentDigest"
123
+ - "CookieDomain"
124
+ - "CookieExpires"
125
+ - "CookieLog"
126
+ - "CookieName"
127
+ - "CookieStyle"
128
+ - "CookieTracking"
129
+ - "CoreDumpDirectory"
130
+ - "CustomLog"
131
+ - "Dav"
132
+ - "DavDepthInfinity"
133
+ - "DavLockDB"
134
+ - "DavMinTimeout"
135
+ - "DefaultIcon"
136
+ - "DefaultLanguage"
137
+ - "DefaultMode"
138
+ - "DefaultType"
139
+ - "DeflateBufferSize"
140
+ - "DeflateCompressionLevel"
141
+ - "DeflateFilterNote"
142
+ - "DeflateMemLevel"
143
+ - "DeflateWindowSize"
144
+ - "Deny"
145
+ - "DirectoryIndex"
146
+ - "DirectorySlash"
147
+ - "DocTitle"
148
+ - "DocTrailer"
149
+ - "DocumentRoot"
150
+ - "EnableExceptionHook"
151
+ - "EnableMMAP"
152
+ - "EnableSendfile"
153
+ - "ErrorDocument"
154
+ - "ErrorLog"
155
+ - "Example"
156
+ - "ExpiresActive"
157
+ - "ExpiresByType"
158
+ - "ExpiresDefault"
159
+ - "ExtFilterDefine"
160
+ - "ExtFilterOptions"
161
+ - "ExtendedStatus"
162
+ - "FancyIndexing"
163
+ - "FileETag"
164
+ - "ForceLanguagePriority"
165
+ - "ForceType"
166
+ - "ForensicLog"
167
+ - "Group"
168
+ - "HTMLDir"
169
+ - "HTTPLogFile"
170
+ - "HeadPrefix"
171
+ - "HeadSuffix"
172
+ - "Header"
173
+ - "HeaderName"
174
+ - "HideSys"
175
+ - "HideURL"
176
+ - "HostNameLookups"
177
+ - "HostnameLookups"
178
+ - "ISAPIAppendLogToErrors"
179
+ - "ISAPIAppendLogToQuery"
180
+ - "ISAPICacheFile"
181
+ - "ISAPIFakeAsync"
182
+ - "ISAPILogNotSupported"
183
+ - "ISAPIReadAheadBuffer"
184
+ - "IdentityCheck"
185
+ - "ImapBase"
186
+ - "ImapDefault"
187
+ - "ImapMenu"
188
+ - "Include"
189
+ - "IndexIgnore"
190
+ - "IndexOptions"
191
+ - "IndexOrderDefault"
192
+ - "KeepAlive"
193
+ - "KeepAliveTimeout"
194
+ - "LDAPCacheEntries"
195
+ - "LDAPCacheTTL"
196
+ - "LDAPOpCacheEntries"
197
+ - "LDAPOpCacheTTL"
198
+ - "LDAPSharedCacheFile"
199
+ - "LDAPSharedCacheSize"
200
+ - "LDAPTrustedCA"
201
+ - "LDAPTrustedCAType"
202
+ - "LanguagePriority"
203
+ - "LastURLs"
204
+ - "LimitInternalRecursion"
205
+ - "LimitRequestBody"
206
+ - "LimitRequestFields"
207
+ - "LimitRequestFieldsize"
208
+ - "LimitRequestLine"
209
+ - "LimitXMLRequestBody"
210
+ - "Listen"
211
+ - "ListenBacklog"
212
+ - "LoadFile"
213
+ - "LoadModule"
214
+ - "LockFile"
215
+ - "LogFormat"
216
+ - "LogLevel"
217
+ - "MCacheMaxObjectCount"
218
+ - "MCacheMaxObjectSize"
219
+ - "MCacheMaxStreamingBuffer"
220
+ - "MCacheMinObjectSize"
221
+ - "MCacheRemovalAlgorithm"
222
+ - "MCacheSize"
223
+ - "MMapFile"
224
+ - "MaxClients"
225
+ - "MaxKeepAliveRequests"
226
+ - "MaxMemFree"
227
+ - "MaxRequestsPerChild"
228
+ - "MaxRequestsPerThread"
229
+ - "MaxSpareServers"
230
+ - "MaxSpareThreads"
231
+ - "MaxThreads"
232
+ - "MaxThreadsPerChild"
233
+ - "MetaDir"
234
+ - "MetaFiles"
235
+ - "MetaSuffix"
236
+ - "MimeMagicFile"
237
+ - "MinSpareServers"
238
+ - "MinSpareThreads"
239
+ - "ModMimeUsePathInfo"
240
+ - "MultiviewsMatch"
241
+ - "NWSSLTrustedCerts"
242
+ - "NWSSLUpgradeable"
243
+ - "NameVirtualHost"
244
+ - "NoCache"
245
+ - "NoProxy"
246
+ - "NumServers"
247
+ - "Options"
248
+ - "Order"
249
+ - "PassEnv"
250
+ - "PidFile"
251
+ - "Port"
252
+ - "PrivateDir"
253
+ - "ProtocolEcho"
254
+ - "ProxyBadHeader"
255
+ - "ProxyBlock"
256
+ - "ProxyDomain"
257
+ - "ProxyErrorOverride"
258
+ - "ProxyIOBufferSize"
259
+ - "ProxyMaxForwards"
260
+ - "ProxyPass"
261
+ - "ProxyPassReverse"
262
+ - "ProxyPreserveHost"
263
+ - "ProxyReceiveBufferSize"
264
+ - "ProxyRemote"
265
+ - "ProxyRemoteMatch"
266
+ - "ProxyRequests"
267
+ - "ProxyTimeout"
268
+ - "ProxyVia"
269
+ - "RLimitCPU"
270
+ - "RLimitMEM"
271
+ - "RLimitNPROC"
272
+ - "ReadmeName"
273
+ - "Redirect"
274
+ - "RedirectMatch"
275
+ - "RedirectPermanent"
276
+ - "RedirectTemp"
277
+ - "RefererIgnore"
278
+ - "RefererLog"
279
+ - "RemoveCharset"
280
+ - "RemoveEncoding"
281
+ - "RemoveHandler"
282
+ - "RemoveInputFilter"
283
+ - "RemoveLanguage"
284
+ - "RemoveOutputFilter"
285
+ - "RemoveType"
286
+ - "RequestHeader"
287
+ - "Require"
288
+ - "ResourceConfig"
289
+ - "RewriteBase"
290
+ - "RewriteCond"
291
+ - "RewriteEngine"
292
+ - "RewriteLock"
293
+ - "RewriteLog"
294
+ - "RewriteLogLevel"
295
+ - "RewriteMap"
296
+ - "RewriteOptions"
297
+ - "RewriteRule"
298
+ - "SSIEndTag"
299
+ - "SSIErrorMsg"
300
+ - "SSIStartTag"
301
+ - "SSITimeFormat"
302
+ - "SSIUndefinedEcho"
303
+ - "SSLCACertificateFile"
304
+ - "SSLCACertificatePath"
305
+ - "SSLCARevocationFile"
306
+ - "SSLCARevocationPath"
307
+ - "SSLCertificateChainFile"
308
+ - "SSLCertificateFile"
309
+ - "SSLCertificateKeyFile"
310
+ - "SSLCipherSuite"
311
+ - "SSLEngine"
312
+ - "SSLMutex"
313
+ - "SSLOptions"
314
+ - "SSLPassPhraseDialog"
315
+ - "SSLProtocol"
316
+ - "SSLProxyCACertificateFile"
317
+ - "SSLProxyCACertificatePath"
318
+ - "SSLProxyCARevocationFile"
319
+ - "SSLProxyCARevocationPath"
320
+ - "SSLProxyCipherSuite"
321
+ - "SSLProxyEngine"
322
+ - "SSLProxyMachineCertificateFile"
323
+ - "SSLProxyMachineCertificatePath"
324
+ - "SSLProxyProtocol"
325
+ - "SSLProxyVerify"
326
+ - "SSLProxyVerifyDepth"
327
+ - "SSLRandomSeed"
328
+ - "SSLRequire"
329
+ - "SSLRequireSSL"
330
+ - "SSLSessionCache"
331
+ - "SSLSessionCacheTimeout"
332
+ - "SSLVerifyClient"
333
+ - "SSLVerifyDepth"
334
+ - "Satisfy"
335
+ - "ScoreBoardFile"
336
+ - "Script"
337
+ - "ScriptAlias"
338
+ - "ScriptAliasMatch"
339
+ - "ScriptInterpreterSource"
340
+ - "ScriptLog"
341
+ - "ScriptLogBuffer"
342
+ - "ScriptLogLength"
343
+ - "ScriptSock"
344
+ - "SecureListen"
345
+ - "SendBufferSize"
346
+ - "ServerAdmin"
347
+ - "ServerAlias"
348
+ - "ServerLimit"
349
+ - "ServerName"
350
+ - "ServerPath"
351
+ - "ServerRoot"
352
+ - "ServerSignature"
353
+ - "ServerTokens"
354
+ - "ServerType"
355
+ - "SetEnv"
356
+ - "SetEnvIf"
357
+ - "SetEnvIfNoCase"
358
+ - "SetHandler"
359
+ - "SetInputFilter"
360
+ - "SetOutputFilter"
361
+ - "StartServers"
362
+ - "StartThreads"
363
+ - "SuexecUserGroup"
364
+ - "ThreadLimit"
365
+ - "ThreadStackSize"
366
+ - "ThreadsPerChild"
367
+ - "TimeOut"
368
+ - "TopSites"
369
+ - "TopURLs"
370
+ - "TransferLog"
371
+ - "TypesConfig"
372
+ - "UnsetEnv"
373
+ - "UseCanonicalName"
374
+ - "User"
375
+ - "UserDir"
376
+ - "VirtualDocumentRoot"
377
+ - "VirtualDocumentRootIP"
378
+ - "VirtualScriptAlias"
379
+ - "VirtualScriptAliasIP"
380
+ - "Win32DisableAcceptEx"
381
+ - "XBitHack"
382
+ - "deny"
383
+ - "order"
384
+ - "require"
385
+ :values:
386
+ - "All"
387
+ - "AuthConfig"
388
+ - "Basic"
389
+ - "CONNECT"
390
+ - "DELETE"
391
+ - "Digest"
392
+ - "ExecCGI"
393
+ - "FancyIndexing"
394
+ - "FileInfo"
395
+ - "FollowSymLinks"
396
+ - "Full"
397
+ - "GET"
398
+ - "IconsAreLinks"
399
+ - "Includes"
400
+ - "IncludesNOEXEC"
401
+ - "Indexes"
402
+ - "Limit"
403
+ - "Minimal"
404
+ - "MultiViews"
405
+ - "None"
406
+ - "OPTIONS"
407
+ - "OS"
408
+ - "Options"
409
+ - "Options"
410
+ - "POST"
411
+ - "PUT"
412
+ - "ScanHTMLTitles"
413
+ - "SuppressDescription"
414
+ - "SuppressLastModified"
415
+ - "SuppressSize"
416
+ - "SymLinksIfOwnerMatch"
417
+ - "URL"
418
+ - "add"
419
+ - "allow"
420
+ - "any"
421
+ - "append"
422
+ - "deny"
423
+ - "double"
424
+ - "downgrade-1.0"
425
+ - "email"
426
+ - "env"
427
+ - "error"
428
+ - "force-response-1.0"
429
+ - "formatted"
430
+ - "from"
431
+ - "full"
432
+ - "gone"
433
+ - "group"
434
+ - "inetd"
435
+ - "inherit"
436
+ - "map"
437
+ - "mutual-failure"
438
+ - "nocontent"
439
+ - "nokeepalive"
440
+ - "none"
441
+ - "off"
442
+ - "on"
443
+ - "permanent"
444
+ - "referer"
445
+ - "seeother"
446
+ - "semi-formatted"
447
+ - "set"
448
+ - "standalone"
449
+ - "temporary"
450
+ - "unformatted"
451
+ - "unset"
452
+ - "user"
453
+ - "valid-user"
@@ -184,7 +184,7 @@ module Rouge
184
184
  state :root do
185
185
  mixin :basics
186
186
  rule /{/, Punctuation, :stanza
187
- rule /:#{identifier}/, Name::Decorator
187
+ rule /:[:]?#{identifier}/, Name::Decorator
188
188
  rule /\.#{identifier}/, Name::Class
189
189
  rule /##{identifier}/, Name::Function
190
190
  rule /@#{identifier}/, Keyword, :at_rule
@@ -196,7 +196,7 @@ module Rouge
196
196
  mixin :basics
197
197
  rule /url\(.*?\)/, Str::Other
198
198
  rule /#[0-9a-f]{1,6}/i, Num # colors
199
- rule /#{number}(?:em|px|%|pt|pc|in|mm|m|ex|s)?\b/, Num
199
+ rule /#{number}(?:%|(?:em|px|pt|pc|in|mm|cm|ex|rem|ch|vw|vh|vmin|vmax|dpi|dpcm|dppx|deg|grad|rad|turn|s|ms|Hz|kHz)\b)?/, Num
200
200
  rule /[\[\]():\/.,]/, Punctuation
201
201
  rule /"(\\\\|\\"|[^"])*"/, Str::Single
202
202
  rule /'(\\\\|\\'|[^'])*'/, Str::Double
@@ -168,6 +168,8 @@ module Rouge
168
168
  groups Name::Label, Text, Punctuation
169
169
  end
170
170
 
171
+ rule /[{}]/, Punctuation
172
+
171
173
  mixin :expr_start
172
174
  end
173
175
 
@@ -0,0 +1,151 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class Nim < RegexLexer
6
+ # This is pretty much a 1-1 port of the pygments NimrodLexer class
7
+ desc "The Nim programming language (http://nim-lang.org/)"
8
+
9
+ tag 'nim'
10
+ aliases 'nimrod'
11
+ filenames '*.nim'
12
+
13
+ KEYWORDS = %w(
14
+ addr as asm atomic bind block break case cast const continue
15
+ converter defer discard distinct do elif else end enum except export
16
+ func finally for from generic if import include interface iterator let
17
+ macro method mixin nil object of out proc ptr raise ref return static
18
+ template try tuple type using var when while with without yield
19
+ )
20
+
21
+ OPWORDS = %w(
22
+ and or not xor shl shr div mod in notin is isnot
23
+ )
24
+
25
+ PSEUDOKEYWORDS = %w(
26
+ nil true false
27
+ )
28
+
29
+ TYPES = %w(
30
+ int int8 int16 int32 int64 float float32 float64 bool char range array
31
+ seq set string
32
+ )
33
+
34
+ NAMESPACE = %w(
35
+ from import include
36
+ )
37
+
38
+ def self.underscorize(words)
39
+ words.map do |w|
40
+ w.gsub(/./) { |x| "#{Regexp.escape(x)}_?" }
41
+ end.join('|')
42
+ end
43
+
44
+ state :chars do
45
+ rule(/\\([\\abcefnrtvl"\']|x[a-fA-F0-9]{2}|[0-9]{1,3})/, Str::Escape)
46
+ rule(/'/, Str::Char, :pop!)
47
+ rule(/./, Str::Char)
48
+ end
49
+
50
+ state :strings do
51
+ rule(/(?<!\$)\$(\d+|#|\w+)+/, Str::Interpol)
52
+ rule(/[^\\\'"\$\n]+/, Str)
53
+ rule(/[\'"\\]/, Str)
54
+ rule(/\$/, Str)
55
+ end
56
+
57
+ state :dqs do
58
+ rule(/\\([\\abcefnrtvl"\']|\n|x[a-fA-F0-9]{2}|[0-9]{1,3})/,
59
+ Str::Escape)
60
+ rule(/"/, Str, :pop!)
61
+ mixin :strings
62
+ end
63
+
64
+ state :rdqs do
65
+ rule(/"(?!")/, Str, :pop!)
66
+ rule(/"/, Str::Escape, :pop!)
67
+ mixin :strings
68
+ end
69
+
70
+ state :tdqs do
71
+ rule(/"""(?!")/, Str, :pop!)
72
+ mixin :strings
73
+ mixin :nl
74
+ end
75
+
76
+ state :funcname do
77
+ rule(/((?![\d_])\w)(((?!_)\w)|(_(?!_)\w))*/, Name::Function, :pop!)
78
+ rule(/`.+`/, Name::Function, :pop!)
79
+ end
80
+
81
+ state :nl do
82
+ rule(/\n/, Str)
83
+ end
84
+
85
+ state :floatnumber do
86
+ rule(/\.(?!\.)[0-9_]*/, Num::Float)
87
+ rule(/[eE][+-]?[0-9][0-9_]*/, Num::Float)
88
+ rule(//, Text, :pop!)
89
+ end
90
+
91
+ # Making apostrophes optional, as only hexadecimal with type suffix
92
+ # possibly ambiguous.
93
+ state :floatsuffix do
94
+ rule(/'?[fF](32|64)/, Num::Float)
95
+ rule(//, Text, :pop!)
96
+ end
97
+
98
+ state :intsuffix do
99
+ rule(/'?[iI](32|64)/, Num::Integer::Long)
100
+ rule(/'?[iI](8|16)/, Num::Integer)
101
+ rule(/'?[uU]/, Num::Integer)
102
+ rule(//, Text, :pop!)
103
+ end
104
+
105
+ state :root do
106
+ rule(/##.*$/, Str::Doc)
107
+ rule(/#.*$/, Comment)
108
+ rule(/\*|=|>|<|\+|-|\/|@|\$|~|&|%|\!|\?|\||\\|\[|\]/, Operator)
109
+ rule(/\.\.|\.|,|\[\.|\.\]|{\.|\.}|\(\.|\.\)|{|}|\(|\)|:|\^|`|;/,
110
+ Punctuation)
111
+
112
+ # Strings
113
+ rule(/(?:[\w]+)"/,Str, :rdqs)
114
+ rule(/"""/, Str, :tdqs)
115
+ rule(/"/, Str, :dqs)
116
+
117
+ # Char
118
+ rule(/'/, Str::Char, :chars)
119
+
120
+ # Keywords
121
+ rule(%r[(#{Nim.underscorize(OPWORDS)})\b], Operator::Word)
122
+ rule(/(p_?r_?o_?c_?\s)(?![\(\[\]])/, Keyword, :funcname)
123
+ rule(%r[(#{Nim.underscorize(KEYWORDS)})\b], Keyword)
124
+ rule(%r[(#{Nim.underscorize(NAMESPACE)})\b], Keyword::Namespace)
125
+ rule(/(v_?a_?r)\b/, Keyword::Declaration)
126
+ rule(%r[(#{Nim.underscorize(TYPES)})\b], Keyword::Type)
127
+ rule(%r[(#{Nim.underscorize(PSEUDOKEYWORDS)})\b], Keyword::Pseudo)
128
+ # Identifiers
129
+ rule(/\b((?![_\d])\w)(((?!_)\w)|(_(?!_)\w))*/, Name)
130
+
131
+ # Numbers
132
+ # Note: Have to do this with a block to push multiple states first,
133
+ # since we can't pass array of states like w/ Pygments.
134
+ rule(/[0-9][0-9_]*(?=([eE.]|'?[fF](32|64)))/) do |number|
135
+ push :floatsuffix
136
+ push :floatnumber
137
+ token Num::Float
138
+ end
139
+ rule(/0[xX][a-fA-F0-9][a-fA-F0-9_]*/, Num::Hex, :intsuffix)
140
+ rule(/0[bB][01][01_]*/, Num, :intsuffix)
141
+ rule(/0o[0-7][0-7_]*/, Num::Oct, :intsuffix)
142
+ rule(/[0-9][0-9_]*/, Num::Integer, :intsuffix)
143
+
144
+ # Whitespace
145
+ rule(/\s+/, Text)
146
+ rule(/.+$/, Error)
147
+ end
148
+
149
+ end
150
+ end
151
+ end
@@ -6,8 +6,8 @@ module Rouge
6
6
  desc "The Ruby programming language (ruby-lang.org)"
7
7
  tag 'ruby'
8
8
  aliases 'rb'
9
- filenames '*.rb', '*.ruby', '*.rbw', '*.rake', '*.gemspec',
10
- 'Rakefile', 'Guardfile', 'Gemfile', 'Capfile',
9
+ filenames '*.rb', '*.ruby', '*.rbw', '*.rake', '*.gemspec', '*.podspec',
10
+ 'Rakefile', 'Guardfile', 'Gemfile', 'Capfile', 'Podfile',
11
11
  'Vagrantfile', '*.ru', '*.prawn'
12
12
 
13
13
  mimetypes 'text/x-ruby', 'application/x-ruby'
@@ -125,7 +125,7 @@ module Rouge
125
125
  private_class_method private_instance_methods private_methods proc
126
126
  protected_instance_methods protected_methods public_class_method
127
127
  public_instance_methods public_methods putc puts raise rand
128
- readline readlines require scan select self send set_trace_func
128
+ readline readlines require require_relative scan select self send set_trace_func
129
129
  singleton_methods sleep split sprintf srand sub syscall system
130
130
  taint test throw to_a to_s trace_var trap untaint untrace_var warn
131
131
  )
@@ -8,7 +8,7 @@ module Rouge
8
8
  tag 'shell'
9
9
  aliases 'bash', 'zsh', 'ksh', 'sh'
10
10
  filenames '*.sh', '*.bash', '*.zsh', '*.ksh',
11
- '.bashrc', '.zshrc', '.kshrc', '.profile'
11
+ '.bashrc', '.zshrc', '.kshrc', '.profile', 'PKGBUILD'
12
12
 
13
13
  mimetypes 'application/x-sh', 'application/x-shellscript'
14
14
 
data/lib/rouge/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rouge
4
4
  def self.version
5
- "1.7.4"
5
+ "1.7.7"
6
6
  end
7
7
  end
data/rouge.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  desc
13
13
  s.homepage = "http://github.com/jneen/rouge"
14
14
  s.rubyforge_project = "rouge"
15
- s.files = Dir['Gemfile', 'LICENSE', 'rouge.gemspec', 'lib/**/*.rb', 'bin/rougify', 'lib/rouge/demos/*']
15
+ s.files = Dir['Gemfile', 'LICENSE', 'rouge.gemspec', 'lib/**/*.rb', 'lib/**/*.yml', 'bin/rougify', 'lib/rouge/demos/*']
16
16
  s.executables = %w(rougify)
17
17
  s.license = 'MIT (see LICENSE file)'
18
18
  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.4
4
+ version: 1.7.7
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-11-23 00:00:00.000000000 Z
11
+ date: 2014-12-24 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:
@@ -23,6 +23,7 @@ files:
23
23
  - bin/rougify
24
24
  - lib/rouge.rb
25
25
  - lib/rouge/cli.rb
26
+ - lib/rouge/demos/apache
26
27
  - lib/rouge/demos/applescript
27
28
  - lib/rouge/demos/c
28
29
  - lib/rouge/demos/clojure
@@ -60,6 +61,7 @@ files:
60
61
  - lib/rouge/demos/matlab
61
62
  - lib/rouge/demos/moonscript
62
63
  - lib/rouge/demos/nginx
64
+ - lib/rouge/demos/nim
63
65
  - lib/rouge/demos/objective_c
64
66
  - lib/rouge/demos/ocaml
65
67
  - lib/rouge/demos/perl
@@ -97,6 +99,8 @@ files:
97
99
  - lib/rouge/formatters/null.rb
98
100
  - lib/rouge/formatters/terminal256.rb
99
101
  - lib/rouge/lexer.rb
102
+ - lib/rouge/lexers/apache.rb
103
+ - lib/rouge/lexers/apache/keywords.yml
100
104
  - lib/rouge/lexers/apple_script.rb
101
105
  - lib/rouge/lexers/c.rb
102
106
  - lib/rouge/lexers/clojure.rb
@@ -136,6 +140,7 @@ files:
136
140
  - lib/rouge/lexers/matlab/builtins.rb
137
141
  - lib/rouge/lexers/moonscript.rb
138
142
  - lib/rouge/lexers/nginx.rb
143
+ - lib/rouge/lexers/nim.rb
139
144
  - lib/rouge/lexers/objective_c.rb
140
145
  - lib/rouge/lexers/ocaml.rb
141
146
  - lib/rouge/lexers/perl.rb