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

    macro_rules! keyword {
        ($i:expr, $keyword:expr) => { ... };
    }

Parse a keyword like "fn" or "struct".

See also `punct!` for parsing punctuation, which are subtly different from keywords.

- Syntax: `keyword!("...")`
- Output: `&str`

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

    use synom::IResult;

    // Parse zero or more "bang" keywords.
    named!(many_bangs -> Vec<&str>,
        terminated!(
            many0!(keyword!("bang")),
            punct!(";")
        )
    );

    fn main() {
        let input = "bang bang bang;";
        let parsed = many_bangs(input).expect("bangs");
        assert_eq!(parsed, ["bang", "bang", "bang"]);

        let input = "bangbang;";
        let err = many_bangs(input);
        assert_eq!(err, IResult::Error);
    }

# 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`)