module Mail::ContentTransferEncoding - mail-2.5.4 Documentation

# module Mail::ContentTransferEncoding

### Public Instance Methods

_nt_encoding() click to toggle source

    # File lib/mail/parsers/content_transfer_encoding.rb, line 88
    def _nt_encoding
      start_index = index
      if node_cache[:encoding].has_key?(index)
        cached = node_cache[:encoding][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0 = index
      if has_terminal?("7bits", false, index)
        r1 = instantiate_node(SyntaxNode,input, index...(index + 5))
        @index += 5
      else
        terminal_parse_failure("7bits")
        r1 = nil
      end
      if r1
        r0 = r1
      else
        if has_terminal?("8bits", false, index)
          r2 = instantiate_node(SyntaxNode,input, index...(index + 5))
          @index += 5
        else
          terminal_parse_failure("8bits")
          r2 = nil
        end
        if r2
          r0 = r2
        else
          if has_terminal?("7bit", false, index)
            r3 = instantiate_node(SyntaxNode,input, index...(index + 4))
            @index += 4
          else
            terminal_parse_failure("7bit")
            r3 = nil
          end
          if r3
            r0 = r3
          else
            if has_terminal?("8bit", false, index)
              r4 = instantiate_node(SyntaxNode,input, index...(index + 4))
              @index += 4
            else
              terminal_parse_failure("8bit")
              r4 = nil
            end
            if r4
              r0 = r4
            else
              if has_terminal?("binary", false, index)
                r5 = instantiate_node(SyntaxNode,input, index...(index + 6))
                @index += 6
              else
                terminal_parse_failure("binary")
                r5 = nil
              end
              if r5
                r0 = r5
              else
                if has_terminal?("quoted-printable", false, index)
                  r6 = instantiate_node(SyntaxNode,input, index...(index + 16))
                  @index += 16
                else
                  terminal_parse_failure("quoted-printable")
                  r6 = nil
                end
                if r6
                  r0 = r6
                else
                  if has_terminal?("base64", false, index)
                    r7 = instantiate_node(SyntaxNode,input, index...(index + 6))
                    @index += 6
                  else
                    terminal_parse_failure("base64")
                    r7 = nil
                  end
                  if r7
                    r0 = r7
                  else
                    r8 = _nt_ietf_token
                    if r8
                      r0 = r8
                    else
                      r9 = _nt_custom_x_token
                      if r9
                        r0 = r9
                      else
                        @index = i0
                        r0 = nil
                      end
                    end
                  end
                end
              end
            end
          end
        end
      end

      node_cache[:encoding][start_index] = r0

      r0
    end

_nt_primary() click to toggle source

    # File lib/mail/parsers/content_transfer_encoding.rb, line 34
    def _nt_primary
      start_index = index
      if node_cache[:primary].has_key?(index)
        cached = node_cache[:primary][index]
        if cached
          cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
          @index = cached.interval.end
        end
        return cached
      end

      i0, s0 = index, []
      r1 = _nt_CFWS
      s0 << r1
      if r1
        r2 = _nt_encoding
        s0 << r2
        if r2
          r3 = _nt_CFWS
          s0 << r3
          if r3
            if has_terminal?(";", false, index)
              r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
              @index += 1
            else
              terminal_parse_failure(";")
              r5 = nil
            end
            if r5
              r4 = r5
            else
              r4 = instantiate_node(SyntaxNode,input, index...index)
            end
            s0 << r4
            if r4
              r6 = _nt_CFWS
              s0 << r6
            end
          end
        end
      end
      if s0.last
        r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
        r0.extend(Primary0)
      else
        @index = i0
        r0 = nil
      end

      node_cache[:primary][start_index] = r0

      r0
    end

root() click to toggle source

    # File lib/mail/parsers/content_transfer_encoding.rb, line 8
    def root
      @root ||= :primary
    end