hcl-checker 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +19 -19
- data/hcl-checker.gemspec +2 -2
- data/lib/hcl/checker/version.rb +1 -1
- data/lib/hcl/lexer.rb +87 -86
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 247e05cab60fd6767963cf61fe8f2ad29eaf0b846188190abbfad18622a0ed24
|
4
|
+
data.tar.gz: b21ba731c3f5900733d6558a14f88f2a58f09c9bea0f1e679a08f771cced6678
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad59851141be917a28be85d9d18ca41ce436a966b37a6cf9e71ee81b67e24d456d909d89a0785066eb23b740bc6319321b5d7f0aa38212486ca1b82ed2196d32
|
7
|
+
data.tar.gz: 7e5446473d11b96397c9c3d7471de1c165f279109e5f84005dada493ddb939443f2fa345f17c5490b39137761a9c61dfdf2af65008e141b62f28c5ff0c4517ba
|
data/Gemfile
CHANGED
@@ -7,7 +7,7 @@ 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 "nokogiri", ">= 1.10.
|
10
|
+
gem "nokogiri", ">= 1.10.8"
|
11
11
|
|
12
12
|
|
13
13
|
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
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.3.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -10,13 +10,13 @@ GEM
|
|
10
10
|
filesize (0.2.0)
|
11
11
|
jsobfu (0.4.2)
|
12
12
|
rkelly-remix
|
13
|
-
json (2.
|
13
|
+
json (2.3.0)
|
14
14
|
metasm (1.0.4)
|
15
15
|
mini_portile2 (2.4.0)
|
16
|
-
nokogiri (1.10.
|
16
|
+
nokogiri (1.10.9)
|
17
17
|
mini_portile2 (~> 2.4.0)
|
18
18
|
racc (1.4.14)
|
19
|
-
rake (
|
19
|
+
rake (12.3.3)
|
20
20
|
rb-readline (0.5.5)
|
21
21
|
rex (2.0.12)
|
22
22
|
filesize (~> 0)
|
@@ -27,32 +27,32 @@ GEM
|
|
27
27
|
rb-readline (~> 0)
|
28
28
|
rexical (1.0.7)
|
29
29
|
rkelly-remix (0.0.7)
|
30
|
-
rspec (3.
|
31
|
-
rspec-core (~> 3.
|
32
|
-
rspec-expectations (~> 3.
|
33
|
-
rspec-mocks (~> 3.
|
34
|
-
rspec-core (3.
|
35
|
-
rspec-support (~> 3.
|
36
|
-
rspec-expectations (3.
|
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.1)
|
35
|
+
rspec-support (~> 3.9.1)
|
36
|
+
rspec-expectations (3.9.1)
|
37
37
|
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
-
rspec-support (~> 3.
|
39
|
-
rspec-mocks (3.
|
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.
|
42
|
-
rspec-support (3.
|
41
|
+
rspec-support (~> 3.9.0)
|
42
|
+
rspec-support (3.9.2)
|
43
43
|
|
44
44
|
PLATFORMS
|
45
45
|
ruby
|
46
46
|
|
47
47
|
DEPENDENCIES
|
48
|
-
bundler (~> 2.
|
48
|
+
bundler (~> 2.1.4)
|
49
49
|
hcl-checker!
|
50
|
-
nokogiri (>= 1.10.
|
50
|
+
nokogiri (>= 1.10.8)
|
51
51
|
racc (= 1.4.14)
|
52
|
-
rake (~>
|
52
|
+
rake (~> 12.3.3)
|
53
53
|
rex (= 2.0.12)
|
54
54
|
rexical (>= 1.0.7)
|
55
55
|
rspec (~> 3.0)
|
56
56
|
|
57
57
|
BUNDLED WITH
|
58
|
-
2.
|
58
|
+
2.1.4
|
data/hcl-checker.gemspec
CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
end
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
22
|
-
spec.add_development_dependency 'rake', '~>
|
21
|
+
spec.add_development_dependency 'bundler', '~> 2.1.4'
|
22
|
+
spec.add_development_dependency 'rake', '~> 12.3.3'
|
23
23
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
24
24
|
spec.add_development_dependency 'racc', '1.4.14'
|
25
25
|
spec.add_development_dependency 'rex', '2.0.12'
|
data/lib/hcl/checker/version.rb
CHANGED
data/lib/hcl/lexer.rb
CHANGED
@@ -1,123 +1,124 @@
|
|
1
1
|
#--
|
2
2
|
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by rex 1.0.
|
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
|
-
|
9
|
+
require 'strscan'
|
10
10
|
|
11
|
-
|
11
|
+
class ScanError < StandardError ; end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
attr_reader :lineno
|
14
|
+
attr_reader :filename
|
15
|
+
attr_accessor :state
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
def scan_setup(str)
|
18
|
+
@ss = StringScanner.new(str)
|
19
|
+
@lineno = 1
|
20
|
+
@state = nil
|
21
|
+
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
def action
|
24
|
+
yield
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
def scan_str(str)
|
28
|
+
scan_setup(str)
|
29
|
+
do_parse
|
30
|
+
end
|
31
|
+
alias :scan :scan_str
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
def scan_file( filename )
|
41
|
+
load_file(filename)
|
42
|
+
do_parse
|
43
|
+
end
|
44
44
|
|
45
45
|
|
46
|
-
|
47
|
-
|
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
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
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
|
-
|
67
|
-
|
63
|
+
when (text = @ss.scan(/\#.*|\/\/.*$/))
|
64
|
+
;
|
68
65
|
|
69
|
-
|
70
|
-
|
66
|
+
when (text = @ss.scan(/\n|\r/))
|
67
|
+
;
|
71
68
|
|
72
|
-
|
73
|
-
|
69
|
+
when (text = @ss.scan(/\/\*/))
|
70
|
+
action { consume_comment(text) }
|
74
71
|
|
75
|
-
|
76
|
-
|
72
|
+
when (text = @ss.scan(/true|false/))
|
73
|
+
action { [:BOOL, to_boolean(text)]}
|
77
74
|
|
78
|
-
|
79
|
-
|
75
|
+
when (text = @ss.scan(/\-?\d+\.\d+/))
|
76
|
+
action { [:FLOAT, text.to_f] }
|
80
77
|
|
81
|
-
|
82
|
-
|
78
|
+
when (text = @ss.scan(/-?\d+/))
|
79
|
+
action { [:NUMBER, text.to_i] }
|
83
80
|
|
84
|
-
|
85
|
-
|
81
|
+
when (text = @ss.scan(/\"/))
|
82
|
+
action { [:STRING, consume_string(text)] }
|
86
83
|
|
87
|
-
|
88
|
-
|
84
|
+
when (text = @ss.scan(/\<<\-?/))
|
85
|
+
action { [:STRING, consume_heredoc] }
|
89
86
|
|
90
|
-
|
91
|
-
|
87
|
+
when (text = @ss.scan(/\{/))
|
88
|
+
action { [:LEFTBRACE, text]}
|
92
89
|
|
93
|
-
|
94
|
-
|
90
|
+
when (text = @ss.scan(/\}/))
|
91
|
+
action { [:RIGHTBRACE, text]}
|
95
92
|
|
96
|
-
|
97
|
-
|
93
|
+
when (text = @ss.scan(/\[/))
|
94
|
+
action { [:LEFTBRACKET, text]}
|
98
95
|
|
99
|
-
|
100
|
-
|
96
|
+
when (text = @ss.scan(/\]/))
|
97
|
+
action { [:RIGHTBRACKET, text]}
|
101
98
|
|
102
|
-
|
103
|
-
|
99
|
+
when (text = @ss.scan(/\,/))
|
100
|
+
action { [:COMMA, text]}
|
104
101
|
|
105
|
-
|
106
|
-
|
102
|
+
when (text = @ss.scan(/[a-zA-Z_][a-zA-Z0-9_\-\.]*/))
|
103
|
+
action { [:IDENTIFIER, text]}
|
107
104
|
|
108
|
-
|
109
|
-
|
105
|
+
when (text = @ss.scan(/\=/))
|
106
|
+
action { [:EQUAL, text]}
|
110
107
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
108
|
+
when (text = @ss.scan(/\-/))
|
109
|
+
action { [:MINUS, text]}
|
110
|
+
|
111
|
+
|
112
|
+
else
|
113
|
+
text = @ss.string[@ss.pos .. -1]
|
114
|
+
raise ScanError, "can not match: '" + text + "'"
|
115
|
+
end # if
|
116
|
+
|
117
|
+
else
|
118
|
+
raise ScanError, "undefined state: '" + state.to_s + "'"
|
119
|
+
end # case state
|
120
|
+
token
|
121
|
+
end # def _next_token
|
121
122
|
|
122
123
|
def lex(input)
|
123
124
|
scan_setup(input)
|
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.3.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:
|
11
|
+
date: 2020-05-18 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: 2.
|
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: 2.
|
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:
|
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:
|
40
|
+
version: 12.3.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,8 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
|
-
|
142
|
-
rubygems_version: 2.7.6.2
|
141
|
+
rubygems_version: 3.0.1
|
143
142
|
signing_key:
|
144
143
|
specification_version: 4
|
145
144
|
summary: Hashicorp Configuration Language parser for Ruby
|