From 5f399393e6c7c3df810cd53793f9ddba5cbcfabd Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sat, 27 Apr 2019 21:10:47 -0500 Subject: [PATCH] Update to dhall-lang 7.0.0 --- dhall-lang | 2 +- lib/dhall/parser.rb | 21 ++++++++++++--------- scripts/generate_citrus_parser.rb | 13 +++---------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/dhall-lang b/dhall-lang index 588741c..f0509b4 160000 --- a/dhall-lang +++ b/dhall-lang @@ -1 +1 @@ -Subproject commit 588741c181225bb82eddd325ea1caf105d4745ce +Subproject commit f0509b403ace4b8a72ebb5fa9c473b9aeabeaf33 diff --git a/lib/dhall/parser.rb b/lib/dhall/parser.rb index fd8c4bb..6fe46b3 100644 --- a/lib/dhall/parser.rb +++ b/lib/dhall/parser.rb @@ -318,18 +318,21 @@ module Dhall end end - module Identifier + module Variable def value - name = capture(:any_label).value + Dhall::Variable.new( + name: capture(:nonreserved_label).value, + index: capture(:natural_literal)&.string.to_i + ) + end + end - return Dhall::Bool.new(value: true) if name == "True" - return Dhall::Bool.new(value: false) if name == "False" + module Builtin + def value + return Dhall::Bool.new(value: true) if string == "True" + return Dhall::Bool.new(value: false) if string == "False" - (!name.quoted? && Dhall::Builtins[name.to_sym]) || - Variable.new( - name: name, - index: capture(:natural_literal)&.string.to_i - ) + Dhall::Builtins[string.to_sym] end end diff --git a/scripts/generate_citrus_parser.rb b/scripts/generate_citrus_parser.rb index d047fc9..94a5c63 100644 --- a/scripts/generate_citrus_parser.rb +++ b/scripts/generate_citrus_parser.rb @@ -118,8 +118,8 @@ class RuleFormatter end if name == :"nonreserved-label" - return "reserved_identifier simple_label_next_char+ | " \ - "!reserved_identifier label" + return "builtin simple_label_next_char+ | " \ + "!builtin label" end case rule @@ -169,7 +169,7 @@ abnf.each do |name, rule| puts "rule #{name.to_s.tr("-", "_")}" print "\t(#{formatter.format_rule(name, rule)})" extension = name.to_s.split(/-/).map(&:capitalize).join - if Dhall::Parser.const_defined?(extension) + if Dhall::Parser.const_defined?(extension, false) puts " " else puts @@ -177,11 +177,4 @@ abnf.each do |name, rule| puts "end" end -puts "rule reserved_identifier" -print "\t" -puts Dhall::Builtins.constants.map { |name| - "\"#{name.to_s.tr("_", "/")}\"" -}.join(" |\n\t") -puts "end" - puts "end" -- 2.38.5