Skip to content

Commit 5e6fb71

Browse files
committed
rs: allow str literal date/time parts
1 parent 7946127 commit 5e6fb71

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

src/ast/value.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ pub enum DateTimeField {
127127
Minute,
128128
Second,
129129
Epoch,
130+
Literal(String),
130131
}
131132

132133
impl fmt::Display for DateTimeField {
@@ -147,6 +148,7 @@ impl fmt::Display for DateTimeField {
147148
DateTimeField::Minute => "MINUTE",
148149
DateTimeField::Second => "SECOND",
149150
DateTimeField::Epoch => "EPOCH",
151+
DateTimeField::Literal(ref s) => return write!(f, "'{}'", s),
150152
})
151153
}
152154
}

src/parser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ impl<'a> Parser<'a> {
666666
Keyword::EPOCH => Ok(DateTimeField::Epoch),
667667
_ => self.expected("date/time field", Token::Word(w))?,
668668
},
669+
Token::SingleQuotedString(w) => Ok(DateTimeField::Literal(w.clone())),
669670
unexpected => self.expected("date/time field", unexpected),
670671
}
671672
}

0 commit comments

Comments
 (0)