hcl-checker 1.1.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b7ce027ea644e153d4072b9f1347e0f6a20a431e9176cfdb9cf9ca77921fcfc
4
- data.tar.gz: bc4c91e49a9daaca42350708e833cf14a6a6e0600201470be8403d7f03b39bf4
3
+ metadata.gz: cb47986f7941e27c8c23509a32796a30c309af1341c7aac468acac3c33efaa26
4
+ data.tar.gz: a90c767872e02d7f6b94d044a8750969d1c1ec5236c565be051a7a8cc7b1889d
5
5
  SHA512:
6
- metadata.gz: 25f9138ab082cfa2a6b4975c13b8ce366659983af37177b60d8b0dbf5832714a16260442f27f9e28acb2e37b1a2dd97ab1a710db3b0ce35fb066bbeb27f4f8b7
7
- data.tar.gz: 8f08c32861de7a06be458d070aa88160779a0f46f4ff1acc817c7b73f5f51b397a8e21cf96055d1f779b973203e87f822704e2a6badd4487f90d8018a8695ad5
6
+ metadata.gz: 9efd2312d2ff19fb9518259689491ac616923ab1df6a7eaa922d3d72e2b92a97583c3f56065c43d5bcd8660a2ec3f520df828480bfb209d1b04ab34d187e1ca8
7
+ data.tar.gz: c4446a6f7b85a90fd1eb4157d5c4dbe8522497309fbe53ac63b66b66b6612a88f354028ecc074f8c7dda45e6802a21be0aca02767d9f2f1277eed509178d8e02
data/Gemfile CHANGED
@@ -1,5 +1,15 @@
1
1
  source "https://rubygems.org"
2
2
 
3
+ # This is needed due https://nvd.nist.gov/vuln/detail/CVE-2018-14404
4
+ # A NULL pointer dereference vulnerability exists in the xpath.c:xmlXPathCompOpEval()
5
+ # function of libxml2 through 2.9.8 when parsing an invalid XPath expression in the
6
+ # XPATH_OP_AND or XPATH_OP_OR case. Applications processing untrusted XSL format inputs
7
+ # with the use of the libxml2 library may be vulnerable to a denial of service attack due
8
+ # to a crash of the application.
9
+ # Nokogiri >= 1.8.5 solves this problem
10
+ gem "nokogiri", ">= 1.10.8"
11
+
12
+
3
13
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
14
 
5
15
  # Specify your gem's dependencies in hcl-checker.gemspec
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hcl-checker (1.1.0)
4
+ hcl-checker (1.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- diff-lcs (1.3)
10
- filesize (0.1.1)
9
+ diff-lcs (1.4.4)
10
+ filesize (0.2.0)
11
11
  jsobfu (0.4.2)
12
12
  rkelly-remix
13
- json (2.0.4)
14
- metasm (1.0.3)
15
- mini_portile2 (2.3.0)
16
- nokogiri (1.8.2)
17
- mini_portile2 (~> 2.3.0)
18
- racc (1.4.14)
19
- rake (10.4.2)
13
+ json (2.3.1)
14
+ metasm (1.0.4)
15
+ mini_portile2 (2.4.0)
16
+ nokogiri (1.10.10)
17
+ mini_portile2 (~> 2.4.0)
18
+ racc (1.5.0)
19
+ rake (12.3.3)
20
20
  rb-readline (0.5.5)
21
21
  rex (2.0.12)
22
22
  filesize (~> 0)
@@ -25,33 +25,34 @@ GEM
25
25
  metasm (~> 1)
26
26
  nokogiri (~> 1)
27
27
  rb-readline (~> 0)
28
- rexical (1.0.5)
28
+ rexical (1.0.7)
29
29
  rkelly-remix (0.0.7)
30
- rspec (3.7.0)
31
- rspec-core (~> 3.7.0)
32
- rspec-expectations (~> 3.7.0)
33
- rspec-mocks (~> 3.7.0)
34
- rspec-core (3.7.1)
35
- rspec-support (~> 3.7.0)
36
- rspec-expectations (3.7.0)
30
+ rspec (3.9.0)
31
+ rspec-core (~> 3.9.0)
32
+ rspec-expectations (~> 3.9.0)
33
+ rspec-mocks (~> 3.9.0)
34
+ rspec-core (3.9.2)
35
+ rspec-support (~> 3.9.3)
36
+ rspec-expectations (3.9.2)
37
37
  diff-lcs (>= 1.2.0, < 2.0)
38
- rspec-support (~> 3.7.0)
39
- rspec-mocks (3.7.0)
38
+ rspec-support (~> 3.9.0)
39
+ rspec-mocks (3.9.1)
40
40
  diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.7.0)
42
- rspec-support (3.7.0)
41
+ rspec-support (~> 3.9.0)
42
+ rspec-support (3.9.3)
43
43
 
44
44
  PLATFORMS
45
45
  ruby
46
46
 
47
47
  DEPENDENCIES
48
- bundler (~> 1.16)
48
+ bundler (~> 2.1.4)
49
49
  hcl-checker!
50
- racc (= 1.4.14)
51
- rake (~> 10.0)
50
+ nokogiri (>= 1.10.8)
51
+ racc (= 1.5.0)
52
+ rake (~> 12.3.3)
52
53
  rex (= 2.0.12)
53
- rexical (= 1.0.5)
54
+ rexical (>= 1.0.7)
54
55
  rspec (~> 3.0)
55
56
 
56
57
  BUNDLED WITH
57
- 1.16.2
58
+ 2.1.4
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Hcl::Checker
2
2
 
3
- **Hashicorp Configuration Language** syntax checker and parser.
3
+ **Hashicorp Configuration Language** syntax checker and parser.
4
4
 
5
5
  Parser originally created by [Sikula](https://github.com/sikula) and available
6
6
  at [Ruby HCL Repository](https://github.com/sikula/ruby-hcl). Only works with
7
- [HCL Version 1](https://github.com/hashicorp/hcl).
7
+ [HCL Version 1](https://github.com/hashicorp/hcl).
8
8
 
9
9
  ## Installation
10
10
 
@@ -84,7 +84,7 @@ $ bundle exec rake build_grammar
84
84
  Building Lexer....done
85
85
  Building Parser....done
86
86
  ```
87
-
87
+
88
88
  ## Contributing
89
89
 
90
90
  Bug reports and pull requests are welcome on GitHub at
@@ -96,5 +96,3 @@ to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
96
96
 
97
97
  The gem is available as open source under the terms of the [MIT
98
98
  License](https://opensource.org/licenses/MIT).
99
-
100
-
data/Rakefile CHANGED
@@ -16,4 +16,3 @@ task :build_grammar do
16
16
  `racc ./assets/parse.y -o ./lib/hcl/parser.rb`
17
17
  print "....done\n\n"
18
18
  end
19
-
@@ -2,7 +2,7 @@
2
2
  class HCLLexer
3
3
  option
4
4
  independent
5
-
5
+
6
6
  macro
7
7
  NEWLINE \n|\r
8
8
  BLANK \s+
@@ -20,7 +20,9 @@ macro
20
20
  RIGHTBRACE \}
21
21
  LEFTBRACKET \[
22
22
  RIGHTBRACKET \]
23
- HEREDOCUMENT \<<-
23
+ LEFTPARENTHESES \(
24
+ RIGHTPARENTHESES \)
25
+ HEREDOCUMENT \<<\-?
24
26
 
25
27
  rule
26
28
  # [:state] pattern [actions]
@@ -36,17 +38,18 @@ rule
36
38
  {QUOTE} { [:STRING, consume_string(text)] }
37
39
  {HEREDOCUMENT} { [:STRING, consume_heredoc] }
38
40
  #-------------------------------------------------------------------------------
39
- {LEFTBRACE} { [:LEFTBRACE, text]}
40
- {RIGHTBRACE} { [:RIGHTBRACE, text]}
41
- {LEFTBRACKET} { [:LEFTBRACKET, text]}
42
- {RIGHTBRACKET} { [:RIGHTBRACKET, text]}
41
+ {LEFTBRACE} { [:LEFTBRACE, text]}
42
+ {RIGHTBRACE} { [:RIGHTBRACE, text]}
43
+ {LEFTBRACKET} { [:LEFTBRACKET, text]}
44
+ {RIGHTBRACKET} { [:RIGHTBRACKET, text]}
45
+ {LEFTPARENTHESES} { [:LEFTPARENTHESES, text]}
46
+ {RIGHTPARENTHESES} { [:RIGHTPARENTHESES, text]}
43
47
  #-------------------------------------------------------------------------------
44
48
  {COMMA} { [:COMMA, text]}
45
49
  {IDENTIFIER} { [:IDENTIFIER, text]}
46
50
  {EQUAL} { [:EQUAL, text]}
47
51
  {MINUS} { [:MINUS, text]}
48
52
 
49
-
50
53
  inner
51
54
 
52
55
  def lex(input)
@@ -12,6 +12,8 @@ token BOOL
12
12
  RIGHTBRACE
13
13
  LEFTBRACKET
14
14
  RIGHTBRACKET
15
+ LEFTPARENTHESES
16
+ RIGHTPARENTHESES
15
17
  PERIOD
16
18
  EPLUS
17
19
  EMINUS
@@ -24,10 +26,13 @@ rule
24
26
  | objectlist
25
27
  ;
26
28
 
27
-
28
29
  objectlist:
29
- objectitem
30
+ objectitem COMMA
31
+ { result = [val[0]] }
32
+ | objectitem
30
33
  { result = [val[0]] }
34
+ | objectlist objectitem COMMA
35
+ { result = val[0] << val[1] }
31
36
  | objectlist objectitem
32
37
  { result = val[0] << val[1] }
33
38
  ;
@@ -57,6 +62,10 @@ rule
57
62
  { result = val[0], val[2] }
58
63
  | objectkey EQUAL list
59
64
  { result = val[0], val[2] }
65
+ | objectkey EQUAL IDENTIFIER LEFTPARENTHESES IDENTIFIER RIGHTPARENTHESES
66
+ { result = val[0], "#{val[2]}(#{val[4]})" }
67
+ | objectkey EQUAL IDENTIFIER
68
+ { result = val[0], val[2] }
60
69
  | block
61
70
  { result = val[0] }
62
71
  ;
@@ -126,7 +135,7 @@ require_relative './lexer'
126
135
  #// from object.go: there is a flattened list structure
127
136
  #//
128
137
  def flatten_objectlist(list)
129
- list.each_with_object({}) do |a, h|
138
+ (list || {}).each_with_object({}) do |a, h|
130
139
  h[a.first] =
131
140
  case a.last
132
141
  when Hash
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.name = 'hcl-checker'
7
7
  spec.version = HCL::Checker::VERSION
8
8
  spec.authors = ['Marcelo Castellani']
9
- spec.email = ['marcelofc.rock@gmail.com']
9
+ spec.email = ['marcelo@linux.com']
10
10
 
11
11
  spec.summary = 'Hashicorp Configuration Language parser for Ruby'
12
12
  spec.description = 'Hashicorp Configuration Language parser and checker for Ruby'
@@ -17,12 +17,21 @@ Gem::Specification.new do |spec|
17
17
  f.match(%r{^(test|spec|features)/})
18
18
  end
19
19
  spec.require_paths = ['lib']
20
+ spec.required_ruby_version = '>= 2.5.0'
20
21
 
21
- spec.add_development_dependency 'bundler', '~> 1.16'
22
- spec.add_development_dependency 'rake', '~> 10.0'
22
+ spec.add_development_dependency 'bundler', '~> 2.1.4'
23
+ spec.add_development_dependency 'rake', '~> 12.3.3'
23
24
  spec.add_development_dependency 'rspec', '~> 3.0'
24
- spec.add_development_dependency 'racc', '1.4.14'
25
+ spec.add_development_dependency 'racc', '1.5.0'
25
26
  spec.add_development_dependency 'rex', '2.0.12'
26
- spec.add_development_dependency 'rexical', '1.0.5'
27
+ spec.add_development_dependency 'rexical', '>= 1.0.7'
27
28
 
29
+ spec.post_install_message = %q{
30
+ Hello, me again. After several contacts of users of this gem requesting that
31
+ the module name be kept only as HCL, instead of HCL1 and HCL2, I went back and
32
+ kept it. Sorry for those who eventually switched from HCL to HCL1. And thanks to
33
+ everyone who got in touch justifying why my change would be bad for all users.
34
+
35
+ Thank you :)
36
+ }
28
37
  end
@@ -4,18 +4,24 @@ require_relative 'parser'
4
4
 
5
5
  module HCL
6
6
  module Checker
7
- def self.valid?(value)
8
- ret = HCLParser.new.parse(value)
9
- return true if ret.is_a? Hash
10
- false
11
- rescue
12
- false
13
- end
7
+ class << self
8
+ attr_accessor :last_error
9
+
10
+ def valid?(value)
11
+ ret = HCLParser.new.parse(value)
12
+ return true if ret.is_a? Hash
13
+ false
14
+ rescue Racc::ParseError => e
15
+ @last_error = e.message
16
+ false
17
+ end
14
18
 
15
- def self.parse(value)
16
- HCLParser.new.parse(value)
17
- rescue Racc::ParseError => e
18
- return e.message
19
+ def parse(value)
20
+ HCLParser.new.parse(value)
21
+ rescue Racc::ParseError => e
22
+ @last_error = e.message
23
+ return e.message
24
+ end
19
25
  end
20
26
  end
21
27
  end
@@ -1,5 +1,5 @@
1
1
  module HCL
2
2
  module Checker
3
- VERSION = '1.1.0'
3
+ VERSION = '1.5.0'
4
4
  end
5
5
  end
@@ -1,123 +1,130 @@
1
1
  #--
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by rex 1.0.5
3
+ # This file is automatically generated by rex 1.0.7
4
4
  # from lexical definition file "./assets/lexer.rex".
5
5
  #++
6
6
 
7
7
 
8
8
  class HCLLexer
9
- require 'strscan'
9
+ require 'strscan'
10
10
 
11
- class ScanError < StandardError ; end
11
+ class ScanError < StandardError ; end
12
12
 
13
- attr_reader :lineno
14
- attr_reader :filename
15
- attr_accessor :state
13
+ attr_reader :lineno
14
+ attr_reader :filename
15
+ attr_accessor :state
16
16
 
17
- def scan_setup(str)
18
- @ss = StringScanner.new(str)
19
- @lineno = 1
20
- @state = nil
21
- end
17
+ def scan_setup(str)
18
+ @ss = StringScanner.new(str)
19
+ @lineno = 1
20
+ @state = nil
21
+ end
22
22
 
23
- def action
24
- yield
25
- end
23
+ def action
24
+ yield
25
+ end
26
26
 
27
- def scan_str(str)
28
- scan_setup(str)
29
- do_parse
30
- end
31
- alias :scan :scan_str
27
+ def scan_str(str)
28
+ scan_setup(str)
29
+ do_parse
30
+ end
31
+ alias :scan :scan_str
32
32
 
33
- def load_file( filename )
34
- @filename = filename
35
- open(filename, "r") do |f|
36
- scan_setup(f.read)
37
- end
38
- end
33
+ def load_file( filename )
34
+ @filename = filename
35
+ File.open(filename, "r") do |f|
36
+ scan_setup(f.read)
37
+ end
38
+ end
39
39
 
40
- def scan_file( filename )
41
- load_file(filename)
42
- do_parse
43
- end
40
+ def scan_file( filename )
41
+ load_file(filename)
42
+ do_parse
43
+ end
44
44
 
45
45
 
46
- def next_token
47
- return if @ss.eos?
48
-
49
- # skips empty actions
50
- until token = _next_token or @ss.eos?; end
51
- token
52
- end
46
+ def next_token
47
+ return if @ss.eos?
53
48
 
54
- def _next_token
55
- text = @ss.peek(1)
56
- @lineno += 1 if text == "\n"
57
- token = case @state
58
- when nil
59
- case
60
- when (text = @ss.scan(/\s+/))
61
- ;
49
+ # skips empty actions
50
+ until token = _next_token or @ss.eos?; end
51
+ token
52
+ end
62
53
 
63
- when (text = @ss.scan(/\#.*|\/\/.*$/))
64
- ;
54
+ def _next_token
55
+ text = @ss.peek(1)
56
+ @lineno += 1 if text == "\n"
57
+ token = case @state
58
+ when nil
59
+ case
60
+ when (text = @ss.scan(/\s+/))
61
+ ;
65
62
 
66
- when (text = @ss.scan(/\n|\r/))
67
- ;
63
+ when (text = @ss.scan(/\#.*|\/\/.*$/))
64
+ ;
68
65
 
69
- when (text = @ss.scan(/\/\*/))
70
- action { consume_comment(text) }
66
+ when (text = @ss.scan(/\n|\r/))
67
+ ;
71
68
 
72
- when (text = @ss.scan(/true|false/))
73
- action { [:BOOL, to_boolean(text)]}
69
+ when (text = @ss.scan(/\/\*/))
70
+ action { consume_comment(text) }
74
71
 
75
- when (text = @ss.scan(/\-?\d+\.\d+/))
76
- action { [:FLOAT, text.to_f] }
72
+ when (text = @ss.scan(/true|false/))
73
+ action { [:BOOL, to_boolean(text)]}
77
74
 
78
- when (text = @ss.scan(/-?\d+/))
79
- action { [:NUMBER, text.to_i] }
75
+ when (text = @ss.scan(/\-?\d+\.\d+/))
76
+ action { [:FLOAT, text.to_f] }
80
77
 
81
- when (text = @ss.scan(/\"/))
82
- action { [:STRING, consume_string(text)] }
78
+ when (text = @ss.scan(/-?\d+/))
79
+ action { [:NUMBER, text.to_i] }
83
80
 
84
- when (text = @ss.scan(/\<<-/))
85
- action { [:STRING, consume_heredoc] }
81
+ when (text = @ss.scan(/\"/))
82
+ action { [:STRING, consume_string(text)] }
86
83
 
87
- when (text = @ss.scan(/\{/))
88
- action { [:LEFTBRACE, text]}
84
+ when (text = @ss.scan(/\<<\-?/))
85
+ action { [:STRING, consume_heredoc] }
89
86
 
90
- when (text = @ss.scan(/\}/))
91
- action { [:RIGHTBRACE, text]}
87
+ when (text = @ss.scan(/\{/))
88
+ action { [:LEFTBRACE, text]}
92
89
 
93
- when (text = @ss.scan(/\[/))
94
- action { [:LEFTBRACKET, text]}
90
+ when (text = @ss.scan(/\}/))
91
+ action { [:RIGHTBRACE, text]}
95
92
 
96
- when (text = @ss.scan(/\]/))
97
- action { [:RIGHTBRACKET, text]}
93
+ when (text = @ss.scan(/\[/))
94
+ action { [:LEFTBRACKET, text]}
98
95
 
99
- when (text = @ss.scan(/\,/))
100
- action { [:COMMA, text]}
96
+ when (text = @ss.scan(/\]/))
97
+ action { [:RIGHTBRACKET, text]}
101
98
 
102
- when (text = @ss.scan(/[a-zA-Z_][a-zA-Z0-9_\-\.]*/))
103
- action { [:IDENTIFIER, text]}
99
+ when (text = @ss.scan(/\(/))
100
+ action { [:LEFTPARENTHESES, text]}
104
101
 
105
- when (text = @ss.scan(/\=/))
106
- action { [:EQUAL, text]}
102
+ when (text = @ss.scan(/\)/))
103
+ action { [:RIGHTPARENTHESES, text]}
107
104
 
108
- when (text = @ss.scan(/\-/))
109
- action { [:MINUS, text]}
105
+ when (text = @ss.scan(/\,/))
106
+ action { [:COMMA, text]}
110
107
 
111
- else
112
- text = @ss.string[@ss.pos .. -1]
113
- raise ScanError, "can not match: '" + text + "'"
114
- end # if
115
-
116
- else
117
- raise ScanError, "undefined state: '" + state.to_s + "'"
118
- end # case state
119
- token
120
- end # def _next_token
108
+ when (text = @ss.scan(/[a-zA-Z_][a-zA-Z0-9_\-\.]*/))
109
+ action { [:IDENTIFIER, text]}
110
+
111
+ when (text = @ss.scan(/\=/))
112
+ action { [:EQUAL, text]}
113
+
114
+ when (text = @ss.scan(/\-/))
115
+ action { [:MINUS, text]}
116
+
117
+
118
+ else
119
+ text = @ss.string[@ss.pos .. -1]
120
+ raise ScanError, "can not match: '" + text + "'"
121
+ end # if
122
+
123
+ else
124
+ raise ScanError, "undefined state: '" + state.to_s + "'"
125
+ end # case state
126
+ token
127
+ end # def _next_token
121
128
 
122
129
  def lex(input)
123
130
  scan_setup(input)
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by Racc 1.4.14
4
- # from Racc grammer file "".
3
+ # This file is automatically generated by Racc 1.5.0
4
+ # from Racc grammar file "".
5
5
  #
6
6
 
7
7
  require 'racc/parser.rb'
@@ -10,7 +10,7 @@ require_relative './lexer'
10
10
 
11
11
  class HCLParser < Racc::Parser
12
12
 
13
- module_eval(<<'...end parse.y/module_eval...', 'parse.y', 119)
13
+ module_eval(<<'...end parse.y/module_eval...', 'parse.y', 128)
14
14
  #//
15
15
  #// HCL is unclear on what one should do when duplicate
16
16
  #// keys are encountered.
@@ -21,7 +21,7 @@ module_eval(<<'...end parse.y/module_eval...', 'parse.y', 119)
21
21
  #// from object.go: there is a flattened list structure
22
22
  #//
23
23
  def flatten_objectlist(list)
24
- list.each_with_object({}) do |a, h|
24
+ (list || {}).each_with_object({}) do |a, h|
25
25
  h[a.first] =
26
26
  case a.last
27
27
  when Hash
@@ -69,83 +69,91 @@ module_eval(<<'...end parse.y/module_eval...', 'parse.y', 119)
69
69
  ##### State transition tables begin ###
70
70
 
71
71
  racc_action_table = [
72
- 20, 26, 25, 18, 26, 25, 5, 21, 6, 13,
73
- 33, 24, 13, 12, 24, 30, 26, 25, 38, 5,
74
- -9, 6, 33, 5, 13, 6, 24, 37, 28, 5,
75
- -8, 6, 10, 16, 36, 17, nil, 13 ]
72
+ 22, 29, 28, 10, 12, 26, 43, 23, 5, 14,
73
+ 6, 27, 29, 28, 5, 42, 6, -10, 37, 31,
74
+ 14, -11, 27, 34, 29, 28, 5, 5, 6, 6,
75
+ 37, 40, 14, 17, 27, 18, 13, 14, 19, 20,
76
+ 32, 41, 44 ]
76
77
 
77
78
  racc_action_check = [
78
- 12, 12, 12, 10, 24, 24, 0, 12, 0, 12,
79
- 24, 12, 24, 7, 24, 24, 38, 38, 29, 3,
80
- 6, 3, 38, 13, 38, 13, 38, 29, 13, 27,
81
- 5, 27, 1, 9, 27, 9, nil, 9 ]
79
+ 13, 13, 13, 1, 4, 13, 33, 13, 0, 13,
80
+ 0, 13, 27, 27, 14, 33, 14, 5, 27, 14,
81
+ 27, 6, 27, 27, 43, 43, 30, 3, 30, 3,
82
+ 43, 30, 43, 9, 43, 9, 7, 9, 10, 11,
83
+ 26, 32, 41 ]
82
84
 
83
85
  racc_action_pointer = [
84
- -1, 32, nil, 12, nil, 22, 12, 5, nil, 26,
85
- 3, nil, -2, 16, nil, nil, nil, nil, nil, nil,
86
- nil, nil, nil, nil, 1, nil, nil, 22, nil, 13,
87
- nil, nil, nil, nil, nil, nil, nil, nil, 13, nil ]
86
+ 1, 3, nil, 20, -1, 9, 13, 28, nil, 26,
87
+ 38, 34, nil, -2, 7, nil, nil, nil, nil, nil,
88
+ nil, nil, nil, nil, nil, nil, 25, 9, nil, nil,
89
+ 19, nil, 34, 1, nil, nil, nil, nil, nil, nil,
90
+ nil, 26, nil, 21, nil, nil ]
88
91
 
89
92
  racc_action_default = [
90
- -2, -31, -1, -3, -4, -18, -19, -31, -15, -31,
91
- -31, -5, -31, -31, -16, -17, -18, -19, 40, -10,
92
- -11, -12, -13, -14, -31, -29, -30, -31, -7, -31,
93
- -21, -22, -25, -26, -27, -28, -6, -20, -24, -23 ]
93
+ -2, -35, -1, -3, -5, -22, -23, -35, -19, -35,
94
+ -35, -7, -4, -35, -35, -20, -21, -22, -23, 46,
95
+ -6, -12, -13, -14, -15, -16, -18, -35, -33, -34,
96
+ -35, -9, -35, -35, -25, -26, -29, -30, -31, -32,
97
+ -8, -35, -24, -28, -17, -27 ]
94
98
 
95
99
  racc_goto_table = [
96
- 11, 31, 14, 3, 15, 22, 29, 19, 2, 1,
97
- 23, nil, nil, nil, nil, 39, 27, nil, nil, nil,
98
- nil, nil, nil, nil, 11 ]
100
+ 11, 35, 3, 15, 1, 2, 21, 24, 25, 16,
101
+ 33, nil, nil, nil, nil, nil, 30, 45, nil, nil,
102
+ nil, nil, nil, nil, nil, nil, nil, 11 ]
99
103
 
100
104
  racc_goto_check = [
101
- 4, 12, 5, 3, 9, 5, 11, 7, 2, 1,
102
- 8, nil, nil, nil, nil, 12, 3, nil, nil, nil,
103
- nil, nil, nil, nil, 4 ]
105
+ 4, 12, 3, 5, 1, 2, 7, 5, 8, 9,
106
+ 11, nil, nil, nil, nil, nil, 3, 12, nil, nil,
107
+ nil, nil, nil, nil, nil, nil, nil, 4 ]
104
108
 
105
109
  racc_goto_pointer = [
106
- nil, 9, 8, 3, -3, -7, nil, -5, -2, -5,
107
- nil, -18, -23 ]
110
+ nil, 4, 5, 2, -3, -6, nil, -7, -5, 0,
111
+ nil, -17, -26 ]
108
112
 
109
113
  racc_goto_default = [
110
- nil, nil, nil, nil, 4, 35, 7, 32, 34, 8,
114
+ nil, nil, nil, nil, 4, 39, 7, 36, 38, 8,
111
115
  9, nil, nil ]
112
116
 
113
117
  racc_reduce_table = [
114
118
  0, 0, :racc_error,
115
- 1, 19, :_reduce_1,
116
- 0, 20, :_reduce_2,
117
- 1, 20, :_reduce_none,
118
- 1, 21, :_reduce_4,
119
- 2, 21, :_reduce_5,
119
+ 1, 21, :_reduce_1,
120
+ 0, 22, :_reduce_2,
121
+ 1, 22, :_reduce_none,
122
+ 2, 23, :_reduce_4,
123
+ 1, 23, :_reduce_5,
120
124
  3, 23, :_reduce_6,
121
125
  2, 23, :_reduce_7,
122
- 1, 24, :_reduce_8,
123
- 1, 24, :_reduce_9,
124
- 3, 22, :_reduce_10,
125
- 3, 22, :_reduce_11,
126
- 3, 22, :_reduce_12,
127
- 3, 22, :_reduce_13,
128
- 3, 22, :_reduce_14,
129
- 1, 22, :_reduce_15,
130
- 2, 27, :_reduce_16,
131
- 2, 27, :_reduce_17,
132
- 1, 28, :_reduce_18,
133
- 1, 28, :_reduce_19,
134
- 3, 26, :_reduce_20,
135
- 2, 26, :_reduce_21,
136
- 1, 29, :_reduce_22,
137
- 3, 29, :_reduce_23,
138
- 2, 29, :_reduce_24,
139
- 1, 30, :_reduce_25,
140
- 1, 30, :_reduce_26,
141
- 1, 30, :_reduce_27,
142
- 1, 30, :_reduce_28,
143
- 1, 25, :_reduce_29,
144
- 1, 25, :_reduce_30 ]
145
-
146
- racc_reduce_n = 31
147
-
148
- racc_shift_n = 40
126
+ 3, 25, :_reduce_8,
127
+ 2, 25, :_reduce_9,
128
+ 1, 26, :_reduce_10,
129
+ 1, 26, :_reduce_11,
130
+ 3, 24, :_reduce_12,
131
+ 3, 24, :_reduce_13,
132
+ 3, 24, :_reduce_14,
133
+ 3, 24, :_reduce_15,
134
+ 3, 24, :_reduce_16,
135
+ 6, 24, :_reduce_17,
136
+ 3, 24, :_reduce_18,
137
+ 1, 24, :_reduce_19,
138
+ 2, 29, :_reduce_20,
139
+ 2, 29, :_reduce_21,
140
+ 1, 30, :_reduce_22,
141
+ 1, 30, :_reduce_23,
142
+ 3, 28, :_reduce_24,
143
+ 2, 28, :_reduce_25,
144
+ 1, 31, :_reduce_26,
145
+ 3, 31, :_reduce_27,
146
+ 2, 31, :_reduce_28,
147
+ 1, 32, :_reduce_29,
148
+ 1, 32, :_reduce_30,
149
+ 1, 32, :_reduce_31,
150
+ 1, 32, :_reduce_32,
151
+ 1, 27, :_reduce_33,
152
+ 1, 27, :_reduce_34 ]
153
+
154
+ racc_reduce_n = 35
155
+
156
+ racc_shift_n = 46
149
157
 
150
158
  racc_token_table = {
151
159
  false => 0,
@@ -163,11 +171,13 @@ racc_token_table = {
163
171
  :RIGHTBRACE => 12,
164
172
  :LEFTBRACKET => 13,
165
173
  :RIGHTBRACKET => 14,
166
- :PERIOD => 15,
167
- :EPLUS => 16,
168
- :EMINUS => 17 }
174
+ :LEFTPARENTHESES => 15,
175
+ :RIGHTPARENTHESES => 16,
176
+ :PERIOD => 17,
177
+ :EPLUS => 18,
178
+ :EMINUS => 19 }
169
179
 
170
- racc_nt_base = 18
180
+ racc_nt_base = 20
171
181
 
172
182
  racc_use_result_var = true
173
183
 
@@ -203,6 +213,8 @@ Racc_token_to_s_table = [
203
213
  "RIGHTBRACE",
204
214
  "LEFTBRACKET",
205
215
  "RIGHTBRACKET",
216
+ "LEFTPARENTHESES",
217
+ "RIGHTPARENTHESES",
206
218
  "PERIOD",
207
219
  "EPLUS",
208
220
  "EMINUS",
@@ -226,207 +238,235 @@ Racc_debug_parser = false
226
238
 
227
239
  # reduce 0 omitted
228
240
 
229
- module_eval(<<'.,.,', 'parse.y', 19)
241
+ module_eval(<<'.,.,', 'parse.y', 21)
230
242
  def _reduce_1(val, _values, result)
231
243
  @result = flatten_objectlist(val[0])
232
244
  result
233
245
  end
234
246
  .,.,
235
247
 
236
- module_eval(<<'.,.,', 'parse.y', 22)
248
+ module_eval(<<'.,.,', 'parse.y', 24)
237
249
  def _reduce_2(val, _values, result)
238
- result = val[0]
250
+ result = val[0]
239
251
  result
240
252
  end
241
253
  .,.,
242
254
 
243
255
  # reduce 3 omitted
244
256
 
245
- module_eval(<<'.,.,', 'parse.y', 29)
257
+ module_eval(<<'.,.,', 'parse.y', 30)
246
258
  def _reduce_4(val, _values, result)
247
- result = [val[0]]
259
+ result = [val[0]]
248
260
  result
249
261
  end
250
262
  .,.,
251
263
 
252
- module_eval(<<'.,.,', 'parse.y', 31)
264
+ module_eval(<<'.,.,', 'parse.y', 32)
253
265
  def _reduce_5(val, _values, result)
254
- result = val[0] << val[1]
266
+ result = [val[0]]
255
267
  result
256
268
  end
257
269
  .,.,
258
270
 
259
- module_eval(<<'.,.,', 'parse.y', 36)
271
+ module_eval(<<'.,.,', 'parse.y', 34)
260
272
  def _reduce_6(val, _values, result)
261
- result = flatten_objectlist(val[1])
273
+ result = val[0] << val[1]
262
274
  result
263
275
  end
264
276
  .,.,
265
277
 
266
- module_eval(<<'.,.,', 'parse.y', 38)
278
+ module_eval(<<'.,.,', 'parse.y', 36)
267
279
  def _reduce_7(val, _values, result)
268
- return
280
+ result = val[0] << val[1]
269
281
  result
270
282
  end
271
283
  .,.,
272
284
 
273
- module_eval(<<'.,.,', 'parse.y', 43)
285
+ module_eval(<<'.,.,', 'parse.y', 41)
274
286
  def _reduce_8(val, _values, result)
275
- result = val[0]
287
+ result = flatten_objectlist(val[1])
276
288
  result
277
289
  end
278
290
  .,.,
279
291
 
280
- module_eval(<<'.,.,', 'parse.y', 45)
292
+ module_eval(<<'.,.,', 'parse.y', 43)
281
293
  def _reduce_9(val, _values, result)
282
- result = val[0]
294
+ return
283
295
  result
284
296
  end
285
297
  .,.,
286
298
 
287
- module_eval(<<'.,.,', 'parse.y', 50)
299
+ module_eval(<<'.,.,', 'parse.y', 48)
288
300
  def _reduce_10(val, _values, result)
289
- result = val[0], val[2]
301
+ result = val[0]
290
302
  result
291
303
  end
292
304
  .,.,
293
305
 
294
- module_eval(<<'.,.,', 'parse.y', 52)
306
+ module_eval(<<'.,.,', 'parse.y', 50)
295
307
  def _reduce_11(val, _values, result)
296
- result = val[0], val[2]
308
+ result = val[0]
297
309
  result
298
310
  end
299
311
  .,.,
300
312
 
301
- module_eval(<<'.,.,', 'parse.y', 54)
313
+ module_eval(<<'.,.,', 'parse.y', 55)
302
314
  def _reduce_12(val, _values, result)
303
- result = val[0], val[2]
315
+ result = val[0], val[2]
304
316
  result
305
317
  end
306
318
  .,.,
307
319
 
308
- module_eval(<<'.,.,', 'parse.y', 56)
320
+ module_eval(<<'.,.,', 'parse.y', 57)
309
321
  def _reduce_13(val, _values, result)
310
- result = val[0], val[2]
322
+ result = val[0], val[2]
311
323
  result
312
324
  end
313
325
  .,.,
314
326
 
315
- module_eval(<<'.,.,', 'parse.y', 58)
327
+ module_eval(<<'.,.,', 'parse.y', 59)
316
328
  def _reduce_14(val, _values, result)
317
- result = val[0], val[2]
329
+ result = val[0], val[2]
318
330
  result
319
331
  end
320
332
  .,.,
321
333
 
322
- module_eval(<<'.,.,', 'parse.y', 60)
334
+ module_eval(<<'.,.,', 'parse.y', 61)
323
335
  def _reduce_15(val, _values, result)
324
- result = val[0]
336
+ result = val[0], val[2]
325
337
  result
326
338
  end
327
339
  .,.,
328
340
 
329
- module_eval(<<'.,.,', 'parse.y', 65)
341
+ module_eval(<<'.,.,', 'parse.y', 63)
330
342
  def _reduce_16(val, _values, result)
331
- result = val[0], val[1]
343
+ result = val[0], val[2]
332
344
  result
333
345
  end
334
346
  .,.,
335
347
 
336
- module_eval(<<'.,.,', 'parse.y', 67)
348
+ module_eval(<<'.,.,', 'parse.y', 65)
337
349
  def _reduce_17(val, _values, result)
338
- result = val[0], {val[1][0] => val[1][1]}
350
+ result = val[0], "#{val[2]}(#{val[4]})"
339
351
  result
340
352
  end
341
353
  .,.,
342
354
 
343
- module_eval(<<'.,.,', 'parse.y', 72)
355
+ module_eval(<<'.,.,', 'parse.y', 67)
344
356
  def _reduce_18(val, _values, result)
345
- result = val[0]
357
+ result = val[0], val[2]
346
358
  result
347
359
  end
348
360
  .,.,
349
361
 
350
- module_eval(<<'.,.,', 'parse.y', 74)
362
+ module_eval(<<'.,.,', 'parse.y', 69)
351
363
  def _reduce_19(val, _values, result)
352
- result = val[0]
364
+ result = val[0]
353
365
  result
354
366
  end
355
367
  .,.,
356
368
 
357
- module_eval(<<'.,.,', 'parse.y', 79)
369
+ module_eval(<<'.,.,', 'parse.y', 74)
358
370
  def _reduce_20(val, _values, result)
359
- result = val[1]
371
+ result = val[0], val[1]
360
372
  result
361
373
  end
362
374
  .,.,
363
375
 
364
- module_eval(<<'.,.,', 'parse.y', 81)
376
+ module_eval(<<'.,.,', 'parse.y', 76)
365
377
  def _reduce_21(val, _values, result)
366
- return
378
+ result = val[0], {val[1][0] => val[1][1]}
367
379
  result
368
380
  end
369
381
  .,.,
370
382
 
371
- module_eval(<<'.,.,', 'parse.y', 86)
383
+ module_eval(<<'.,.,', 'parse.y', 81)
372
384
  def _reduce_22(val, _values, result)
373
- result = [val[0]]
385
+ result = val[0]
374
386
  result
375
387
  end
376
388
  .,.,
377
389
 
378
- module_eval(<<'.,.,', 'parse.y', 88)
390
+ module_eval(<<'.,.,', 'parse.y', 83)
379
391
  def _reduce_23(val, _values, result)
380
- result = val[0] << val[2]
392
+ result = val[0]
381
393
  result
382
394
  end
383
395
  .,.,
384
396
 
385
- module_eval(<<'.,.,', 'parse.y', 90)
397
+ module_eval(<<'.,.,', 'parse.y', 88)
386
398
  def _reduce_24(val, _values, result)
387
- result = val[0]
399
+ result = val[1]
388
400
  result
389
401
  end
390
402
  .,.,
391
403
 
392
- module_eval(<<'.,.,', 'parse.y', 95)
404
+ module_eval(<<'.,.,', 'parse.y', 90)
393
405
  def _reduce_25(val, _values, result)
394
- result = val[0]
406
+ return
395
407
  result
396
408
  end
397
409
  .,.,
398
410
 
399
- module_eval(<<'.,.,', 'parse.y', 97)
411
+ module_eval(<<'.,.,', 'parse.y', 95)
400
412
  def _reduce_26(val, _values, result)
401
- result = val[0]
413
+ result = [val[0]]
402
414
  result
403
415
  end
404
416
  .,.,
405
417
 
406
- module_eval(<<'.,.,', 'parse.y', 99)
418
+ module_eval(<<'.,.,', 'parse.y', 97)
407
419
  def _reduce_27(val, _values, result)
408
- result = val[0]
420
+ result = val[0] << val[2]
409
421
  result
410
422
  end
411
423
  .,.,
412
424
 
413
- module_eval(<<'.,.,', 'parse.y', 101)
425
+ module_eval(<<'.,.,', 'parse.y', 99)
414
426
  def _reduce_28(val, _values, result)
415
- result = val[0]
427
+ result = val[0]
416
428
  result
417
429
  end
418
430
  .,.,
419
431
 
420
- module_eval(<<'.,.,', 'parse.y', 106)
432
+ module_eval(<<'.,.,', 'parse.y', 104)
421
433
  def _reduce_29(val, _values, result)
422
- result = val[0]
434
+ result = val[0]
423
435
  result
424
436
  end
425
437
  .,.,
426
438
 
427
- module_eval(<<'.,.,', 'parse.y', 108)
439
+ module_eval(<<'.,.,', 'parse.y', 106)
428
440
  def _reduce_30(val, _values, result)
429
- result = val[0]
441
+ result = val[0]
442
+ result
443
+ end
444
+ .,.,
445
+
446
+ module_eval(<<'.,.,', 'parse.y', 108)
447
+ def _reduce_31(val, _values, result)
448
+ result = val[0]
449
+ result
450
+ end
451
+ .,.,
452
+
453
+ module_eval(<<'.,.,', 'parse.y', 110)
454
+ def _reduce_32(val, _values, result)
455
+ result = val[0]
456
+ result
457
+ end
458
+ .,.,
459
+
460
+ module_eval(<<'.,.,', 'parse.y', 115)
461
+ def _reduce_33(val, _values, result)
462
+ result = val[0]
463
+ result
464
+ end
465
+ .,.,
466
+
467
+ module_eval(<<'.,.,', 'parse.y', 117)
468
+ def _reduce_34(val, _values, result)
469
+ result = val[0]
430
470
  result
431
471
  end
432
472
  .,.,
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.1.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Castellani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-14 00:00:00.000000000 Z
11
+ date: 2020-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: 2.1.4
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: '1.16'
26
+ version: 2.1.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
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: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 1.4.14
61
+ version: 1.5.0
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: 1.4.14
68
+ version: 1.5.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rex
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -84,19 +84,19 @@ dependencies:
84
84
  name: rexical
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 1.0.5
89
+ version: 1.0.7
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: 1.0.5
96
+ version: 1.0.7
97
97
  description: Hashicorp Configuration Language parser and checker for Ruby
98
98
  email:
99
- - marcelofc.rock@gmail.com
99
+ - marcelo@linux.com
100
100
  executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
@@ -123,7 +123,14 @@ homepage: https://github.com/mfcastellani/hcl-checker
123
123
  licenses:
124
124
  - MIT
125
125
  metadata: {}
126
- post_install_message:
126
+ post_install_message: |2
127
+
128
+ Hello, me again. After several contacts of users of this gem requesting that
129
+ the module name be kept only as HCL, instead of HCL1 and HCL2, I went back and
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
134
  rdoc_options: []
128
135
  require_paths:
129
136
  - lib
@@ -131,15 +138,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
138
  requirements:
132
139
  - - ">="
133
140
  - !ruby/object:Gem::Version
134
- version: '0'
141
+ version: 2.5.0
135
142
  required_rubygems_version: !ruby/object:Gem::Requirement
136
143
  requirements:
137
144
  - - ">="
138
145
  - !ruby/object:Gem::Version
139
146
  version: '0'
140
147
  requirements: []
141
- rubyforge_project:
142
- rubygems_version: 2.7.7
148
+ rubygems_version: 3.0.8
143
149
  signing_key:
144
150
  specification_version: 4
145
151
  summary: Hashicorp Configuration Language parser for Ruby