Coverage Report

Created: 2026-03-14 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/lexpr-0.2.7/src/syntax.rs
Line
Count
Source
1
//! Declarations shared between printer and parser.
2
3
/// Indicates a syntax of keywords.
4
#[derive(Debug, Clone, Copy, PartialEq)]
5
pub enum KeywordSyntax {
6
    /// Parse identifiers starting with a colon as keywords.
7
    ///
8
    /// In the absence of this option, such identifiers would be
9
    /// parsed as symbols.
10
    ColonPrefix,
11
12
    /// Parse identifiers ending with a colon as keywords.
13
    ///
14
    /// In the absence of this option, such identifiers would be
15
    /// parsed as symbols.
16
    ColonPostfix,
17
18
    /// Parse identifiers prefixed with `#:` as keywords.
19
    ///
20
    /// In the absence of this option, the sequence `#:` will result
21
    /// in a parser error.
22
    Octothorpe,
23
}
24
25
impl KeywordSyntax {
26
    #[inline]
27
0
    pub(crate) fn to_flag(self) -> u8 {
28
        use KeywordSyntax::*;
29
0
        match self {
30
0
            ColonPrefix => 1,
31
0
            ColonPostfix => 2,
32
0
            Octothorpe => 4,
33
        }
34
0
    }
35
}
36
37
/// Indicates the syntax for strings.
38
#[derive(Debug, Copy, Clone, PartialEq)]
39
pub enum StringSyntax {
40
    /// Syntax as specified the R6RS.
41
    ///
42
    /// Note that there is no R7RS variant, because R6RS specifies a superset of
43
    /// R7RS syntax. When printing however, the syntax used will be restricted
44
    /// to be understood by an R7RS parser.
45
    R6RS,
46
47
    /// Emacs Lisp syntax.
48
    ///
49
    /// Note that unibyte strings will be parsed as byte vectors.
50
    Elisp,
51
}
52
53
/// Indicates the syntax for characters.
54
#[derive(Debug, Copy, Clone, PartialEq)]
55
pub enum CharSyntax {
56
    /// Syntax as specified in R6RS.
57
    ///
58
    /// Note that there is no R7RS variant, because R6RS specifies a superset of
59
    /// R7RS syntax.
60
    R6RS,
61
62
    /// Emacs Lisp syntax.
63
    Elisp,
64
}