public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] libproc_macro: Add Literal 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:0b6b3851de3a8dab4e687069ed49617785c9690f

commit 0b6b3851de3a8dab4e687069ed49617785c9690f
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Fri Feb 10 15:05:03 2023 +0100

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

Diff:
---
 librust/proc_macro/rust/lib.rs | 164 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 164 insertions(+)

diff --git a/librust/proc_macro/rust/lib.rs b/librust/proc_macro/rust/lib.rs
index c28ffebb550..78a302f889a 100644
--- a/librust/proc_macro/rust/lib.rs
+++ b/librust/proc_macro/rust/lib.rs
@@ -1,5 +1,6 @@
 use std::error;
 use std::fmt;
+use std::str::FromStr;
 
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
 pub enum Delimiter {
@@ -104,3 +105,166 @@ impl fmt::Display for LexError {
 }
 
 impl error::Error for LexError {}
+
+#[derive(Clone)]
+pub struct Literal {
+    // Internal implementation details
+}
+
+impl Literal {
+    // TODO: Add experimental API functions for this type
+
+    pub fn u8_suffixed(n: u8) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn u16_suffixed(n: u16) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn u32_suffixed(n: u32) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn u64_suffixed(n: u64) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn u128_suffixed(n: u128) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn usize_suffixed(n: usize) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn i8_suffixed(n: i8) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn i16_suffixed(n: i16) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn i32_suffixed(n: i32) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn i64_suffixed(n: i64) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn i128_suffixed(n: i128) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn isize_suffixed(n: isize) -> Self {
+        todo!("Implement this function")
+    }
+
+    // Unsuffixed
+
+    pub fn u8_unsuffixed(n: u8) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn u16_unsuffixed(n: u16) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn u32_unsuffixed(n: u32) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn u64_unsuffixed(n: u64) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn u128_unsuffixed(n: u128) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn usize_unsuffixed(n: usize) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn i8_unsuffixed(n: i8) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn i16_unsuffixed(n: i16) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn i32_unsuffixed(n: i32) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn i64_unsuffixed(n: i64) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn i128_unsuffixed(n: i128) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn isize_unsuffixed(n: isize) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn f32_unsuffixed(n: f32) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn f32_suffixed(n: f32) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn f64_unsuffixed(n: f64) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn f64_suffixed(n: f64) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn string(string: &str) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn character(c: char) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn byte_string(bytes: &[u8]) -> Self {
+        todo!("Implement this function")
+    }
+
+    pub fn span(&self) -> Span {
+        todo!("Get the span of a literal")
+    }
+
+    pub fn set_span(&mut self, span: Span) {
+        todo!("Set the span of a literal")
+    }
+}
+
+impl fmt::Debug for Literal {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        todo!("Implement this function")
+    }
+}
+
+impl fmt::Display for Literal {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        todo!("Implement this function")
+    }
+}
+
+impl FromStr for Literal {
+    type Err = LexError;
+
+    fn from_str(src: &str) -> Result<Self, LexError> {
+        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 Literal 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).