Remove temporary parsers

This commit is contained in:
dalance 2019-07-09 14:15:37 +09:00
parent 0e88bda969
commit 7d4887c669
5 changed files with 30 additions and 93 deletions

View File

@ -77,7 +77,7 @@ pub struct Var {}
#[derive(Debug)]
pub enum ForStepAssignment<'a> {
Operator(OperatorAssignment<'a>),
IncOrDec(IncOrDecDeclaration<'a>),
IncOrDec(IncOrDecExpression<'a>),
Subroutine(SubroutineCall<'a>),
}
@ -213,7 +213,7 @@ pub fn for_step(s: &str) -> IResult<&str, Vec<ForStepAssignment>> {
pub fn for_step_assignment(s: &str) -> IResult<&str, ForStepAssignment> {
alt((
map(operator_assignment, |x| ForStepAssignment::Operator(x)),
map(inc_or_dec_declaration, |x| ForStepAssignment::IncOrDec(x)),
map(inc_or_dec_expression, |x| ForStepAssignment::IncOrDec(x)),
map(function_subroutine_call, |x| {
ForStepAssignment::Subroutine(x)
}),

View File

@ -19,7 +19,7 @@ pub struct ConstraintDeclaration<'a> {
pub struct Static {}
#[derive(Debug)]
pub struct ConstraintsBlock<'a> {
pub struct ConstraintBlock<'a> {
pub nodes: (Vec<ConstraintBlockItem<'a>>,),
}

View File

@ -1,4 +1,6 @@
pub mod specify_block_declaration;
pub mod specify_block_terminals;
pub mod specify_path_delays;
pub use specify_block_declaration::*;
pub use specify_block_terminals::*;
pub use specify_path_delays::*;

View File

@ -0,0 +1,18 @@
use crate::parser::*;
//use nom::branch::*;
//use nom::combinator::*;
use nom::error::*;
use nom::{Err, IResult};
// -----------------------------------------------------------------------------
#[derive(Debug)]
pub struct EdgeIdentifier<'a> {
pub nodes: (Identifier<'a>,),
}
// -----------------------------------------------------------------------------
pub fn edge_identifier(s: &str) -> IResult<&str, EdgeIdentifier> {
Err(Err::Error(make_error(s, ErrorKind::Fix)))
}

View File

@ -6,6 +6,13 @@ use nom::IResult;
// -----------------------------------------------------------------------------
#[derive(Debug)]
pub struct Symbol<'a> {
pub nodes: (&'a str,),
}
// -----------------------------------------------------------------------------
pub fn ws<'a, O, F>(f: F) -> impl Fn(&'a str) -> IResult<&'a str, O>
where
F: Fn(&'a str) -> IResult<&'a str, O>,
@ -70,94 +77,4 @@ where
}
}
#[derive(Debug)]
pub struct Symbol<'a> {
pub nodes: (&'a str,),
}
// -----------------------------------------------------------------------------
#[derive(Debug)]
pub struct ConstraintBlock<'a> {
pub raw: Vec<&'a str>,
}
#[derive(Debug)]
pub struct EdgeIdentifier<'a> {
pub raw: Vec<&'a str>,
}
#[derive(Debug)]
pub struct IncOrDecDeclaration<'a> {
pub raw: Vec<&'a str>,
}
#[derive(Debug)]
pub struct CheckerInstantiation<'a> {
pub raw: Vec<&'a str>,
}
#[derive(Debug)]
pub struct DataDeclaration<'a> {
pub raw: Vec<&'a str>,
}
#[derive(Debug)]
pub struct ModuleOrGenerateItem<'a> {
pub raw: Vec<&'a str>,
}
#[derive(Debug)]
pub struct InterfaceOrGenerateItem<'a> {
pub raw: Vec<&'a str>,
}
#[derive(Debug)]
pub struct CheckerOrGenerateItem<'a> {
pub raw: Vec<&'a str>,
}
#[derive(Debug)]
pub struct RandomQualifier<'a> {
pub raw: Vec<&'a str>,
}
pub fn constraint_block(s: &str) -> IResult<&str, ConstraintBlock> {
Ok((s, ConstraintBlock { raw: vec![] }))
}
pub fn identifier_list(s: &str) -> IResult<&str, Vec<Identifier>> {
Ok((s, vec![]))
}
pub fn edge_identifier(s: &str) -> IResult<&str, EdgeIdentifier> {
Ok((s, EdgeIdentifier { raw: vec![] }))
}
pub fn inc_or_dec_declaration(s: &str) -> IResult<&str, IncOrDecDeclaration> {
Ok((s, IncOrDecDeclaration { raw: vec![] }))
}
pub fn checker_instantiation(s: &str) -> IResult<&str, CheckerInstantiation> {
Ok((s, CheckerInstantiation { raw: vec![] }))
}
pub fn data_declaration(s: &str) -> IResult<&str, DataDeclaration> {
Ok((s, DataDeclaration { raw: vec![] }))
}
pub fn module_or_generate_item(s: &str) -> IResult<&str, ModuleOrGenerateItem> {
Ok((s, ModuleOrGenerateItem { raw: vec![] }))
}
pub fn interface_or_generate_item(s: &str) -> IResult<&str, InterfaceOrGenerateItem> {
Ok((s, InterfaceOrGenerateItem { raw: vec![] }))
}
pub fn checker_or_generate_item(s: &str) -> IResult<&str, CheckerOrGenerateItem> {
Ok((s, CheckerOrGenerateItem { raw: vec![] }))
}
pub fn random_qualifier(s: &str) -> IResult<&str, RandomQualifier> {
Ok((s, RandomQualifier { raw: vec![] }))
}