Class: Dhaka::LexerSupport::AcceptAction

Inherits:
Object
  • Object
show all
Defined in:
lib/lexer/regex_grammar.rb

Direct Known Subclasses

LookaheadAcceptAction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern) ⇒ AcceptAction

Returns a new instance of AcceptAction.



411
412
413
# File 'lib/lexer/regex_grammar.rb', line 411

def initialize(pattern)
  @pattern = pattern
end

Instance Attribute Details

#patternObject (readonly)

Returns the value of attribute pattern.



410
411
412
# File 'lib/lexer/regex_grammar.rb', line 410

def pattern
  @pattern
end

Instance Method Details

#call(lexer_run) ⇒ Object



415
416
417
# File 'lib/lexer/regex_grammar.rb', line 415

def call(lexer_run)
  lexer_run.accept(pattern)
end

#compile_to_ruby_sourceObject



419
420
421
# File 'lib/lexer/regex_grammar.rb', line 419

def compile_to_ruby_source
  "accept(#{pattern.inspect})"
end

#to_dotObject



423
424
425
# File 'lib/lexer/regex_grammar.rb', line 423

def to_dot
  "Accept #{pattern.inspect}"
end