class ANTLR3::Rewrite::RewriteOperation

RewiteOperation objects represent some particular editing command that should be executed by a token rewrite stream at some time in future when the stream is rendering a rewritten stream.

To perform token stream rewrites safely and efficiently, the rewrites are executed lazily (that is, only when the rewritten text is explicitly requested). Rewrite streams implement lazy rewriting by storing the parameters of edit-inducing methods like delete and insert as RewriteOperation objects in a rewrite program list.

The three subclasses of RewriteOperation, InsertBefore, Delete, and Replace, define specific implementations of stream edits.

Attributes

operation_name[R]

the printable name of operations represented by the class – used for inspection

Public Instance Methods

execute(() click to toggle source

run the rewrite operation represented by this object and append the output to buffer

# File lib/antlr3/streams/rewrite.rb, line 71
abstract :execute
inspect() click to toggle source

return a compact, readable representation of this operation

# File lib/antlr3/streams/rewrite.rb, line 81
def inspect
  return "(%s @ %p : %p)" % [ name, location, text ]
end
name() click to toggle source

return the name of this operation as set by its class

# File lib/antlr3/streams/rewrite.rb, line 75
def name
  self.class.operation_name
end