703 |
} // _XMLDeclaration_ |
} // _XMLDeclaration_ |
704 |
|
|
705 |
/* |
/* |
|
Document Type Declaration |
|
|
*/ |
|
|
rule _DocumentTypeDeclaration_ ($doc) { |
|
|
?lexmode 'DocumentTypeDeclaration'; |
|
|
|
|
|
~ (Name == 'DOCTYPE') { } |
|
|
|
|
|
~ (S) { } |
|
|
|
|
|
// Document type name |
|
|
~ (Name) { |
|
|
|
|
|
} |
|
|
|
|
|
// TODO: Implement this |
|
|
|
|
|
// TODO: set $self->{standalone} true if only internal subset |
|
|
// with no param ref |
|
|
|
|
|
// ~ (MDC) { } |
|
|
} // _DocumentTypeDeclaration_ |
|
|
|
|
|
/* |
|
706 |
Comment Declaration |
Comment Declaration |
707 |
|
|
708 |
Comment := '<!--' *(Char - '-' / '-' (Char - '-')) |
Comment := '<!--' *(Char - '-' / '-' (Char - '-')) |
709 |
'-->' ;; [15] |
'-->' ;; [15] |
710 |
*/ |
*/ |
711 |
rule _CommentDeclaration_ ($doc, $parent) { |
rule _CommentDeclaration_ ($doc, $parent) { |
712 |
?lexmode 'CommentDeclaration'; |
?lexmode 'CommentDeclaration'; |
713 |
|
|
730 |
} |
} |
731 |
|
|
732 |
// ~ (MDC) { } |
// ~ (MDC) { } |
733 |
} // _CommentDeclaration_ |
} // _CommentDeclaration |
734 |
|
_ |
735 |
|
rule _CommentDeclarationDTD ($doc) { |
736 |
|
?lexmode 'CommentDeclaration'; |
737 |
|
|
738 |
|
~? (STRING) { |
739 |
|
// |
740 |
|
} |
741 |
|
|
742 |
|
~ (COM) { |
743 |
|
?lexmode MarkupDeclaration; |
744 |
|
} else { |
745 |
|
?lexmode MarkupDeclaration; |
746 |
|
} |
747 |
|
|
748 |
|
~ (MDC) { |
749 |
|
?lexmode DTD; |
750 |
|
} else { |
751 |
|
?lexmode DTD; |
752 |
|
} |
753 |
|
} // _CommentDeclarationDTD |
754 |
|
|
755 |
/* |
/* |
756 |
Processing Instruction |
Processing Instruction |
757 |
|
|
815 |
|
|
816 |
// ~ (PIC) { } |
// ~ (PIC) { } |
817 |
} // _ProcessingInstruction_ |
} // _ProcessingInstruction_ |
818 |
|
|
819 |
|
rule _ProcessingInstructionDTD ($doc) { |
820 |
|
?lexmode 'PIName'; |
821 |
|
|
822 |
|
~ (Name) { |
823 |
|
|
824 |
|
} |
825 |
|
|
826 |
|
~ (S) { |
827 |
|
?lexmode 'PIData'; |
828 |
|
|
829 |
|
~? (DATA) { |
830 |
|
|
831 |
|
} |
832 |
|
} |
833 |
|
|
834 |
|
~ (PIC) { |
835 |
|
?lexmode DTD; |
836 |
|
} else { |
837 |
|
?lexmode DTD; |
838 |
|
} |
839 |
|
} // _ProcessingInstructionDTD |
840 |
|
|
841 |
/* |
/* |
842 |
Element content parsing mode |
Element content parsing mode |
1355 |
$self->{has_error} = true; |
$self->{has_error} = true; |
1356 |
} |
} |
1357 |
my $ncr = $doc-><M::Document.createTextNode> (chr $num); |
my $ncr = $doc-><M::Document.createTextNode> (chr $num); |
|
(chr (0+$num)); |
|
1358 |
$parent-><M::Node.appendChild> ($ncr); |
$parent-><M::Node.appendChild> ($ncr); |
1359 |
} |
} |
1360 |
} |
} |
1522 |
// ~ (REFC) { } |
// ~ (REFC) { } |
1523 |
} // _GeneralEntityReferenceV_ |
} // _GeneralEntityReferenceV_ |
1524 |
|
|
1525 |
|
/* |
1526 |
|
Document Type Declaration |
1527 |
|
*/ |
1528 |
|
rule _DocumentTypeDeclaration_ ($doc) { |
1529 |
|
?lexmode MarkupDeclaration; |
1530 |
|
|
1531 |
|
~ (Name == 'DOCTYPE') { } |
1532 |
|
|
1533 |
|
~ (S) { } |
1534 |
|
|
1535 |
|
// Document type name |
1536 |
|
~ (Name) { |
1537 |
|
|
1538 |
|
} |
1539 |
|
|
1540 |
|
~? (S) { |
1541 |
|
~? (Name == 'PUBLIC') { |
1542 |
|
~ (S) { } |
1543 |
|
|
1544 |
|
&PubidLiteral ($doc => $doc); |
1545 |
|
|
1546 |
|
~ (S) { } |
1547 |
|
|
1548 |
|
&SystemLiteral ($doc => $doc); |
1549 |
|
|
1550 |
|
~? (S) { } |
1551 |
|
} (Name == 'SYSTEM') { |
1552 |
|
~ (S) { } |
1553 |
|
|
1554 |
|
&SystemLiteral ($doc => $doc); |
1555 |
|
|
1556 |
|
~? (S) { } |
1557 |
|
} |
1558 |
|
} |
1559 |
|
|
1560 |
|
~? (DSO) { |
1561 |
|
&InternalSubset ($doc => $doc); |
1562 |
|
|
1563 |
|
~ (DSC) { |
1564 |
|
?lexmode MarkupDeclaration; |
1565 |
|
} else { |
1566 |
|
?lexmode MarkupDeclaration; |
1567 |
|
} |
1568 |
|
|
1569 |
|
~? (S) { } |
1570 |
|
} |
1571 |
|
|
1572 |
|
// TODO: set $self->{standalone} true if only internal subset |
1573 |
|
// with no param ref |
1574 |
|
|
1575 |
|
// ~ (MDC) { } |
1576 |
|
} // _DocumentTypeDeclaration_ |
1577 |
|
|
1578 |
|
rule PubidLiteral ($doc) { |
1579 |
|
~ (LIT) { |
1580 |
|
?lexmode SystemLiteral; |
1581 |
|
|
1582 |
|
~? (STRING) { |
1583 |
|
// TODO: Charrange check & normalization is required |
1584 |
|
|
1585 |
|
} |
1586 |
|
|
1587 |
|
~ (LIT) { |
1588 |
|
?lexmode MarkupDeclaration; |
1589 |
|
} else { |
1590 |
|
?lexmode MarkupDeclaration; |
1591 |
|
} |
1592 |
|
} (LITA) { |
1593 |
|
?lexmode SystemLiteralA; |
1594 |
|
|
1595 |
|
~? (STRING) { |
1596 |
|
// TODO: Charrange check & normalization is required |
1597 |
|
|
1598 |
|
} |
1599 |
|
|
1600 |
|
~ (LITA) { |
1601 |
|
?lexmode MarkupDeclaration; |
1602 |
|
} else { |
1603 |
|
?lexmode MarkupDeclaration; |
1604 |
|
} |
1605 |
|
} |
1606 |
|
} // PubidLiteral |
1607 |
|
|
1608 |
|
rule SystemLiteral ($doc) { |
1609 |
|
~ (LIT) { |
1610 |
|
?lexmode SystemLiteral; |
1611 |
|
&_SystemLiteral ($doc => $doc); |
1612 |
|
} (LITA) { |
1613 |
|
?lexmode SystemLiteralA; |
1614 |
|
&_SystemLiteral ($doc => $doc); |
1615 |
|
} |
1616 |
|
} // SystemLiteral |
1617 |
|
|
1618 |
|
rule _SystemLiteral ($doc) { |
1619 |
|
~? (STRING) { |
1620 |
|
|
1621 |
|
} |
1622 |
|
|
1623 |
|
~ (LIT) { |
1624 |
|
?lexmode MarkupDeclaration; |
1625 |
|
} (LITA) { |
1626 |
|
?lexmode MarkupDeclaration; |
1627 |
|
} else { |
1628 |
|
?lexmode MarkupDeclaration; |
1629 |
|
} |
1630 |
|
} // _SystemLiteral |
1631 |
|
|
1632 |
|
/* |
1633 |
|
DTD Internal Subset |
1634 |
|
|
1635 |
|
intSubset := *(markupdecl / DeclSep) ;; [28b] |
1636 |
|
*/ |
1637 |
|
rule InternalSubset ($doc) { |
1638 |
|
?lexmode DTD; |
1639 |
|
|
1640 |
|
~* (MDO) { |
1641 |
|
?lexmode MarkupDeclaration; |
1642 |
|
|
1643 |
|
~ (Name == 'ELEMENT') { |
1644 |
|
&_ElementDeclaration ($doc => $doc); |
1645 |
|
} (Name == 'ATTLIST') { |
1646 |
|
&_AttlistDeclaration ($doc => $doc); |
1647 |
|
} (Name == 'ENTITY') { |
1648 |
|
&_EntityDeclaration ($doc => $doc); |
1649 |
|
} (Name == 'NOTATION') { |
1650 |
|
&_NotationDeclaration ($doc => $doc); |
1651 |
|
} |
1652 |
|
} (S) { |
1653 |
|
// |
1654 |
|
} (CDO) { |
1655 |
|
&_CommentDeclarationDTD ($doc => $doc); |
1656 |
|
} (PIO) { |
1657 |
|
&_ProcessingInstructionDTD ($doc => $doc); |
1658 |
|
} (PERO) { |
1659 |
|
?lexmode EntityReference; |
1660 |
|
|
1661 |
|
~ (Name) { |
1662 |
|
|
1663 |
|
} |
1664 |
|
|
1665 |
|
~ (REFC) { |
1666 |
|
?lexmode DTD; |
1667 |
|
} else { |
1668 |
|
?lexmode DTD; |
1669 |
|
} |
1670 |
|
} |
1671 |
|
} // InternalSubset |
1672 |
|
|
1673 |
|
rule _ElementDeclaration ($doc) { |
1674 |
|
// ~ (MDO) { } |
1675 |
|
// ?lexmode MarkupDeclaration |
1676 |
|
// ~ (Name == 'Element') { } |
1677 |
|
|
1678 |
|
~ (S) { } |
1679 |
|
|
1680 |
|
~ (Name) { |
1681 |
|
|
1682 |
|
} |
1683 |
|
|
1684 |
|
?lexmode ElementDeclaration; |
1685 |
|
|
1686 |
|
~ (S) { } |
1687 |
|
|
1688 |
|
// contentspec |
1689 |
|
~ (MGO) { |
1690 |
|
&_ContentModel ($doc => $doc); |
1691 |
|
} (Name == 'EMPTY') { |
1692 |
|
|
1693 |
|
} (Name == 'ANY') { |
1694 |
|
|
1695 |
|
} |
1696 |
|
|
1697 |
|
~? (S) { } |
1698 |
|
|
1699 |
|
~ (MDC) { |
1700 |
|
?lexmode DTD; |
1701 |
|
} else { |
1702 |
|
?lexmode DTD; |
1703 |
|
} |
1704 |
|
} // _ElementDeclaration |
1705 |
|
|
1706 |
|
rule _ContentModel ($doc) { |
1707 |
|
// ~ (MGO) { } |
1708 |
|
|
1709 |
|
~? (S) { } |
1710 |
|
|
1711 |
|
~ (Name) { |
1712 |
|
// Element content model |
1713 |
|
&_ModelGroup ($doc => $doc) |
1714 |
|
: unshift-current-token; |
1715 |
|
|
1716 |
|
~? (OPT) { |
1717 |
|
|
1718 |
|
} (REP) { |
1719 |
|
|
1720 |
|
} (PLUS) { |
1721 |
|
|
1722 |
|
} |
1723 |
|
|
1724 |
|
} (MDO) { |
1725 |
|
&_ModelGroup ($doc => $doc) |
1726 |
|
: unshift-current-token; |
1727 |
|
|
1728 |
|
~? (OPT) { |
1729 |
|
|
1730 |
|
} (REP) { |
1731 |
|
|
1732 |
|
} (PLUS) { |
1733 |
|
|
1734 |
|
} |
1735 |
|
|
1736 |
|
} (PCDATA) { |
1737 |
|
// Mixed content declaration |
1738 |
|
~? (S) { } |
1739 |
|
|
1740 |
|
~* (OR) { |
1741 |
|
~? (S) { } |
1742 |
|
|
1743 |
|
~ (Name) { |
1744 |
|
|
1745 |
|
} |
1746 |
|
|
1747 |
|
~? (S) { } |
1748 |
|
} |
1749 |
|
|
1750 |
|
~ (MGC) { } |
1751 |
|
|
1752 |
|
~? (REP) { |
1753 |
|
|
1754 |
|
} else { |
1755 |
|
// TODO: error if |Name| |
1756 |
|
} |
1757 |
|
|
1758 |
|
|
1759 |
|
} |
1760 |
|
} // _ContentModel |
1761 |
|
|
1762 |
|
rule _ModelGroup ($doc) |
1763 |
|
: standalone |
1764 |
|
: recursive |
1765 |
|
{ |
1766 |
|
// ~ (MGO) { } |
1767 |
|
// ~? (S) { } |
1768 |
|
|
1769 |
|
&ContentParticle ($doc => $doc); |
1770 |
|
|
1771 |
|
~? (S) { } |
1772 |
|
|
1773 |
|
~? (OR) { |
1774 |
|
~? (S) { } |
1775 |
|
|
1776 |
|
&ContentParticle ($doc => $doc); |
1777 |
|
|
1778 |
|
~? (S) { } |
1779 |
|
|
1780 |
|
~* (OR) { |
1781 |
|
~? (S) { } |
1782 |
|
|
1783 |
|
&ContentParticle ($doc => $doc); |
1784 |
|
|
1785 |
|
~? (S) { } |
1786 |
|
} |
1787 |
|
|
1788 |
|
} (SEQ) { |
1789 |
|
~? (S) { } |
1790 |
|
|
1791 |
|
&ContentParticle ($doc => $doc); |
1792 |
|
|
1793 |
|
~? (S) { } |
1794 |
|
|
1795 |
|
~* (SEQ) { |
1796 |
|
~? (S) { } |
1797 |
|
|
1798 |
|
&ContentParticle ($doc => $doc); |
1799 |
|
|
1800 |
|
~? (S) { } |
1801 |
|
} |
1802 |
|
|
1803 |
|
} |
1804 |
|
|
1805 |
|
~ (MGC) { } |
1806 |
|
} // _ModelGroup |
1807 |
|
|
1808 |
|
rule ContentParticle ($doc) { |
1809 |
|
~ (Name) { |
1810 |
|
|
1811 |
|
} (MGO) { |
1812 |
|
~? (S) { } |
1813 |
|
|
1814 |
|
&_ModelGroup ($doc => $doc); |
1815 |
|
} |
1816 |
|
|
1817 |
|
~? (OPT) { |
1818 |
|
|
1819 |
|
} (REP) { |
1820 |
|
|
1821 |
|
} (PLUS) { |
1822 |
|
|
1823 |
|
} |
1824 |
|
} // ContentParticle |
1825 |
|
|
1826 |
|
rule _AttlistDeclaration ($doc) { |
1827 |
|
// ~ (MDO) { } |
1828 |
|
// ~ (Name == 'ATTLIST') { } |
1829 |
|
|
1830 |
|
?lexmode AttlistDeclaration; |
1831 |
|
|
1832 |
|
~ (S) { } |
1833 |
|
|
1834 |
|
~ (Name) { |
1835 |
|
|
1836 |
|
} |
1837 |
|
|
1838 |
|
~? (S) { } |
1839 |
|
|
1840 |
|
~* (Name) { |
1841 |
|
|
1842 |
|
~ (S) { } |
1843 |
|
|
1844 |
|
// AttType |
1845 |
|
~ (Name == 'NOTATION') { |
1846 |
|
~ (S) { } |
1847 |
|
|
1848 |
|
~ (EGO) { |
1849 |
|
~? (S) { } |
1850 |
|
|
1851 |
|
~ (Name) { |
1852 |
|
|
1853 |
|
~? (S) { } |
1854 |
|
} (OR) : separator { |
1855 |
|
~? (S) { } |
1856 |
|
} |
1857 |
|
|
1858 |
|
~ (EGC) { } |
1859 |
|
} |
1860 |
|
} (Name) { |
1861 |
|
// TODO: check keyword |
1862 |
|
|
1863 |
|
} (EGO) { |
1864 |
|
?lexmode Enumeration; |
1865 |
|
|
1866 |
|
~? (S) { } |
1867 |
|
|
1868 |
|
~ (Nmtoken) { |
1869 |
|
|
1870 |
|
~? (S) { } |
1871 |
|
} (OR) : separator { |
1872 |
|
~? (S) { } |
1873 |
|
} |
1874 |
|
|
1875 |
|
~ (EGC) { |
1876 |
|
?lexmode AttlistDeclaration; |
1877 |
|
} else { |
1878 |
|
?lexmode AttlistDeclaration; |
1879 |
|
} |
1880 |
|
|
1881 |
|
} |
1882 |
|
|
1883 |
|
~ (S) { } |
1884 |
|
|
1885 |
|
// DefaultDecl |
1886 |
|
~ (RNI) { |
1887 |
|
~ (Name == 'REQUIRED') { |
1888 |
|
|
1889 |
|
} (Name == 'IMPLIED') { |
1890 |
|
|
1891 |
|
} (Name == 'FIXED') { |
1892 |
|
~ (S) { } |
1893 |
|
|
1894 |
|
~ (LIT) { |
1895 |
|
my $vals; |
1896 |
|
lang:Perl { |
1897 |
|
$vals = []; |
1898 |
|
} |
1899 |
|
|
1900 |
|
&_AttributeValueSpecification_ ($doc => $doc, $vals => $vals); |
1901 |
|
|
1902 |
|
~ (LIT) { |
1903 |
|
?lexmode AttlistDeclaration; |
1904 |
|
} else { |
1905 |
|
?lexmode AttlistDeclaration; |
1906 |
|
} |
1907 |
|
} (LITA) { |
1908 |
|
my $vals; |
1909 |
|
lang:Perl { |
1910 |
|
$vals = []; |
1911 |
|
} |
1912 |
|
|
1913 |
|
&_AttributeValueSpecificationA_ ($doc => $doc, $vals => $vals); |
1914 |
|
|
1915 |
|
~ (LIT) { |
1916 |
|
?lexmode AttlistDeclaration; |
1917 |
|
} else { |
1918 |
|
?lexmode AttlistDeclaration; |
1919 |
|
} |
1920 |
|
} |
1921 |
|
} |
1922 |
|
|
1923 |
|
} (LIT) { |
1924 |
|
my $vals; |
1925 |
|
lang:Perl { |
1926 |
|
$vals = []; |
1927 |
|
} |
1928 |
|
|
1929 |
|
&_AttributeValueSpecification_ ($doc => $doc, $vals => $vals); |
1930 |
|
|
1931 |
|
~ (LIT) { |
1932 |
|
?lexmode AttlistDeclaration; |
1933 |
|
} else { |
1934 |
|
?lexmode AttlistDeclaration; |
1935 |
|
} |
1936 |
|
} (LITA) { |
1937 |
|
my $vals; |
1938 |
|
lang:Perl { |
1939 |
|
$vals = []; |
1940 |
|
} |
1941 |
|
|
1942 |
|
&_AttributeValueSpecificationA_ ($doc => $doc, $vals => $vals); |
1943 |
|
|
1944 |
|
~ (LITA) { |
1945 |
|
?lexmode AttlistDeclaration; |
1946 |
|
} else { |
1947 |
|
?lexmode AttlistDeclaration; |
1948 |
|
} |
1949 |
|
} |
1950 |
|
|
1951 |
|
} (S) : separator : terminator? { |
1952 |
|
// |
1953 |
|
} |
1954 |
|
|
1955 |
|
~ (MDC) { |
1956 |
|
?lexmode DTD; |
1957 |
|
} else { |
1958 |
|
?lexmode DTD; |
1959 |
|
} |
1960 |
|
} // _AttlistDeclaration |
1961 |
|
|
1962 |
|
rule _EntityDeclaration ($doc) { |
1963 |
|
// ~ (MDO) { } |
1964 |
|
// ~ (Name == ENTITY) { } |
1965 |
|
|
1966 |
|
~ (S) { } |
1967 |
|
|
1968 |
|
~? (PERO) { |
1969 |
|
~ (S) { } |
1970 |
|
} |
1971 |
|
|
1972 |
|
~ (Name) { |
1973 |
|
|
1974 |
|
} |
1975 |
|
|
1976 |
|
~ (S) { } |
1977 |
|
|
1978 |
|
~ (LIT) { |
1979 |
|
&_EntityValue ($doc => $doc); |
1980 |
|
} (LITA) { |
1981 |
|
&_EntityValueA ($doc => $doc); |
1982 |
|
} (Name == 'PUBLIC') { |
1983 |
|
~ (S) { } |
1984 |
|
|
1985 |
|
&PubidLiteral ($doc => $doc); |
1986 |
|
|
1987 |
|
~ (S) { } |
1988 |
|
|
1989 |
|
&SystemLiteral ($doc => $doc); |
1990 |
|
} (Name == 'SYSTEM') { |
1991 |
|
~ (S) { } |
1992 |
|
|
1993 |
|
&SystemLiteral ($doc => $doc); |
1994 |
|
} |
1995 |
|
|
1996 |
|
~? (S) { |
1997 |
|
~? (Name == 'NDATA') { |
1998 |
|
// TODO: error if parameter entity |
1999 |
|
|
2000 |
|
~ (S) { } |
2001 |
|
|
2002 |
|
~ (Name) { |
2003 |
|
|
2004 |
|
} |
2005 |
|
|
2006 |
|
~? (S) { } |
2007 |
|
} |
2008 |
|
} |
2009 |
|
|
2010 |
|
~ (MDC) { |
2011 |
|
?lexmode DTD; |
2012 |
|
} else { |
2013 |
|
?lexmode DTD; |
2014 |
|
} |
2015 |
|
} // _EntityDeclaration |
2016 |
|
|
2017 |
|
rule _NotationDeclaration ($doc) { |
2018 |
|
// ~ (MDO) { } |
2019 |
|
// ~ (Name == NOTATION) { } |
2020 |
|
|
2021 |
|
~ (S) { } |
2022 |
|
|
2023 |
|
~ (Name) { |
2024 |
|
|
2025 |
|
} |
2026 |
|
|
2027 |
|
~ (S) { } |
2028 |
|
|
2029 |
|
~ (Name == 'PUBLIC') { |
2030 |
|
~ (S) { } |
2031 |
|
|
2032 |
|
&PubidLiteral ($doc => $doc); |
2033 |
|
|
2034 |
|
~? (S) { |
2035 |
|
~? (LIT) { |
2036 |
|
?lexmode SystemLiteral; |
2037 |
|
&_SystemLiteral ($doc => $doc); |
2038 |
|
|
2039 |
|
~? (S) { } |
2040 |
|
} (LITA) { |
2041 |
|
?lexmode SystemLiteralA; |
2042 |
|
&_SystemLiteral ($doc => $doc); |
2043 |
|
|
2044 |
|
~? (S) { } |
2045 |
|
} |
2046 |
|
} |
2047 |
|
} (Name == 'SYSTEM') { |
2048 |
|
~ (S) { } |
2049 |
|
|
2050 |
|
&SystemLiteral ($doc => $doc); |
2051 |
|
|
2052 |
|
~? (S) { } |
2053 |
|
} |
2054 |
|
|
2055 |
|
~ (MDC) { |
2056 |
|
?lexmode DTD; |
2057 |
|
} else { |
2058 |
|
?lexmode DTD; |
2059 |
|
} |
2060 |
|
} // _NotationDeclaration |
2061 |
|
|
2062 |
|
rule _EntityValue ($doc) { |
2063 |
|
?lexmode EntityValue; |
2064 |
|
|
2065 |
|
my $vals; |
2066 |
|
lang:Perl { |
2067 |
|
$vals = []; |
2068 |
|
} |
2069 |
|
|
2070 |
|
~* (STRING) { |
2071 |
|
|
2072 |
|
} (PERO) { |
2073 |
|
?lexmode EntityDeclaration; |
2074 |
|
|
2075 |
|
~ (Name) { |
2076 |
|
|
2077 |
|
} |
2078 |
|
|
2079 |
|
~ (REFC) { |
2080 |
|
?lexmode EntityValue; |
2081 |
|
} else { |
2082 |
|
?lexmode EntityValue; |
2083 |
|
} |
2084 |
|
} (HCRO) { |
2085 |
|
&_HexadecimalCharacterReferenceV_ |
2086 |
|
($doc => $doc, $vals => $vals); |
2087 |
|
|
2088 |
|
~ (REFC) { |
2089 |
|
?lexmode EntityValue; |
2090 |
|
} else { |
2091 |
|
?lexmode EntityValue; |
2092 |
|
} |
2093 |
|
} (CRO) { |
2094 |
|
&_NumericCharacterReferenceV_ |
2095 |
|
($doc => $doc, $vals => $vals); |
2096 |
|
|
2097 |
|
~ (REFC) { |
2098 |
|
?lexmode EntityValue; |
2099 |
|
} else { |
2100 |
|
?lexmode EntityValue; |
2101 |
|
} |
2102 |
|
} (ERO) { |
2103 |
|
&_GeneralEntityReferenceV_ |
2104 |
|
($doc => $doc, $vals => $vals); |
2105 |
|
|
2106 |
|
~ (REFC) { |
2107 |
|
?lexmode EntityValue; |
2108 |
|
} else { |
2109 |
|
?lexmode EntityValue; |
2110 |
|
} |
2111 |
|
} |
2112 |
|
|
2113 |
|
~ (LIT) { |
2114 |
|
?lexmode MarkupDeclaration; |
2115 |
|
} (LITA) { |
2116 |
|
?lexmode MarkupDeclaration; |
2117 |
|
} else { |
2118 |
|
?lexmode MarkupDeclaration; |
2119 |
|
} |
2120 |
|
} // _EntityValue |
2121 |
|
|
2122 |
|
rule _EntityValueA ($doc) { |
2123 |
|
?lexmode EntityValueA; |
2124 |
|
|
2125 |
|
my $vals; |
2126 |
|
lang:Perl { |
2127 |
|
$vals = []; |
2128 |
|
} |
2129 |
|
|
2130 |
|
~* (STRING) { |
2131 |
|
|
2132 |
|
} (PERO) { |
2133 |
|
?lexmode EntityDeclaration; |
2134 |
|
|
2135 |
|
~ (Name) { |
2136 |
|
|
2137 |
|
} |
2138 |
|
|
2139 |
|
~ (REFC) { |
2140 |
|
?lexmode EntityValueA; |
2141 |
|
} else { |
2142 |
|
?lexmode EntityValueA; |
2143 |
|
} |
2144 |
|
} (HCRO) { |
2145 |
|
&_HexadecimalCharacterReferenceV_ |
2146 |
|
($doc => $doc, $vals => $vals); |
2147 |
|
|
2148 |
|
~ (REFC) { |
2149 |
|
?lexmode EntityValueA; |
2150 |
|
} else { |
2151 |
|
?lexmode EntityValueA; |
2152 |
|
} |
2153 |
|
} (CRO) { |
2154 |
|
&_NumericCharacterReferenceV_ |
2155 |
|
($doc => $doc, $vals => $vals); |
2156 |
|
|
2157 |
|
~ (REFC) { |
2158 |
|
?lexmode EntityValueA; |
2159 |
|
} else { |
2160 |
|
?lexmode EntityValueA; |
2161 |
|
} |
2162 |
|
} (ERO) { |
2163 |
|
&_GeneralEntityReferenceV_ |
2164 |
|
($doc => $doc, $vals => $vals); |
2165 |
|
|
2166 |
|
~ (REFC) { |
2167 |
|
?lexmode EntityValueA; |
2168 |
|
} else { |
2169 |
|
?lexmode EntityValueA; |
2170 |
|
} |
2171 |
|
} |
2172 |
|
|
2173 |
|
~ (LITA) { |
2174 |
|
?lexmode MarkupDeclaration; |
2175 |
|
} else { |
2176 |
|
?lexmode MarkupDeclaration; |
2177 |
|
} |
2178 |
|
} // _EntityValueA |
2179 |
|
|
2180 |
|
|
2181 |
/* |
/* |
2182 |
XML Name |
XML Name |
2183 |
*/ |
*/ |
2184 |
lexmode Name { |
lexmode NameChar { |
2185 |
$NameStartChar10 := [ |
$NameStartChar10 := [ |
2186 |
'_' ':' |
'_' ':' |
2187 |
// Letter |
// Letter |
2386 |
U+2070..U+218F U+2C00..U+2FEF U+3001..U+D7FF |
U+2070..U+218F U+2C00..U+2FEF U+3001..U+D7FF |
2387 |
U+F900..U+FDCF U+FDF0..U+FFFD U+10000..U+EFFFF |
U+F900..U+FDCF U+FDF0..U+FFFD U+10000..U+EFFFF |
2388 |
]; |
]; |
2389 |
|
} // NameChar |
2390 |
|
|
2391 |
|
lexmode Name |
2392 |
|
: extends => 'NameChar' |
2393 |
|
{ |
2394 |
Name : value := $NameStartChar11 $NameChar11*; |
Name : value := $NameStartChar11 $NameChar11*; |
2395 |
} // Name |
} // Name |
2396 |
|
|
2397 |
|
lexmode Nmtoken |
2398 |
|
: extends => 'NameChar' |
2399 |
|
{ |
2400 |
|
Nmtoken : value := $NameChar11*; |
2401 |
|
} // Nmtoken |
2402 |
|
|
2403 |
/* |
/* |
2404 |
Space |
Space |
2469 |
} // DocumentStart |
} // DocumentStart |
2470 |
|
|
2471 |
/* |
/* |
|
Markup declaration scanning mode |
|
|
|
|
|
This mode is used to recognize |MDC| that terminates |
|
|
a comment declaration as well as the base |lexmode| |
|
|
for e.g. document type declaration scanning mode. |
|
|
*/ |
|
|
lexmode MarkupDeclaration |
|
|
: standalone |
|
|
: extends => 'Name' |
|
|
{ |
|
|
/* |
|
|
Markup declaration close |
|
|
*/ |
|
|
MDC := ['>']; |
|
|
|
|
|
/* |
|
|
Literal open |
|
|
*/ |
|
|
LIT := ['"']; |
|
|
|
|
|
/* |
|
|
Alternative literal open |
|
|
*/ |
|
|
LITA := [U+0027]; |
|
|
} // MarkupDeclaration |
|
|
|
|
|
lexmode DocumentTypeDeclaration |
|
|
: standalone |
|
|
: extends => 'MarkupDeclaration' |
|
|
{ |
|
|
/* |
|
|
Declaration subset close |
|
|
*/ |
|
|
DSO := ['[']; |
|
|
|
|
|
/* |
|
|
Declaration subset close |
|
|
*/ |
|
|
DSC := [']']; |
|
|
} // DocumentTypeDeclaration |
|
|
|
|
|
/* |
|
2472 |
Comment declaration scanning mode |
Comment declaration scanning mode |
2473 |
*/ |
*/ |
2474 |
lexmode CommentDeclaration |
lexmode CommentDeclaration |
2717 |
: standalone |
: standalone |
2718 |
: extends => 'AttributeValueLiteral_' |
: extends => 'AttributeValueLiteral_' |
2719 |
{ |
{ |
2720 |
LIT := [U+0027]; |
LITA := [U+0027]; |
2721 |
STRING : value := [^U+0027 '&' '<']+; |
STRING : value := [^U+0027 '&' '<']+; |
2722 |
} // AttributeValueLiteralA |
} // AttributeValueLiteralA |
2723 |
|
|
2724 |
|
lexmode EntityValue_ { |
2725 |
|
PERO := ['%']; |
2726 |
|
ERO := ['&']; |
2727 |
|
CRO := ['&'] ['#']; |
2728 |
|
HCRO := ['&'] ['#'] ['x']; |
2729 |
|
} // EntityValue_ |
2730 |
|
|
2731 |
|
lexmode EntityValue |
2732 |
|
: standalone |
2733 |
|
: extends => 'EntityValue_' |
2734 |
|
{ |
2735 |
|
LIT := ['"']; |
2736 |
|
STRING : value := [^'"' '&' '%']+; |
2737 |
|
} // EntityValue |
2738 |
|
|
2739 |
|
lexmode EntityValueA |
2740 |
|
: standalone |
2741 |
|
: extends => 'EntityValue_' |
2742 |
|
{ |
2743 |
|
LITA := [U+0027]; |
2744 |
|
STRING : value := [^U+0027 '&' '%']+; |
2745 |
|
} // EntityValueA |
2746 |
|
|
2747 |
|
lexmode SystemLiteral |
2748 |
|
: standalone |
2749 |
|
{ |
2750 |
|
LIT := ['"']; |
2751 |
|
?default-token STRING : value; |
2752 |
|
} // SystemLiteral |
2753 |
|
|
2754 |
|
lexmode SystemLiteralA |
2755 |
|
: standalone |
2756 |
|
{ |
2757 |
|
LITA := [U+0027]; |
2758 |
|
?default-token STRING : value; |
2759 |
|
} // SystemLiteralA |
2760 |
|
|
2761 |
|
lexmode DTD |
2762 |
|
: standalone |
2763 |
|
: extends => 'S' |
2764 |
|
{ |
2765 |
|
/* |
2766 |
|
Markup declaration open |
2767 |
|
*/ |
2768 |
|
MDO := ['<'] ['!']; |
2769 |
|
|
2770 |
|
/* |
2771 |
|
Comment declaration open |
2772 |
|
*/ |
2773 |
|
CDO := ['<'] ['!'] ['-'] ['-']; |
2774 |
|
|
2775 |
|
/* |
2776 |
|
Processing instruction open |
2777 |
|
*/ |
2778 |
|
PIO := ['<'] ['?']; |
2779 |
|
|
2780 |
|
/* |
2781 |
|
Parameter entity reference open |
2782 |
|
*/ |
2783 |
|
PERO := ['%']; |
2784 |
|
|
2785 |
|
/* |
2786 |
|
Declaration subset close |
2787 |
|
*/ |
2788 |
|
DSC := [']']; |
2789 |
|
|
2790 |
|
/* |
2791 |
|
Contition section open |
2792 |
|
*/ |
2793 |
|
CSO := ['<'] ['!'] ['[']; |
2794 |
|
} // DTD |
2795 |
|
|
2796 |
|
/* |
2797 |
|
Markup declaration scanning mode |
2798 |
|
|
2799 |
|
This mode is used to recognize |MDC| that terminates |
2800 |
|
a comment declaration as well as the base |lexmode| |
2801 |
|
for e.g. document type declaration scanning mode. |
2802 |
|
*/ |
2803 |
|
lexmode MarkupDeclaration |
2804 |
|
: standalone |
2805 |
|
: extends => 'Name' |
2806 |
|
: extends => 'S' |
2807 |
|
{ |
2808 |
|
/* |
2809 |
|
Markup declaration close |
2810 |
|
*/ |
2811 |
|
MDC := ['>']; |
2812 |
|
|
2813 |
|
/* |
2814 |
|
Literal open |
2815 |
|
*/ |
2816 |
|
LIT := ['"']; |
2817 |
|
|
2818 |
|
/* |
2819 |
|
Alternative literal open |
2820 |
|
*/ |
2821 |
|
LITA := [U+0027]; |
2822 |
|
|
2823 |
|
/* |
2824 |
|
Parameter entity reference open |
2825 |
|
*/ |
2826 |
|
PERO := ['%']; |
2827 |
|
|
2828 |
|
/* |
2829 |
|
Declaration subset open |
2830 |
|
*/ |
2831 |
|
DSO := ['[']; |
2832 |
|
} // MarkupDeclaration |
2833 |
|
|
2834 |
|
lexmode ElementDeclaration |
2835 |
|
: standalone |
2836 |
|
: extends => 'MarkupDeclaration' |
2837 |
|
{ |
2838 |
|
/* |
2839 |
|
Model group open |
2840 |
|
*/ |
2841 |
|
MGO := ['(']; |
2842 |
|
|
2843 |
|
/* |
2844 |
|
Model group close |
2845 |
|
*/ |
2846 |
|
MGC := [')']; |
2847 |
|
|
2848 |
|
/* |
2849 |
|
Reserved name indicator |
2850 |
|
*/ |
2851 |
|
RNI := ['#']; |
2852 |
|
|
2853 |
|
/* |
2854 |
|
Occurence indicators |
2855 |
|
*/ |
2856 |
|
OPT := ['?']; |
2857 |
|
REP := ['*']; |
2858 |
|
PLUS := ['+']; |
2859 |
|
|
2860 |
|
/* |
2861 |
|
Connectors |
2862 |
|
*/ |
2863 |
|
OR := ['|']; |
2864 |
|
SEQ := [',']; |
2865 |
|
} // ElementDeclaration |
2866 |
|
|
2867 |
|
lexmode AttlistDeclaration |
2868 |
|
: standalone |
2869 |
|
: extends => 'MarkupDeclaration' |
2870 |
|
{ |
2871 |
|
/* |
2872 |
|
Enumeration group open |
2873 |
|
*/ |
2874 |
|
EGO := ['(']; |
2875 |
|
|
2876 |
|
/* |
2877 |
|
Enumeration group close |
2878 |
|
*/ |
2879 |
|
EGC := [')']; |
2880 |
|
|
2881 |
|
/* |
2882 |
|
Enumeration choice delimiter |
2883 |
|
*/ |
2884 |
|
OR := ['|']; |
2885 |
|
|
2886 |
|
/* |
2887 |
|
Reserved name indicator |
2888 |
|
*/ |
2889 |
|
RNI := ['#']; |
2890 |
|
} // AttlistDeclaration |
2891 |
|
|
2892 |
|
lexmode Enumeration |
2893 |
|
: standalone |
2894 |
|
: extends => 'Nmtoken' |
2895 |
|
: extends => 'S' |
2896 |
|
{ |
2897 |
|
/* |
2898 |
|
Enumeration group close |
2899 |
|
*/ |
2900 |
|
EGC := [')']; |
2901 |
|
|
2902 |
|
/* |
2903 |
|
Enumeration choice delimiter |
2904 |
|
*/ |
2905 |
|
OR := ['|']; |
2906 |
|
} // Enumeration |
2907 |
|
|
2908 |
|
|
2909 |
token-error default : default { |
token-error default : default { |
2910 |
lang:Perl { |
lang:Perl { |