M dhall-lang => dhall-lang +1 -1
@@ 1,1 1,1 @@
-Subproject commit 588741c181225bb82eddd325ea1caf105d4745ce
+Subproject commit f0509b403ace4b8a72ebb5fa9c473b9aeabeaf33
M lib/dhall/parser.rb => lib/dhall/parser.rb +12 -9
@@ 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
M scripts/generate_citrus_parser.rb => scripts/generate_citrus_parser.rb +3 -10
@@ 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 " <Dhall::Parser::#{extension}>"
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"