diff options
| author | 2024-11-24 02:05:41 +0000 | |
|---|---|---|
| committer | 2024-11-24 02:05:41 +0000 | |
| commit | 87e6ff405b0d687ed341f304fba7c5b391a49359 (patch) | |
| tree | f56ddd5271fb2bb104f641c035e58a744038f5cf /src/xml | |
| parent | c1e6f7e918eacaad9c8b1a4b27fcd4d6245aaf68 (diff) | |
| download | peanuts-87e6ff405b0d687ed341f304fba7c5b391a49359.tar.gz peanuts-87e6ff405b0d687ed341f304fba7c5b391a49359.tar.bz2 peanuts-87e6ff405b0d687ed341f304fba7c5b391a49359.zip | |
misc
Diffstat (limited to '')
| -rw-r--r-- | src/xml/mod.rs | 44 | 
1 files changed, 41 insertions, 3 deletions
| diff --git a/src/xml/mod.rs b/src/xml/mod.rs index 3150df0..43f3027 100644 --- a/src/xml/mod.rs +++ b/src/xml/mod.rs @@ -389,9 +389,9 @@ pub type Prolog<'s> = (  /// [23]   	XMLDecl	   ::=   	'<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'  #[derive(Debug)]  pub struct XMLDecl<'s> { -    version_info: VersionInfo, -    encoding_decl: Option<EncodingDecl<'s>>, -    sd_decl: Option<SDDecl>, +    pub(crate) version_info: VersionInfo, +    pub(crate) encoding_decl: Option<EncodingDecl<'s>>, +    pub(crate) sd_decl: Option<SDDecl>,  }  /// [24]   	VersionInfo	   ::=   	S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"') @@ -401,6 +401,17 @@ pub enum VersionInfo {      DoubleQuoted(VersionNum),  } +impl Deref for VersionInfo { +    type Target = VersionNum; + +    fn deref(&self) -> &Self::Target { +        match self { +            VersionInfo::SingleQuoted(version_num) => version_num, +            VersionInfo::DoubleQuoted(version_num) => version_num, +        } +    } +} +  /// [25]   	Eq	   ::=   	S? '=' S?  #[derive(Clone)]  pub struct Eq; @@ -479,6 +490,17 @@ pub enum SDDecl {      DoubleQuoted(bool),  } +impl Deref for SDDecl { +    type Target = bool; + +    fn deref(&self) -> &Self::Target { +        match self { +            SDDecl::SingleQuoted(b) => b, +            SDDecl::DoubleQuoted(b) => b, +        } +    } +} +  // (Productions 33 through 38 have been removed.)  /// [39]   	element	   ::=   	EmptyElemTag | STag content ETag @@ -846,10 +868,26 @@ pub struct ExtParsedEnt<'s> {  // TODO?: select quote version  pub struct EncodingDecl<'s>(EncName<'s>); +impl<'s> Deref for EncodingDecl<'s> { +    type Target = EncName<'s>; + +    fn deref(&self) -> &Self::Target { +        &self.0 +    } +} +  /// [81]   	EncName	   ::=   	[A-Za-z] ([A-Za-z0-9._] | '-')*  #[derive(Debug)]  pub struct EncName<'s>(&'s str); +impl<'s> Deref for EncName<'s> { +    type Target = &'s str; + +    fn deref(&self) -> &Self::Target { +        &self.0 +    } +} +  #[derive(Debug)]  pub enum NotationDeclID<'s> {      External(ExternalID<'s>), | 
