Class: Dhaka::TokenizerState

### Home Classes Methods

### In Files

- lib/dhaka/tokenizer/tokenizer.rb

### Parent

Object

### Methods

- ::new
- #for_character
- #for_characters
- #for_default

### Class/Module Index

Quicksearch

- Dhaka
- Dhaka::CompiledLexer
- Dhaka::CompiledParser
- Dhaka::Evaluator
- Dhaka::Grammar
- Dhaka::GrammarSymbol
- Dhaka::Lexeme
- Dhaka::Lexer
- Dhaka::LexerRun
- Dhaka::LexerSpecification
- Dhaka::LexerSupport
- Dhaka::LexerSupport::AcceptAction
- Dhaka::LexerSupport::CheckpointAction
- Dhaka::LexerSupport::DFARun
- Dhaka::LexerSupport::InvalidRegexException
- Dhaka::LexerSupport::LookaheadAcceptAction
- Dhaka::LexerSupport::RegexParser
- Dhaka::LexerSupport::RegexTokenizer
- Dhaka::LexerSupport::State
- Dhaka::LexerSupport::StateMachine
- Dhaka::NoStartProductionsError
- Dhaka::ParseErrorResult
- Dhaka::ParseSuccessResult
- Dhaka::ParseTreeCompositeNode
- Dhaka::ParseTreeLeafNode
- Dhaka::Parser
- Dhaka::ParserMethods
- Dhaka::PrecedenceBuilder
- Dhaka::Production
- Dhaka::ProductionBuilder
- Dhaka::Token
- Dhaka::Tokenizer
- Dhaka::TokenizerErrorResult
- Dhaka::TokenizerState
- Dhaka::TokenizerSuccessResult

No matching classes.

# 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.