rouge 1.3.3 → 1.3.4

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: 655cf7caf531705969ba4dd70fb14e844d402ace
4
- data.tar.gz: 7c9aa4d4c38cdf6664fd65aefd61ef487f6946bb
3
+ metadata.gz: 348faa966dfc41fca0cc87eab6a2cd724bad6a6d
4
+ data.tar.gz: 02e5a8446ac380f2ee75df978e4573c53fd461bc
5
5
  SHA512:
6
- metadata.gz: 1a2f19f1a538b2adb688dfdd921dfae66062dc8a3d6966c3fd9ad27165f3e00fe7451fce1078d3967605e30e04469ff5acc469b485b37f97d5f131e090d61783
7
- data.tar.gz: 5e4103ce369d28143b452d912f91f733b2369eeb098ee4aa6fc388f88404a0519dd1845919401caea10f2c42838fe32fbbdd53ab1cbe7a715f9d910323876c32
6
+ metadata.gz: 7ff37b2f1dd11e918dea989ac0eaaf34a2fbc80fc8285e6c25fcd4c14f3ae83e0243f83e04f69c0270102efe4dd247717b1cb6f77f187580943b73e3eaaaeed8
7
+ data.tar.gz: a3a9c6256ec0a898fa7e284988625406f605d90ae8414a481cde2911a02291f3c967e0ced5637905aba5b60f5972e2e297ca0f88608b4455f4771227f913877e
@@ -43,6 +43,7 @@ Dir.glob(load_dir.join('rouge/lexers/*.rb')).each { |f| load f }
43
43
  load load_dir.join('rouge/formatter.rb')
44
44
  load load_dir.join('rouge/formatters/html.rb')
45
45
  load load_dir.join('rouge/formatters/terminal256.rb')
46
+ load load_dir.join('rouge/formatters/null.rb')
46
47
 
47
48
  load load_dir.join('rouge/theme.rb')
48
49
  load load_dir.join('rouge/themes/thankful_eyes.rb')
@@ -323,7 +323,7 @@ module Rouge
323
323
  def run
324
324
  puts "== Available Lexers =="
325
325
 
326
- Lexer.all.each do |lexer|
326
+ Lexer.all.sort_by(&:tag).each do |lexer|
327
327
  desc = "#{lexer.desc}"
328
328
  if lexer.aliases.any?
329
329
  desc << " [aliases: #{lexer.aliases.join(',')}]"
@@ -0,0 +1,2 @@
1
+ -- AppleScript playing with iTunes
2
+ tell application "iTunes" to get current selection
@@ -1 +1 @@
1
- { "one": 1, "two": 2 }
1
+ { "one": 1, "two": 2, "null": null, "simple": true }
@@ -0,0 +1,7 @@
1
+ # You are reading the ".properties" entry.
2
+ ! The exclamation mark can also mark text as comments.
3
+ website = http\://en.wikipedia.org/
4
+ language = English
5
+ country : Poland
6
+ continent=Europe
7
+ key.with.dots=This is the value that could be looked up with the key "key.with.dots".
@@ -0,0 +1,9 @@
1
+ import QtQuick 2.0
2
+ Item {
3
+ width: 200
4
+ height: 100
5
+ MouseArea {
6
+ anchors.fill: parent
7
+ onClicked: Qt.quit()
8
+ }
9
+ }
@@ -0,0 +1,15 @@
1
+ module Rouge
2
+ module Formatters
3
+ # A formatter which renders nothing.
4
+ class Null < Formatter
5
+ tag 'null'
6
+
7
+ def initialize(*)
8
+ end
9
+
10
+ def stream(tokens, &b)
11
+ tokens.to_a
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,366 @@
1
+ # encoding: utf-8
2
+ module Rouge
3
+ module Lexers
4
+ class AppleScript < RegexLexer
5
+ desc "The AppleScript scripting language by Apple Inc. (http://developer.apple.com/applescript/)"
6
+
7
+ tag 'applescript'
8
+ aliases 'applescript'
9
+
10
+ filenames '*.applescript', '*.scpt'
11
+
12
+ mimetypes 'application/x-applescript'
13
+
14
+ def self.literals
15
+ @literals ||= ['AppleScript', 'current application', 'false', 'linefeed',
16
+ 'missing value', 'pi','quote', 'result', 'return', 'space',
17
+ 'tab', 'text item delimiters', 'true', 'version']
18
+ end
19
+
20
+ def self.classes
21
+ @classes ||= ['alias ', 'application ', 'boolean ', 'class ', 'constant ',
22
+ 'date ', 'file ', 'integer ', 'list ', 'number ', 'POSIX file ',
23
+ 'real ', 'record ', 'reference ', 'RGB color ', 'script ',
24
+ 'text ', 'unit types', '(?:Unicode )?text', 'string']
25
+ end
26
+
27
+ def self.builtins
28
+ @builtins ||= ['attachment', 'attribute run', 'character', 'day', 'month',
29
+ 'paragraph', 'word', 'year']
30
+ end
31
+
32
+ def self.handler_params
33
+ @handler_params ||= ['about', 'above', 'against', 'apart from', 'around',
34
+ 'aside from', 'at', 'below', 'beneath', 'beside',
35
+ 'between', 'for', 'given', 'instead of', 'on', 'onto',
36
+ 'out of', 'over', 'since']
37
+ end
38
+
39
+ def self.commands
40
+ @commands ||= ['ASCII (character|number)', 'activate', 'beep', 'choose URL',
41
+ 'choose application', 'choose color', 'choose file( name)?',
42
+ 'choose folder', 'choose from list',
43
+ 'choose remote application', 'clipboard info',
44
+ 'close( access)?', 'copy', 'count', 'current date', 'delay',
45
+ 'delete', 'display (alert|dialog)', 'do shell script',
46
+ 'duplicate', 'exists', 'get eof', 'get volume settings',
47
+ 'info for', 'launch', 'list (disks|folder)', 'load script',
48
+ 'log', 'make', 'mount volume', 'new', 'offset',
49
+ 'open( (for access|location))?', 'path to', 'print', 'quit',
50
+ 'random number', 'read', 'round', 'run( script)?',
51
+ 'say', 'scripting components',
52
+ 'set (eof|the clipboard to|volume)', 'store script',
53
+ 'summarize', 'system attribute', 'system info',
54
+ 'the clipboard', 'time to GMT', 'write', 'quoted form']
55
+ end
56
+
57
+ def self.references
58
+ @references ||= ['(in )?back of', '(in )?front of', '[0-9]+(st|nd|rd|th)',
59
+ 'first', 'second', 'third', 'fourth', 'fifth', 'sixth',
60
+ 'seventh', 'eighth', 'ninth', 'tenth', 'after', 'back',
61
+ 'before', 'behind', 'every', 'front', 'index', 'last',
62
+ 'middle', 'some', 'that', 'through', 'thru', 'where', 'whose']
63
+ end
64
+
65
+ def self.operators
66
+ @operators ||= ["and", "or", "is equal", "equals", "(is )?equal to", "is not",
67
+ "isn't", "isn't equal( to)?", "is not equal( to)?",
68
+ "doesn't equal", "does not equal", "(is )?greater than",
69
+ "comes after", "is not less than or equal( to)?",
70
+ "isn't less than or equal( to)?", "(is )?less than",
71
+ "comes before", "is not greater than or equal( to)?",
72
+ "isn't greater than or equal( to)?",
73
+ "(is )?greater than or equal( to)?", "is not less than",
74
+ "isn't less than", "does not come before",
75
+ "doesn't come before", "(is )?less than or equal( to)?",
76
+ "is not greater than", "isn't greater than",
77
+ "does not come after", "doesn't come after", "starts? with",
78
+ "begins? with", "ends? with", "contains?", "does not contain",
79
+ "doesn't contain", "is in", "is contained by", "is not in",
80
+ "is not contained by", "isn't contained by", "div", "mod",
81
+ "not", "(a )?(ref( to)?|reference to)", "is", "does"]
82
+ end
83
+
84
+ def self.controls
85
+ @controls ||= ['considering', 'else', 'error', 'exit', 'from', 'if',
86
+ 'ignoring', 'in', 'repeat', 'tell', 'then', 'times', 'to',
87
+ 'try', 'until', 'using terms from', 'while', 'whith',
88
+ 'with timeout( of)?', 'with transaction', 'by', 'continue',
89
+ 'end', 'its?', 'me', 'my', 'return', 'of' , 'as']
90
+ end
91
+
92
+ def self.declarations
93
+ @declarations ||= ['global', 'local', 'prop(erty)?', 'set', 'get']
94
+ end
95
+
96
+ def self.reserved
97
+ @reserved ||= ['but', 'put', 'returning', 'the']
98
+ end
99
+
100
+ def self.studio_classes
101
+ @studio_classes ||= ['action cell', 'alert reply', 'application', 'box',
102
+ 'browser( cell)?', 'bundle', 'button( cell)?', 'cell',
103
+ 'clip view', 'color well', 'color-panel',
104
+ 'combo box( item)?', 'control',
105
+ 'data( (cell|column|item|row|source))?', 'default entry',
106
+ 'dialog reply', 'document', 'drag info', 'drawer',
107
+ 'event', 'font(-panel)?', 'formatter',
108
+ 'image( (cell|view))?', 'matrix', 'menu( item)?', 'item',
109
+ 'movie( view)?', 'open-panel', 'outline view', 'panel',
110
+ 'pasteboard', 'plugin', 'popup button',
111
+ 'progress indicator', 'responder', 'save-panel',
112
+ 'scroll view', 'secure text field( cell)?', 'slider',
113
+ 'sound', 'split view', 'stepper', 'tab view( item)?',
114
+ 'table( (column|header cell|header view|view))',
115
+ 'text( (field( cell)?|view))?', 'toolbar( item)?',
116
+ 'user-defaults', 'view', 'window']
117
+ end
118
+
119
+ def self.studio_events
120
+ @studio_events ||= ['accept outline drop', 'accept table drop', 'action',
121
+ 'activated', 'alert ended', 'awake from nib', 'became key',
122
+ 'became main', 'begin editing', 'bounds changed',
123
+ 'cell value', 'cell value changed', 'change cell value',
124
+ 'change item value', 'changed', 'child of item',
125
+ 'choose menu item', 'clicked', 'clicked toolbar item',
126
+ 'closed', 'column clicked', 'column moved',
127
+ 'column resized', 'conclude drop', 'data representation',
128
+ 'deminiaturized', 'dialog ended', 'document nib name',
129
+ 'double clicked', 'drag( (entered|exited|updated))?',
130
+ 'drop', 'end editing', 'exposed', 'idle', 'item expandable',
131
+ 'item value', 'item value changed', 'items changed',
132
+ 'keyboard down', 'keyboard up', 'launched',
133
+ 'load data representation', 'miniaturized', 'mouse down',
134
+ 'mouse dragged', 'mouse entered', 'mouse exited',
135
+ 'mouse moved', 'mouse up', 'moved',
136
+ 'number of browser rows', 'number of items',
137
+ 'number of rows', 'open untitled', 'opened', 'panel ended',
138
+ 'parameters updated', 'plugin loaded', 'prepare drop',
139
+ 'prepare outline drag', 'prepare outline drop',
140
+ 'prepare table drag', 'prepare table drop',
141
+ 'read from file', 'resigned active', 'resigned key',
142
+ 'resigned main', 'resized( sub views)?',
143
+ 'right mouse down', 'right mouse dragged',
144
+ 'right mouse up', 'rows changed', 'scroll wheel',
145
+ 'selected tab view item', 'selection changed',
146
+ 'selection changing', 'should begin editing',
147
+ 'should close', 'should collapse item',
148
+ 'should end editing', 'should expand item',
149
+ 'should open( untitled)?',
150
+ 'should quit( after last window closed)?',
151
+ 'should select column', 'should select item',
152
+ 'should select row', 'should select tab view item',
153
+ 'should selection change', 'should zoom', 'shown',
154
+ 'update menu item', 'update parameters',
155
+ 'update toolbar item', 'was hidden', 'was miniaturized',
156
+ 'will become active', 'will close', 'will dismiss',
157
+ 'will display browser cell', 'will display cell',
158
+ 'will display item cell', 'will display outline cell',
159
+ 'will finish launching', 'will hide', 'will miniaturize',
160
+ 'will move', 'will open', 'will pop up', 'will quit',
161
+ 'will resign active', 'will resize( sub views)?',
162
+ 'will select tab view item', 'will show', 'will zoom',
163
+ 'write to file', 'zoomed']
164
+ end
165
+
166
+ def self.studio_commands
167
+ @studio_commands ||= ['animate', 'append', 'call method', 'center',
168
+ 'close drawer', 'close panel', 'display',
169
+ 'display alert', 'display dialog', 'display panel', 'go',
170
+ 'hide', 'highlight', 'increment', 'item for',
171
+ 'load image', 'load movie', 'load nib', 'load panel',
172
+ 'load sound', 'localized string', 'lock focus', 'log',
173
+ 'open drawer', 'path for', 'pause', 'perform action',
174
+ 'play', 'register', 'resume', 'scroll', 'select( all)?',
175
+ 'show', 'size to fit', 'start', 'step back',
176
+ 'step forward', 'stop', 'synchronize', 'unlock focus',
177
+ 'update']
178
+ end
179
+
180
+ def self.studio_properties
181
+ @studio_properties ||= ['accepts arrow key', 'action method', 'active',
182
+ 'alignment', 'allowed identifiers',
183
+ 'allows branch selection', 'allows column reordering',
184
+ 'allows column resizing', 'allows column selection',
185
+ 'allows customization', 'allows editing text attributes',
186
+ 'allows empty selection', 'allows mixed state',
187
+ 'allows multiple selection', 'allows reordering',
188
+ 'allows undo', 'alpha( value)?', 'alternate image',
189
+ 'alternate increment value', 'alternate title',
190
+ 'animation delay', 'associated file name',
191
+ 'associated object', 'auto completes', 'auto display',
192
+ 'auto enables items', 'auto repeat', 'auto resizes( outline column)?',
193
+ 'auto save expanded items', 'auto save name',
194
+ 'auto save table columns', 'auto saves configuration',
195
+ 'auto scroll', 'auto sizes all columns to fit',
196
+ 'auto sizes cells', 'background color', 'bezel state',
197
+ 'bezel style', 'bezeled', 'border rect', 'border type',
198
+ 'bordered', 'bounds( rotation)?', 'box type',
199
+ 'button returned', 'button type',
200
+ 'can choose directories', 'can choose files', 'can draw', 'can hide',
201
+ 'cell( (background color|size|type))?', 'characters',
202
+ 'class', 'click count', 'clicked( data)? column',
203
+ 'clicked data item', 'clicked( data)? row',
204
+ 'closeable', 'collating', 'color( (mode|panel))',
205
+ 'command key down', 'configuration',
206
+ 'content(s| (size|view( margins)?))?', 'context',
207
+ 'continuous', 'control key down', 'control size',
208
+ 'control tint', 'control view',
209
+ 'controller visible', 'coordinate system',
210
+ 'copies( on scroll)?', 'corner view', 'current cell',
211
+ 'current column', 'current( field)? editor',
212
+ 'current( menu)? item', 'current row',
213
+ 'current tab view item', 'data source',
214
+ 'default identifiers', 'delta (x|y|z)',
215
+ 'destination window', 'directory', 'display mode',
216
+ 'displayed cell', 'document( (edited|rect|view))?',
217
+ 'double value', 'dragged column', 'dragged distance',
218
+ 'dragged items', 'draws( cell)? background',
219
+ 'draws grid', 'dynamically scrolls', 'echos bullets',
220
+ 'edge', 'editable', 'edited( data)? column',
221
+ 'edited data item', 'edited( data)? row', 'enabled',
222
+ 'enclosing scroll view', 'ending page',
223
+ 'error handling', 'event number', 'event type',
224
+ 'excluded from windows menu', 'executable path',
225
+ 'expanded', 'fax number', 'field editor', 'file kind',
226
+ 'file name', 'file type', 'first responder',
227
+ 'first visible column', 'flipped', 'floating',
228
+ 'font( panel)?', 'formatter', 'frameworks path',
229
+ 'frontmost', 'gave up', 'grid color', 'has data items',
230
+ 'has horizontal ruler', 'has horizontal scroller',
231
+ 'has parent data item', 'has resize indicator',
232
+ 'has shadow', 'has sub menu', 'has vertical ruler',
233
+ 'has vertical scroller', 'header cell', 'header view',
234
+ 'hidden', 'hides when deactivated', 'highlights by',
235
+ 'horizontal line scroll', 'horizontal page scroll',
236
+ 'horizontal ruler view', 'horizontally resizable',
237
+ 'icon image', 'id', 'identifier',
238
+ 'ignores multiple clicks',
239
+ 'image( (alignment|dims when disabled|frame style|scaling))?',
240
+ 'imports graphics', 'increment value',
241
+ 'indentation per level', 'indeterminate', 'index',
242
+ 'integer value', 'intercell spacing', 'item height',
243
+ 'key( (code|equivalent( modifier)?|window))?',
244
+ 'knob thickness', 'label', 'last( visible)? column',
245
+ 'leading offset', 'leaf', 'level', 'line scroll',
246
+ 'loaded', 'localized sort', 'location', 'loop mode',
247
+ 'main( (bunde|menu|window))?', 'marker follows cell',
248
+ 'matrix mode', 'maximum( content)? size',
249
+ 'maximum visible columns',
250
+ 'menu( form representation)?', 'miniaturizable',
251
+ 'miniaturized', 'minimized image', 'minimized title',
252
+ 'minimum column width', 'minimum( content)? size',
253
+ 'modal', 'modified', 'mouse down state',
254
+ 'movie( (controller|file|rect))?', 'muted', 'name',
255
+ 'needs display', 'next state', 'next text',
256
+ 'number of tick marks', 'only tick mark values',
257
+ 'opaque', 'open panel', 'option key down',
258
+ 'outline table column', 'page scroll', 'pages across',
259
+ 'pages down', 'palette label', 'pane splitter',
260
+ 'parent data item', 'parent window', 'pasteboard',
261
+ 'path( (names|separator))?', 'playing',
262
+ 'plays every frame', 'plays selection only', 'position',
263
+ 'preferred edge', 'preferred type', 'pressure',
264
+ 'previous text', 'prompt', 'properties',
265
+ 'prototype cell', 'pulls down', 'rate',
266
+ 'released when closed', 'repeated',
267
+ 'requested print time', 'required file type',
268
+ 'resizable', 'resized column', 'resource path',
269
+ 'returns records', 'reuses columns', 'rich text',
270
+ 'roll over', 'row height', 'rulers visible',
271
+ 'save panel', 'scripts path', 'scrollable',
272
+ 'selectable( identifiers)?', 'selected cell',
273
+ 'selected( data)? columns?', 'selected data items?',
274
+ 'selected( data)? rows?', 'selected item identifier',
275
+ 'selection by rect', 'send action on arrow key',
276
+ 'sends action when done editing', 'separates columns',
277
+ 'separator item', 'sequence number', 'services menu',
278
+ 'shared frameworks path', 'shared support path',
279
+ 'sheet', 'shift key down', 'shows alpha',
280
+ 'shows state by', 'size( mode)?',
281
+ 'smart insert delete enabled', 'sort case sensitivity',
282
+ 'sort column', 'sort order', 'sort type',
283
+ 'sorted( data rows)?', 'sound', 'source( mask)?',
284
+ 'spell checking enabled', 'starting page', 'state',
285
+ 'string value', 'sub menu', 'super menu', 'super view',
286
+ 'tab key traverses cells', 'tab state', 'tab type',
287
+ 'tab view', 'table view', 'tag', 'target( printer)?',
288
+ 'text color', 'text container insert',
289
+ 'text container origin', 'text returned',
290
+ 'tick mark position', 'time stamp',
291
+ 'title(d| (cell|font|height|position|rect))?',
292
+ 'tool tip', 'toolbar', 'trailing offset', 'transparent',
293
+ 'treat packages as directories', 'truncated labels',
294
+ 'types', 'unmodified characters', 'update views',
295
+ 'use sort indicator', 'user defaults',
296
+ 'uses data source', 'uses ruler', 'uses threaded animation',
297
+ 'uses title from previous column', 'value wraps', 'version',
298
+ 'vertical( (line scroll|page scroll|ruler view))?', 'vertically resizable', 'view',
299
+ 'visible( document rect)?', 'volume', 'width', 'window',
300
+ 'windows menu', 'wraps', 'zoomable', 'zoomed']
301
+ end
302
+
303
+ operators = %r(\b(#{self.operators.to_a.join('|')})\b)
304
+ classes = %r(\b(as )(#{self.classes.to_a.join('|')})\b)
305
+ literals = %r(\b(#{self.literals.to_a.join('|')})\b)
306
+ commands = %r(\b(#{self.commands.to_a.join('|')})\b)
307
+ controls = %r(\b(#{self.controls.to_a.join('|')})\b)
308
+ declarations = %r(\b(#{self.declarations.to_a.join('|')})\b)
309
+ reserved = %r(\b(#{self.reserved.to_a.join('|')})\b)
310
+ builtins = %r(\b(#{self.builtins.to_a.join('|')})s?\b)
311
+ handler_params = %r(\b(#{self.handler_params.to_a.join('|')})\b)
312
+ references = %r(\b(#{self.references.to_a.join('|')})\b)
313
+ studio_properties = %r(\b(#{self.studio_properties.to_a.join('|')})\b)
314
+ studio_classes = %r(\b(#{self.studio_classes.to_a.join('|')})s?\b)
315
+ studio_commands = %r(\b(#{self.studio_commands.to_a.join('|')})\b)
316
+ identifiers = %r(\b([a-zA-Z]\w*)\b)
317
+
318
+ state :root do
319
+ rule /\s+/, Text::Whitespace
320
+ rule /¬\n/, Literal::String::Escape
321
+ rule /'s\s+/, Text
322
+ rule /(--|#).*?$/, Comment::Single
323
+ rule /\(\*/, Comment::Multiline
324
+ rule /[\(\){}!,.:]/, Punctuation
325
+ rule /(«)([^»]+)(»)/ do |match|
326
+ token Text, match[1]
327
+ token Name::Builtin, match[2]
328
+ token Text, match[3]
329
+ end
330
+ rule /\b((?:considering|ignoring)\s*)(application responses|case|diacriticals|hyphens|numeric strings|punctuation|white space)/ do |match|
331
+ token Keyword, match[1]
332
+ token Name::Builtin, match[2]
333
+ end
334
+ rule /(-|\*|\+|&|≠|>=?|<=?|=|≥|≤|\/|÷|\^)/, Operator
335
+ rule operators, Operator::Word
336
+ rule /^(\s*(?:on|end)\s+)'r'(%s)/ do |match|
337
+ token Keyword, match[1]
338
+ token Name::Function, match[2]
339
+ end
340
+ rule /^(\s*)(in|on|script|to)(\s+)/ do |match|
341
+ token Text, match[1]
342
+ token Keyword, match[2]
343
+ token Text, match[3]
344
+ end
345
+ rule classes do |match|
346
+ token Keyword, match[1]
347
+ token Name::Class, match[2]
348
+ end
349
+ rule commands, Name::Builtin
350
+ rule controls, Keyword
351
+ rule declarations, Keyword
352
+ rule reserved, Name::Builtin
353
+ rule builtins, Name::Builtin
354
+ rule handler_params, Name::Builtin
355
+ rule studio_properties, Name::Attribute
356
+ rule studio_classes, Name::Builtin
357
+ rule studio_commands, Name::Builtin
358
+ rule references, Name::Builtin
359
+ rule /"(\\\\|\\"|[^"])*"/, Literal::String::Double
360
+ rule identifiers, Name::Variable
361
+ rule /[-+]?(\d+\.\d*|\d*\.\d+)(E[-+][0-9]+)?/, Literal::Number::Float
362
+ rule /[-+]?\d+/, Literal::Number::Integer
363
+ end
364
+ end
365
+ end
366
+ end
@@ -179,7 +179,7 @@ module Rouge
179
179
  rule /(\{)(\s*)(\})/m do
180
180
  groups Punctuation, Text::Whitespace, Punctuation
181
181
  end
182
- rule /(?:true|false)\b/, Keyword::Constant
182
+ rule /(?:true|false|null)\b/, Keyword::Constant
183
183
  rule /{/, Punctuation, :object_key
184
184
  rule /\[/, Punctuation, :array
185
185
  rule /-?(?:0|[1-9]\d*)\.\d+(?:e[+-]\d+)?/i, Num::Float
@@ -0,0 +1,52 @@
1
+ module Rouge
2
+ module Lexers
3
+ class Properties < RegexLexer
4
+ desc '.properties config files for Java'
5
+ tag 'properties'
6
+
7
+ filenames '*.properties'
8
+ mimetypes 'text/x-java-properties'
9
+
10
+ def self.analyze_text(text)
11
+ return 0.1 if text =~ /\A\[[\w.]+\]\s*\w+=\w+/
12
+ end
13
+
14
+ identifier = /[\w.]+/
15
+
16
+ state :basic do
17
+ rule /[!#].*?\n/, Comment
18
+ rule /\s+/, Text
19
+ rule /\\\n/, Str::Escape
20
+ end
21
+
22
+ state :root do
23
+ mixin :basic
24
+
25
+ rule /(#{identifier})(\s*)([=:])/ do
26
+ groups Name::Property, Text, Punctuation
27
+ push :value
28
+ end
29
+ end
30
+
31
+ state :value do
32
+ rule /\n/, Text, :pop!
33
+ mixin :basic
34
+ rule /"/, Str, :dq
35
+ rule /'.*?'/, Str
36
+ mixin :esc_str
37
+ rule /[^\\\n]+/, Str
38
+ end
39
+
40
+ state :dq do
41
+ rule /"/, Str, :pop!
42
+ mixin :esc_str
43
+ rule /[^\\"]+/m, Str
44
+ end
45
+
46
+ state :esc_str do
47
+ rule /\\u[0-9]{4}/, Str::Escape
48
+ rule /\\./m, Str::Escape
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,68 @@
1
+ module Rouge
2
+ module Lexers
3
+ load_const :Javascript, 'javascript.rb'
4
+ class Qml < Javascript
5
+ desc 'QML, a UI markup language'
6
+ tag 'qml'
7
+ aliases 'qml'
8
+ filenames '*.qml'
9
+
10
+ mimetypes 'application/x-qml', 'text/x-qml'
11
+
12
+ id_with_dots = /[$a-zA-Z_][a-zA-Z0-9_.]*/
13
+
14
+ prepend :root do
15
+ rule /(#{id_with_dots})(\s*)({)/ do
16
+ groups Keyword::Type, Text, Punctuation
17
+ push :type_block
18
+ end
19
+ rule /(#{id_with_dots})(\s+)(on)(\s+)(#{id_with_dots})(\s*)({)/ do
20
+ groups Keyword::Type, Text, Keyword, Text, Name::Label, Text, Punctuation
21
+ push :type_block
22
+ end
23
+ end
24
+
25
+ state :type_block do
26
+ rule /(id)(\s*)(:)(\s*)(#{id_with_dots})/ do
27
+ groups Name::Label, Text, Punctuation, Text, Keyword::Declaration
28
+ end
29
+
30
+ rule /(#{id_with_dots})(\s*)(:)/ do
31
+ groups Name::Label, Text, Punctuation
32
+ push :slash_starts_regex
33
+ end
34
+
35
+ rule /(signal)(\s+)(#{id_with_dots})/ do
36
+ groups Keyword::Declaration, Text, Name::Label
37
+ push :signal
38
+ end
39
+
40
+ rule /(property)(\s+)(#{id_with_dots})(\s+)(#{id_with_dots})(\s*)(:?)/ do
41
+ groups Keyword::Declaration, Text, Keyword::Type, Text, Name::Label, Text, Punctuation
42
+ push :slash_starts_regex
43
+ end
44
+
45
+ rule /[}]/, Punctuation, :pop!
46
+ mixin :root
47
+ end
48
+
49
+ state :signal do
50
+ mixin :comments_and_whitespace
51
+ rule /\(/ do
52
+ token Punctuation
53
+ goto :signal_args
54
+ end
55
+ rule //, Text, :pop!
56
+ end
57
+
58
+ state :signal_args do
59
+ mixin :comments_and_whitespace
60
+ rule /(#{id_with_dots})(\s+)(#{id_with_dots})(\s*)(,?)/ do
61
+ groups Keyword::Type, Text, Name, Text, Punctuation
62
+ end
63
+ rule /\)/ , Punctuation, :pop!
64
+ end
65
+ end
66
+ end
67
+ end
68
+
@@ -27,7 +27,7 @@ module Rouge
27
27
  Str::Symbol
28
28
 
29
29
  rule /:'(\\\\|\\'|[^'])*'/, Str::Symbol
30
- rule /\b[a-z_]\w*?:\s+/, Str::Symbol
30
+ rule /\b[a-z_]\w*?:\s+/, Str::Symbol, :expr_start
31
31
  rule /'(\\\\|\\'|[^'])*'/, Str::Single
32
32
  rule /:"/, Str::Symbol, :simple_sym
33
33
  rule /"/, Str::Double, :simple_string
@@ -1,5 +1,5 @@
1
1
  module Rouge
2
2
  def self.version
3
- "1.3.3"
3
+ "1.3.4"
4
4
  end
5
5
  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.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Adkisson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-02 00:00:00.000000000 Z
11
+ date: 2014-05-05 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:
@@ -20,158 +20,165 @@ extra_rdoc_files: []
20
20
  files:
21
21
  - Gemfile
22
22
  - LICENSE
23
- - rouge.gemspec
24
- - lib/rouge/token.rb
25
- - lib/rouge/version.rb
26
- - lib/rouge/util.rb
27
- - lib/rouge/theme.rb
28
- - lib/rouge/lexer.rb
29
- - lib/rouge/template_lexer.rb
30
- - lib/rouge/formatter.rb
31
- - lib/rouge/plugins/redcarpet.rb
23
+ - bin/rougify
24
+ - lib/rouge.rb
32
25
  - lib/rouge/cli.rb
26
+ - lib/rouge/demos/applescript
27
+ - lib/rouge/demos/c
28
+ - lib/rouge/demos/clojure
29
+ - lib/rouge/demos/coffeescript
30
+ - lib/rouge/demos/common_lisp
31
+ - lib/rouge/demos/conf
32
+ - lib/rouge/demos/cpp
33
+ - lib/rouge/demos/csharp
34
+ - lib/rouge/demos/css
35
+ - lib/rouge/demos/diff
36
+ - lib/rouge/demos/elixir
37
+ - lib/rouge/demos/erb
38
+ - lib/rouge/demos/erlang
39
+ - lib/rouge/demos/factor
40
+ - lib/rouge/demos/gherkin
41
+ - lib/rouge/demos/go
42
+ - lib/rouge/demos/groovy
43
+ - lib/rouge/demos/haml
44
+ - lib/rouge/demos/handlebars
45
+ - lib/rouge/demos/haskell
46
+ - lib/rouge/demos/html
47
+ - lib/rouge/demos/http
48
+ - lib/rouge/demos/ini
49
+ - lib/rouge/demos/io
50
+ - lib/rouge/demos/java
51
+ - lib/rouge/demos/javascript
52
+ - lib/rouge/demos/json
53
+ - lib/rouge/demos/literate_coffeescript
54
+ - lib/rouge/demos/literate_haskell
55
+ - lib/rouge/demos/llvm
56
+ - lib/rouge/demos/lua
57
+ - lib/rouge/demos/make
58
+ - lib/rouge/demos/markdown
59
+ - lib/rouge/demos/matlab
60
+ - lib/rouge/demos/moonscript
61
+ - lib/rouge/demos/nginx
62
+ - lib/rouge/demos/objective_c
63
+ - lib/rouge/demos/ocaml
64
+ - lib/rouge/demos/perl
65
+ - lib/rouge/demos/php
66
+ - lib/rouge/demos/plaintext
67
+ - lib/rouge/demos/prolog
68
+ - lib/rouge/demos/properties
69
+ - lib/rouge/demos/puppet
70
+ - lib/rouge/demos/python
71
+ - lib/rouge/demos/qml
72
+ - lib/rouge/demos/r
73
+ - lib/rouge/demos/racket
74
+ - lib/rouge/demos/ruby
75
+ - lib/rouge/demos/rust
76
+ - lib/rouge/demos/sass
77
+ - lib/rouge/demos/scala
78
+ - lib/rouge/demos/scheme
79
+ - lib/rouge/demos/scss
80
+ - lib/rouge/demos/sed
81
+ - lib/rouge/demos/shell
82
+ - lib/rouge/demos/smalltalk
83
+ - lib/rouge/demos/sml
84
+ - lib/rouge/demos/sql
85
+ - lib/rouge/demos/tcl
86
+ - lib/rouge/demos/tex
87
+ - lib/rouge/demos/toml
88
+ - lib/rouge/demos/vb
89
+ - lib/rouge/demos/viml
90
+ - lib/rouge/demos/xml
91
+ - lib/rouge/demos/yaml
92
+ - lib/rouge/formatter.rb
33
93
  - lib/rouge/formatters/html.rb
94
+ - lib/rouge/formatters/null.rb
34
95
  - lib/rouge/formatters/terminal256.rb
35
- - lib/rouge/themes/thankful_eyes.rb
36
- - lib/rouge/themes/base16.rb
37
- - lib/rouge/themes/github.rb
38
- - lib/rouge/themes/monokai.rb
39
- - lib/rouge/themes/colorful.rb
40
- - lib/rouge/text_analyzer.rb
41
- - lib/rouge/regex_lexer.rb
42
- - lib/rouge/lexers/html.rb
43
- - lib/rouge/lexers/smalltalk.rb
96
+ - lib/rouge/lexer.rb
97
+ - lib/rouge/lexers/apple_script.rb
98
+ - lib/rouge/lexers/c.rb
44
99
  - lib/rouge/lexers/clojure.rb
45
- - lib/rouge/lexers/plain_text.rb
46
- - lib/rouge/lexers/sass/common.rb
47
- - lib/rouge/lexers/sass.rb
48
- - lib/rouge/lexers/factor.rb
49
- - lib/rouge/lexers/csharp.rb
50
- - lib/rouge/lexers/php/builtins.rb
51
- - lib/rouge/lexers/nginx.rb
52
- - lib/rouge/lexers/llvm.rb
53
- - lib/rouge/lexers/scala.rb
54
- - lib/rouge/lexers/perl.rb
55
- - lib/rouge/lexers/groovy.rb
56
- - lib/rouge/lexers/sed.rb
57
100
  - lib/rouge/lexers/coffeescript.rb
58
- - lib/rouge/lexers/literate_coffeescript.rb
59
- - lib/rouge/lexers/racket.rb
60
- - lib/rouge/lexers/diff.rb
61
- - lib/rouge/lexers/viml/keywords.rb
101
+ - lib/rouge/lexers/common_lisp.rb
102
+ - lib/rouge/lexers/conf.rb
103
+ - lib/rouge/lexers/cpp.rb
104
+ - lib/rouge/lexers/csharp.rb
62
105
  - lib/rouge/lexers/css.rb
63
- - lib/rouge/lexers/toml.rb
64
- - lib/rouge/lexers/moonscript.rb
65
- - lib/rouge/lexers/puppet.rb
66
- - lib/rouge/lexers/ruby.rb
67
- - lib/rouge/lexers/http.rb
68
- - lib/rouge/lexers/xml.rb
69
- - lib/rouge/lexers/handlebars.rb
70
- - lib/rouge/lexers/php.rb
71
- - lib/rouge/lexers/tcl.rb
72
- - lib/rouge/lexers/tex.rb
106
+ - lib/rouge/lexers/diff.rb
107
+ - lib/rouge/lexers/elixir.rb
108
+ - lib/rouge/lexers/erb.rb
109
+ - lib/rouge/lexers/erlang.rb
110
+ - lib/rouge/lexers/factor.rb
73
111
  - lib/rouge/lexers/gherkin.rb
74
- - lib/rouge/lexers/vb.rb
75
- - lib/rouge/lexers/rust.rb
112
+ - lib/rouge/lexers/gherkin/keywords.rb
113
+ - lib/rouge/lexers/go.rb
114
+ - lib/rouge/lexers/groovy.rb
115
+ - lib/rouge/lexers/haml.rb
116
+ - lib/rouge/lexers/handlebars.rb
117
+ - lib/rouge/lexers/haskell.rb
118
+ - lib/rouge/lexers/html.rb
119
+ - lib/rouge/lexers/http.rb
76
120
  - lib/rouge/lexers/ini.rb
77
- - lib/rouge/lexers/scss.rb
78
- - lib/rouge/lexers/javascript.rb
79
- - lib/rouge/lexers/shell.rb
80
- - lib/rouge/lexers/erlang.rb
81
- - lib/rouge/lexers/yaml.rb
82
- - lib/rouge/lexers/make.rb
83
- - lib/rouge/lexers/objective_c.rb
84
- - lib/rouge/lexers/lua.rb
85
- - lib/rouge/lexers/viml.rb
121
+ - lib/rouge/lexers/io.rb
86
122
  - lib/rouge/lexers/java.rb
87
- - lib/rouge/lexers/common_lisp.rb
88
- - lib/rouge/lexers/sml.rb
89
- - lib/rouge/lexers/scheme.rb
90
- - lib/rouge/lexers/haml.rb
91
- - lib/rouge/lexers/erb.rb
123
+ - lib/rouge/lexers/javascript.rb
124
+ - lib/rouge/lexers/literate_coffeescript.rb
92
125
  - lib/rouge/lexers/literate_haskell.rb
93
- - lib/rouge/lexers/c.rb
94
- - lib/rouge/lexers/gherkin/keywords.rb
95
- - lib/rouge/lexers/io.rb
96
- - lib/rouge/lexers/elixir.rb
126
+ - lib/rouge/lexers/llvm.rb
127
+ - lib/rouge/lexers/lua.rb
97
128
  - lib/rouge/lexers/lua/builtins.rb
98
- - lib/rouge/lexers/go.rb
99
- - lib/rouge/lexers/python.rb
100
- - lib/rouge/lexers/cpp.rb
101
- - lib/rouge/lexers/sql.rb
102
- - lib/rouge/lexers/haskell.rb
129
+ - lib/rouge/lexers/make.rb
130
+ - lib/rouge/lexers/markdown.rb
103
131
  - lib/rouge/lexers/matlab.rb
104
132
  - lib/rouge/lexers/matlab/builtins.rb
105
- - lib/rouge/lexers/r.rb
106
- - lib/rouge/lexers/markdown.rb
133
+ - lib/rouge/lexers/moonscript.rb
134
+ - lib/rouge/lexers/nginx.rb
135
+ - lib/rouge/lexers/objective_c.rb
107
136
  - lib/rouge/lexers/ocaml.rb
137
+ - lib/rouge/lexers/perl.rb
138
+ - lib/rouge/lexers/php.rb
139
+ - lib/rouge/lexers/php/builtins.rb
140
+ - lib/rouge/lexers/plain_text.rb
108
141
  - lib/rouge/lexers/prolog.rb
109
- - lib/rouge/lexers/conf.rb
110
- - lib/rouge.rb
111
- - bin/rougify
112
- - lib/rouge/demos/erlang
113
- - lib/rouge/demos/moonscript
114
- - lib/rouge/demos/sass
115
- - lib/rouge/demos/ruby
116
- - lib/rouge/demos/factor
117
- - lib/rouge/demos/smalltalk
118
- - lib/rouge/demos/yaml
119
- - lib/rouge/demos/handlebars
120
- - lib/rouge/demos/tex
121
- - lib/rouge/demos/racket
122
- - lib/rouge/demos/elixir
123
- - lib/rouge/demos/php
124
- - lib/rouge/demos/tcl
125
- - lib/rouge/demos/html
126
- - lib/rouge/demos/shell
127
- - lib/rouge/demos/perl
128
- - lib/rouge/demos/prolog
129
- - lib/rouge/demos/r
130
- - lib/rouge/demos/scala
131
- - lib/rouge/demos/viml
132
- - lib/rouge/demos/haskell
133
- - lib/rouge/demos/css
134
- - lib/rouge/demos/conf
135
- - lib/rouge/demos/haml
136
- - lib/rouge/demos/literate_haskell
137
- - lib/rouge/demos/io
138
- - lib/rouge/demos/c
139
- - lib/rouge/demos/scss
140
- - lib/rouge/demos/llvm
141
- - lib/rouge/demos/literate_coffeescript
142
- - lib/rouge/demos/python
143
- - lib/rouge/demos/make
144
- - lib/rouge/demos/clojure
145
- - lib/rouge/demos/java
146
- - lib/rouge/demos/csharp
147
- - lib/rouge/demos/go
148
- - lib/rouge/demos/javascript
149
- - lib/rouge/demos/sed
150
- - lib/rouge/demos/common_lisp
151
- - lib/rouge/demos/groovy
152
- - lib/rouge/demos/sml
153
- - lib/rouge/demos/nginx
154
- - lib/rouge/demos/vb
155
- - lib/rouge/demos/toml
156
- - lib/rouge/demos/gherkin
157
- - lib/rouge/demos/http
158
- - lib/rouge/demos/rust
159
- - lib/rouge/demos/json
160
- - lib/rouge/demos/markdown
161
- - lib/rouge/demos/plaintext
162
- - lib/rouge/demos/xml
163
- - lib/rouge/demos/lua
164
- - lib/rouge/demos/erb
165
- - lib/rouge/demos/cpp
166
- - lib/rouge/demos/coffeescript
167
- - lib/rouge/demos/objective_c
168
- - lib/rouge/demos/sql
169
- - lib/rouge/demos/puppet
170
- - lib/rouge/demos/matlab
171
- - lib/rouge/demos/ini
172
- - lib/rouge/demos/ocaml
173
- - lib/rouge/demos/scheme
174
- - lib/rouge/demos/diff
142
+ - lib/rouge/lexers/properties.rb
143
+ - lib/rouge/lexers/puppet.rb
144
+ - lib/rouge/lexers/python.rb
145
+ - lib/rouge/lexers/qml.rb
146
+ - lib/rouge/lexers/r.rb
147
+ - lib/rouge/lexers/racket.rb
148
+ - lib/rouge/lexers/ruby.rb
149
+ - lib/rouge/lexers/rust.rb
150
+ - lib/rouge/lexers/sass.rb
151
+ - lib/rouge/lexers/sass/common.rb
152
+ - lib/rouge/lexers/scala.rb
153
+ - lib/rouge/lexers/scheme.rb
154
+ - lib/rouge/lexers/scss.rb
155
+ - lib/rouge/lexers/sed.rb
156
+ - lib/rouge/lexers/shell.rb
157
+ - lib/rouge/lexers/smalltalk.rb
158
+ - lib/rouge/lexers/sml.rb
159
+ - lib/rouge/lexers/sql.rb
160
+ - lib/rouge/lexers/tcl.rb
161
+ - lib/rouge/lexers/tex.rb
162
+ - lib/rouge/lexers/toml.rb
163
+ - lib/rouge/lexers/vb.rb
164
+ - lib/rouge/lexers/viml.rb
165
+ - lib/rouge/lexers/viml/keywords.rb
166
+ - lib/rouge/lexers/xml.rb
167
+ - lib/rouge/lexers/yaml.rb
168
+ - lib/rouge/plugins/redcarpet.rb
169
+ - lib/rouge/regex_lexer.rb
170
+ - lib/rouge/template_lexer.rb
171
+ - lib/rouge/text_analyzer.rb
172
+ - lib/rouge/theme.rb
173
+ - lib/rouge/themes/base16.rb
174
+ - lib/rouge/themes/colorful.rb
175
+ - lib/rouge/themes/github.rb
176
+ - lib/rouge/themes/monokai.rb
177
+ - lib/rouge/themes/thankful_eyes.rb
178
+ - lib/rouge/token.rb
179
+ - lib/rouge/util.rb
180
+ - lib/rouge/version.rb
181
+ - rouge.gemspec
175
182
  homepage: http://github.com/jayferd/rouge
176
183
  licenses:
177
184
  - MIT (see LICENSE file)
@@ -182,17 +189,17 @@ require_paths:
182
189
  - lib
183
190
  required_ruby_version: !ruby/object:Gem::Requirement
184
191
  requirements:
185
- - - '>='
192
+ - - ">="
186
193
  - !ruby/object:Gem::Version
187
194
  version: '0'
188
195
  required_rubygems_version: !ruby/object:Gem::Requirement
189
196
  requirements:
190
- - - '>='
197
+ - - ">="
191
198
  - !ruby/object:Gem::Version
192
199
  version: '0'
193
200
  requirements: []
194
201
  rubyforge_project: rouge
195
- rubygems_version: 2.0.14
202
+ rubygems_version: 2.2.2
196
203
  signing_key:
197
204
  specification_version: 4
198
205
  summary: A pure-ruby colorizer based on pygments