Class: RubyLexer::KeywordToken

Inherits:
WToken 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 WToken

#===

Methods inherited from Token

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

Constructor Details

#initialize(*args) ⇒ KeywordToken

also some operators



79
80
81
82
83
84
85
86
87
88
# File 'lib/rubylexer/token.rb', line 79

def initialize(*args)
  if Hash===args.last
    opts=args.pop
    as=opts.delete :as
    fail unless opts.empty?
  end

  super(*args)
  self.as=as
end

Instance Attribute Details

#groupingObject

Returns the value of attribute grouping.



130
131
132
# File 'lib/rubylexer/token.rb', line 130

def grouping
  @grouping
end

#ternaryObject

Returns the value of attribute ternary.



130
131
132
# File 'lib/rubylexer/token.rb', line 130

def ternary
  @ternary
end

#valueObject

Returns the value of attribute value.



101
102
103
# File 'lib/rubylexer/token.rb', line 101

def value
  @value
end

Instance Method Details

#callsite?Boolean


Returns:

  • (Boolean)


97
98
99
# File 'lib/rubylexer/token.rb', line 97

def callsite? 
  @callsite if defined? @callsite
end

#has_end!Object




121
122
123
# File 'lib/rubylexer/token.rb', line 121

def has_end!
  @has_end=true
end

#has_end?Boolean


Returns:

  • (Boolean)


126
127
128
# File 'lib/rubylexer/token.rb', line 126

def has_end?
  self===RubyLexer::BEGINWORDS and @has_end||=nil
end

#has_no_block!Object



132
133
134
# File 'lib/rubylexer/token.rb', line 132

def has_no_block!
   @has_no_block=true
end

#has_no_block?Boolean

Returns:

  • (Boolean)


136
137
138
# File 'lib/rubylexer/token.rb', line 136

def has_no_block?
   @has_no_block if defined? @has_no_block
end

#infixObject



140
141
142
# File 'lib/rubylexer/token.rb', line 140

def infix
  @infix if defined? @infix
end

#infix?Boolean


Returns:

  • (Boolean)


114
115
116
# File 'lib/rubylexer/token.rb', line 114

def infix? 
  @infix ||= nil
end

#prefix?Boolean Also known as: unary

Returns:

  • (Boolean)


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

def prefix?; !infix? end

#set_callsite!(x = true) ⇒ Object




92
93
94
# File 'lib/rubylexer/token.rb', line 92

def set_callsite!(x=true)
  @callsite=x
end

#set_infix!Object




104
105
106
# File 'lib/rubylexer/token.rb', line 104

def set_infix! 
  @infix=true
end

#unary=(flag) ⇒ Object




109
110
111
# File 'lib/rubylexer/token.rb', line 109

def unary= flag
  @infix=!flag
end