Trait rusty_parser::IntoParser

source ·
pub trait IntoParser {
    type Into;

Show 17 methods // Required method fn into_parser(self) -> Self::Into; // Provided methods fn seq<RhsParser: IntoParser>( self, rhs: RhsParser ) -> SeqParser<Self::Into, RhsParser::Into> where Self: Sized { ... } fn repeat<Idx, RangeType>( self, range_: RangeType ) -> RepeatParser<Self::Into, RangeType, Idx> where Self: Sized, RangeType: RangeBounds<Idx>, Idx: PartialOrd + PartialEq + PartialOrd<i32> + PartialEq<i32>, i32: PartialOrd + PartialEq + PartialOrd<Idx> + PartialEq<Idx> { ... } fn or<RhsParser: IntoParser>( self, rhs: RhsParser ) -> OrParser<Self::Into, RhsParser::Into> where Self: Sized { ... } fn map<ClosureType, ClosureInput, ClosureOutput>( self, callback: ClosureType ) -> MapParser<Self::Into, ClosureType, ClosureInput, ClosureOutput> where ClosureInput: Tuple, ClosureType: Fn(ClosureInput) -> ClosureOutput, ClosureOutput: Tuple, Self: Sized { ... } fn void_(self) -> VoidParser<Self::Into> where Self: Sized { ... } fn optional(self) -> OptionalParser<Self::Into> where Self: Sized { ... } fn optional_or<Output: Clone + Tuple>( self, output: Output ) -> OptionalOrParser<Self::Into, Output> where Self: Sized { ... } fn refcell(self) -> RefCelledParser<Self::Into> where Self: Sized { ... } fn rc(self) -> RcedParser<Self::Into> where Self: Sized { ... } fn box_chars<Output>(self) -> DynBoxChars<Output> where Output: Tuple, Self: Sized, Self::Into: for<'a> Parser<Chars<'a>, Output = Output> + 'static { ... } fn box_slice<Output, T>(self) -> DynBoxSlice<Output, T> where Output: Tuple, Self: Sized, Self::Into: for<'a> Parser<Iter<'a, T>, Output = Output> + 'static { ... } fn not<RhsParser: IntoParser>( self, rhs: RhsParser ) -> NotParser<Self::Into, RhsParser::Into> where Self: Sized { ... } fn output<Output: Tuple + Clone>( self, output: Output ) -> OutputParser<Self::Into, Output> where Self: Sized { ... } fn string(self) -> StringParser<Self::Into> where Self: Sized, Self::Into: for<'a> Parser<Chars<'a>> { ... } fn vec<T>(self) -> SliceParser<Self::Into> where Self: Sized, Self::Into: for<'a> Parser<Iter<'a, T>> { ... } fn not_consume(self) -> NotConsumeParser<Self::Into> where Self: Sized { ... }
}
Expand description

Trait for converting possible types to Parser

Required Associated Types§

Required Methods§

source

fn into_parser(self) -> Self::Into

Provided Methods§

source

fn seq<RhsParser: IntoParser>( self, rhs: RhsParser ) -> SeqParser<Self::Into, RhsParser::Into>
where Self: Sized,

concatenate two parser

source

fn repeat<Idx, RangeType>( self, range_: RangeType ) -> RepeatParser<Self::Into, RangeType, Idx>
where Self: Sized, RangeType: RangeBounds<Idx>, Idx: PartialOrd + PartialEq + PartialOrd<i32> + PartialEq<i32>, i32: PartialOrd + PartialEq + PartialOrd<Idx> + PartialEq<Idx>,

repeat parser for given range ( this matches as long as possible )

source

fn or<RhsParser: IntoParser>( self, rhs: RhsParser ) -> OrParser<Self::Into, RhsParser::Into>
where Self: Sized,

Or combinator of parsers

source

fn map<ClosureType, ClosureInput, ClosureOutput>( self, callback: ClosureType ) -> MapParser<Self::Into, ClosureType, ClosureInput, ClosureOutput>
where ClosureInput: Tuple, ClosureType: Fn(ClosureInput) -> ClosureOutput, ClosureOutput: Tuple, Self: Sized,

Map parser’s Output to new value

source

fn void_(self) -> VoidParser<Self::Into>
where Self: Sized,

change Parser’s Output to (). This internally call match_pattern() instead of parse()

source

fn optional(self) -> OptionalParser<Self::Into>
where Self: Sized,

this parser always success whether the input is matched or not

source

fn optional_or<Output: Clone + Tuple>( self, output: Output ) -> OptionalOrParser<Self::Into, Output>
where Self: Sized,

source

fn refcell(self) -> RefCelledParser<Self::Into>
where Self: Sized,

create RefCell<Parser> wrapper

source

fn rc(self) -> RcedParser<Self::Into>
where Self: Sized,

create Rc<Parser> wrapper

source

fn box_chars<Output>(self) -> DynBoxChars<Output>
where Output: Tuple, Self: Sized, Self::Into: for<'a> Parser<Chars<'a>, Output = Output> + 'static,

create a Box<dyn Parser> wrapper for iterators of std::str::Chars This can take any parser with Output of Output

source

fn box_slice<Output, T>(self) -> DynBoxSlice<Output, T>
where Output: Tuple, Self: Sized, Self::Into: for<'a> Parser<Iter<'a, T>, Output = Output> + 'static,

create a Box<dyn Parser> wrapper for iterators of std::slice::Iter This can take any parser with Output of Output

source

fn not<RhsParser: IntoParser>( self, rhs: RhsParser ) -> NotParser<Self::Into, RhsParser::Into>
where Self: Sized,

match for parser1 parser2, parser1 must success and parser2 must fail This is equivalent to not(parser1, parser2)

source

fn output<Output: Tuple + Clone>( self, output: Output ) -> OutputParser<Self::Into, Output>
where Self: Sized,

change Parser’s Output to output

source

fn string(self) -> StringParser<Self::Into>
where Self: Sized, Self::Into: for<'a> Parser<Chars<'a>>,

returns String of parsed input only works for parsing with std::str::Chars

source

fn vec<T>(self) -> SliceParser<Self::Into>
where Self: Sized, Self::Into: for<'a> Parser<Iter<'a, T>>,

returns Vec of parsed input only works for parsing with std::slice::Iter

source

fn not_consume(self) -> NotConsumeParser<Self::Into>
where Self: Sized,

Parser will not consume the input iterator It still match and return the output

Implementations on Foreign Types§

source§

impl IntoParser for char

§

type Into = SingleEqualParser<char>

source§

fn into_parser(self) -> Self::Into

source§

impl IntoParser for i8

§

type Into = SingleEqualParser<i8>

source§

fn into_parser(self) -> Self::Into

source§

impl IntoParser for i16

§

type Into = SingleEqualParser<i16>

source§

fn into_parser(self) -> Self::Into

source§

impl IntoParser for i32

§

type Into = SingleEqualParser<i32>

source§

fn into_parser(self) -> Self::Into

source§

impl IntoParser for i64

§

type Into = SingleEqualParser<i64>

source§

fn into_parser(self) -> Self::Into

source§

impl IntoParser for i128

§

type Into = SingleEqualParser<i128>

source§

fn into_parser(self) -> Self::Into

source§

impl IntoParser for isize

§

type Into = SingleEqualParser<isize>

source§

fn into_parser(self) -> Self::Into

source§

impl IntoParser for u8

§

type Into = SingleEqualParser<u8>

source§

fn into_parser(self) -> Self::Into

source§

impl IntoParser for u16

§

type Into = SingleEqualParser<u16>

source§

fn into_parser(self) -> Self::Into

source§

impl IntoParser for u32

§

type Into = SingleEqualParser<u32>

source§

fn into_parser(self) -> Self::Into

source§

impl IntoParser for u64

§

type Into = SingleEqualParser<u64>

source§

fn into_parser(self) -> Self::Into

source§

impl IntoParser for u128

§

type Into = SingleEqualParser<u128>

source§

fn into_parser(self) -> Self::Into

source§

impl IntoParser for usize

§

type Into = SingleEqualParser<usize>

source§

fn into_parser(self) -> Self::Into

source§

impl<'a> IntoParser for &'a str

§

type Into = SliceEqualParser<Chars<'a>>

source§

fn into_parser(self) -> Self::Into

source§

impl<'a, T> IntoParser for &'a [T]
where T: Clone,

§

type Into = SliceEqualParser<Iter<'a, T>>

source§

fn into_parser(self) -> Self::Into

source§

impl<Idx> IntoParser for Range<Idx>
where Idx: PartialOrd + PartialEq,

§

type Into = SingleRangeParser<Range<Idx>, Idx>

source§

fn into_parser(self) -> Self::Into

source§

impl<Idx> IntoParser for RangeFrom<Idx>
where Idx: PartialOrd + PartialEq,

§

type Into = SingleRangeParser<RangeFrom<Idx>, Idx>

source§

fn into_parser(self) -> Self::Into

source§

impl<Idx> IntoParser for RangeInclusive<Idx>
where Idx: PartialOrd + PartialEq,

§

type Into = SingleRangeParser<RangeInclusive<Idx>, Idx>

source§

fn into_parser(self) -> Self::Into

source§

impl<Idx> IntoParser for RangeTo<Idx>
where Idx: PartialOrd + PartialEq,

§

type Into = SingleRangeParser<RangeTo<Idx>, Idx>

source§

fn into_parser(self) -> Self::Into

source§

impl<Idx> IntoParser for RangeToInclusive<Idx>
where Idx: PartialOrd + PartialEq,

§

type Into = SingleRangeParser<RangeToInclusive<Idx>, Idx>

source§

fn into_parser(self) -> Self::Into

Implementors§

source§

impl<CharType, Output> IntoParser for DictHashMapParser<Output, CharType>
where CharType: Hash + Eq, Output: Clone + Tuple,

§

type Into = DictHashMapParser<Output, CharType>

source§

impl<Output> IntoParser for DynBoxChars<Output>
where Output: Tuple,

§

type Into = DynBoxChars<Output>

source§

impl<Output, CharType> IntoParser for DictBTreeParser<Output, CharType>
where Output: Clone + Tuple, CharType: Ord,

§

type Into = DictBTreeParser<Output, CharType>

source§

impl<Output, T> IntoParser for DynBoxSlice<Output, T>
where Output: Tuple,

§

type Into = DynBoxSlice<Output, T>

source§

impl<ParserType> IntoParser for RcedParser<ParserType>

§

type Into = RcedParser<ParserType>

source§

impl<ParserType> IntoParser for RefCelledParser<ParserType>

§

type Into = RefCelledParser<ParserType>