public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] libproc_macro: Add punct type interface
@ 2023-04-06 21:29 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-04-06 21:29 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f7152d606c82e2c0b9c57d6c2e8f30ab90214553

commit f7152d606c82e2c0b9c57d6c2e8f30ab90214553
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Mon Feb 13 10:01:44 2023 +0100

    libproc_macro: Add punct type interface
    
    Add the Punct rust type interface for the libproc_macro.
    
    ChangeLog:
    
            * librust/proc_macro/rust/lib.rs: Add punct module.
            * librust/proc_macro/rust/punct.rs: Add Punct type.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Diff:
---
 librust/proc_macro/rust/lib.rs   |  2 ++
 librust/proc_macro/rust/punct.rs | 75 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+)

diff --git a/librust/proc_macro/rust/lib.rs b/librust/proc_macro/rust/lib.rs
index 8e7e077f591..1bb8e247762 100644
--- a/librust/proc_macro/rust/lib.rs
+++ b/librust/proc_macro/rust/lib.rs
@@ -1,11 +1,13 @@
 pub use ident::Ident;
 pub use literal::Literal;
+pub use punct::Punct;
 pub use span::Span;
 use std::error;
 use std::fmt;
 
 mod ident;
 mod literal;
+mod punct;
 mod span;
 
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
diff --git a/librust/proc_macro/rust/punct.rs b/librust/proc_macro/rust/punct.rs
new file mode 100644
index 00000000000..1389122e299
--- /dev/null
+++ b/librust/proc_macro/rust/punct.rs
@@ -0,0 +1,75 @@
+use std::fmt;
+use Spacing;
+use Span;
+
+#[derive(Clone)]
+pub struct Punct {
+    // Internal implementation details.
+}
+
+impl Punct {
+    /// Creates a new [Punct] from a given character and spacing.
+    ///
+    /// # Arguments
+    ///
+    /// * `ch` - The punctuation character.
+    /// * `spacing` - The link between this character and the next one.
+    ///
+    /// # Panics
+    ///
+    /// This function will panic if the `ch` argument is not a valid
+    /// punctuation character allowed by the language.
+    pub fn new(_ch: char, _spacing: Spacing) -> Self {
+        todo!("Implement this function")
+    }
+
+    /// Get the value for this punctuation character as `char`.
+    pub fn as_char(&self) -> char {
+        todo!("Implement this function")
+    }
+
+    /// Get the [`Spacing`] of this punctuation character, indicating whether
+    /// the following character can be combined into a multi-character operator
+    /// or not.
+    pub fn spacing(&self) -> Spacing {
+        todo!("Implement this function")
+    }
+
+    /// Get the [`Span`] for this punctuation character.
+    pub fn span(&self) -> Span {
+        todo!("Implement this function")
+    }
+
+    /// Set the span for this punctuation character.
+    ///
+    /// # Arguments
+    ///
+    /// * `span` - The new span value.
+    pub fn set_span(&mut self, _span: Span) {
+        todo!("Implement this function")
+    }
+}
+
+impl fmt::Display for Punct {
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        todo!("Implement this function")
+    }
+}
+
+impl fmt::Debug for Punct {
+    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        todo!("Implement this function")
+    }
+}
+
+impl PartialEq<char> for Punct {
+    fn eq(&self, _rhs: &char) -> bool {
+        todo!("Implement this function")
+    }
+}
+
+impl PartialEq<Punct> for char {
+    fn eq(&self, _rhs: &Punct) -> bool {
+        todo!("Implement this function")
+    }
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-06 21:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-06 21:29 [gcc/devel/rust/master] libproc_macro: Add punct type interface Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).