Class: ANTLR3::TokenRewriteStream

Inherits:
CommonTokenStream show all
Includes:
Rewrite
Defined in:
lib/antlr3/streams/rewrite.rb

Overview

TokenRewriteStream is a specialized form of CommonTokenStream that provides simple stream editing functionality. By creating rewrite programs, new text output can be created based upon the tokens in the stream. The basic token stream itself is preserved, and text output is rendered on demand using the #to_s method.

Constant Summary

Constants included from Constants

Constants::BUILT_IN_TOKEN_NAMES, Constants::DEFAULT, Constants::DOWN, Constants::EOF, Constants::EOF_TOKEN, Constants::EOR_TOKEN_TYPE, Constants::HIDDEN, Constants::INVALID, Constants::INVALID_TOKEN, Constants::MEMO_RULE_FAILED, Constants::MEMO_RULE_UNKNOWN, Constants::MIN_TOKEN_TYPE, Constants::SKIP_TOKEN, Constants::UP

Instance Attribute Summary

Attributes included from Rewrite

#programs

Attributes included from TokenStream

#channel, #last_marker, #position, #token_source

Attributes included from Stream

#size, #source_name

Instance Method Summary collapse

Methods included from Rewrite

#delete, #delete_program, #insert_after, #insert_before, #original_string, #program, #render, #replace, #rewrite

Methods inherited from CommonTokenStream

#<<, #[], #at, #consume, #each, #each_on_channel, #extract_text, #future?, #hold, #inspect, #look, #mark, #past?, #peek, #rebuild, #release, #reset, #rewind, #seek, #size, #token_class, #tokens, #tune_to, #walk

Methods included from TokenStream

#at, #to_s

Methods included from Stream

#consume, #index, #look, #mark, #peek, #release, #rewind, #seek

Constructor Details

#initialize(token_source, options = {}) ⇒ TokenRewriteStream

Returns a new instance of TokenRewriteStream


428
429
430
431
# File 'lib/antlr3/streams/rewrite.rb', line 428

def initialize( token_source, options = {} )
  super( token_source, options )
  initialize_rewrite
end