ephemeris_documents/
json.rs1mod backend;
8mod cst;
9mod lexer;
10mod node;
11mod parser;
12
13pub(crate) use self::backend::Json;
14use self::cst::{Comma, Position};
15use crate::format::Format;
16
17#[derive(Debug, Clone, Copy, PartialEq, Eq)]
18pub(crate) enum Dialect {
19 Json,
20 Json5,
21}
22
23impl Dialect {
24 pub(crate) const fn format(self) -> Format {
26 match self {
27 Self::Json => Format::Json,
28 Self::Json5 => Format::Json5,
29 }
30 }
31
32 const fn comma(self, position: Position, comma: Comma) -> bool {
35 match position {
36 Position::Inner => true,
37 Position::Last => matches!(comma, Comma::Present) && matches!(self, Self::Json5),
38 }
39 }
40}
41
42#[cfg(test)]
43mod tests;