Skip to content

Commit

Permalink
parsing docs, bunch of fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sam0x17 committed Apr 1, 2024
1 parent e281172 commit 5b4c868
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 46 deletions.
6 changes: 3 additions & 3 deletions src/parsable/everything.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use super::*;

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Everything(Span);
use crate as quoth;

make_parsable!(Everything);
#[derive(Clone, Debug, PartialEq, Eq, Hash, ParsableExt)]
pub struct Everything(Span);

impl Spanned for Everything {
fn span(&self) -> Span {
Expand Down
6 changes: 3 additions & 3 deletions src/parsable/exact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use std::rc::Rc;

use super::*;

#[derive(Clone, Debug, Hash, PartialEq, Eq)]
use crate as quoth;

#[derive(Clone, Debug, Hash, PartialEq, Eq, ParsableExt)]
pub struct Exact(pub Span);

impl Exact {
Expand All @@ -23,8 +25,6 @@ impl Spanned for Exact {
}
}

make_parsable!(Exact);

impl Parsable for Exact {
fn parse(stream: &mut ParseStream) -> Result<Self> {
Ok(Exact(Span::new(
Expand Down
6 changes: 3 additions & 3 deletions src/parsable/nothing.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use super::*;

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Nothing(Span);
use crate as quoth;

make_parsable!(Nothing);
#[derive(Clone, Debug, PartialEq, Eq, Hash, ParsableExt)]
pub struct Nothing(Span);

impl Spanned for Nothing {
fn span(&self) -> Span {
Expand Down
20 changes: 5 additions & 15 deletions src/parsable/numbers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use super::*;
// enables usage of quoth proc macros within quoth
use crate as quoth;

#[derive(Clone, PartialEq, Eq, Hash, Debug)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, ParsableExt)]
pub struct U64(u64, Span);

impl U64 {
Expand Down Expand Up @@ -48,8 +48,6 @@ impl Parsable for U64 {
}
}

make_parsable!(U64);

impl From<U64> for u64 {
fn from(value: U64) -> Self {
value.0
Expand All @@ -68,7 +66,7 @@ impl From<U64> for i128 {
}
}

#[derive(Clone, PartialEq, Eq, Hash, Debug)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, ParsableExt)]
pub struct U128(u128, Span);

impl U128 {
Expand Down Expand Up @@ -111,14 +109,12 @@ impl Parsable for U128 {
}
}

make_parsable!(U128);

impl From<U128> for u128 {
fn from(value: U128) -> Self {
value.0
}
}
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, ParsableExt)]
pub struct I64(i64, Span);

impl I64 {
Expand Down Expand Up @@ -166,8 +162,6 @@ impl Parsable for I64 {
}
}

make_parsable!(I64);

impl From<I64> for i64 {
fn from(value: I64) -> Self {
value.0
Expand All @@ -180,7 +174,7 @@ impl From<I64> for i128 {
}
}

#[derive(Clone, PartialEq, Eq, Hash, Debug)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, ParsableExt)]
pub struct I128(i128, Span);

impl I128 {
Expand Down Expand Up @@ -228,8 +222,6 @@ impl Parsable for I128 {
}
}

make_parsable!(I128);

impl From<I128> for i128 {
fn from(value: I128) -> Self {
value.0
Expand All @@ -242,7 +234,7 @@ impl From<I64> for I128 {
}
}

#[derive(Clone, PartialEq, Eq, Debug, Hash)]
#[derive(Clone, PartialEq, Eq, Debug, Hash, ParsableExt)]
pub struct Decimal(rust_decimal::Decimal, Span);

impl Decimal {
Expand Down Expand Up @@ -276,8 +268,6 @@ impl Spanned for Decimal {
}
}

make_parsable!(Decimal);

impl Parsable for Decimal {
fn parse(stream: &mut ParseStream) -> Result<Self> {
let start_position = stream.position;
Expand Down
6 changes: 3 additions & 3 deletions src/parsable/whitespace.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use super::*;

#[derive(Clone, PartialEq, Eq, Debug, Hash)]
use crate as quoth;

#[derive(Clone, PartialEq, Eq, Debug, Hash, ParsableExt)]
pub struct Whitespace(Span);

impl Spanned for Whitespace {
Expand All @@ -9,8 +11,6 @@ impl Spanned for Whitespace {
}
}

make_parsable!(Whitespace);

impl Parsable for Whitespace {
fn parse(stream: &mut ParseStream) -> Result<Self> {
let start_position = stream.position;
Expand Down
Loading

0 comments on commit 5b4c868

Please sign in to comment.