class ANTLR3::Rewrite::Replace

Represents rewrite operation:

add text op.text to the rewrite buffer in lieu of the text of tokens indexed within the range op.index .. op.last_index

Public Class Methods

new( stream, location, text ) click to toggle source
Calls superclass method
# File lib/antlr3/streams/rewrite.rb, line 122
def initialize( stream, location, text )
  super( stream, nil, text )
  self.location = location
end

Public Instance Methods

execute( buffer ) click to toggle source
# File lib/antlr3/streams/rewrite.rb, line 136
def execute( buffer )
  buffer << text.to_s unless text.nil?
  return( location.end + 1 )
end
index() click to toggle source
# File lib/antlr3/streams/rewrite.rb, line 141
def index
  location.first
end
location=( val ) click to toggle source
Calls superclass method
# File lib/antlr3/streams/rewrite.rb, line 127
def location=( val )
  case val
  when Range then super( val )
  else
    val = val.to_i
    super( val..val )
  end
end