Class: Rouge::Lexers::Lua
- Inherits:
-
RegexLexer
- Object
- Rouge::Lexer
- RegexLexer
- Rouge::Lexers::Lua
- Defined in:
- lib/rouge/lexers/lua.rb,
lib/rouge/lexers/lua/builtins.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 = {}) ⇒ Lua
constructor
A new instance of Lua.
Methods inherited from RegexLexer
#delegate, get_state, #get_state, #goto, #group, #groups, #in_state?, #pop!, #push, #reset!, #reset_stack, #run_callback, #run_rule, #stack, start, start_procs, #state, state, #state?, 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
Methods included from Token::Tokens
Constructor Details
#initialize(opts = {}) ⇒ Lua
Returns a new instance of Lua.
10 11 12 13 14 |
# File 'lib/rouge/lexers/lua.rb', line 10 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
16 17 18 |
# File 'lib/rouge/lexers/lua.rb', line 16 def self.analyze_text(text) return 1 if text.shebang? 'lua' end |
.builtins ⇒ Object
20 21 22 23 |
# File 'lib/rouge/lexers/lua.rb', line 20 def self.builtins load Pathname.new(__FILE__).dirname.join('lua/builtins.rb') self.builtins end |
Instance Method Details
#builtins ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rouge/lexers/lua.rb', line 25 def builtins return [] unless @function_highlighting @builtins ||= Set.new.tap do |builtins| self.class.builtins.each do |mod, fns| next if @disabled_modules.include? mod builtins.merge(fns) end end end |