clippy fix
This commit is contained in:
parent
825703e1ce
commit
1798baa9d3
|
@ -1,4 +1,4 @@
|
||||||
use crate::frontend::types::{Type, TypeStruct};
|
use crate::frontend::types::TypeStruct;
|
||||||
use crate::frontend::Callable;
|
use crate::frontend::Callable;
|
||||||
use crate::rtlil;
|
use crate::rtlil;
|
||||||
use crate::rtlil::SigSpec;
|
use crate::rtlil::SigSpec;
|
||||||
|
@ -39,7 +39,7 @@ fn instantiate_binop(celltype: &str, id: &str, args: &[SigSpec], ret: &SigSpec)
|
||||||
cell
|
cell
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_binop_callable<'ctx>(name: &str, celltype: &'static str) -> Callable<'ctx> {
|
fn make_binop_callable<'ctx>(name: &str, _celltype: &'static str) -> Callable<'ctx> {
|
||||||
// FIXME: CRIMES CRIMES CRIMES
|
// FIXME: CRIMES CRIMES CRIMES
|
||||||
let logic_type: &'static TypeStruct = Box::leak(Box::new(TypeStruct::logic_infer()));
|
let logic_type: &'static TypeStruct = Box::leak(Box::new(TypeStruct::logic_infer()));
|
||||||
let args = vec![
|
let args = vec![
|
||||||
|
@ -53,7 +53,7 @@ fn make_binop_callable<'ctx>(name: &str, celltype: &'static str) -> Callable<'ct
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_unnop_callable<'ctx>(name: &str, celltype: &'static str) -> Callable<'ctx> {
|
fn make_unnop_callable<'ctx>(name: &str, _celltype: &'static str) -> Callable<'ctx> {
|
||||||
// FIXME: CRIMES CRIMES CRIMES
|
// FIXME: CRIMES CRIMES CRIMES
|
||||||
let logic_type: &'static TypeStruct = Box::leak(Box::new(TypeStruct::logic_infer()));
|
let logic_type: &'static TypeStruct = Box::leak(Box::new(TypeStruct::logic_infer()));
|
||||||
let args = vec![(Some("A".to_owned()), logic_type)];
|
let args = vec![(Some("A".to_owned()), logic_type)];
|
||||||
|
|
|
@ -255,7 +255,7 @@ fn lower_expression(
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
let cell_id = module.make_genid(&callable.name());
|
let cell_id = module.make_genid(callable.name());
|
||||||
|
|
||||||
let output_gen_id = format!("{}$out", &cell_id);
|
let output_gen_id = format!("{}$out", &cell_id);
|
||||||
module.add_wire(rtlil::Wire::new(&output_gen_id, TODO_WIDTH, None));
|
module.add_wire(rtlil::Wire::new(&output_gen_id, TODO_WIDTH, None));
|
||||||
|
|
|
@ -8,7 +8,6 @@ use std::fs::File;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use ariadne::Source;
|
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug, StructOpt)]
|
||||||
|
|
|
@ -7,11 +7,11 @@ pub mod tokens;
|
||||||
use nom::{
|
use nom::{
|
||||||
branch::alt,
|
branch::alt,
|
||||||
bytes::complete::tag,
|
bytes::complete::tag,
|
||||||
character::complete::{alpha1, alphanumeric1, char, multispace0, u64 as decimal},
|
character::complete::{alpha1, alphanumeric1, multispace0},
|
||||||
combinator::{map, opt, recognize},
|
combinator::{map, opt, recognize},
|
||||||
error::{ErrorKind, ParseError},
|
error::{ErrorKind, ParseError},
|
||||||
multi::{many0, separated_list0},
|
multi::{many0, separated_list0},
|
||||||
sequence::{delimited, pair, preceded, separated_pair, terminated, tuple},
|
sequence::{delimited, pair, preceded, separated_pair, tuple},
|
||||||
};
|
};
|
||||||
use nom_greedyerror::GreedyError;
|
use nom_greedyerror::GreedyError;
|
||||||
use nom_locate::LocatedSpan;
|
use nom_locate::LocatedSpan;
|
||||||
|
@ -114,7 +114,7 @@ fn declaration(i: TokenSpan) -> IResult<TokenSpan, NetDecl> {
|
||||||
separated_pair(token(tk::Ident), token(tk::Colon), typename),
|
separated_pair(token(tk::Ident), token(tk::Colon), typename),
|
||||||
opt(preceded(token(tk::Assign), token(tk::Number))),
|
opt(preceded(token(tk::Assign), token(tk::Number))),
|
||||||
)),
|
)),
|
||||||
|((ident, typ), value)| NetDecl {
|
|((ident, typ), _value)| NetDecl {
|
||||||
name: ident.span(),
|
name: ident.span(),
|
||||||
typ,
|
typ,
|
||||||
value: None,
|
value: None,
|
||||||
|
|
|
@ -6,7 +6,7 @@ fn span_to_range(input: Span) -> std::ops::Range<usize> {
|
||||||
input.position()..(input.position() + input.len())
|
input.position()..(input.position() + input.len())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn convert_error(input: Span, e: IErr<Span>) -> Report {
|
pub fn convert_error(_input: Span, e: IErr<Span>) -> Report {
|
||||||
let mut labels = Vec::new();
|
let mut labels = Vec::new();
|
||||||
for err in e.errors {
|
for err in e.errors {
|
||||||
let label = match err.1 {
|
let label = match err.1 {
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
use nom::{
|
use nom::{
|
||||||
branch::alt,
|
branch::alt,
|
||||||
bytes::complete::tag,
|
combinator::map,
|
||||||
character::complete::{char, multispace1},
|
|
||||||
combinator::{consumed, map},
|
|
||||||
error::context,
|
error::context,
|
||||||
multi::{many0, separated_list0},
|
multi::{many0, separated_list0},
|
||||||
sequence::{delimited, preceded, terminated, tuple},
|
sequence::{delimited, preceded, tuple},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::parser::{
|
use crate::parser::{
|
||||||
assign_statement, declaration, identifier,
|
assign_statement, declaration,
|
||||||
proc::{proc_block, ProcBlock},
|
proc::{proc_block, ProcBlock},
|
||||||
tokens::{token, Token, TokenKind as tk, TokenSpan},
|
tokens::{token, TokenKind as tk, TokenSpan},
|
||||||
typename, ws0, Assign, IResult, NetDecl, Span,
|
typename, Assign, IResult, NetDecl, Span,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -76,7 +74,7 @@ pub fn module(input: TokenSpan) -> IResult<TokenSpan, Module> {
|
||||||
preceded(token(tk::RArrow), typename),
|
preceded(token(tk::RArrow), typename),
|
||||||
delimited(token(tk::LBrace), many0(module_item), token(tk::RBrace)),
|
delimited(token(tk::LBrace), many0(module_item), token(tk::RBrace)),
|
||||||
)),
|
)),
|
||||||
|(_, name, inputs, ret, items)| Module {
|
|(_, name, inputs, _ret, items)| Module {
|
||||||
// TODO: bring back returns
|
// TODO: bring back returns
|
||||||
name: name.span(),
|
name: name.span(),
|
||||||
ports: inputs,
|
ports: inputs,
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
use nom::{
|
use nom::{
|
||||||
branch::alt,
|
branch::alt,
|
||||||
bytes::complete::tag,
|
|
||||||
character::complete::char,
|
|
||||||
combinator::map,
|
combinator::map,
|
||||||
error::context,
|
error::context,
|
||||||
multi::{many1, separated_list1},
|
multi::{many1, separated_list1},
|
||||||
|
@ -9,9 +7,9 @@ use nom::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::parser::{
|
use crate::parser::{
|
||||||
assign_statement, expression, identifier,
|
assign_statement, expression,
|
||||||
tokens::{token, Token, TokenKind as tk, TokenSpan},
|
tokens::{token, TokenKind as tk, TokenSpan},
|
||||||
ws0, Assign, Expression, IResult, Span,
|
Assign, Expression, IResult, Span,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -10,7 +10,6 @@ use nom::{
|
||||||
multi::many0,
|
multi::many0,
|
||||||
};
|
};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io;
|
|
||||||
|
|
||||||
pub struct Token<'a> {
|
pub struct Token<'a> {
|
||||||
span: Span<'a>,
|
span: Span<'a>,
|
||||||
|
@ -100,8 +99,8 @@ impl nom::InputTake for TokenSpan<'_> {
|
||||||
fn take_split(&self, count: usize) -> (Self, Self) {
|
fn take_split(&self, count: usize) -> (Self, Self) {
|
||||||
let (head, tail) = &self.rest.split_at(count);
|
let (head, tail) = &self.rest.split_at(count);
|
||||||
(
|
(
|
||||||
TokenSpan::with_pos(&head, self.pos),
|
TokenSpan::with_pos(head, self.pos),
|
||||||
TokenSpan::with_pos(&tail, self.pos + count),
|
TokenSpan::with_pos(tail, self.pos + count),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue