hcl-checker 1.1.1 → 1.6.0
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 +4 -4
- data/.rubocop.yml +32 -0
- data/Gemfile +3 -4
- data/Gemfile.lock +29 -28
- data/README.md +3 -5
- data/Rakefile +7 -8
- data/assets/lexer.rex +25 -20
- data/assets/parse.y +39 -16
- data/bin/console +3 -3
- data/hcl-checker.gemspec +18 -7
- data/lib/hcl/checker.rb +27 -14
- data/lib/hcl/checker/lexer.rb +182 -0
- data/lib/hcl/checker/parser.rb +496 -0
- data/lib/hcl/checker/version.rb +1 -1
- metadata +37 -34
- data/lib/hcl/lexer.rb +0 -174
- data/lib/hcl/parser.rb +0 -438
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,93 +16,94 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
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:
|
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
|
100
100
|
executables: []
|
101
101
|
extensions: []
|
102
102
|
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,14 +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
|
+
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"
|
127
131
|
rdoc_options: []
|
128
132
|
require_paths:
|
129
133
|
- lib
|
@@ -131,16 +135,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
135
|
requirements:
|
132
136
|
- - ">="
|
133
137
|
- !ruby/object:Gem::Version
|
134
|
-
version:
|
138
|
+
version: 2.5.0
|
135
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
140
|
requirements:
|
137
141
|
- - ">="
|
138
142
|
- !ruby/object:Gem::Version
|
139
143
|
version: '0'
|
140
144
|
requirements: []
|
141
|
-
|
142
|
-
|
143
|
-
signing_key:
|
145
|
+
rubygems_version: 3.2.3
|
146
|
+
signing_key:
|
144
147
|
specification_version: 4
|
145
148
|
summary: Hashicorp Configuration Language parser for Ruby
|
146
149
|
test_files: []
|
data/lib/hcl/lexer.rb
DELETED
@@ -1,174 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by rex 1.0.5
|
4
|
-
# from lexical definition file "./assets/lexer.rex".
|
5
|
-
#++
|
6
|
-
|
7
|
-
|
8
|
-
class HCLLexer
|
9
|
-
require 'strscan'
|
10
|
-
|
11
|
-
class ScanError < StandardError ; end
|
12
|
-
|
13
|
-
attr_reader :lineno
|
14
|
-
attr_reader :filename
|
15
|
-
attr_accessor :state
|
16
|
-
|
17
|
-
def scan_setup(str)
|
18
|
-
@ss = StringScanner.new(str)
|
19
|
-
@lineno = 1
|
20
|
-
@state = nil
|
21
|
-
end
|
22
|
-
|
23
|
-
def action
|
24
|
-
yield
|
25
|
-
end
|
26
|
-
|
27
|
-
def scan_str(str)
|
28
|
-
scan_setup(str)
|
29
|
-
do_parse
|
30
|
-
end
|
31
|
-
alias :scan :scan_str
|
32
|
-
|
33
|
-
def load_file( filename )
|
34
|
-
@filename = filename
|
35
|
-
open(filename, "r") do |f|
|
36
|
-
scan_setup(f.read)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def scan_file( filename )
|
41
|
-
load_file(filename)
|
42
|
-
do_parse
|
43
|
-
end
|
44
|
-
|
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
|
53
|
-
|
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
|
-
;
|
62
|
-
|
63
|
-
when (text = @ss.scan(/\#.*|\/\/.*$/))
|
64
|
-
;
|
65
|
-
|
66
|
-
when (text = @ss.scan(/\n|\r/))
|
67
|
-
;
|
68
|
-
|
69
|
-
when (text = @ss.scan(/\/\*/))
|
70
|
-
action { consume_comment(text) }
|
71
|
-
|
72
|
-
when (text = @ss.scan(/true|false/))
|
73
|
-
action { [:BOOL, to_boolean(text)]}
|
74
|
-
|
75
|
-
when (text = @ss.scan(/\-?\d+\.\d+/))
|
76
|
-
action { [:FLOAT, text.to_f] }
|
77
|
-
|
78
|
-
when (text = @ss.scan(/-?\d+/))
|
79
|
-
action { [:NUMBER, text.to_i] }
|
80
|
-
|
81
|
-
when (text = @ss.scan(/\"/))
|
82
|
-
action { [:STRING, consume_string(text)] }
|
83
|
-
|
84
|
-
when (text = @ss.scan(/\<<-/))
|
85
|
-
action { [:STRING, consume_heredoc] }
|
86
|
-
|
87
|
-
when (text = @ss.scan(/\{/))
|
88
|
-
action { [:LEFTBRACE, text]}
|
89
|
-
|
90
|
-
when (text = @ss.scan(/\}/))
|
91
|
-
action { [:RIGHTBRACE, text]}
|
92
|
-
|
93
|
-
when (text = @ss.scan(/\[/))
|
94
|
-
action { [:LEFTBRACKET, text]}
|
95
|
-
|
96
|
-
when (text = @ss.scan(/\]/))
|
97
|
-
action { [:RIGHTBRACKET, text]}
|
98
|
-
|
99
|
-
when (text = @ss.scan(/\,/))
|
100
|
-
action { [:COMMA, text]}
|
101
|
-
|
102
|
-
when (text = @ss.scan(/[a-zA-Z_][a-zA-Z0-9_\-\.]*/))
|
103
|
-
action { [:IDENTIFIER, text]}
|
104
|
-
|
105
|
-
when (text = @ss.scan(/\=/))
|
106
|
-
action { [:EQUAL, text]}
|
107
|
-
|
108
|
-
when (text = @ss.scan(/\-/))
|
109
|
-
action { [:MINUS, text]}
|
110
|
-
|
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
|
121
|
-
|
122
|
-
def lex(input)
|
123
|
-
scan_setup(input)
|
124
|
-
tokens = []
|
125
|
-
while token = next_token
|
126
|
-
tokens << token
|
127
|
-
end
|
128
|
-
tokens
|
129
|
-
end
|
130
|
-
def to_boolean(input)
|
131
|
-
input =
|
132
|
-
if input =~ /true/
|
133
|
-
true
|
134
|
-
elsif input =~ /false/
|
135
|
-
false
|
136
|
-
end
|
137
|
-
return input
|
138
|
-
end
|
139
|
-
def consume_comment(input)
|
140
|
-
nested = 1
|
141
|
-
until nested.zero?
|
142
|
-
case(text = @ss.scan_until(%r{/\*|\*/|\z}) )
|
143
|
-
when %r{/\*\z}
|
144
|
-
nested =+ 1
|
145
|
-
when %r{\*/\z}
|
146
|
-
nested -= 1
|
147
|
-
else
|
148
|
-
break
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|
152
|
-
def consume_string(input)
|
153
|
-
result = ''
|
154
|
-
nested = 0
|
155
|
-
begin
|
156
|
-
case(text = @ss.scan_until(%r{\"|\$\{|\}|\\}))
|
157
|
-
when %r{\$\{\z}
|
158
|
-
nested += 1
|
159
|
-
when %r{\}\z}
|
160
|
-
nested -= 1 if nested > 0
|
161
|
-
when %r{\\\z}
|
162
|
-
result += text.chop + @ss.getch
|
163
|
-
next
|
164
|
-
end
|
165
|
-
result += text.to_s
|
166
|
-
end until nested == 0 && text =~ %r{\"\z}
|
167
|
-
result.chop
|
168
|
-
end
|
169
|
-
def consume_heredoc
|
170
|
-
token = Regexp.new @ss.scan_until(%r{\n})
|
171
|
-
document = @ss.scan_until(token)
|
172
|
-
document.chop
|
173
|
-
end
|
174
|
-
end # class
|
data/lib/hcl/parser.rb
DELETED
@@ -1,438 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# DO NOT MODIFY!!!!
|
3
|
-
# This file is automatically generated by Racc 1.4.14
|
4
|
-
# from Racc grammer file "".
|
5
|
-
#
|
6
|
-
|
7
|
-
require 'racc/parser.rb'
|
8
|
-
|
9
|
-
require_relative './lexer'
|
10
|
-
|
11
|
-
class HCLParser < Racc::Parser
|
12
|
-
|
13
|
-
module_eval(<<'...end parse.y/module_eval...', 'parse.y', 119)
|
14
|
-
#//
|
15
|
-
#// HCL is unclear on what one should do when duplicate
|
16
|
-
#// keys are encountered.
|
17
|
-
#//
|
18
|
-
#// from decoder.go: if we're at the root or we're directly within
|
19
|
-
#// a list, decode to hashes, otherwise lists
|
20
|
-
#//
|
21
|
-
#// from object.go: there is a flattened list structure
|
22
|
-
#//
|
23
|
-
def flatten_objectlist(list)
|
24
|
-
list.each_with_object({}) do |a, h|
|
25
|
-
h[a.first] =
|
26
|
-
case a.last
|
27
|
-
when Hash
|
28
|
-
deep_merge(h[a.first] || {}, a.last)
|
29
|
-
else
|
30
|
-
h[a.first] = a.last
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
def on_error(error_token_id, error_value, value_stack)
|
37
|
-
error_message = value_stack.to_s.split(',').last.gsub(']', '')
|
38
|
-
header = "Parse error at #{error_message} #{error_value} (invalid token: #{error_value})"
|
39
|
-
raise Racc::ParseError, header
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
def parse(input)
|
44
|
-
@lexer = HCLLexer.new.lex(input)
|
45
|
-
do_parse
|
46
|
-
return @result
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
def next_token
|
51
|
-
@lexer.shift
|
52
|
-
end
|
53
|
-
|
54
|
-
def deep_merge(hash1, hash2)
|
55
|
-
hash2.keys.each do |key|
|
56
|
-
value1 = hash1[key]
|
57
|
-
value2 = hash2[key]
|
58
|
-
|
59
|
-
if value1.is_a?(Hash) && value2.is_a?(Hash)
|
60
|
-
hash1[key] = deep_merge(value1, value2)
|
61
|
-
else
|
62
|
-
hash1[key] = value2
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
hash1
|
67
|
-
end
|
68
|
-
...end parse.y/module_eval...
|
69
|
-
##### State transition tables begin ###
|
70
|
-
|
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 ]
|
76
|
-
|
77
|
-
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 ]
|
82
|
-
|
83
|
-
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 ]
|
88
|
-
|
89
|
-
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 ]
|
94
|
-
|
95
|
-
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 ]
|
99
|
-
|
100
|
-
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 ]
|
104
|
-
|
105
|
-
racc_goto_pointer = [
|
106
|
-
nil, 9, 8, 3, -3, -7, nil, -5, -2, -5,
|
107
|
-
nil, -18, -23 ]
|
108
|
-
|
109
|
-
racc_goto_default = [
|
110
|
-
nil, nil, nil, nil, 4, 35, 7, 32, 34, 8,
|
111
|
-
9, nil, nil ]
|
112
|
-
|
113
|
-
racc_reduce_table = [
|
114
|
-
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,
|
120
|
-
3, 23, :_reduce_6,
|
121
|
-
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
|
149
|
-
|
150
|
-
racc_token_table = {
|
151
|
-
false => 0,
|
152
|
-
:error => 1,
|
153
|
-
:BOOL => 2,
|
154
|
-
:FLOAT => 3,
|
155
|
-
:NUMBER => 4,
|
156
|
-
:COMMA => 5,
|
157
|
-
:COMMAEND => 6,
|
158
|
-
:IDENTIFIER => 7,
|
159
|
-
:EQUAL => 8,
|
160
|
-
:STRING => 9,
|
161
|
-
:MINUS => 10,
|
162
|
-
:LEFTBRACE => 11,
|
163
|
-
:RIGHTBRACE => 12,
|
164
|
-
:LEFTBRACKET => 13,
|
165
|
-
:RIGHTBRACKET => 14,
|
166
|
-
:PERIOD => 15,
|
167
|
-
:EPLUS => 16,
|
168
|
-
:EMINUS => 17 }
|
169
|
-
|
170
|
-
racc_nt_base = 18
|
171
|
-
|
172
|
-
racc_use_result_var = true
|
173
|
-
|
174
|
-
Racc_arg = [
|
175
|
-
racc_action_table,
|
176
|
-
racc_action_check,
|
177
|
-
racc_action_default,
|
178
|
-
racc_action_pointer,
|
179
|
-
racc_goto_table,
|
180
|
-
racc_goto_check,
|
181
|
-
racc_goto_default,
|
182
|
-
racc_goto_pointer,
|
183
|
-
racc_nt_base,
|
184
|
-
racc_reduce_table,
|
185
|
-
racc_token_table,
|
186
|
-
racc_shift_n,
|
187
|
-
racc_reduce_n,
|
188
|
-
racc_use_result_var ]
|
189
|
-
|
190
|
-
Racc_token_to_s_table = [
|
191
|
-
"$end",
|
192
|
-
"error",
|
193
|
-
"BOOL",
|
194
|
-
"FLOAT",
|
195
|
-
"NUMBER",
|
196
|
-
"COMMA",
|
197
|
-
"COMMAEND",
|
198
|
-
"IDENTIFIER",
|
199
|
-
"EQUAL",
|
200
|
-
"STRING",
|
201
|
-
"MINUS",
|
202
|
-
"LEFTBRACE",
|
203
|
-
"RIGHTBRACE",
|
204
|
-
"LEFTBRACKET",
|
205
|
-
"RIGHTBRACKET",
|
206
|
-
"PERIOD",
|
207
|
-
"EPLUS",
|
208
|
-
"EMINUS",
|
209
|
-
"$start",
|
210
|
-
"target",
|
211
|
-
"top",
|
212
|
-
"objectlist",
|
213
|
-
"objectitem",
|
214
|
-
"object",
|
215
|
-
"objectkey",
|
216
|
-
"number",
|
217
|
-
"list",
|
218
|
-
"block",
|
219
|
-
"block_id",
|
220
|
-
"listitems",
|
221
|
-
"listitem" ]
|
222
|
-
|
223
|
-
Racc_debug_parser = false
|
224
|
-
|
225
|
-
##### State transition tables end #####
|
226
|
-
|
227
|
-
# reduce 0 omitted
|
228
|
-
|
229
|
-
module_eval(<<'.,.,', 'parse.y', 19)
|
230
|
-
def _reduce_1(val, _values, result)
|
231
|
-
@result = flatten_objectlist(val[0])
|
232
|
-
result
|
233
|
-
end
|
234
|
-
.,.,
|
235
|
-
|
236
|
-
module_eval(<<'.,.,', 'parse.y', 22)
|
237
|
-
def _reduce_2(val, _values, result)
|
238
|
-
result = val[0]
|
239
|
-
result
|
240
|
-
end
|
241
|
-
.,.,
|
242
|
-
|
243
|
-
# reduce 3 omitted
|
244
|
-
|
245
|
-
module_eval(<<'.,.,', 'parse.y', 29)
|
246
|
-
def _reduce_4(val, _values, result)
|
247
|
-
result = [val[0]]
|
248
|
-
result
|
249
|
-
end
|
250
|
-
.,.,
|
251
|
-
|
252
|
-
module_eval(<<'.,.,', 'parse.y', 31)
|
253
|
-
def _reduce_5(val, _values, result)
|
254
|
-
result = val[0] << val[1]
|
255
|
-
result
|
256
|
-
end
|
257
|
-
.,.,
|
258
|
-
|
259
|
-
module_eval(<<'.,.,', 'parse.y', 36)
|
260
|
-
def _reduce_6(val, _values, result)
|
261
|
-
result = flatten_objectlist(val[1])
|
262
|
-
result
|
263
|
-
end
|
264
|
-
.,.,
|
265
|
-
|
266
|
-
module_eval(<<'.,.,', 'parse.y', 38)
|
267
|
-
def _reduce_7(val, _values, result)
|
268
|
-
return
|
269
|
-
result
|
270
|
-
end
|
271
|
-
.,.,
|
272
|
-
|
273
|
-
module_eval(<<'.,.,', 'parse.y', 43)
|
274
|
-
def _reduce_8(val, _values, result)
|
275
|
-
result = val[0]
|
276
|
-
result
|
277
|
-
end
|
278
|
-
.,.,
|
279
|
-
|
280
|
-
module_eval(<<'.,.,', 'parse.y', 45)
|
281
|
-
def _reduce_9(val, _values, result)
|
282
|
-
result = val[0]
|
283
|
-
result
|
284
|
-
end
|
285
|
-
.,.,
|
286
|
-
|
287
|
-
module_eval(<<'.,.,', 'parse.y', 50)
|
288
|
-
def _reduce_10(val, _values, result)
|
289
|
-
result = val[0], val[2]
|
290
|
-
result
|
291
|
-
end
|
292
|
-
.,.,
|
293
|
-
|
294
|
-
module_eval(<<'.,.,', 'parse.y', 52)
|
295
|
-
def _reduce_11(val, _values, result)
|
296
|
-
result = val[0], val[2]
|
297
|
-
result
|
298
|
-
end
|
299
|
-
.,.,
|
300
|
-
|
301
|
-
module_eval(<<'.,.,', 'parse.y', 54)
|
302
|
-
def _reduce_12(val, _values, result)
|
303
|
-
result = val[0], val[2]
|
304
|
-
result
|
305
|
-
end
|
306
|
-
.,.,
|
307
|
-
|
308
|
-
module_eval(<<'.,.,', 'parse.y', 56)
|
309
|
-
def _reduce_13(val, _values, result)
|
310
|
-
result = val[0], val[2]
|
311
|
-
result
|
312
|
-
end
|
313
|
-
.,.,
|
314
|
-
|
315
|
-
module_eval(<<'.,.,', 'parse.y', 58)
|
316
|
-
def _reduce_14(val, _values, result)
|
317
|
-
result = val[0], val[2]
|
318
|
-
result
|
319
|
-
end
|
320
|
-
.,.,
|
321
|
-
|
322
|
-
module_eval(<<'.,.,', 'parse.y', 60)
|
323
|
-
def _reduce_15(val, _values, result)
|
324
|
-
result = val[0]
|
325
|
-
result
|
326
|
-
end
|
327
|
-
.,.,
|
328
|
-
|
329
|
-
module_eval(<<'.,.,', 'parse.y', 65)
|
330
|
-
def _reduce_16(val, _values, result)
|
331
|
-
result = val[0], val[1]
|
332
|
-
result
|
333
|
-
end
|
334
|
-
.,.,
|
335
|
-
|
336
|
-
module_eval(<<'.,.,', 'parse.y', 67)
|
337
|
-
def _reduce_17(val, _values, result)
|
338
|
-
result = val[0], {val[1][0] => val[1][1]}
|
339
|
-
result
|
340
|
-
end
|
341
|
-
.,.,
|
342
|
-
|
343
|
-
module_eval(<<'.,.,', 'parse.y', 72)
|
344
|
-
def _reduce_18(val, _values, result)
|
345
|
-
result = val[0]
|
346
|
-
result
|
347
|
-
end
|
348
|
-
.,.,
|
349
|
-
|
350
|
-
module_eval(<<'.,.,', 'parse.y', 74)
|
351
|
-
def _reduce_19(val, _values, result)
|
352
|
-
result = val[0]
|
353
|
-
result
|
354
|
-
end
|
355
|
-
.,.,
|
356
|
-
|
357
|
-
module_eval(<<'.,.,', 'parse.y', 79)
|
358
|
-
def _reduce_20(val, _values, result)
|
359
|
-
result = val[1]
|
360
|
-
result
|
361
|
-
end
|
362
|
-
.,.,
|
363
|
-
|
364
|
-
module_eval(<<'.,.,', 'parse.y', 81)
|
365
|
-
def _reduce_21(val, _values, result)
|
366
|
-
return
|
367
|
-
result
|
368
|
-
end
|
369
|
-
.,.,
|
370
|
-
|
371
|
-
module_eval(<<'.,.,', 'parse.y', 86)
|
372
|
-
def _reduce_22(val, _values, result)
|
373
|
-
result = [val[0]]
|
374
|
-
result
|
375
|
-
end
|
376
|
-
.,.,
|
377
|
-
|
378
|
-
module_eval(<<'.,.,', 'parse.y', 88)
|
379
|
-
def _reduce_23(val, _values, result)
|
380
|
-
result = val[0] << val[2]
|
381
|
-
result
|
382
|
-
end
|
383
|
-
.,.,
|
384
|
-
|
385
|
-
module_eval(<<'.,.,', 'parse.y', 90)
|
386
|
-
def _reduce_24(val, _values, result)
|
387
|
-
result = val[0]
|
388
|
-
result
|
389
|
-
end
|
390
|
-
.,.,
|
391
|
-
|
392
|
-
module_eval(<<'.,.,', 'parse.y', 95)
|
393
|
-
def _reduce_25(val, _values, result)
|
394
|
-
result = val[0]
|
395
|
-
result
|
396
|
-
end
|
397
|
-
.,.,
|
398
|
-
|
399
|
-
module_eval(<<'.,.,', 'parse.y', 97)
|
400
|
-
def _reduce_26(val, _values, result)
|
401
|
-
result = val[0]
|
402
|
-
result
|
403
|
-
end
|
404
|
-
.,.,
|
405
|
-
|
406
|
-
module_eval(<<'.,.,', 'parse.y', 99)
|
407
|
-
def _reduce_27(val, _values, result)
|
408
|
-
result = val[0]
|
409
|
-
result
|
410
|
-
end
|
411
|
-
.,.,
|
412
|
-
|
413
|
-
module_eval(<<'.,.,', 'parse.y', 101)
|
414
|
-
def _reduce_28(val, _values, result)
|
415
|
-
result = val[0]
|
416
|
-
result
|
417
|
-
end
|
418
|
-
.,.,
|
419
|
-
|
420
|
-
module_eval(<<'.,.,', 'parse.y', 106)
|
421
|
-
def _reduce_29(val, _values, result)
|
422
|
-
result = val[0]
|
423
|
-
result
|
424
|
-
end
|
425
|
-
.,.,
|
426
|
-
|
427
|
-
module_eval(<<'.,.,', 'parse.y', 108)
|
428
|
-
def _reduce_30(val, _values, result)
|
429
|
-
result = val[0]
|
430
|
-
result
|
431
|
-
end
|
432
|
-
.,.,
|
433
|
-
|
434
|
-
def _reduce_none(val, _values, result)
|
435
|
-
val[0]
|
436
|
-
end
|
437
|
-
|
438
|
-
end # class HCLParser
|