heredoc_identifier (RubyLexer)

    # File lib/ruby_lexer.rb, line 152
      def heredoc_identifier # 51 lines
        term, func = nil, STR_FUNC_BORING
        self.string_buffer = []

        case
        when src.scan(/(-?)(['"`])(.*?)\2/) then
          term = src[2]
          unless src[1].empty? then
            func |= STR_FUNC_INDENT
          end
          func |= case term
                  when "\'" then
                    STR_SQUOTE
                  when '"' then
                    STR_DQUOTE
                  else
                    STR_XQUOTE
                  end
          string_buffer << src[3]
        when src.scan(/-?(['"`])(?!\1*\Z)/) then
          rb_compile_error "unterminated here document identifier"
        when src.scan(/(-?)(\w+)/) then
          term = '"'
          func |= STR_DQUOTE
          unless src[1].empty? then
            func |= STR_FUNC_INDENT
          end
          string_buffer << src[2]
        else
          return nil
        end

        if src.check(/.*\n/) then
          # TODO: think about storing off the char range instead
          line = src.string[src.pos, src.matched_size]
          src.string[src.pos, src.matched_size] = "\n"
          src.pos += 1
        else
          line = nil
        end

        self.lex_strterm = [:heredoc, string_buffer.join, func, line]

        if term == '`' then
          self.yacc_value = "`"
          return :tXSTRING_BEG
        else
          self.yacc_value = "\""
          return :tSTRING_BEG
        end
      end