ObjFW  Check-in [7eff7e3918]

Overview
Comment:Treat \f as whitespace.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7eff7e391866c4dbda9101902a562c8441ea5df23eb163d02e5cb7459dbdf380
User & Date: js on 2011-09-10 20:24:08
Other Links: manifest | tags
Context
2011-09-10
20:35
Declare of_std{in,out,err} as OFStream. check-in: 5adb201b41 user: js tags: trunk
20:24
Treat \f as whitespace. check-in: 7eff7e3918 user: js tags: trunk
19:54
Add new files to Xcode project. check-in: b0a56c3273 user: js tags: trunk
Changes

Modified src/OFMutableString.m from [e3840cf4e3] to [79d9601955].

570
571
572
573
574
575
576
577

578
579
580
581
582
583
584

- (void)deleteLeadingWhitespaces
{
	size_t i;

	for (i = 0; i < s->cStringLength; i++)
		if (s->cString[i] != ' '  && s->cString[i] != '\t' &&
		    s->cString[i] != '\n' && s->cString[i] != '\r')

			break;

	s->cStringLength -= i;
	s->length -= i;

	memmove(s->cString, s->cString + i, s->cStringLength);
	s->cString[s->cStringLength] = '\0';







|
>







570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585

- (void)deleteLeadingWhitespaces
{
	size_t i;

	for (i = 0; i < s->cStringLength; i++)
		if (s->cString[i] != ' '  && s->cString[i] != '\t' &&
		    s->cString[i] != '\n' && s->cString[i] != '\r' &&
		    s->cString[i] != '\f')
			break;

	s->cStringLength -= i;
	s->length -= i;

	memmove(s->cString, s->cString + i, s->cStringLength);
	s->cString[s->cStringLength] = '\0';
595
596
597
598
599
600
601
602

603
604
605
606
607
608
609
- (void)deleteTrailingWhitespaces
{
	size_t d;
	char *p;

	d = 0;
	for (p = s->cString + s->cStringLength - 1; p >= s->cString; p--) {
		if (*p != ' ' && *p != '\t' && *p != '\n' && *p != '\r')

			break;

		*p = '\0';
		d++;
	}

	s->cStringLength -= d;







|
>







596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
- (void)deleteTrailingWhitespaces
{
	size_t d;
	char *p;

	d = 0;
	for (p = s->cString + s->cStringLength - 1; p >= s->cString; p--) {
		if (*p != ' ' && *p != '\t' && *p != '\n' && *p != '\r' &&
		    *p != '\f')
			break;

		*p = '\0';
		d++;
	}

	s->cStringLength -= d;
621
622
623
624
625
626
627
628

629
630
631
632
633
634
635
636
637
638
639
640

641
642
643
644
645
646
647
- (void)deleteEnclosingWhitespaces
{
	size_t d, i;
	char *p;

	d = 0;
	for (p = s->cString + s->cStringLength - 1; p >= s->cString; p--) {
		if (*p != ' ' && *p != '\t' && *p != '\n' && *p != '\r')

			break;

		*p = '\0';
		d++;
	}

	s->cStringLength -= d;
	s->length -= d;

	for (i = 0; i < s->cStringLength; i++)
		if (s->cString[i] != ' '  && s->cString[i] != '\t' &&
		    s->cString[i] != '\n' && s->cString[i] != '\r')

			break;

	s->cStringLength -= i;
	s->length -= i;

	memmove(s->cString, s->cString + i, s->cStringLength);
	s->cString[s->cStringLength] = '\0';







|
>











|
>







623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
- (void)deleteEnclosingWhitespaces
{
	size_t d, i;
	char *p;

	d = 0;
	for (p = s->cString + s->cStringLength - 1; p >= s->cString; p--) {
		if (*p != ' ' && *p != '\t' && *p != '\n' && *p != '\r' &&
		    *p != '\f')
			break;

		*p = '\0';
		d++;
	}

	s->cStringLength -= d;
	s->length -= d;

	for (i = 0; i < s->cStringLength; i++)
		if (s->cString[i] != ' '  && s->cString[i] != '\t' &&
		    s->cString[i] != '\n' && s->cString[i] != '\r' &&
		    s->cString[i] != '\f')
			break;

	s->cStringLength -= i;
	s->length -= i;

	memmove(s->cString, s->cString + i, s->cStringLength);
	s->cString[s->cStringLength] = '\0';

Modified src/OFString.m from [a9a4d55e1d] to [eb163b9c24].

1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706

1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720

1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759

1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
	const char *cString = s->cString;
	size_t cStringLength = s->cStringLength;
	int i = 0;
	intmax_t value = 0;
	BOOL expectWhitespace = NO;

	while (*cString == ' ' || *cString == '\t' || *cString == '\n' ||
	    *cString == '\r') {
		cString++;
		cStringLength--;
	}

	if (cString[0] == '-' || cString[0] == '+')
		i++;

	for (; i < cStringLength; i++) {
		if (expectWhitespace) {
			if (cString[i] != ' ' && cString[i] != '\t' &&
			    cString[i] != '\n' && cString[i] != '\r')

				@throw [OFInvalidFormatException
				    newWithClass: isa];
			continue;
		}

		if (cString[i] >= '0' && cString[i] <= '9') {
			if (INTMAX_MAX / 10 < value ||
			    INTMAX_MAX - value * 10 < cString[i] - '0')
				@throw [OFOutOfRangeException
				    newWithClass: isa];

			value = (value * 10) + (cString[i] - '0');
		} else if (cString[i] == ' ' || cString[i] == '\t' ||
		    cString[i] == '\n' || cString[i] == '\r')

			expectWhitespace = YES;
		else
			@throw [OFInvalidFormatException newWithClass: isa];
	}

	if (cString[0] == '-')
		value *= -1;

	return value;
}

- (uintmax_t)hexadecimalValue
{
	const char *cString = s->cString;
	size_t cStringLength = s->cStringLength;
	int i = 0;
	uintmax_t value = 0;
	BOOL expectWhitespace = NO, foundValue = NO;

	while (*cString == ' ' || *cString == '\t' || *cString == '\n' ||
	    *cString == '\r') {
		cString++;
		cStringLength--;
	}

	if (cStringLength == 0)
		return 0;

	if (cStringLength >= 2 && cString[0] == '0' && cString[1] == 'x')
		i = 2;
	else if (cStringLength >= 1 && (cString[0] == 'x' || cString[0] == '$'))
		i = 1;

	for (; i < cStringLength; i++) {
		uintmax_t newValue;

		if (expectWhitespace) {
			if (cString[i] != ' ' && cString[i] != '\t' &&
			    cString[i] != '\n' && cString[i] != '\r')

				@throw [OFInvalidFormatException
				    newWithClass: isa];
			continue;
		}

		if (cString[i] >= '0' && cString[i] <= '9') {
			newValue = (value << 4) | (cString[i] - '0');
			foundValue = YES;
		} else if (cString[i] >= 'A' && cString[i] <= 'F') {
			newValue = (value << 4) | (cString[i] - 'A' + 10);
			foundValue = YES;
		} else if (cString[i] >= 'a' && cString[i] <= 'f') {
			newValue = (value << 4) | (cString[i] - 'a' + 10);
			foundValue = YES;
		} else if (cString[i] == 'h' || cString[i] == ' ' ||
		    cString[i] == '\t' || cString[i] == '\n' ||
		    cString[i] == '\r') {
			expectWhitespace = YES;
			continue;
		} else
			@throw [OFInvalidFormatException newWithClass: isa];

		if (newValue < value)
			@throw [OFOutOfRangeException newWithClass: isa];







|










|
>













|
>




















|

















|
>
















|







1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
	const char *cString = s->cString;
	size_t cStringLength = s->cStringLength;
	int i = 0;
	intmax_t value = 0;
	BOOL expectWhitespace = NO;

	while (*cString == ' ' || *cString == '\t' || *cString == '\n' ||
	    *cString == '\r' || *cString == '\f') {
		cString++;
		cStringLength--;
	}

	if (cString[0] == '-' || cString[0] == '+')
		i++;

	for (; i < cStringLength; i++) {
		if (expectWhitespace) {
			if (cString[i] != ' ' && cString[i] != '\t' &&
			    cString[i] != '\n' && cString[i] != '\r' &&
			    cString[i] != '\f')
				@throw [OFInvalidFormatException
				    newWithClass: isa];
			continue;
		}

		if (cString[i] >= '0' && cString[i] <= '9') {
			if (INTMAX_MAX / 10 < value ||
			    INTMAX_MAX - value * 10 < cString[i] - '0')
				@throw [OFOutOfRangeException
				    newWithClass: isa];

			value = (value * 10) + (cString[i] - '0');
		} else if (cString[i] == ' ' || cString[i] == '\t' ||
		    cString[i] == '\n' || cString[i] == '\r' ||
		    cString[i] == '\f')
			expectWhitespace = YES;
		else
			@throw [OFInvalidFormatException newWithClass: isa];
	}

	if (cString[0] == '-')
		value *= -1;

	return value;
}

- (uintmax_t)hexadecimalValue
{
	const char *cString = s->cString;
	size_t cStringLength = s->cStringLength;
	int i = 0;
	uintmax_t value = 0;
	BOOL expectWhitespace = NO, foundValue = NO;

	while (*cString == ' ' || *cString == '\t' || *cString == '\n' ||
	    *cString == '\r' || *cString == '\f') {
		cString++;
		cStringLength--;
	}

	if (cStringLength == 0)
		return 0;

	if (cStringLength >= 2 && cString[0] == '0' && cString[1] == 'x')
		i = 2;
	else if (cStringLength >= 1 && (cString[0] == 'x' || cString[0] == '$'))
		i = 1;

	for (; i < cStringLength; i++) {
		uintmax_t newValue;

		if (expectWhitespace) {
			if (cString[i] != ' ' && cString[i] != '\t' &&
			    cString[i] != '\n' && cString[i] != '\r' &&
			    cString[i] != '\f')
				@throw [OFInvalidFormatException
				    newWithClass: isa];
			continue;
		}

		if (cString[i] >= '0' && cString[i] <= '9') {
			newValue = (value << 4) | (cString[i] - '0');
			foundValue = YES;
		} else if (cString[i] >= 'A' && cString[i] <= 'F') {
			newValue = (value << 4) | (cString[i] - 'A' + 10);
			foundValue = YES;
		} else if (cString[i] >= 'a' && cString[i] <= 'f') {
			newValue = (value << 4) | (cString[i] - 'a' + 10);
			foundValue = YES;
		} else if (cString[i] == 'h' || cString[i] == ' ' ||
		    cString[i] == '\t' || cString[i] == '\n' ||
		    cString[i] == '\r' || cString[i] == '\f') {
			expectWhitespace = YES;
			continue;
		} else
			@throw [OFInvalidFormatException newWithClass: isa];

		if (newValue < value)
			@throw [OFOutOfRangeException newWithClass: isa];
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810

1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833

1834
1835
1836
1837
1838
1839
1840
- (float)floatValue
{
	const char *cString = s->cString;
	char *endPointer = NULL;
	float value;

	while (*cString == ' ' || *cString == '\t' || *cString == '\n' ||
	    *cString == '\r')
		cString++;

	value = strtof(cString, &endPointer);

	/* Check if there are any invalid chars left */
	if (endPointer != NULL)
		for (; *endPointer != '\0'; endPointer++)
			if (*endPointer != ' ' && *endPointer != '\t' &&
			    *endPointer != '\n' && *endPointer != '\r')

				@throw [OFInvalidFormatException
				    newWithClass: isa];

	return value;
}

- (double)doubleValue
{
	const char *cString = s->cString;
	char *endPointer = NULL;
	double value;

	while (*cString == ' ' || *cString == '\t' || *cString == '\n' ||
	    *cString == '\r')
		cString++;

	value = strtod(cString, &endPointer);

	/* Check if there are any invalid chars left */
	if (endPointer != NULL)
		for (; *endPointer != '\0'; endPointer++)
			if (*endPointer != ' ' && *endPointer != '\t' &&
			    *endPointer != '\n' && *endPointer != '\r')

				@throw [OFInvalidFormatException
				    newWithClass: isa];

	return value;
}

- (of_unichar_t*)unicodeString







|








|
>













|








|
>







1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
- (float)floatValue
{
	const char *cString = s->cString;
	char *endPointer = NULL;
	float value;

	while (*cString == ' ' || *cString == '\t' || *cString == '\n' ||
	    *cString == '\r' || *cString == '\f')
		cString++;

	value = strtof(cString, &endPointer);

	/* Check if there are any invalid chars left */
	if (endPointer != NULL)
		for (; *endPointer != '\0'; endPointer++)
			if (*endPointer != ' ' && *endPointer != '\t' &&
			    *endPointer != '\n' && *endPointer != '\r' &&
			    *endPointer != '\f')
				@throw [OFInvalidFormatException
				    newWithClass: isa];

	return value;
}

- (double)doubleValue
{
	const char *cString = s->cString;
	char *endPointer = NULL;
	double value;

	while (*cString == ' ' || *cString == '\t' || *cString == '\n' ||
	    *cString == '\r' || *cString == '\f')
		cString++;

	value = strtod(cString, &endPointer);

	/* Check if there are any invalid chars left */
	if (endPointer != NULL)
		for (; *endPointer != '\0'; endPointer++)
			if (*endPointer != ' ' && *endPointer != '\t' &&
			    *endPointer != '\n' && *endPointer != '\r' &&
			    *endPointer != '\f')
				@throw [OFInvalidFormatException
				    newWithClass: isa];

	return value;
}

- (of_unichar_t*)unicodeString

Modified src/OFXMLParser.m from [e1a9a7f1bc] to [2217f932b7].

313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
				 i: (size_t*)i
			      last: (size_t*)last
{
	size_t length;

	if ((finishedParsing || [previous count] < 1) && buffer[*i] != ' ' &&
	    buffer[*i] != '\t' && buffer[*i] != '\n' && buffer[*i] != '\r' &&
	    buffer[*i] != '<')
		@throw [OFMalformedXMLException newWithClass: isa
						      parser: self];

	if (buffer[*i] != '<')
		return;

	if ((length = *i - *last) > 0)







|







313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
				 i: (size_t*)i
			      last: (size_t*)last
{
	size_t length;

	if ((finishedParsing || [previous count] < 1) && buffer[*i] != ' ' &&
	    buffer[*i] != '\t' && buffer[*i] != '\n' && buffer[*i] != '\r' &&
	    buffer[*i] != '\f' && buffer[*i] != '<')
		@throw [OFMalformedXMLException newWithClass: isa
						      parser: self];

	if (buffer[*i] != '<')
		return;

	if ((length = *i - *last) > 0)
405
406
407
408
409
410
411
412

413
414
415
416
417
418
419
	cString = [pi cString];
	length = [pi cStringLength];

	for (i = last = 0; i < length; i++) {
		switch (piState) {
		case 0:
			if (cString[i] == ' ' || cString[i] == '\t' ||
			    cString[i] == '\r' || cString[i] == '\n')

				continue;

			last = i;
			piState = 1;
			i--;

			break;







|
>







405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
	cString = [pi cString];
	length = [pi cStringLength];

	for (i = last = 0; i < length; i++) {
		switch (piState) {
		case 0:
			if (cString[i] == ' ' || cString[i] == '\t' ||
			    cString[i] == '\r' || cString[i] == '\n' ||
			    cString[i] == '\f')
				continue;

			last = i;
			piState = 1;
			i--;

			break;
521
522
523
524
525
526
527
528

529
530
531
532
533
534
535
{
	OFAutoreleasePool *pool;
	const char *cacheCString, *tmp;
	size_t length, cacheLength;
	OFString *cacheString;

	if (buffer[*i] != ' ' && buffer[*i] != '\t' && buffer[*i] != '\n' &&
	    buffer[*i] != '\r' && buffer[*i] != '>' && buffer[*i] != '/')

		return;

	if ((length = *i - *last) > 0)
		cache_append(cache, buffer + *last, encoding, length);

	pool = [[OFAutoreleasePool alloc] init];








|
>







522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
{
	OFAutoreleasePool *pool;
	const char *cacheCString, *tmp;
	size_t length, cacheLength;
	OFString *cacheString;

	if (buffer[*i] != ' ' && buffer[*i] != '\t' && buffer[*i] != '\n' &&
	    buffer[*i] != '\r' && buffer[*i] != '\f' && buffer[*i] != '>' &&
	    buffer[*i] != '/')
		return;

	if ((length = *i - *last) > 0)
		cache_append(cache, buffer + *last, encoding, length);

	pool = [[OFAutoreleasePool alloc] init];

622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
	OFAutoreleasePool *pool;
	const char *cacheCString, *tmp;
	size_t length, cacheLength;
	OFString *cacheString;
	OFString *ns;

	if (buffer[*i] != ' ' && buffer[*i] != '\t' && buffer[*i] != '\n' &&
	    buffer[*i] != '\r' && buffer[*i] != '>')
		return;

	if ((length = *i - *last) > 0)
		cache_append(cache, buffer + *last, encoding, length);

	pool = [[OFAutoreleasePool alloc] init];








|







624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
	OFAutoreleasePool *pool;
	const char *cacheCString, *tmp;
	size_t length, cacheLength;
	OFString *cacheString;
	OFString *ns;

	if (buffer[*i] != ' ' && buffer[*i] != '\t' && buffer[*i] != '\n' &&
	    buffer[*i] != '\r' && buffer[*i] != '\f' && buffer[*i] != '>')
		return;

	if ((length = *i - *last) > 0)
		cache_append(cache, buffer + *last, encoding, length);

	pool = [[OFAutoreleasePool alloc] init];

698
699
700
701
702
703
704
705

706
707
708
709
710
711
712
	OFAutoreleasePool *pool;
	OFString *ns;
	OFXMLAttribute **attributesCArray;
	size_t j, attributesCount;

	if (buffer[*i] != '>' && buffer[*i] != '/') {
		if (buffer[*i] != ' ' && buffer[*i] != '\t' &&
		    buffer[*i] != '\n' && buffer[*i] != '\r') {

			*last = *i;
			state = OF_XMLPARSER_IN_ATTR_NAME;
			(*i)--;
		}

		return;
	}







|
>







700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
	OFAutoreleasePool *pool;
	OFString *ns;
	OFXMLAttribute **attributesCArray;
	size_t j, attributesCount;

	if (buffer[*i] != '>' && buffer[*i] != '/') {
		if (buffer[*i] != ' ' && buffer[*i] != '\t' &&
		    buffer[*i] != '\n' && buffer[*i] != '\r' &&
		    buffer[*i] != '\f') {
			*last = *i;
			state = OF_XMLPARSER_IN_ATTR_NAME;
			(*i)--;
		}

		return;
	}
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
- (void)_parseExpectDelimiterWithBuffer: (const char*)buffer
				      i: (size_t*)i
				   last: (size_t*)last
{
	*last = *i + 1;

	if (buffer[*i] == ' ' || buffer[*i] == '\t' || buffer[*i] == '\n' ||
	    buffer[*i] == '\r')
		return;

	if (buffer[*i] != '\'' && buffer[*i] != '"')
		@throw [OFMalformedXMLException newWithClass: isa
						      parser: self];

	delimiter = buffer[*i];







|







827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
- (void)_parseExpectDelimiterWithBuffer: (const char*)buffer
				      i: (size_t*)i
				   last: (size_t*)last
{
	*last = *i + 1;

	if (buffer[*i] == ' ' || buffer[*i] == '\t' || buffer[*i] == '\n' ||
	    buffer[*i] == '\r' || buffer[*i] == '\f')
		return;

	if (buffer[*i] != '\'' && buffer[*i] != '"')
		@throw [OFMalformedXMLException newWithClass: isa
						      parser: self];

	delimiter = buffer[*i];
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
					 i: (size_t*)i
				      last: (size_t*)last
{
	if (buffer[*i] == '>') {
		*last = *i + 1;
		state = OF_XMLPARSER_OUTSIDE_TAG;
	} else if (buffer[*i] != ' ' && buffer[*i] != '\t' &&
	    buffer[*i] != '\n' && buffer[*i] != '\r')
		@throw [OFMalformedXMLException newWithClass: isa
						      parser: self];
}

/* In <! */
- (void)_parseInExclamationMarkWithBuffer: (const char*)buffer
					i: (size_t*)i







|







904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
					 i: (size_t*)i
				      last: (size_t*)last
{
	if (buffer[*i] == '>') {
		*last = *i + 1;
		state = OF_XMLPARSER_OUTSIDE_TAG;
	} else if (buffer[*i] != ' ' && buffer[*i] != '\t' &&
	    buffer[*i] != '\n' && buffer[*i] != '\r' && buffer[*i] != '\f')
		@throw [OFMalformedXMLException newWithClass: isa
						      parser: self];
}

/* In <! */
- (void)_parseInExclamationMarkWithBuffer: (const char*)buffer
					i: (size_t*)i
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
/* In <!DOCTYPE ...> */
- (void)_parseInDoctypeWithBuffer: (const char*)buffer
				i: (size_t*)i
			     last: (size_t*)last
{
	if ((level < 6 && buffer[*i] != "OCTYPE"[level]) ||
	    (level == 6 && buffer[*i] != ' ' && buffer[*i] != '\t' &&
	    buffer[*i] != '\n' && buffer[*i] != '\r'))
		@throw [OFMalformedXMLException newWithClass: isa
						      parser: self];

	if (level < 7 || buffer[*i] == '<')
		level++;

	if (buffer[*i] == '>') {







|







1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
/* In <!DOCTYPE ...> */
- (void)_parseInDoctypeWithBuffer: (const char*)buffer
				i: (size_t*)i
			     last: (size_t*)last
{
	if ((level < 6 && buffer[*i] != "OCTYPE"[level]) ||
	    (level == 6 && buffer[*i] != ' ' && buffer[*i] != '\t' &&
	    buffer[*i] != '\n' && buffer[*i] != '\r' && buffer[*i] != '\f'))
		@throw [OFMalformedXMLException newWithClass: isa
						      parser: self];

	if (level < 7 || buffer[*i] == '<')
		level++;

	if (buffer[*i] == '>') {