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=, #matches?, #wantarrow

Constructor Details

#initialize(linenum) ⇒ DefContext

Returns a new instance of DefContext.



199
200
201
202
# File 'lib/rubylexer/context.rb', line 199

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.



215
216
217
# File 'lib/rubylexer/context.rb', line 215

def has_parens=(value)
  @has_parens = value
end

#in_bodyObject (readonly)

Returns the value of attribute in_body.



213
214
215
# File 'lib/rubylexer/context.rb', line 213

def in_body
  @in_body
end

Instance Method Details

#has_parens?Boolean

Returns:

  • (Boolean)


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

def has_parens?; @has_parens end

#see(lxr, msg) ⇒ Object



204
205
206
207
208
209
210
211
# File 'lib/rubylexer/context.rb', line 204

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