File: parser_macro.rs

package info (click to toggle)
rust-combine 4.6.6-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 988 kB
  • sloc: sh: 21; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 744 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#![allow(clippy::single_match)]

#[macro_use]
extern crate combine;

parser! {
    pub fn test[Input]()(Input) -> ()
        where [Input: ::combine::Stream<Token = char>]
    {

use combine::parser::token::value;

let _ = ();
        fn _test() { }
        match Some(1) {
            Some(_) => (),
            None => (),
        }
        value(())
    }
}

parser! {
    pub fn test_that_parsers_with_unnamed_types_can_be_in_same_scope[Input]()(Input) -> ()
        where [Input: ::combine::Stream<Token = char>]
    {

use combine::parser::token::value;

value(())
    }
}

#[test]
fn test_that_we_dont_need_imports_for_this_macro_to_work() {
    test::<&str>();
    test_that_parsers_with_unnamed_types_can_be_in_same_scope::<&str>();
}