Class: RubyLexer::OperatorToken

Inherits:
WToken show all
Defined in:
lib/rubylexer/token.rb

Overview


Instance Attribute Summary collapse

Attributes inherited from Token

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

Instance Method Summary collapse

Methods inherited from WToken

#===

Methods inherited from Token

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

Constructor Details

#initialize(*args) ⇒ OperatorToken

Returns a new instance of OperatorToken.



147
148
149
150
# File 'lib/rubylexer/token.rb', line 147

def initialize(*args)
  @tag=nil
  super
end

Instance Attribute Details

#asObject



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

def as
  return @as if defined? @as
  if tag and ident[/^[,*&]$/]
    tag.to_s+ident
  end
end

Instance Method Details

#infix?Boolean

Returns:

  • (Boolean)


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

def infix?; !prefix? end

#unaryObject Also known as: prefix?



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

def unary; @tag==:unary end

#unary=(flag) ⇒ Object



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

def unary= flag; @tag=:unary if flag end