hcl-checker 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +32 -0
- data/Gemfile +3 -4
- data/Gemfile.lock +8 -7
- data/Rakefile +7 -7
- data/assets/lexer.rex +15 -13
- data/assets/parse.y +27 -13
- data/bin/console +3 -3
- data/hcl-checker.gemspec +12 -10
- data/lib/hcl/checker.rb +14 -7
- data/lib/hcl/{lexer.rb → checker/lexer.rb} +13 -12
- data/lib/hcl/{parser.rb → checker/parser.rb} +54 -36
- data/lib/hcl/checker/version.rb +1 -1
- metadata +35 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db4fad85fc6cac710e6cf24082498ce2454f89f19204afc977413913a0e58699
|
4
|
+
data.tar.gz: 8d6be4dd1a00565006886e0dadbee8d2737de8d2b0819eed26d76d0573dbddb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 878423137f46f8043861744bbb8ff9026f5472caa0d8f9cfa0eb532f612f82bad0451b5c154b0aec19a98fdd9b568860a578d36903ef55fee9f3efbeec03e6a6
|
7
|
+
data.tar.gz: 63ebcea583cc378a141a41435ab0c32b0a9ee88a21fbbac197b7f0756fd8c46461f55987730fc591e0cfee124b85cb6558be5281e41e1ea52f32ad421f8842f8
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
Exclude:
|
4
|
+
- lib/hcl/lexer.rb
|
5
|
+
- lib/hcl/parser.rb
|
6
|
+
|
7
|
+
Layout/LineLength:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Metrics/AbcSize:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Metrics/BlockLength:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Metrics/ClassLength:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Metrics/CyclomaticComplexity:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Metrics/MethodLength:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Metrics/PerceivedComplexity:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Style/Documentation:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Style/FrozenStringLiteralComment:
|
32
|
+
EnforcedStyle: never
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
# This is needed due https://nvd.nist.gov/vuln/detail/CVE-2018-14404
|
4
4
|
# A NULL pointer dereference vulnerability exists in the xpath.c:xmlXPathCompOpEval()
|
@@ -7,10 +7,9 @@ source "https://rubygems.org"
|
|
7
7
|
# with the use of the libxml2 library may be vulnerable to a denial of service attack due
|
8
8
|
# to a crash of the application.
|
9
9
|
# Nokogiri >= 1.8.5 solves this problem
|
10
|
-
gem
|
10
|
+
gem 'nokogiri', '>= 1.11.4'
|
11
11
|
|
12
|
-
|
13
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
12
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
14
13
|
|
15
14
|
# Specify your gem's dependencies in hcl-checker.gemspec
|
16
15
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hcl-checker (1.
|
4
|
+
hcl-checker (1.6.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -12,9 +12,10 @@ GEM
|
|
12
12
|
rkelly-remix
|
13
13
|
json (2.3.1)
|
14
14
|
metasm (1.0.4)
|
15
|
-
mini_portile2 (2.
|
16
|
-
nokogiri (1.
|
17
|
-
mini_portile2 (~> 2.
|
15
|
+
mini_portile2 (2.5.3)
|
16
|
+
nokogiri (1.11.7)
|
17
|
+
mini_portile2 (~> 2.5.0)
|
18
|
+
racc (~> 1.4)
|
18
19
|
racc (1.5.0)
|
19
20
|
rake (12.3.3)
|
20
21
|
rb-readline (0.5.5)
|
@@ -45,9 +46,9 @@ PLATFORMS
|
|
45
46
|
ruby
|
46
47
|
|
47
48
|
DEPENDENCIES
|
48
|
-
bundler (~> 2.
|
49
|
+
bundler (~> 2.2.10)
|
49
50
|
hcl-checker!
|
50
|
-
nokogiri (>= 1.
|
51
|
+
nokogiri (>= 1.11.4)
|
51
52
|
racc (= 1.5.0)
|
52
53
|
rake (~> 12.3.3)
|
53
54
|
rex (= 2.0.12)
|
@@ -55,4 +56,4 @@ DEPENDENCIES
|
|
55
56
|
rspec (~> 3.0)
|
56
57
|
|
57
58
|
BUNDLED WITH
|
58
|
-
2.
|
59
|
+
2.2.20
|
data/Rakefile
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
3
|
|
4
4
|
RSpec::Core::RakeTask.new do |c|
|
5
|
-
options = [
|
6
|
-
options += [
|
5
|
+
options = ['--color']
|
6
|
+
options += ['--format', 'documentation']
|
7
7
|
c.rspec_opts = options
|
8
8
|
end
|
9
9
|
|
10
|
-
desc
|
10
|
+
desc 'Generate Grammar files for HCL'
|
11
11
|
task :build_grammar do
|
12
12
|
print 'Building Lexer'
|
13
|
-
`rex
|
13
|
+
`rex ./assets/lexer.rex -o ./lib/hcl/checker/lexer.rb`
|
14
14
|
print "....done\n"
|
15
15
|
print 'Building Parser'
|
16
|
-
`racc ./assets/parse.y -o ./lib/hcl/parser.rb`
|
16
|
+
`racc ./assets/parse.y -o ./lib/hcl/checker/parser.rb`
|
17
17
|
print "....done\n\n"
|
18
18
|
end
|
data/assets/lexer.rex
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
class HCLLexer
|
1
|
+
class HCL::Checker::Lexer
|
3
2
|
option
|
4
3
|
independent
|
5
4
|
|
@@ -51,25 +50,26 @@ rule
|
|
51
50
|
{MINUS} { [:MINUS, text]}
|
52
51
|
|
53
52
|
inner
|
54
|
-
|
55
53
|
def lex(input)
|
56
54
|
scan_setup(input)
|
57
55
|
tokens = []
|
58
56
|
while token = next_token
|
59
57
|
tokens << token
|
60
58
|
end
|
59
|
+
|
61
60
|
tokens
|
62
61
|
end
|
63
62
|
|
64
63
|
|
65
64
|
def to_boolean(input)
|
66
|
-
input
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
65
|
+
case input
|
66
|
+
when /true/
|
67
|
+
true
|
68
|
+
when /false/
|
69
|
+
false
|
70
|
+
else
|
71
|
+
raise "Invalid value for `to_boolean`, expected true/false got #{input}"
|
72
|
+
end
|
73
73
|
end
|
74
74
|
|
75
75
|
|
@@ -93,19 +93,21 @@ inner
|
|
93
93
|
result = ''
|
94
94
|
nested = 0
|
95
95
|
|
96
|
-
|
96
|
+
loop do
|
97
97
|
case(text = @ss.scan_until(%r{\"|\$\{|\}|\\}))
|
98
98
|
when %r{\$\{\z}
|
99
99
|
nested += 1
|
100
100
|
when %r{\}\z}
|
101
|
-
nested -= 1 if nested
|
101
|
+
nested -= 1 if nested.positive?
|
102
102
|
when %r{\\\z}
|
103
103
|
result += text.chop + @ss.getch
|
104
104
|
next
|
105
105
|
end
|
106
106
|
|
107
107
|
result += text.to_s
|
108
|
-
|
108
|
+
|
109
|
+
break if nested.zero? && text =~ %r{\"\z}
|
110
|
+
end
|
109
111
|
|
110
112
|
result.chop
|
111
113
|
end
|
data/assets/parse.y
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class HCL::Checker::Parser
|
2
2
|
token BOOL
|
3
3
|
FLOAT
|
4
4
|
NUMBER
|
@@ -41,7 +41,7 @@ rule
|
|
41
41
|
LEFTBRACE objectlist RIGHTBRACE
|
42
42
|
{ result = flatten_objectlist(val[1]) }
|
43
43
|
| LEFTBRACE RIGHTBRACE
|
44
|
-
{ return }
|
44
|
+
{ return {} }
|
45
45
|
;
|
46
46
|
|
47
47
|
objectkey:
|
@@ -88,7 +88,7 @@ rule
|
|
88
88
|
LEFTBRACKET listitems RIGHTBRACKET
|
89
89
|
{ result = val[1] }
|
90
90
|
| LEFTBRACKET RIGHTBRACKET
|
91
|
-
{ return }
|
91
|
+
{ return [] }
|
92
92
|
;
|
93
93
|
|
94
94
|
listitems:
|
@@ -122,7 +122,7 @@ rule
|
|
122
122
|
end
|
123
123
|
|
124
124
|
---- header
|
125
|
-
require_relative '
|
125
|
+
require_relative 'lexer'
|
126
126
|
|
127
127
|
---- inner
|
128
128
|
#//
|
@@ -130,19 +130,31 @@ require_relative './lexer'
|
|
130
130
|
#// keys are encountered.
|
131
131
|
#//
|
132
132
|
#// from decoder.go: if we're at the root or we're directly within
|
133
|
-
#// a list, decode
|
133
|
+
#// a list, decode to hashes, otherwise lists
|
134
134
|
#//
|
135
135
|
#// from object.go: there is a flattened list structure
|
136
136
|
#//
|
137
|
+
#// if @duplicate_mode is set:
|
138
|
+
#// - :array then duplicates will be appended to an array
|
139
|
+
#// - :merge then duplicates will be deep merged into a hash
|
140
|
+
#//
|
137
141
|
def flatten_objectlist(list)
|
138
142
|
(list || {}).each_with_object({}) do |a, h|
|
139
|
-
h
|
140
|
-
case
|
141
|
-
when
|
143
|
+
if h.keys.include?(a.first)
|
144
|
+
case @duplicate_mode
|
145
|
+
when :array
|
146
|
+
if h[a.first].is_a?(Array)
|
147
|
+
h[a.first].push(a.last)
|
148
|
+
else
|
149
|
+
h[a.first] = [ h[a.first], a.last ]
|
150
|
+
end
|
151
|
+
when :merge
|
142
152
|
deep_merge(h[a.first] || {}, a.last)
|
143
|
-
else
|
144
|
-
h[a.first] = a.last
|
153
|
+
else raise ArgumentError
|
145
154
|
end
|
155
|
+
else
|
156
|
+
h[a.first] = a.last
|
157
|
+
end
|
146
158
|
end
|
147
159
|
end
|
148
160
|
|
@@ -154,10 +166,12 @@ require_relative './lexer'
|
|
154
166
|
end
|
155
167
|
|
156
168
|
|
157
|
-
def parse(input)
|
158
|
-
@
|
169
|
+
def parse(input, duplicate_mode = :array)
|
170
|
+
@duplicate_mode = duplicate_mode
|
171
|
+
@lexer = HCL::Checker::Lexer.new.lex(input)
|
159
172
|
do_parse
|
160
|
-
|
173
|
+
|
174
|
+
@result
|
161
175
|
end
|
162
176
|
|
163
177
|
|
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'hcl/checker'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "hcl/checker"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start(__FILE__)
|
data/hcl-checker.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
lib = File.expand_path('
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
require 'hcl/checker/version'
|
4
4
|
|
@@ -19,19 +19,21 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
spec.required_ruby_version = '>= 2.5.0'
|
21
21
|
|
22
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
23
|
-
spec.add_development_dependency 'rake', '~> 12.3.3'
|
24
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
22
|
+
spec.add_development_dependency 'bundler', '~> 2.2.10'
|
25
23
|
spec.add_development_dependency 'racc', '1.5.0'
|
24
|
+
spec.add_development_dependency 'rake', '~> 12.3.3'
|
26
25
|
spec.add_development_dependency 'rex', '2.0.12'
|
27
26
|
spec.add_development_dependency 'rexical', '>= 1.0.7'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
+
|
29
|
+
spec.post_install_message = '
|
30
|
+
Hello, me again. This version fixes:
|
28
31
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
everyone who got in touch justifying why my change would be bad for all users.
|
32
|
+
- Add support for multiple elements of the same type
|
33
|
+
- Fix bug where empty objects and empty lists were being parsed as nil
|
34
|
+
- Update bundler version
|
35
|
+
- Update nokogiri version
|
34
36
|
|
35
37
|
Thank you :)
|
36
|
-
|
38
|
+
'
|
37
39
|
end
|
data/lib/hcl/checker.rb
CHANGED
@@ -1,26 +1,33 @@
|
|
1
|
-
|
2
|
-
require_relative 'lexer'
|
3
|
-
require_relative 'parser'
|
1
|
+
require_relative 'checker/version'
|
2
|
+
require_relative 'checker/lexer'
|
3
|
+
require_relative 'checker/parser'
|
4
4
|
|
5
5
|
module HCL
|
6
6
|
module Checker
|
7
|
+
VALID_DUPLICATE_MODES = %i(array merge).freeze
|
8
|
+
|
7
9
|
class << self
|
8
10
|
attr_accessor :last_error
|
9
11
|
|
10
12
|
def valid?(value)
|
11
|
-
ret =
|
13
|
+
ret = HCL::Checker::Parser.new.parse(value)
|
12
14
|
return true if ret.is_a? Hash
|
15
|
+
|
13
16
|
false
|
14
17
|
rescue Racc::ParseError => e
|
15
18
|
@last_error = e.message
|
19
|
+
|
16
20
|
false
|
17
21
|
end
|
18
22
|
|
19
|
-
def parse(value)
|
20
|
-
|
23
|
+
def parse(value, duplicate_mode = :array)
|
24
|
+
raise ArgumentError, "Invalid duplicate mode #{duplicate_mode}, must be one of #{VALID_DUPLICATE_MODES}" unless VALID_DUPLICATE_MODES.include?(duplicate_mode)
|
25
|
+
|
26
|
+
HCL::Checker::Parser.new.parse(value, duplicate_mode)
|
21
27
|
rescue Racc::ParseError => e
|
22
28
|
@last_error = e.message
|
23
|
-
|
29
|
+
|
30
|
+
e.message
|
24
31
|
end
|
25
32
|
end
|
26
33
|
end
|
@@ -4,8 +4,7 @@
|
|
4
4
|
# from lexical definition file "./assets/lexer.rex".
|
5
5
|
#++
|
6
6
|
|
7
|
-
|
8
|
-
class HCLLexer
|
7
|
+
class HCL::Checker::Lexer
|
9
8
|
require 'strscan'
|
10
9
|
|
11
10
|
class ScanError < StandardError ; end
|
@@ -135,13 +134,14 @@ class HCLLexer
|
|
135
134
|
tokens
|
136
135
|
end
|
137
136
|
def to_boolean(input)
|
138
|
-
input
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
137
|
+
case input
|
138
|
+
when /true/
|
139
|
+
true
|
140
|
+
when /false/
|
141
|
+
false
|
142
|
+
else
|
143
|
+
raise "Invalid value for `to_boolean`, expected true/false got #{input}"
|
144
|
+
end
|
145
145
|
end
|
146
146
|
def consume_comment(input)
|
147
147
|
nested = 1
|
@@ -159,18 +159,19 @@ class HCLLexer
|
|
159
159
|
def consume_string(input)
|
160
160
|
result = ''
|
161
161
|
nested = 0
|
162
|
-
|
162
|
+
loop do
|
163
163
|
case(text = @ss.scan_until(%r{\"|\$\{|\}|\\}))
|
164
164
|
when %r{\$\{\z}
|
165
165
|
nested += 1
|
166
166
|
when %r{\}\z}
|
167
|
-
nested -= 1 if nested
|
167
|
+
nested -= 1 if nested.positive?
|
168
168
|
when %r{\\\z}
|
169
169
|
result += text.chop + @ss.getch
|
170
170
|
next
|
171
171
|
end
|
172
172
|
result += text.to_s
|
173
|
-
|
173
|
+
break if nested.zero? && text =~ %r{\"\z}
|
174
|
+
end
|
174
175
|
result.chop
|
175
176
|
end
|
176
177
|
def consume_heredoc
|
@@ -1,14 +1,16 @@
|
|
1
1
|
#
|
2
2
|
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by Racc 1.5.
|
3
|
+
# This file is automatically generated by Racc 1.5.2
|
4
4
|
# from Racc grammar file "".
|
5
5
|
#
|
6
6
|
|
7
7
|
require 'racc/parser.rb'
|
8
8
|
|
9
|
-
require_relative '
|
9
|
+
require_relative 'lexer'
|
10
10
|
|
11
|
-
|
11
|
+
module HCL
|
12
|
+
module Checker
|
13
|
+
class Parser < Racc::Parser
|
12
14
|
|
13
15
|
module_eval(<<'...end parse.y/module_eval...', 'parse.y', 128)
|
14
16
|
#//
|
@@ -16,19 +18,31 @@ module_eval(<<'...end parse.y/module_eval...', 'parse.y', 128)
|
|
16
18
|
#// keys are encountered.
|
17
19
|
#//
|
18
20
|
#// from decoder.go: if we're at the root or we're directly within
|
19
|
-
#// a list, decode
|
21
|
+
#// a list, decode to hashes, otherwise lists
|
20
22
|
#//
|
21
23
|
#// from object.go: there is a flattened list structure
|
22
24
|
#//
|
25
|
+
#// if @duplicate_mode is set:
|
26
|
+
#// - :array then duplicates will be appended to an array
|
27
|
+
#// - :merge then duplicates will be deep merged into a hash
|
28
|
+
#//
|
23
29
|
def flatten_objectlist(list)
|
24
30
|
(list || {}).each_with_object({}) do |a, h|
|
25
|
-
h
|
26
|
-
case
|
27
|
-
when
|
31
|
+
if h.keys.include?(a.first)
|
32
|
+
case @duplicate_mode
|
33
|
+
when :array
|
34
|
+
if h[a.first].is_a?(Array)
|
35
|
+
h[a.first].push(a.last)
|
36
|
+
else
|
37
|
+
h[a.first] = [ h[a.first], a.last ]
|
38
|
+
end
|
39
|
+
when :merge
|
28
40
|
deep_merge(h[a.first] || {}, a.last)
|
29
|
-
else
|
30
|
-
h[a.first] = a.last
|
41
|
+
else raise ArgumentError
|
31
42
|
end
|
43
|
+
else
|
44
|
+
h[a.first] = a.last
|
45
|
+
end
|
32
46
|
end
|
33
47
|
end
|
34
48
|
|
@@ -40,10 +54,12 @@ module_eval(<<'...end parse.y/module_eval...', 'parse.y', 128)
|
|
40
54
|
end
|
41
55
|
|
42
56
|
|
43
|
-
def parse(input)
|
44
|
-
@
|
57
|
+
def parse(input, duplicate_mode = :array)
|
58
|
+
@duplicate_mode = duplicate_mode
|
59
|
+
@lexer = HCL::Checker::Lexer.new.lex(input)
|
45
60
|
do_parse
|
46
|
-
|
61
|
+
|
62
|
+
@result
|
47
63
|
end
|
48
64
|
|
49
65
|
|
@@ -69,25 +85,25 @@ module_eval(<<'...end parse.y/module_eval...', 'parse.y', 128)
|
|
69
85
|
##### State transition tables begin ###
|
70
86
|
|
71
87
|
racc_action_table = [
|
72
|
-
22, 29, 28, 10,
|
73
|
-
6, 27, 29, 28, 5, 42, 6,
|
74
|
-
14,
|
75
|
-
37,
|
76
|
-
|
88
|
+
22, 29, 28, 10, 19, 26, 43, 23, 5, 14,
|
89
|
+
6, 27, 29, 28, 5, 42, 6, 13, 37, 40,
|
90
|
+
14, 32, 27, 34, 29, 28, 5, 5, 6, 6,
|
91
|
+
37, 31, 14, 17, 27, 18, -11, 14, -10, 41,
|
92
|
+
12, 44, 20 ]
|
77
93
|
|
78
94
|
racc_action_check = [
|
79
|
-
13, 13, 13, 1,
|
80
|
-
0, 13, 27, 27,
|
81
|
-
27,
|
82
|
-
43,
|
83
|
-
|
95
|
+
13, 13, 13, 1, 10, 13, 33, 13, 0, 13,
|
96
|
+
0, 13, 27, 27, 30, 33, 30, 7, 27, 30,
|
97
|
+
27, 26, 27, 27, 43, 43, 14, 3, 14, 3,
|
98
|
+
43, 14, 43, 9, 43, 9, 6, 9, 5, 32,
|
99
|
+
4, 41, 11 ]
|
84
100
|
|
85
101
|
racc_action_pointer = [
|
86
|
-
1, 3, nil, 20,
|
87
|
-
|
88
|
-
nil, nil, nil, nil, nil, nil,
|
89
|
-
|
90
|
-
nil,
|
102
|
+
1, 3, nil, 20, 35, 30, 28, 9, nil, 26,
|
103
|
+
4, 37, nil, -2, 19, nil, nil, nil, nil, nil,
|
104
|
+
nil, nil, nil, nil, nil, nil, 6, 9, nil, nil,
|
105
|
+
7, nil, 32, 1, nil, nil, nil, nil, nil, nil,
|
106
|
+
nil, 25, nil, 21, nil, nil ]
|
91
107
|
|
92
108
|
racc_action_default = [
|
93
109
|
-2, -35, -1, -3, -5, -22, -23, -35, -19, -35,
|
@@ -97,18 +113,18 @@ racc_action_default = [
|
|
97
113
|
-8, -35, -24, -28, -17, -27 ]
|
98
114
|
|
99
115
|
racc_goto_table = [
|
100
|
-
11, 35, 3, 15,
|
101
|
-
|
116
|
+
11, 35, 3, 15, 16, 33, 21, 24, 2, 1,
|
117
|
+
25, nil, nil, nil, nil, nil, 30, 45, nil, nil,
|
102
118
|
nil, nil, nil, nil, nil, nil, nil, 11 ]
|
103
119
|
|
104
120
|
racc_goto_check = [
|
105
|
-
4, 12, 3, 5,
|
106
|
-
|
121
|
+
4, 12, 3, 5, 9, 11, 7, 5, 2, 1,
|
122
|
+
8, nil, nil, nil, nil, nil, 3, 12, nil, nil,
|
107
123
|
nil, nil, nil, nil, nil, nil, nil, 4 ]
|
108
124
|
|
109
125
|
racc_goto_pointer = [
|
110
|
-
nil,
|
111
|
-
nil, -
|
126
|
+
nil, 9, 8, 2, -3, -6, nil, -7, -3, -5,
|
127
|
+
nil, -22, -26 ]
|
112
128
|
|
113
129
|
racc_goto_default = [
|
114
130
|
nil, nil, nil, nil, 4, 39, 7, 36, 38, 8,
|
@@ -291,7 +307,7 @@ module_eval(<<'.,.,', 'parse.y', 41)
|
|
291
307
|
|
292
308
|
module_eval(<<'.,.,', 'parse.y', 43)
|
293
309
|
def _reduce_9(val, _values, result)
|
294
|
-
return
|
310
|
+
return {}
|
295
311
|
result
|
296
312
|
end
|
297
313
|
.,.,
|
@@ -403,7 +419,7 @@ module_eval(<<'.,.,', 'parse.y', 88)
|
|
403
419
|
|
404
420
|
module_eval(<<'.,.,', 'parse.y', 90)
|
405
421
|
def _reduce_25(val, _values, result)
|
406
|
-
return
|
422
|
+
return []
|
407
423
|
result
|
408
424
|
end
|
409
425
|
.,.,
|
@@ -475,4 +491,6 @@ def _reduce_none(val, _values, result)
|
|
475
491
|
val[0]
|
476
492
|
end
|
477
493
|
|
478
|
-
end # class
|
494
|
+
end # class Parser
|
495
|
+
end # module Checker
|
496
|
+
end # module HCL
|
data/lib/hcl/checker/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hcl-checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcelo Castellani
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,84 +16,84 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.2.10
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.2.10
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: racc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.5.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.5.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 12.3.3
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 12.3.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rex
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.0.12
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 2.0.12
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rexical
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 1.0.7
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 1.0.7
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '3.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '3.0'
|
97
97
|
description: Hashicorp Configuration Language parser and checker for Ruby
|
98
98
|
email:
|
99
99
|
- marcelo@linux.com
|
@@ -103,6 +103,7 @@ extra_rdoc_files: []
|
|
103
103
|
files:
|
104
104
|
- ".gitignore"
|
105
105
|
- ".rspec"
|
106
|
+
- ".rubocop.yml"
|
106
107
|
- ".travis.yml"
|
107
108
|
- CODE_OF_CONDUCT.md
|
108
109
|
- Gemfile
|
@@ -116,21 +117,17 @@ files:
|
|
116
117
|
- bin/setup
|
117
118
|
- hcl-checker.gemspec
|
118
119
|
- lib/hcl/checker.rb
|
120
|
+
- lib/hcl/checker/lexer.rb
|
121
|
+
- lib/hcl/checker/parser.rb
|
119
122
|
- lib/hcl/checker/version.rb
|
120
|
-
- lib/hcl/lexer.rb
|
121
|
-
- lib/hcl/parser.rb
|
122
123
|
homepage: https://github.com/mfcastellani/hcl-checker
|
123
124
|
licenses:
|
124
125
|
- MIT
|
125
126
|
metadata: {}
|
126
|
-
post_install_message:
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
kept it. Sorry for those who eventually switched from HCL to HCL1. And thanks to
|
131
|
-
everyone who got in touch justifying why my change would be bad for all users.
|
132
|
-
|
133
|
-
Thank you :)
|
127
|
+
post_install_message: "\nHello, me again. This version fixes: \n\n- Add support for
|
128
|
+
multiple elements of the same type\n- Fix bug where empty objects and empty lists
|
129
|
+
were being parsed as nil\n- Update bundler version\n- Update nokogiri version\n\nThank
|
130
|
+
you :)\n"
|
134
131
|
rdoc_options: []
|
135
132
|
require_paths:
|
136
133
|
- lib
|
@@ -145,8 +142,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
142
|
- !ruby/object:Gem::Version
|
146
143
|
version: '0'
|
147
144
|
requirements: []
|
148
|
-
rubygems_version: 3.
|
149
|
-
signing_key:
|
145
|
+
rubygems_version: 3.2.3
|
146
|
+
signing_key:
|
150
147
|
specification_version: 4
|
151
148
|
summary: Hashicorp Configuration Language parser for Ruby
|
152
149
|
test_files: []
|