/ruby-hcl

Ruby Parser for the Hashicorp Configuration Language

Primary LanguageRubyMIT LicenseMIT

ruby-hcl

Ruby Parser for the Hashicorp Configuration Language

Lexer

Parser


Hashicorp Configuration Language

Examples

  some_value "other_value" {
    key = "value"
  }

will create a hash which looks like:

{"some_value" => {"other_value" => {"key" => "value"}}}

Ruby-HCL Usage

require 'hcl'
require 'json'

contents = HCLParser.new.parse(File.read("file_to_parse.hcl"))
puts JSON.dump(contents)

TODO

  • Properly handle nested multi-line comments
  • Properly handle floating point values
  • Create a HCL class as an to load/dump/parse HCL files
  • Write tests for the lexer
  • Write tests for the parser