       new Choice Math.floor(alternatives.length/2)-1, alternatives
 
     when "quantified"
-      {min, max} = node.quantifier
+      {min, max, greedy} = node.quantifier
 
       body = rx2rr node.body, options
 

            Optional(body)
          else
            if max == 0
              ZeroOrMore(body, Comment("#{max} times"))
            else if max != Infinity
              ZeroOrMore(body, Comment("0 to #{max} times"))
            else
              ZeroOrMore(body)
        when 1
          if max == 1
            OneOrMore(body, Comment("once"))
          else if max != Infinity
            OneOrMore(body, Comment("1 to #{max} times"))
          else
            OneOrMore(body)
        else
          if max == min
            OneOrMore(body, Comment("#{max} times"))
          else if max != Infinity
            OneOrMore(body, Comment("#{min} to #{max} times"))
          else
            OneOrMore(body, Comment("at least #{min} times"))

    when "capture-group"
      Group rx2rr(node.body, options), Comment("capture #{node.index}")

      # unicode \u...
      # null-character

quantifiedComment = (comment, greedy) ->
  if comment and greedy
    Comment(comment + ' (greedy)')
  else if greedy
    Comment('greedy')
  else if comment
    Comment(comment)

parseRegex = (regex) ->
  if regex instanceof RegExp
    regex = regex.source
