Class: RubyLexer::RubyCode

Inherits:
Token
  • Object
show all
Defined in:
lib/rubylexer/rubycode.rb

Instance Attribute Summary collapse

Attributes inherited from Token

#allow_ooo_offset, #as, #endline, #ident, #offset, #startline, #tag

Instance Method Summary collapse

Methods inherited from Token

#dump, #error, #has_no_block?, #inspect, #linecount, #orig_inspect, #ws_munge

Constructor Details

#initialize(tokens, filename, linenum) ⇒ RubyCode

Returns a new instance of RubyCode.



28
29
30
31
32
# File 'lib/rubylexer/rubycode.rb', line 28

def initialize(tokens,filename,linenum)
   super(tokens)
   @filename=filename
   @linenum=linenum
end

Instance Attribute Details

#linenumObject (readonly)

Returns the value of attribute linenum.



34
35
36
# File 'lib/rubylexer/rubycode.rb', line 34

def linenum
  @linenum
end

Instance Method Details

#[](*args) ⇒ Object



36
37
38
# File 'lib/rubylexer/rubycode.rb', line 36

def [](*args)
   exec? ident.huh
end

#to_sObject



40
41
42
43
44
45
# File 'lib/rubylexer/rubycode.rb', line 40

def to_s()
   result=[]
   keepwsprinter=KeepWsTokenPrinter.new('',@linenum)
   ident.each{|tok| result << keepwsprinter.sprint(tok) }
   return result.join
end