aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-02-10 15:05:03 +0100
committerPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-03-30 13:52:28 +0200
commit0b6b3851de3a8dab4e687069ed49617785c9690f (patch)
tree12d9a853ca8d1f64bbc752239458d0dee15f4316
parent4f6d36157d123e6960f4256243480e5d53b7ba72 (diff)
downloadgcc-0b6b3851de3a8dab4e687069ed49617785c9690f.zip
gcc-0b6b3851de3a8dab4e687069ed49617785c9690f.tar.gz
gcc-0b6b3851de3a8dab4e687069ed49617785c9690f.tar.bz2
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>
-rw-r--r--librust/proc_macro/rust/lib.rs164
1 files changed, 164 insertions, 0 deletions
diff --git a/librust/proc_macro/rust/lib.rs b/librust/proc_macro/rust/lib.rs
index c28ffeb..78a302f 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")
+ }
+}