summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2021-06-06 16:37:19 -0600
committermo khan <mo@mokhan.ca>2021-06-06 16:37:19 -0600
commit6d74beb34775a401c7c824248b80422b2597e437 (patch)
tree7672554edeba557a82ce5e2e519975d862081e25
parent1d35f4c6fc2a3133021f366b0917067435c4bffb (diff)
fix: parse ${variables} from stringsmain
-rw-r--r--lib/hcl2/parser.rb3
-rw-r--r--spec/parser_spec.rb2
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/hcl2/parser.rb b/lib/hcl2/parser.rb
index 58f6c21..4e24f81 100644
--- a/lib/hcl2/parser.rb
+++ b/lib/hcl2/parser.rb
@@ -9,6 +9,7 @@ module Hcl2
rule(:comment) { (str("#") | str("//")) >> ((str("\n") >> str("\r").maybe).absent? >> any).repeat >> eol }
rule(:crlf) { match('[\r\n]') }
rule(:digit) { match('\d') }
+ rule(:dollar) { str("$") }
rule(:dot) { str(".") }
rule(:eol) { whitespace? >> crlf.repeat }
rule(:greater_than_or_equal_to) { str(">=") }
@@ -65,7 +66,7 @@ module Hcl2
rule :string do
quote >> (
- digit | dot | alpha | str("~> ") | slash | colon | assign | plus | hyphen | question_mark | assign
+ digit | dot | alpha | str("~> ") | slash | colon | assign | plus | hyphen | question_mark | assign | lcurly | rcurly | dollar
).repeat(1).as(:value) >> quote
end
diff --git a/spec/parser_spec.rb b/spec/parser_spec.rb
index 023dfe9..b911494 100644
--- a/spec/parser_spec.rb
+++ b/spec/parser_spec.rb
@@ -153,7 +153,7 @@ RSpec.describe Hcl2::Parser do
HCL
end
- pending { expect(subject).to be_truthy }
+ specify { expect(subject).to be_truthy }
end
context "when parsing a module with an argument assigned to a single line array declaration" do