Class: RubyLexer::NestedContexts::DefContext

Inherits:
WantsEndContext show all
Defined in:
lib/rubylexer/context.rb

Instance Attribute Summary collapse

Attributes inherited from WantsEndContext

#state

Attributes inherited from NestedContext

#ender, #linenum, #starter

Instance Method Summary collapse

Methods inherited from NestedContext

#lhs, #lhs=, #matches?, #wantarrow

Constructor Details

#initialize(linenum) ⇒ DefContext

Returns a new instance of DefContext.



206
207
208
209
# File 'lib/rubylexer/context.rb', line 206

def initialize(linenum)
  super('def', linenum)
  @in_body=false
end

Instance Attribute Details

#has_parens=(value) ⇒ Object (writeonly)

Sets the attribute has_parens

Parameters:

  • value

    the value to set the attribute has_parens to.



222
223
224
# File 'lib/rubylexer/context.rb', line 222

def has_parens=(value)
  @has_parens = value
end

#in_bodyObject (readonly)

Returns the value of attribute in_body.



220
221
222
# File 'lib/rubylexer/context.rb', line 220

def in_body
  @in_body
end

Instance Method Details

#has_parens?Boolean

Returns:

  • (Boolean)


223
# File 'lib/rubylexer/context.rb', line 223

def has_parens?; @has_parens end

#see(lxr, msg) ⇒ Object



211
212
213
214
215
216
217
218
# File 'lib/rubylexer/context.rb', line 211

def see(lxr,msg)
  if msg==:semi and @state!=:semi
    @in_body=true
    @state=:semi
  else
    super
  end
end