Parent

Dhaka::TokenizerState

A tokenizer state encapsulates actions that should be performed upon encountering each permissible character for that state.

Attributes

actions[R]
default_action[R]

Public Class Methods

new() click to toggle source
# File lib/dhaka/tokenizer/tokenizer.rb, line 44
def initialize
  @actions = {}
end

Public Instance Methods

for_character(characters, &blk) click to toggle source
Alias for: for_characters
for_characters(characters, &blk) click to toggle source

Define the action (blk) to be performed when encountering any of characters in the token stream.

# File lib/dhaka/tokenizer/tokenizer.rb, line 49
def for_characters(characters, &blk)
  characters.each do |character|
    actions[character] = blk
  end
end
Also aliased as: for_character
for_default(&blk) click to toggle source

define the action (blk) to be performed for any characters that don't have an action to perform.

# File lib/dhaka/tokenizer/tokenizer.rb, line 58
def for_default(&blk)
  @default_action = blk
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.