Skip to content

Commit

Permalink
return stable
Browse files Browse the repository at this point in the history
  • Loading branch information
SkymanOne committed Jan 31, 2024
1 parent e918dc3 commit 0efd0f1
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 166 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --workspace --all-targets --all-features
- run: cargo +nightly fmt --check --all
- run: cargo fmt --check --all
- run: cargo doc --workspace --no-deps
60 changes: 0 additions & 60 deletions .rustfmt.toml

This file was deleted.

16 changes: 6 additions & 10 deletions crates/derive_node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@ fn node_derive(mut s: synstructure::Structure) -> TokenStream2 {
.add_bounds(synstructure::AddBounds::Fields)
.underscore_const(true);
match &s.ast().data {
syn::Data::Struct(_) => {
node_derive_struct(s).unwrap_or_else(|err| err.to_compile_error())
}
_ => {
syn::Error::new(
s.ast().span(),
"can only derive `Node` for Rust `struct` items",
)
.to_compile_error()
}
syn::Data::Struct(_) => node_derive_struct(s).unwrap_or_else(|err| err.to_compile_error()),
_ => syn::Error::new(
s.ast().span(),
"can only derive `Node` for Rust `struct` items",
)
.to_compile_error(),
}
}

Expand Down
20 changes: 6 additions & 14 deletions crates/parser/src/lexer.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
use super::Span;
use logos::{
Logos,
SpannedIter,
};
use std::{
fmt,
num::ParseIntError,
};
use logos::{Logos, SpannedIter};
use std::{fmt, num::ParseIntError};
use thiserror::Error;

#[derive(Default, Clone, Debug, PartialEq)]
Expand Down Expand Up @@ -326,12 +320,10 @@ impl<'input> Iterator for Lexer<'input> {
fn next(&mut self) -> Option<Self::Item> {
if let Some((tok_res, span)) = self.token_stream.next() {
match tok_res {
Ok(tok) => {
match tok {
Token::Comment(_) => self.next(),
_ => Some((span.start, tok, span.end)),
}
}
Ok(tok) => match tok {
Token::Comment(_) => self.next(),
_ => Some((span.start, tok, span.end)),
},
Err(err) => {
self.errors.push(logos_to_lexical_error(&err, &span));
self.next()
Expand Down
122 changes: 42 additions & 80 deletions crates/parser/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,36 +1,12 @@
use crate::{
ast::{
self,
AccessAttribute,
BinaryExpression,
Declaration,
Expression,
FuncReturnType,
FunctionCall,
FunctionDeclaration,
FunctionVisibility,
Identifier,
IfElse,
List,
Mapping,
MappingRelation,
Param,
Set,
Source,
StBlock,
StateDeclaration,
Statement,
StatementBlock,
StructInit,
TypeVariant,
UnaryExpression,
Variable,
self, AccessAttribute, BinaryExpression, Declaration, Expression, FuncReturnType,
FunctionCall, FunctionDeclaration, FunctionVisibility, Identifier, IfElse, List, Mapping,
MappingRelation, Param, Set, Source, StBlock, StateDeclaration, Statement, StatementBlock,
StructInit, TypeVariant, UnaryExpression, Variable,
},
folidity,
lexer::{
Lexer,
Token,
},
lexer::{Lexer, Token},
};

#[test]
Expand Down Expand Up @@ -279,67 +255,53 @@ fn test_factorial_tree() {
}),
else_part: Some(Box::new(Statement::Block(StatementBlock {
loc: 175..349,
statements: vec![Statement::Return(
Expression::FunctionCall(FunctionCall {
statements: vec![Statement::Return(Expression::FunctionCall(
FunctionCall {
loc: 192..342,
name: Identifier {
loc: 192..201,
name: "calculate".to_string(),
},
args: vec![Expression::Pipe(BinaryExpression {
loc: 296..324,
left: Box::new(Expression::Multiply(
BinaryExpression {
loc: 296..315,
left: Box::new(Expression::Variable(
Identifier {
loc: 296..301,
name: "value".to_string(),
},
)),
right: Box::new(Expression::Subtract(
BinaryExpression {
loc: 305..314,
left: Box::new(
Expression::Variable(
Identifier {
loc: 305..310,
name: "value"
.to_string(),
},
),
),
right: Box::new(
Expression::Number(
UnaryExpression {
loc: 313..314,
element: "1"
.to_string(),
},
),
),
},
)),
},
)),
right: Box::new(Expression::FunctionCall(
FunctionCall {
loc: 319..324,
name: Identifier {
loc: 319..321,
name: "or".to_string(),
left: Box::new(Expression::Multiply(BinaryExpression {
loc: 296..315,
left: Box::new(Expression::Variable(Identifier {
loc: 296..301,
name: "value".to_string(),
})),
right: Box::new(Expression::Subtract(
BinaryExpression {
loc: 305..314,
left: Box::new(Expression::Variable(
Identifier {
loc: 305..310,
name: "value".to_string(),
},
)),
right: Box::new(Expression::Number(
UnaryExpression {
loc: 313..314,
element: "1".to_string(),
},
)),
},
args: vec![Expression::Number(
UnaryExpression {
loc: 322..323,
element: "1".to_string(),
},
)],
)),
})),
right: Box::new(Expression::FunctionCall(FunctionCall {
loc: 319..324,
name: Identifier {
loc: 319..321,
name: "or".to_string(),
},
)),
args: vec![Expression::Number(UnaryExpression {
loc: 322..323,
element: "1".to_string(),
})],
})),
})],
}),
)],
},
))],
}))),
})],
}),
Expand Down

0 comments on commit 0efd0f1

Please sign in to comment.