Class: Rouge::Lexers::Moonscript
- Inherits:
-
RegexLexer
- Object
- Rouge::Lexer
- RegexLexer
- Rouge::Lexers::Moonscript
- Defined in:
- lib/rouge/lexers/moonscript.rb
Constant Summary
Constants inherited from RegexLexer
Constants included from Token::Tokens
Token::Tokens::Num, Token::Tokens::Str
Class Method Summary collapse
Instance Method Summary collapse
- #builtins ⇒ Object
-
#initialize(opts = {}) ⇒ Moonscript
constructor
A new instance of Moonscript.
Methods inherited from RegexLexer
append, #delegate, get_state, #get_state, #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, assert_utf8!, #debug, default_options, demo, demo_file, desc, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, lex, #lex, mimetypes, #option, #options, #reset!, #stream_tokens, tag, #tag, title
Methods included from Token::Tokens
Constructor Details
#initialize(opts = {}) ⇒ Moonscript
Returns a new instance of Moonscript.
15 16 17 18 19 |
# File 'lib/rouge/lexers/moonscript.rb', line 15 def initialize(opts={}) @function_highlighting = opts.delete(:function_highlighting) { true } @disabled_modules = opts.delete(:disabled_modules) { [] } super(opts) end |
Class Method Details
.analyze_text(text) ⇒ Object
21 22 23 |
# File 'lib/rouge/lexers/moonscript.rb', line 21 def self.analyze_text(text) return 1 if text.shebang? 'moon' end |
Instance Method Details
#builtins ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rouge/lexers/moonscript.rb', line 25 def builtins return [] unless @function_highlighting @builtins ||= Set.new.tap do |builtins| Rouge::Lexers::Lua.builtins.each do |mod, fns| next if @disabled_modules.include? mod builtins.merge(fns) end end end |