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, mimetypes, option, option_docs, #reset!, #stream_tokens, #string_option, tag, #tag, title, #token_option

Methods included from Token::Tokens

token

Constructor Details

This class inherits a constructor from Rouge::Lexer

Class Method Details

.characterObject


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

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

.decimalObject


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

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

.digitsObject


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

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

.exponentObject


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

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

.global_refObject


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

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

.identifierObject


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

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
# 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 _loop _endloop _loopbody _continue _leave
     _return
     _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


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

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

.numberObject


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

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

.package_identifierObject


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

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

.piped_identifierObject


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

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

.radixObject


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

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

.simple_identifierObject


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

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

.string_doubleObject


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

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

.string_singleObject


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

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

.symbolObject


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

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