parse_string (RubyLexer)

    # File lib/ruby_lexer.rb, line 318
      def parse_string(quote) # 65 lines
        _, string_type, term, open = quote

        space = false # FIX: remove these
        func = string_type
        paren = open
        term_re = Regexp.escape term

        awords = (func & STR_FUNC_AWORDS) != 0
        regexp = (func & STR_FUNC_REGEXP) != 0
        expand = (func & STR_FUNC_EXPAND) != 0

        unless func then # FIX: impossible, prolly needs == 0
          self.lineno = nil
          return :tSTRING_END
        end

        space = true if awords and src.scan(/\s+/)

        if self.nest == 0 && src.scan(/#{term_re}/) then
          if awords then
            quote[1] = nil
            return :tSPACE
          elsif regexp then
            self.yacc_value = self.regx_options
            self.lineno = nil
            return :tREGEXP_END
          else
            self.yacc_value = term
            self.lineno = nil
            return :tSTRING_END
          end
        end

        if space then
          return :tSPACE
        end

        self.string_buffer = []

        if expand
          case
          when src.scan(/#(?=[$@])/) then
            return :tSTRING_DVAR
          when src.scan(/#[{]/) then
            return :tSTRING_DBEG
          when src.scan(/#/) then
            string_buffer << '#'
          end
        end

        if tokadd_string(func, term, paren) == RubyLexer::EOF then
          rb_compile_error "unterminated string meets end of file"
        end

        self.yacc_value = string_buffer.join

        return :tSTRING_CONTENT
      end