Skip to content

Commit 3d7330a

Browse files
committed
trivial cleanup
1 parent e67e322 commit 3d7330a

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

ascent_macro/src/ascent_syntax.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,14 @@ use crate::utils::{
3232
// example: https://gitlab.gnome.org/federico/gnome-class/-/blob/master/src/parser/mod.rs
3333

3434
mod kw {
35+
use derive_syn_parse::Parse;
36+
use syn::Token;
37+
3538
syn::custom_keyword!(relation);
3639
syn::custom_keyword!(lattice);
37-
syn::custom_punctuation!(LongLeftArrow, <--);
40+
#[allow(dead_code)] // for unused fields of LongLeftArrow
41+
#[derive(Parse)]
42+
pub struct LongLeftArrow(Token![<], Token![-], Token![-]);
3843
syn::custom_keyword!(agg);
3944
syn::custom_keyword!(ident);
4045
syn::custom_keyword!(expr);
@@ -451,16 +456,10 @@ impl Parse for RuleNode {
451456
};
452457

453458
if input.peek(Token![;]) {
454-
// println!("fact rule!!!");
455459
input.parse::<Token![;]>()?;
456460
Ok(RuleNode { head_clauses, body_items: vec![] /*Punctuated::default()*/ })
457461
} else {
458-
input.parse::<Token![<]>()?;
459-
input.parse::<Token![-]>()?;
460-
input.parse::<Token![-]>()?;
461-
// NOTE this does not work with quote!
462-
// input.parse::<kw::LongLeftArrow>()?;
463-
462+
input.parse::<kw::LongLeftArrow>()?;
464463
let body_items = Punctuated::<BodyItemNode, Token![,]>::parse_separated_nonempty(input)?;
465464
input.parse::<Token![;]>()?;
466465
Ok(RuleNode { head_clauses, body_items: body_items.into_iter().collect() })
@@ -599,13 +598,10 @@ pub(crate) struct DsAttributeContents {
599598

600599
impl Parse for DsAttributeContents {
601600
fn parse(input: ParseStream) -> Result<Self> {
602-
let content = input;
603-
// parenthesized!(content in input);
604-
605-
let path = syn::Path::parse_mod_style(&content)?;
606-
let args = if content.peek(Token![:]) {
607-
content.parse::<Token![:]>()?;
608-
TokenStream::parse(&content)?
601+
let path = syn::Path::parse_mod_style(&input)?;
602+
let args = if input.peek(Token![:]) {
603+
input.parse::<Token![:]>()?;
604+
TokenStream::parse(&input)?
609605
} else {
610606
TokenStream::default()
611607
};

0 commit comments

Comments
 (0)