Class: Rouge::Lexers::AppleScript

Inherits:
RegexLexer show all
Defined in:
lib/rouge/lexers/apple_script.rb

Constant Summary

Constants inherited from RegexLexer

RegexLexer::MAX_NULL_SCANS

Constants included from Token::Tokens

Token::Tokens::Num, Token::Tokens::Str

Instance Attribute Summary

Attributes inherited from Rouge::Lexer

#options

Class Method Summary collapse

Methods inherited from RegexLexer

append, #delegate, #goto, #group, #groups, #in_state?, #pop!, prepend, #push, #recurse, replace_state, #reset!, #reset_stack, #stack, start, start_procs, state, #state, #state?, state_definitions, states, #step, #stream_tokens, #token

Methods inherited from Rouge::Lexer

aliases, all, #as_bool, #as_lexer, #as_list, #as_string, #as_token, #bool_option, continue_lex, #continue_lex, debug_enabled?, demo, demo_file, desc, detect?, detectable?, disable_debug!, enable_debug!, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #hash_option, #initialize, lex, #lex, #lexer_option, #list_option, lookup_fancy, mimetypes, option, option_docs, #reset!, #stream_tokens, #string_option, tag, #tag, title, #token_option, #with

Methods included from Token::Tokens

token

Constructor Details

This class inherits a constructor from Rouge::Lexer

Class Method Details

.builtinsObject



30
31
32
33
# File 'lib/rouge/lexers/apple_script.rb', line 30

def self.builtins
  @builtins ||= ['attachment', 'attribute run', 'character', 'day', 'month',
                 'paragraph', 'word', 'year']
end

.classesObject



23
24
25
26
27
28
# File 'lib/rouge/lexers/apple_script.rb', line 23

def self.classes
  @classes ||= ['alias ', 'application ', 'boolean ', 'class ', 'constant ',
                'date ', 'file ', 'integer ', 'list ', 'number ', 'POSIX file ',
                'real ', 'record ', 'reference ', 'RGB color ', 'script ',
                'text ', 'unit types', '(?:Unicode )?text', 'string']
end

.commandsObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/rouge/lexers/apple_script.rb', line 42

def self.commands
  @commands ||= ['ASCII (character|number)', 'activate', 'beep', 'choose URL',
          'choose application', 'choose color', 'choose file( name)?',
          'choose folder', 'choose from list',
          'choose remote application', 'clipboard info',
          'close( access)?', 'copy', 'count', 'current date', 'delay',
          'delete', 'display (alert|dialog)', 'do shell script',
          'duplicate', 'exists', 'get eof', 'get volume settings',
          'info for', 'launch', 'list (disks|folder)', 'load script',
          'log', 'make', 'mount volume', 'new', 'offset',
          'open( (for access|location))?', 'path to', 'print', 'quit',
          'random number', 'read', 'round', 'run( script)?',
          'say', 'scripting components',
          'set (eof|the clipboard to|volume)', 'store script',
          'summarize', 'system attribute', 'system info',
          'the clipboard', 'time to GMT', 'write', 'quoted form']
end

.controlsObject



87
88
89
90
91
92
93
# File 'lib/rouge/lexers/apple_script.rb', line 87

def self.controls
  @controls ||= ['considering', 'else', 'error', 'exit', 'from', 'if',
         'ignoring', 'in', 'repeat', 'tell', 'then', 'times', 'to',
         'try', 'until', 'using terms from', 'while', 'whith',
         'with timeout( of)?', 'with transaction', 'by', 'continue',
         'end', 'its?', 'me', 'my', 'return', 'of' , 'as']
end

.declarationsObject



95
96
97
# File 'lib/rouge/lexers/apple_script.rb', line 95

def self.declarations
  @declarations ||= ['global', 'local', 'prop(erty)?', 'set', 'get']
end

.handler_paramsObject



35
36
37
38
39
40
# File 'lib/rouge/lexers/apple_script.rb', line 35

def self.handler_params
  @handler_params ||= ['about', 'above', 'against', 'apart from', 'around',
                       'aside from', 'at', 'below', 'beneath', 'beside',
                       'between', 'for', 'given', 'instead of', 'on', 'onto',
                       'out of', 'over', 'since']
end

.literalsObject



17
18
19
20
21
# File 'lib/rouge/lexers/apple_script.rb', line 17

def self.literals
  @literals ||= ['AppleScript', 'current application', 'false', 'linefeed',
                 'missing value', 'pi','quote', 'result', 'return', 'space',
                 'tab', 'text item delimiters', 'true', 'version']
end

.operatorsObject



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/rouge/lexers/apple_script.rb', line 68

def self.operators
  @operators ||= ["and", "or", "is equal", "equals", "(is )?equal to", "is not",
           "isn't", "isn't equal( to)?", "is not equal( to)?",
           "doesn't equal", "does not equal", "(is )?greater than",
           "comes after", "is not less than or equal( to)?",
           "isn't less than or equal( to)?", "(is )?less than",
           "comes before", "is not greater than or equal( to)?",
           "isn't greater than or equal( to)?",
           "(is  )?greater than or equal( to)?", "is not less than",
           "isn't less than", "does not come before",
           "doesn't come before", "(is )?less than or equal( to)?",
           "is not greater than", "isn't greater than",
           "does not come after", "doesn't come after", "starts? with",
           "begins? with", "ends? with", "contains?", "does not contain",
           "doesn't contain", "is in", "is contained by", "is not in",
           "is not contained by", "isn't contained by", "div", "mod",
           "not", "(a  )?(ref( to)?|reference to)", "is", "does"]
end

.referencesObject



60
61
62
63
64
65
66
# File 'lib/rouge/lexers/apple_script.rb', line 60

def self.references
  @references ||= ['(in )?back of', '(in )?front of', '[0-9]+(st|nd|rd|th)',
            'first', 'second', 'third', 'fourth', 'fifth', 'sixth',
            'seventh', 'eighth', 'ninth', 'tenth', 'after', 'back',
            'before', 'behind', 'every', 'front', 'index', 'last',
            'middle', 'some', 'that', 'through', 'thru', 'where', 'whose']
end

.reservedObject



99
100
101
# File 'lib/rouge/lexers/apple_script.rb', line 99

def self.reserved
  @reserved ||= ['but', 'put', 'returning', 'the']
end

.studio_classesObject



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/rouge/lexers/apple_script.rb', line 103

def self.studio_classes
  @studio_classes ||= ['action cell', 'alert reply', 'application', 'box',
               'browser( cell)?', 'bundle', 'button( cell)?', 'cell',
               'clip view', 'color well', 'color-panel',
               'combo box( item)?', 'control',
               'data( (cell|column|item|row|source))?', 'default entry',
               'dialog reply', 'document', 'drag info', 'drawer',
               'event', 'font(-panel)?', 'formatter',
               'image( (cell|view))?', 'matrix', 'menu( item)?', 'item',
               'movie( view)?', 'open-panel', 'outline view', 'panel',
               'pasteboard', 'plugin', 'popup button',
               'progress indicator', 'responder', 'save-panel',
               'scroll view', 'secure text field( cell)?', 'slider',
               'sound', 'split view', 'stepper', 'tab view( item)?',
               'table( (column|header cell|header view|view))',
               'text( (field( cell)?|view))?', 'toolbar( item)?',
               'user-defaults', 'view', 'window']
end

.studio_commandsObject



169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/rouge/lexers/apple_script.rb', line 169

def self.studio_commands
  @studio_commands ||= ['animate', 'append', 'call method', 'center',
                'close drawer', 'close panel', 'display',
                'display alert', 'display dialog', 'display panel', 'go',
                'hide', 'highlight', 'increment', 'item for',
                'load image', 'load movie', 'load nib', 'load panel',
                'load sound', 'localized string', 'lock focus', 'log',
                'open drawer', 'path for', 'pause', 'perform action',
                'play', 'register', 'resume', 'scroll', 'select( all)?',
                'show', 'size to fit', 'start', 'step back',
                'step forward', 'stop', 'synchronize', 'unlock focus',
                'update']
end

.studio_eventsObject



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/rouge/lexers/apple_script.rb', line 122

def self.studio_events
  @studio_events ||= ['accept outline drop', 'accept table drop', 'action',
              'activated', 'alert ended', 'awake from nib', 'became key',
              'became main', 'begin editing', 'bounds changed',
              'cell value', 'cell value changed', 'change cell value',
              'change item value', 'changed', 'child of item',
              'choose menu item', 'clicked', 'clicked toolbar item',
              'closed', 'column clicked', 'column moved',
              'column resized', 'conclude drop', 'data representation',
              'deminiaturized', 'dialog ended', 'document nib name',
              'double clicked', 'drag( (entered|exited|updated))?',
              'drop', 'end editing', 'exposed', 'idle', 'item expandable',
              'item value', 'item value changed', 'items changed',
              'keyboard down', 'keyboard up', 'launched',
              'load data representation', 'miniaturized', 'mouse down',
              'mouse dragged', 'mouse entered', 'mouse exited',
              'mouse moved', 'mouse up', 'moved',
              'number of browser rows', 'number of items',
              'number of rows', 'open untitled', 'opened', 'panel ended',
              'parameters updated', 'plugin loaded', 'prepare drop',
              'prepare outline drag', 'prepare outline drop',
              'prepare table drag', 'prepare table drop',
              'read from file', 'resigned active', 'resigned key',
              'resigned main', 'resized( sub views)?',
              'right mouse down', 'right mouse dragged',
              'right mouse up', 'rows changed', 'scroll wheel',
              'selected tab view item', 'selection changed',
              'selection changing', 'should begin editing',
              'should close', 'should collapse item',
              'should end editing', 'should expand item',
              'should open( untitled)?',
              'should quit( after last window closed)?',
              'should select column', 'should select item',
              'should select row', 'should select tab view item',
              'should selection change', 'should zoom', 'shown',
              'update menu item', 'update parameters',
              'update toolbar item', 'was hidden', 'was miniaturized',
              'will become active', 'will close', 'will dismiss',
              'will display browser cell', 'will display cell',
              'will display item cell', 'will display outline cell',
              'will finish launching', 'will hide', 'will miniaturize',
              'will move', 'will open', 'will pop up', 'will quit',
              'will resign active', 'will resize( sub views)?',
              'will select tab view item', 'will show', 'will zoom',
              'write to file', 'zoomed']
end

.studio_propertiesObject



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/rouge/lexers/apple_script.rb', line 183

def self.studio_properties
  @studio_properties ||= ['accepts arrow key', 'action method', 'active',
                  'alignment', 'allowed identifiers',
                  'allows branch selection', 'allows column reordering',
                  'allows column resizing', 'allows column selection',
                  'allows customization', 'allows editing text attributes',
                  'allows empty selection', 'allows mixed state',
                  'allows multiple selection', 'allows reordering',
                  'allows undo', 'alpha( value)?', 'alternate image',
                  'alternate increment value', 'alternate title',
                  'animation delay', 'associated file name',
                  'associated object', 'auto completes', 'auto display',
                  'auto enables items', 'auto repeat', 'auto resizes( outline column)?',
                  'auto save expanded items', 'auto save name',
                  'auto save table columns', 'auto saves configuration',
                  'auto scroll', 'auto sizes all columns to fit',
                  'auto sizes cells', 'background color', 'bezel state',
                  'bezel style', 'bezeled', 'border rect', 'border type',
                  'bordered', 'bounds( rotation)?', 'box type',
                  'button returned', 'button type',
                  'can choose directories', 'can choose files', 'can draw', 'can hide',
                  'cell( (background color|size|type))?', 'characters',
                  'class', 'click count', 'clicked( data)? column',
                  'clicked data item', 'clicked( data)? row',
                  'closeable', 'collating', 'color( (mode|panel))',
                  'command key down', 'configuration',
                  'content(s| (size|view( margins)?))?', 'context',
                  'continuous', 'control key down', 'control size',
                  'control tint', 'control view',
                  'controller visible', 'coordinate system',
                  'copies( on scroll)?', 'corner view', 'current cell',
                  'current column', 'current( field)?  editor',
                  'current( menu)? item', 'current row',
                  'current tab view item', 'data source',
                  'default identifiers', 'delta (x|y|z)',
                  'destination window', 'directory', 'display mode',
                  'displayed cell', 'document( (edited|rect|view))?',
                  'double value', 'dragged column', 'dragged distance',
                  'dragged items', 'draws( cell)? background',
                  'draws grid', 'dynamically scrolls', 'echos bullets',
                  'edge', 'editable', 'edited( data)? column',
                  'edited data item', 'edited( data)? row', 'enabled',
                  'enclosing scroll view', 'ending page',
                  'error handling', 'event number', 'event type',
                  'excluded from windows menu', 'executable path',
                  'expanded', 'fax number', 'field editor', 'file kind',
                  'file name', 'file type', 'first responder',
                  'first visible column', 'flipped', 'floating',
                  'font( panel)?', 'formatter', 'frameworks path',
                  'frontmost', 'gave up', 'grid color', 'has data items',
                  'has horizontal ruler', 'has horizontal scroller',
                  'has parent data item', 'has resize indicator',
                  'has shadow', 'has sub menu', 'has vertical ruler',
                  'has vertical scroller', 'header cell', 'header view',
                  'hidden', 'hides when deactivated', 'highlights by',
                  'horizontal line scroll', 'horizontal page scroll',
                  'horizontal ruler view', 'horizontally resizable',
                  'icon image', 'id', 'identifier',
                  'ignores multiple clicks',
                  'image( (alignment|dims when disabled|frame style|scaling))?',
                  'imports graphics', 'increment value',
                  'indentation per level', 'indeterminate', 'index',
                  'integer value', 'intercell spacing', 'item height',
                  'key( (code|equivalent( modifier)?|window))?',
                  'knob thickness', 'label', 'last( visible)? column',
                  'leading offset', 'leaf', 'level', 'line scroll',
                  'loaded', 'localized sort', 'location', 'loop mode',
                  'main( (bunde|menu|window))?', 'marker follows cell',
                  'matrix mode', 'maximum( content)? size',
                  'maximum visible columns',
                  'menu( form representation)?', 'miniaturizable',
                  'miniaturized', 'minimized image', 'minimized title',
                  'minimum column width', 'minimum( content)? size',
                  'modal', 'modified', 'mouse down state',
                  'movie( (controller|file|rect))?', 'muted', 'name',
                  'needs display', 'next state', 'next text',
                  'number of tick marks', 'only tick mark values',
                  'opaque', 'open panel', 'option key down',
                  'outline table column', 'page scroll', 'pages across',
                  'pages down', 'palette label', 'pane splitter',
                  'parent data item', 'parent window', 'pasteboard',
                  'path( (names|separator))?', 'playing',
                  'plays every frame', 'plays selection only', 'position',
                  'preferred edge', 'preferred type', 'pressure',
                  'previous text', 'prompt', 'properties',
                  'prototype cell', 'pulls down', 'rate',
                  'released when closed', 'repeated',
                  'requested print time', 'required file type',
                  'resizable', 'resized column', 'resource path',
                  'returns records', 'reuses columns', 'rich text',
                  'roll over', 'row height', 'rulers visible',
                  'save panel', 'scripts path', 'scrollable',
                  'selectable( identifiers)?', 'selected cell',
                  'selected( data)? columns?', 'selected data items?',
                  'selected( data)? rows?', 'selected item identifier',
                  'selection by rect', 'send action on arrow key',
                  'sends action when done editing', 'separates columns',
                  'separator item', 'sequence number', 'services menu',
                  'shared frameworks path', 'shared support path',
                  'sheet', 'shift key down', 'shows alpha',
                  'shows state by', 'size( mode)?',
                  'smart insert delete enabled', 'sort case sensitivity',
                  'sort column', 'sort order', 'sort type',
                  'sorted( data rows)?', 'sound', 'source( mask)?',
                  'spell checking enabled', 'starting page', 'state',
                  'string value', 'sub menu', 'super menu', 'super view',
                  'tab key traverses cells', 'tab state', 'tab type',
                  'tab view', 'table view', 'tag', 'target( printer)?',
                  'text color', 'text container insert',
                  'text container origin', 'text returned',
                  'tick mark position', 'time stamp',
                  'title(d| (cell|font|height|position|rect))?',
                  'tool tip', 'toolbar', 'trailing offset', 'transparent',
                  'treat packages as directories', 'truncated labels',
                  'types', 'unmodified characters', 'update views',
                  'use sort indicator', 'user defaults',
                  'uses data source', 'uses ruler', 'uses threaded animation',
                  'uses title from previous column', 'value wraps', 'version',
                  'vertical( (line scroll|page scroll|ruler view))?', 'vertically resizable', 'view',
                  'visible( document rect)?', 'volume', 'width', 'window',
                  'windows menu', 'wraps', 'zoomable', 'zoomed']
end