class Rouge::Lexers::AddmusicK
Constants
- KEYWORDS
Public Class Methods
Source
# File lib/rouge/lexers/addmusick.rb, line 18 def self.detect?(analyzer) return true if analyzer.match?(/\A(\s+|;.*?$)*#spc\s*[{]/i) return true if analyzer.match?(/\A(\s+|;.*?$)*#option smwvtable\b/i) return true if analyzer.match?(/\A(\s+|;.*?$)*#amk \d/i) end
Source
# File lib/rouge/lexers/addmusick.rb, line 24 def initialize(*) super @highlight_macros = bool_option(:macros) { true } end
Calls superclass method
Public Instance Methods
Source
# File lib/rouge/lexers/addmusick.rb, line 30 def note_token return Str if @last == :rest return Name::Function if @last == :fade || @last == :arp Str::Symbol end
Source
# File lib/rouge/lexers/addmusick.rb, line 45 def step(state, stream) if @highlight_macros @macros.reverse_each do |macro| if stream.skip(macro) token Comment::Preproc return true end end end super(state, stream) end
override
- jneen
-
This override is required because
AddmusicKhas an extremely
free-form macro system that doesn’t “look like a function call” the same way that normal preproc macros do. They are quite literally arbitrary characters that pre-empt other tokens, in all states.
AddmusicK is technically *even more* lenient than this about where macros can show up, e.g. “F=v123” will attempt to substitute into $FF twice. Neither Ramekin nor this lexer support that.
Calls superclass method