Skip to content

Commit

Permalink
conform to "int subset" names
Browse files Browse the repository at this point in the history
  • Loading branch information
onelson committed Mar 12, 2018
1 parent a830a28 commit 86d29c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ enum SpecificError {
ExpectedWhitespace,

ExpectedDocumentTypeName,
ExpectedInternalDTD,
ExpectedIntSubset,
ExpectedSystemLiteral,

ExpectedClosingQuote(&'static str),
Expand Down Expand Up @@ -151,7 +151,7 @@ impl error::Error for SpecificError {
ExpectedYesNo => "expected yes or no",
ExpectedWhitespace => "expected whitespace",
ExpectedDocumentTypeName => "expected document type name",
ExpectedInternalDTD => "expected Internal DTD definition",
ExpectedIntSubset => "expected int subset",
ExpectedSystemLiteral => "expected system literal",
ExpectedClosingQuote(_) => "expected closing quote",
ExpectedOpeningQuote(_) => "expected opening quote",
Expand Down Expand Up @@ -263,7 +263,7 @@ trait PrivateXmlParseExt<'a> {
fn consume_hex_chars(&self) -> XmlProgress<'a, &'a str>;
fn consume_char_data(&self) -> XmlProgress<'a, &'a str>;
fn consume_cdata(&self) -> XmlProgress<'a, &'a str>;
fn consume_internal_dtd(&self) -> XmlProgress<'a, &'a str>;
fn consume_int_subset(&self) -> XmlProgress<'a, &'a str>;
fn consume_comment(&self) -> XmlProgress<'a, &'a str>;
fn consume_pi_value(&self) -> XmlProgress<'a, &'a str>;
fn consume_start_tag(&self) -> XmlProgress<'a, &'a str>;
Expand Down Expand Up @@ -291,8 +291,8 @@ impl<'a> PrivateXmlParseExt<'a> for StringPoint<'a> {
self.consume_to(self.s.end_of_cdata()).map_err(|_| SpecificError::ExpectedCData)
}

fn consume_internal_dtd(&self) -> XmlProgress<'a, &'a str> {
self.consume_to(self.s.end_of_internal_dtd()).map_err(|_| SpecificError::ExpectedInternalDTD)
fn consume_int_subset(&self) -> XmlProgress<'a, &'a str> {
self.consume_to(self.s.end_of_int_subset()).map_err(|_| SpecificError::ExpectedIntSubset)
}

fn consume_comment(&self) -> XmlProgress<'a, &'a str> {
Expand Down Expand Up @@ -502,7 +502,7 @@ fn parse_int_subset<'a>(_pm: &mut XmlMaster<'a>, xml: StringPoint<'a>)
let (xml, _) = try_parse!(xml.expect_literal("["));
let (xml, _) = xml.consume_space().optional(xml);
let (xml, elements) = try_parse!(
xml.consume_internal_dtd().map_err(|_| SpecificError::ExpectedInternalDTD)
xml.consume_int_subset().map_err(|_| SpecificError::ExpectedIntSubset)
);
let (xml, _) = xml.consume_space().optional(xml);
let (xml, _) = try_parse!(xml.expect_literal("]"));
Expand Down
8 changes: 4 additions & 4 deletions src/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub trait XmlStr {
fn end_of_start_tag(&self) -> Option<usize>;
fn end_of_encoding(&self) -> Option<usize>;
/// Find the end of the internal doc type declaration, not including the ]
fn end_of_internal_dtd(&self) -> Option<usize>;
fn end_of_int_subset(&self) -> Option<usize>;
}

impl<'a> XmlStr for &'a str {
Expand Down Expand Up @@ -146,7 +146,7 @@ impl<'a> XmlStr for &'a str {
self.end_of_start_rest(|c| c.is_encoding_start_char(), |c| c.is_encoding_rest_char())
}

fn end_of_internal_dtd(&self) -> Option<usize> { self.find("]") }
fn end_of_int_subset(&self) -> Option<usize> { self.find("]") }
}

/// Predicates used when parsing an characters in an XML document.
Expand Down Expand Up @@ -303,7 +303,7 @@ mod test {
}

#[test]
fn end_of_internal_dtd_excludes_right_square() {
assert_eq!("hello]>world".end_of_internal_dtd(), Some("hello".len()))
fn end_of_int_subset_excludes_right_square() {
assert_eq!("hello]>world".end_of_int_subset(), Some("hello".len()))
}
}

0 comments on commit 86d29c0

Please sign in to comment.