Class: Antlr4ruby::RuntimeMetaData

Inherits:
Object
  • Object
show all
Defined in:
lib/antlr4ruby/runtime_meta_data.rb

Constant Summary collapse

VERSION =
"4.11.1"

Class Method Summary collapse

Class Method Details

.check_version(tool_version, compile_time_version) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/antlr4ruby/runtime_meta_data.rb', line 11

def self.check_version(tool_version, compile_time_version)
  runtime_version = VERSION
  conflicts_with_tool = false
  conflicts_with_compile = false

  if tool_version
    conflicts_with_tool = !runtime_version.eql?(tool_version) &&
      !get_major_minor_version(runtime_version).eql?(get_major_minor_version(tool_version))
  end

  conflicts_with_compile =
    !runtime_version.eql?(compile_time_version) &&
      !get_major_minor_version(runtime_version).eql?(get_major_minor_version(compile_time_version))

  if conflicts_with_tool
    print "ANTLR Tool version #{tool_version} used for code generation does not match the current runtime version #{runtime_version}"
  end

  if conflicts_with_compile
    print "ANTLR Runtime version #{compile_time_version} used for parser compilation does not match the current runtime version #{runtime_version}"
  end
end

.get_major_minor_version(version) ⇒ Object



34
35
36
37
# File 'lib/antlr4ruby/runtime_meta_data.rb', line 34

def self.get_major_minor_version(version)
  # 懒得解析了

  version
end

.get_runtime_versionObject



7
8
9
# File 'lib/antlr4ruby/runtime_meta_data.rb', line 7

def self.get_runtime_version
  VERSION
end