Class: RubyLexer::SymbolToken

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

Overview


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(ident, offset = nil, starter = ':') ⇒ SymbolToken

Returns a new instance of SymbolToken.



213
214
215
216
217
218
219
220
221
222
# File 'lib/rubylexer/token.rb', line 213

def initialize(ident,offset=nil,starter=':')
  @raw=ident
  str=ident.to_s
  str[0,2]='' if /\A%s/===str
  super starter+str, offset
  @open=":"
  @close=""
#   @char=':'

end

Instance Attribute Details

#closeObject

Returns the value of attribute close.



211
212
213
# File 'lib/rubylexer/token.rb', line 211

def close
  @close
end

#openObject

Returns the value of attribute open.



211
212
213
# File 'lib/rubylexer/token.rb', line 211

def open
  @open
end

#rawObject (readonly)

Returns the value of attribute raw.



212
213
214
# File 'lib/rubylexer/token.rb', line 212

def raw
  @raw
end

Instance Method Details

#to_sObject



224
225
226
227
228
229
230
231
# File 'lib/rubylexer/token.rb', line 224

def to_s
  return @ident
=begin
  [email protected]_s
  raw=raw[1...-1] if StringToken===@raw
  @open+raw+@close 
=end
end