5c302c3abb483597bafbcaea6e7ed04a80eb177e — Stephen Paul Weber 27 days ago a2bb88e master
Fix stack level too deep for single quote string
2 files changed, 12 insertions(+), 1 deletions(-)

M lib/dhall/parser.rb
M scripts/generate_citrus_parser.rb
M lib/dhall/parser.rb => lib/dhall/parser.rb +3 -1
@@ 314,7 314,9 @@   		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 @@ "(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 @@ 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)