Commit 6d74beb

mo khan <mo@mokhan.ca>
2021-06-06 22:37:19
fix: parse ${variables} from strings main
1 parent 1d35f4c
Changed files (2)
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
 
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