class Antlr4::Runtime::CommonTokenFactory

Public Class Methods

new(copy_text = false) click to toggle source
# File lib/antlr4/runtime/common_token_factory.rb, line 6
def initialize(copy_text = false)
  @copy_text = false
  @copy_text = copy_text
end

Public Instance Methods

create(source, type, text, channel, start, stop, line, char_position_in_line) click to toggle source
# File lib/antlr4/runtime/common_token_factory.rb, line 11
def create(source, type, text, channel, start, stop, line, char_position_in_line)
  t = CommonToken.create1(source, type, channel, start, stop)
  t.line = line
  t.char_position_in_line = char_position_in_line
  if !text.nil?
    t._text = text
  elsif @copy_text && !source.b.nil?
    t.set_text(source.b.text(Interval.of(start, stop)))
  end

  t
end
create_simple(type, text) click to toggle source
# File lib/antlr4/runtime/common_token_factory.rb, line 24
def create_simple(type, text)
  CommonToken.create2(type, text)
end