Skip to main content

veripb_parser/
substitution_token.rs

1//! Tokenizer for VeriPB substitutions.
2
3use logos::Logos;
4
5/// VeriPB substitution token.
6#[derive(Debug, Logos, PartialEq, Eq)]
7#[logos(skip r" |\t|\r|\n|->|→")]
8pub enum SubstitutionToken {
9    /// Positive literals in OPB format.
10    #[regex("[a-zA-Z_][_a-zA-Z0-9\\-\\^\\[\\]\\{\\}]+")]
11    PositiveLit,
12
13    /// Negative literals in OPB format.
14    #[regex("~[a-zA-Z_][_a-zA-Z0-9\\-\\^\\[\\]\\{\\}]+")]
15    NegativeLit,
16
17    /// Constant 0 (false) value in a substitution. I.e., the variable before the `0` is assigned to false.
18    #[token("0")]
19    Zero,
20
21    /// Constant 1 (true) value in a substitution. I.e., the variable before the `1` is assigned to true.
22    #[token("1")]
23    One,
24
25    /// Token to finalize the a substitution.
26    #[token(";")]
27    Semicolon,
28}