Class: RubyLexer::FileAndLineToken

Inherits:
IgnoreToken show all
Defined in:
lib/rubylexer/token.rb,
lib/rubylexer/tokenprinter.rb

Overview


Instance Attribute Summary collapse

Attributes inherited from Token

#allow_ooo_offset, #as, #ident, #offset, #tag

Instance Method Summary collapse

Methods inherited from Token

#error, #has_no_block?

Constructor Details

#initialize(ident, line, offset = nil) ⇒ FileAndLineToken

Returns a new instance of FileAndLineToken.



622
623
624
625
626
627
# File 'lib/rubylexer/token.rb', line 622

def initialize(ident,line,offset=nil)

   super ident,offset
   #@char='#'
   @line=line
end

Instance Attribute Details

#lineObject

Returns the value of attribute line.



620
621
622
# File 'lib/rubylexer/token.rb', line 620

def line
  @line
end

Instance Method Details

#fileObject



635
# File 'lib/rubylexer/token.rb', line 635

def file()   @ident   end

#subitemObject

needed?



636
# File 'lib/rubylexer/token.rb', line 636

def subitem()   @line   end

#to_sObject

def char; ‘#’ end



631
632
633
# File 'lib/rubylexer/token.rb', line 631

def to_s()
   ['#', @ident, ':', @line].to_s
end

#ws_munge(tp) ⇒ Object



53
54
55
56
57
58
59
60
61
62
# File 'lib/rubylexer/tokenprinter.rb', line 53

def ws_munge(tp)
   result=''
   
   #faugh, doesn't fix it
   #result= "\\\n"*(line-tp.lastfal.line) if StringToken===tp.lasttok 
   
   tp.lasttok=self
   tp.lastfal=self
   return result
end