M lib/dhall/parser.rb => lib/dhall/parser.rb +3 -1
@@ 314,7 314,9 @@ module Dhall
module SingleQuoteLiteral
def value
- chunks = capture(:single_quote_continue).value
+ chunks = capture(:single_quote_continue).value.flat_map { |chunk|
+ chunk.is_a?(String) ? chunk.chars : chunk
+ }
indent = Util.indent_size(chunks.join)
TextLiteral.for(
M scripts/generate_citrus_parser.rb => scripts/generate_citrus_parser.rb +9 -0
@@ 127,6 127,14 @@ class RuleFormatter
"(block_comment block_comment_continue)"
end
+ if name == :"single-quote-continue"
+ return "single_quote_char+ single_quote_continue | " \
+ "interpolation single_quote_continue | " \
+ "escaped_quote_pair single_quote_continue | " \
+ "escaped_interpolation single_quote_continue | " \
+ "\"''\""
+ end
+
case rule
when ABNF::Term
Terminal.new(@abnf.regexp(name))
@@ 174,6 182,7 @@ abnf.each do |name, rule|
puts "rule #{name.to_s.tr("-", "_")}"
print "\t"
print "!(\"{-\" | \"-}\") " if name == :"block-comment-char"
+ print "!(\"${\" | \"''\") " if name == :"single-quote-char"
print "(#{formatter.format_rule(name, rule)})"
extension = name.to_s.split(/-/).map(&:capitalize).join
if Dhall::Parser.const_defined?(extension, false)