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, #ident, #offset, #tag

Instance Method Summary collapse

Methods inherited from Token

#error, #has_no_block?, #ws_munge

Constructor Details

#initialize(ident, offset = nil, starter = ':') ⇒ SymbolToken

Returns a new instance of SymbolToken.



160
161
162
163
164
165
166
167
168
169
# File 'lib/rubylexer/token.rb', line 160

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.



158
159
160
# File 'lib/rubylexer/token.rb', line 158

def close
  @close
end

#openObject

Returns the value of attribute open.



158
159
160
# File 'lib/rubylexer/token.rb', line 158

def open
  @open
end

#rawObject (readonly)

Returns the value of attribute raw.



159
160
161
# File 'lib/rubylexer/token.rb', line 159

def raw
  @raw
end

Instance Method Details

#to_sObject



171
172
173
174
175
176
177
178
# File 'lib/rubylexer/token.rb', line 171

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