Class: ANTLR3::Rewrite::InsertBefore

Inherits:
RewriteOperation show all
Defined in:
lib/antlr3/streams/rewrite.rb

Overview

Represents rewrite operation:

add string op.text to the rewrite output immediately before adding the text content of the token at index op.index

Instance Attribute Summary

Attributes inherited from RewriteOperation

#location, #stream, #text

Instance Method Summary collapse

Methods inherited from RewriteOperation

#inspect, #name

Instance Method Details

#execute(buffer) ⇒ Object



101
102
103
104
105
106
# File 'lib/antlr3/streams/rewrite.rb', line 101

def execute( buffer )
  buffer << text.to_s
  token = stream[ location ]
  buffer << token.text.to_s if token
  return location + 1
end