# Macro synom::terminated_list [−] [src]

    macro_rules! terminated_list {
        ($i:expr, punct!($sep:expr), $f:ident) => { ... };
        ($i:expr, $sepmac:ident!( $($separgs:tt)* ), $fmac:ident!( $($fargs:tt)* )) => { ... };
        ($i:expr, $sepmac:ident!( $($separgs:tt)* ), $f:expr) => { ... };
        ($i:expr, $sep:expr, $fmac:ident!( $($fargs:tt)* )) => { ... };
        ($i:expr, $sep:expr, $f:expr) => { ... };
    }

Zero or more values separated by some separator. A trailing separator is allowed.

- Syntax: `terminated_list!(punct!("..."), THING)`
- Output: `Vec<THING>`

You may also be looking for:

- `separated_list!` - zero or more, allows trailing separator
- `separated_nonempty_list!` - one or more values
- `many0!` - zero or more, no separator

    extern crate syn;
    #[macro_use] extern crate synom;

    use syn::Expr;
    use syn::parse::expr;

    named!(expr_list -> Vec<Expr>,
        terminated_list!(punct!(","), expr)
    );

    fn main() {
        let input = "1 + 1, things, Construct { this: thing },";

        let parsed = expr_list(input).expect("expr list");
        assert_eq!(parsed.len(), 3);
    }

    extern crate syn;
    #[macro_use] extern crate synom;

    use syn::Ident;
    use syn::parse::ident;

    named!(run_on -> Vec<Ident>,
        terminated!(
            terminated_list!(keyword!("and"), preceded!(punct!("$"), ident)),
            punct!("...")
        )
    );

    fn main() {
        let input = "$expr and $ident and $pat and ...";

        let parsed = run_on(input).expect("run-on sentence");
        assert_eq!(parsed.len(), 3);
        assert_eq!(parsed[0], "expr");
        assert_eq!(parsed[1], "ident");
        assert_eq!(parsed[2], "pat");
    }

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)