Class: Rouge::Lexers::Magik

Inherits:
RegexLexer show all
Defined in:
lib/rouge/lexers/magik.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

.characterObject



63
64
65
# File 'lib/rouge/lexers/magik.rb', line 63

def self.character
  @character ||= /%u[0-9a-z]{4}|%[^\s]+/i
end

.decimalObject



56
57
58
# File 'lib/rouge/lexers/magik.rb', line 56

def self.decimal
  @decimal ||= /\.#{Magik.digits}/
end

.digitsObject



47
48
49
# File 'lib/rouge/lexers/magik.rb', line 47

def self.digits
  @digits ||= /[0-9]+/
end

.exponentObject



53
54
55
# File 'lib/rouge/lexers/magik.rb', line 53

def self.exponent
  @exponent ||= /(e|&)[+-]?#{Magik.digits}/i
end

.global_refObject



82
83
84
# File 'lib/rouge/lexers/magik.rb', line 82

def self.global_ref
  @global_ref ||= /@[\s]*#{Magik.identifier}:#{Magik.identifier}/
end

.identifierObject



73
74
75
# File 'lib/rouge/lexers/magik.rb', line 73

def self.identifier
  @identifier ||= /(?:#{Magik.simple_identifier}|#{Magik.piped_identifier})+/i
end

.keywordsObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/rouge/lexers/magik.rb', line 13

def self.keywords
  @keywords ||= %w(
     _package
     _pragma
     _block _endblock
     _handling _default
     _protect _protection _endprotect
     _try _with _when _endtry
     _catch _endcatch
     _throw
     _lock _endlock
     _if _then _elif _else _endif
     _for _over _while _loop _finally _endloop _loopbody _continue _leave
     _return
     _class
     _local _constant _recursive _global _dynamic _import
     _private _iter _abstract _method _endmethod
     _proc _endproc
     _gather _scatter _allresults _optional
     _thisthread _self _clone _super
     _primitive
     _unset _true _false _maybe
     _is _isnt _not _and _or _xor _cf _andif _orif
     _div _mod
  )
end

.labelObject



85
86
87
# File 'lib/rouge/lexers/magik.rb', line 85

def self.label
  @label = /@[\s]*#{Magik.identifier}/
end

.numberObject



59
60
61
# File 'lib/rouge/lexers/magik.rb', line 59

def self.number
  @number = /#{Magik.digits}(#{Magik.radix}|#{Magik.exponent}|#{Magik.decimal})*/
end

.package_identifierObject



76
77
78
# File 'lib/rouge/lexers/magik.rb', line 76

def self.package_identifier
  @package_identifier ||= /#{Magik.identifier}:#{Magik.identifier}/
end

.piped_identifierObject



70
71
72
# File 'lib/rouge/lexers/magik.rb', line 70

def self.piped_identifier
  @piped_identifier ||= /\|[^\|\n]*\|/
end

.radixObject



50
51
52
# File 'lib/rouge/lexers/magik.rb', line 50

def self.radix
  @radix ||= /r[0-9a-z]/i
end

.simple_identifierObject



67
68
69
# File 'lib/rouge/lexers/magik.rb', line 67

def self.simple_identifier
  @simple_identifier ||= /(?>(?:[a-z0-9_!?]|\\.)+)/i
end

.string_doubleObject



40
41
42
# File 'lib/rouge/lexers/magik.rb', line 40

def self.string_double
  @string_double ||= /"[^"\n]*?"/
end

.string_singleObject



43
44
45
# File 'lib/rouge/lexers/magik.rb', line 43

def self.string_single
  @string_single ||= /'[^'\n]*?'/
end

.symbolObject



79
80
81
# File 'lib/rouge/lexers/magik.rb', line 79

def self.symbol
  @symbol ||= /:#{Magik.identifier}/i
end