Class: Dhaka::LexerSupport::CheckpointAction

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern) ⇒ CheckpointAction

Returns a new instance of CheckpointAction.



11
12
13
# File 'lib/dhaka/lexer/dfa.rb', line 11

def initialize(pattern)
  @pattern = pattern
end

Instance Attribute Details

#patternObject (readonly)

Returns the value of attribute pattern.



10
11
12
# File 'lib/dhaka/lexer/dfa.rb', line 10

def pattern
  @pattern
end

Instance Method Details

#call(lexer_run) ⇒ Object



15
16
17
# File 'lib/dhaka/lexer/dfa.rb', line 15

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

#compile_to_ruby_sourceObject



19
20
21
# File 'lib/dhaka/lexer/dfa.rb', line 19

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