kodept_core/structure/rlt/
literal.rs1use crate::code_point::CodePoint;
2use crate::structure::Located;
3use crate::structure::rlt::new_types::Enclosed;
4use crate::structure::rlt::Operation;
5use crate::structure::span::Span;
6
7#[derive(Clone, Debug, PartialEq)]
8pub enum Literal {
9 Binary(Span),
10 Octal(Span),
11 Hex(Span),
12 Floating(Span),
13 Char(Span),
14 String(Span),
15 Tuple(Enclosed<Box<[Operation]>>),
16}
17
18impl Located for Literal {
19 fn location(&self) -> CodePoint {
20 match self {
21 Literal::Binary(x) => x.location(),
22 Literal::Octal(x) => x.location(),
23 Literal::Hex(x) => x.location(),
24 Literal::Floating(x) => x.location(),
25 Literal::Char(x) => x.location(),
26 Literal::String(x) => x.location(),
27 Literal::Tuple(x) => x.left.location(),
28 }
29 }
30}