Flowdock
method

identify_string

Importance_0
identify_string(ltype, quoted = ltype) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/irb/ruby-lex.rb, line 1040
  def identify_string(ltype, quoted = ltype)
    @ltype = ltype
    @quoted = quoted
    subtype = nil
    begin
      nest = 0
      while ch = getc
        if @quoted == ch and nest == 0
          break
        elsif ch == "#" and peek(0) == "{"
          identify_string_dvar
        elsif @ltype != "'" && @ltype != "]" && @ltype != ":" and ch == "#"
          subtype = true
        elsif ch == '\' and @ltype == "'" #'
          case ch = getc
          when "\\", "\n", "'"
          else
            ungetc
          end
        elsif ch == '\' #'
          read_escape
        end
        if PERCENT_PAREN.values.include?(@quoted)
          if PERCENT_PAREN[ch] == @quoted
            nest += 1
          elsif ch == @quoted
            nest -= 1
          end
        end
      end
      if @ltype == "/"
       while peek(0) =~ /i|m|x|o|e|s|u|n/
          getc
        end
      end
      if subtype
        Token(DLtype2Token[ltype])
      else
        Token(Ltype2Token[ltype])
      end
    ensure
      @ltype = nil
      @quoted = nil
      @lex_state = EXPR_END
    end
  end
Register or log in to add new notes.