Sha256: 473f77f302c495332037475bda0c95cbaf4a3f692063fdc526eccd5c5feb15f5

Contents?: true

Size: 663 Bytes

Versions: 13

Compression:

Stored size: 663 Bytes

Contents

module Antlr4::Runtime

  class CommonTokenFactory
    include Singleton

    def initialize(copy_text = false)
      @copy_text = false
      @copy_text = copy_text
    end

    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

    def create_simple(type, text)
      CommonToken.create2(type, text)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
antlr4-runtime-0.2.12 lib/antlr4/runtime/common_token_factory.rb
antlr4-runtime-0.2.11 lib/antlr4/runtime/common_token_factory.rb
antlr4-runtime-0.2.10 lib/antlr4/runtime/common_token_factory.rb
antlr4-runtime-0.2.9 lib/antlr4/runtime/common_token_factory.rb
antlr4-runtime-0.2.8 lib/antlr4/runtime/common_token_factory.rb
antlr4-runtime-0.2.7 lib/antlr4/runtime/common_token_factory.rb
antlr4-runtime-0.2.6 lib/antlr4/runtime/common_token_factory.rb
antlr4-runtime-0.2.5 lib/antlr4/runtime/common_token_factory.rb
antlr4-runtime-0.2.4 lib/antlr4/runtime/common_token_factory.rb
antlr4-runtime-0.2.3 lib/antlr4/runtime/common_token_factory.rb
antlr4-runtime-0.2.2 lib/antlr4/runtime/common_token_factory.rb
antlr4-runtime-0.2.1 lib/antlr4/runtime/common_token_factory.rb
antlr4-runtime-0.2.0 lib/antlr4/runtime/common_token_factory.rb