Class: Dhaka::LexerSupport::AcceptAction

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

Direct Known Subclasses

LookaheadAcceptAction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern) ⇒ AcceptAction

Returns a new instance of AcceptAction.



5
6
7
# File 'lib/dhaka/lexer/accept_actions.rb', line 5

def initialize(pattern)
  @pattern = pattern
end

Instance Attribute Details

#patternObject (readonly)

Returns the value of attribute pattern.



4
5
6
# File 'lib/dhaka/lexer/accept_actions.rb', line 4

def pattern
  @pattern
end

Instance Method Details

#call(lexer_run) ⇒ Object



9
10
11
# File 'lib/dhaka/lexer/accept_actions.rb', line 9

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

#compile_to_ruby_sourceObject



13
14
15
# File 'lib/dhaka/lexer/accept_actions.rb', line 13

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

#to_dotObject



17
18
19
# File 'lib/dhaka/lexer/accept_actions.rb', line 17

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