reorganize typedef
This commit is contained in:
parent
465c63706b
commit
6a4dd3ce54
|
@ -6,7 +6,7 @@ use nom::{
|
|||
sequence::{preceded, terminated},
|
||||
};
|
||||
|
||||
use crate::IResult;
|
||||
use crate::parser::IResult;
|
||||
|
||||
pub fn decimal(input: &str) -> IResult<&str, u64> {
|
||||
map_res(
|
||||
|
|
|
@ -2,7 +2,7 @@ mod literals;
|
|||
mod parser;
|
||||
mod rtlil;
|
||||
|
||||
use nom::error::{convert_error, VerboseError};
|
||||
use nom::error::convert_error;
|
||||
use std::path::PathBuf;
|
||||
use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
|
@ -16,9 +16,6 @@ struct Opt {
|
|||
input: PathBuf,
|
||||
}
|
||||
|
||||
// custom IResult type for verboseerror
|
||||
pub type IResult<I, O, E = VerboseError<I>> = nom::IResult<I, O, E>;
|
||||
|
||||
fn main() {
|
||||
let opt = Opt::from_args();
|
||||
let mut infile = File::open(opt.input).expect("could not open file");
|
||||
|
|
|
@ -3,16 +3,20 @@ use nom::{
|
|||
bytes::complete::tag,
|
||||
character::complete::{alpha1, alphanumeric1, char, multispace0, multispace1},
|
||||
combinator::{map, opt, recognize},
|
||||
error::{context, ParseError},
|
||||
error::{context, ParseError, VerboseError},
|
||||
multi::{many0, many1, separated_list0},
|
||||
sequence::{delimited, pair, preceded, separated_pair, terminated, tuple},
|
||||
};
|
||||
|
||||
use nom_locate::{position, LocatedSpan};
|
||||
|
||||
// custom span type for nom_locate
|
||||
type Span<'a> = LocatedSpan<&'a str>;
|
||||
|
||||
// custom IResult type for VerboseError
|
||||
pub type IResult<I, O, E = VerboseError<I>> = nom::IResult<I, O, E>;
|
||||
|
||||
use crate::literals::{decimal, hexadecimal};
|
||||
use crate::IResult;
|
||||
|
||||
fn ws0<'a, F: 'a, O, E: ParseError<&'a str>>(
|
||||
inner: F,
|
||||
|
@ -207,7 +211,7 @@ pub fn module(input: &str) -> IResult<&str, Module> {
|
|||
)(input)
|
||||
}
|
||||
|
||||
fn parse(input: &str) -> IResult<&str, Module> {
|
||||
pub fn parse(input: &str) -> IResult<&str, Module> {
|
||||
module(input)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue