From 6d74beb34775a401c7c824248b80422b2597e437 Mon Sep 17 00:00:00 2001 From: mo khan Date: Sun, 6 Jun 2021 16:37:19 -0600 Subject: fix: parse ${variables} from strings --- lib/hcl2/parser.rb | 3 ++- spec/parser_spec.rb | 2 +- 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 -- cgit v1.2.3