Sha256: 85b746b698e912a7090a678325f07ef640b9aa597bcfc380b745fa907f2528f3

Contents?: true

Size: 399 Bytes

Versions: 9

Compression:

Stored size: 399 Bytes

Contents

module Antlr4Native
  class ContextMethodArg
    attr_reader :raw_arg

    def initialize(raw_arg)
      @raw_arg = raw_arg
    end

    def name
      @name ||= parts[1]
    end

    def type
      @type ||= parts[0].gsub(' ', '')
    end

    def pointer?
      type.end_with?('*')
    end

    private

    def parts
      @parts ||= raw_arg.scan(/([\w\d:]+\s?\*?\s?)/).flatten
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
antlr4-native-2.2.1 lib/antlr4-native/context_method_arg.rb
antlr4-native-2.2.0 lib/antlr4-native/context_method_arg.rb
antlr4-native-2.1.0 lib/antlr4-native/context_method_arg.rb
antlr4-native-2.0.1 lib/antlr4-native/context_method_arg.rb
antlr4-native-2.0.0 lib/antlr4-native/context_method_arg.rb
antlr4-native-1.1.0 lib/antlr4-native/context_method_arg.rb
antlr4-native-1.0.2 lib/antlr4-native/context_method_arg.rb
antlr4-native-1.0.1 lib/antlr4-native/context_method_arg.rb
antlr4-native-1.0.0 lib/antlr4-native/context_method_arg.rb