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