vernacular 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69c7a680b5b3bb074f6e71ac41951fee4b8bd742
4
- data.tar.gz: c4c41d1c663a06d7d123e02eb9143e7cf2e40fda
3
+ metadata.gz: 0ae148c9d3c9c69aeceffad4bc1f16ea21e5514d
4
+ data.tar.gz: 209e7af5273d7b6925a60f6238ed2fed4f5460ca
5
5
  SHA512:
6
- metadata.gz: 4e3c75c0048da7ca9b78b58a85c2ddb286dda0080895d530aeee52d1fbd0a55ffb3bba84f643f31b5b9ba9579aea6ab91478f8cb525da6056b5a693a31a12137
7
- data.tar.gz: 419fd4ad67834bb9def1a26efc960752a82e32ce9ab28e513e7160e7ffe5e9d8cddc70f06fd499f0cab41054f038496cc40a6d2c1e3ae78f1ae1d26916b86656
6
+ metadata.gz: 9dd6ec7445cc90d6a346bb1d1ba248731c514a7981c9885ba1c845347bd71fa47812519e3c5588e8b467a81243f809f60a2d6b877f6bb1cf9041ac4cb8347f39
7
+ data.tar.gz: c07d353edea1eb702c78b1dc2482d35edd0d76994c6ead7cc1035ae60569974af975fa855d809647a169718ac44bf7eabe74614067c90390dcb9afd3a69b6fa8
@@ -12,7 +12,7 @@ module Vernacular
12
12
  end
13
13
 
14
14
  write_parser(source)
15
- load 'vernacular/parser.rb'
15
+ load PARSER_PATH
16
16
  Parser::Vernacular.new(builder)
17
17
  end
18
18
 
@@ -48,10 +48,12 @@ module Vernacular
48
48
  end
49
49
 
50
50
  def compile_parser(filepath)
51
- output = File.expand_path('../parser.rb', __FILE__)
52
51
  exec_path = Gem.activate_bin_path('racc', 'racc', [])
53
- `#{exec_path} --superclass=Parser::Base -o #{output} #{filepath}`
54
- File.write(output, File.read(output).gsub('Ruby24', 'Vernacular'))
52
+ `#{exec_path} --superclass=Parser::Base -o #{PARSER_PATH} #{filepath}`
53
+ File.write(
54
+ PARSER_PATH,
55
+ File.read(PARSER_PATH).gsub("Ruby#{parser_version}", 'Vernacular')
56
+ )
55
57
  end
56
58
 
57
59
  # rubocop:disable Metrics/MethodLength
@@ -73,7 +75,12 @@ module Vernacular
73
75
 
74
76
  def parser_source
75
77
  filepath, = Parser.method(:check_for_encoding_support).source_location
76
- File.read(File.expand_path('../../lib/parser/ruby24.y', filepath))
78
+ grammar_filepath = "../../lib/parser/ruby#{parser_version}.y"
79
+ File.read(File.expand_path(grammar_filepath, filepath))
80
+ end
81
+
82
+ def parser_version
83
+ @parser_version ||= RUBY_VERSION.gsub(/\A(\d)\.(\d).+/, '\1\2')
77
84
  end
78
85
 
79
86
  def write_parser(source)
@@ -1,3 +1,3 @@
1
1
  module Vernacular
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vernacular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Deisz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-13 00:00:00.000000000 Z
11
+ date: 2017-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser