Module: Dhall::Parser::PosixEnvironmentVariableCharacter

Defined in:
lib/dhall/parser.rb

Constant Summary collapse

ESCAPES =
{
  "\"" => "\"",
  "\\" => "\\",
  "a"  => "\a",
  "b"  => "\b",
  "f"  => "\f",
  "n"  => "\n",
  "r"  => "\r",
  "t"  => "\t",
  "v"  => "\v"
}.freeze

Instance Method Summary collapse

Instance Method Details

#valueObject



609
610
611
612
613
614
615
616
617
# File 'lib/dhall/parser.rb', line 609

def value
  if first&.string == "\\"
    ESCAPES.fetch(matches[1].string) {
      raise "Invalid escape: #{string}"
    }.encode("UTF-16BE")
  else
    string
  end
end