Skip to main content

oxilean_parse/command/
commandparser_predicates.rs

1//! # CommandParser - predicates Methods
2//!
3//! This module contains method implementations for `CommandParser`.
4//!
5//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
6
7use crate::TokenKind;
8
9use super::commandparser_type::CommandParser;
10
11impl CommandParser {
12    /// Check if a token is a command keyword.
13    pub fn is_command_keyword(token: &TokenKind) -> bool {
14        matches!(
15            token,
16            TokenKind::Axiom
17                | TokenKind::Definition
18                | TokenKind::Theorem
19                | TokenKind::Lemma
20                | TokenKind::Inductive
21                | TokenKind::Structure
22                | TokenKind::Class
23                | TokenKind::Instance
24                | TokenKind::Opaque
25                | TokenKind::Constant
26                | TokenKind::Constants
27                | TokenKind::Namespace
28                | TokenKind::Section
29                | TokenKind::Variable
30                | TokenKind::Variables
31                | TokenKind::Parameter
32                | TokenKind::Parameters
33                | TokenKind::End
34                | TokenKind::Import
35                | TokenKind::Export
36                | TokenKind::Open
37                | TokenKind::Attribute
38                | TokenKind::Hash
39        ) || matches!(
40            token, TokenKind::Ident(s) if matches!(s.as_str(), "set_option" |
41            "universe" | "universes" | "notation" | "prefix" | "infix" | "infixl" |
42            "infixr" | "postfix" | "derive" | "deriving" | "syntax" | "precedence")
43        )
44    }
45}