Skip to main content

gobject_ast/model/expression/
literal.rs

1use serde::Serialize;
2
3use crate::model::SourceLocation;
4
5#[derive(Debug, Clone, Serialize)]
6pub struct StringLiteralExpression {
7    pub value: String,
8    pub location: SourceLocation,
9}
10
11#[derive(Debug, Clone, Serialize)]
12pub struct NumberLiteralExpression {
13    pub value: String,
14    pub location: SourceLocation,
15}
16
17#[derive(Debug, Clone, Serialize)]
18pub struct CharLiteralExpression {
19    pub value: String, // Like "'a'" or "'\\n'"
20    pub location: SourceLocation,
21}
22
23#[derive(Debug, Clone, Serialize)]
24pub struct NullExpression {
25    pub location: SourceLocation,
26}
27
28#[derive(Debug, Clone, Serialize)]
29pub struct BooleanExpression {
30    pub value: bool,
31    pub location: SourceLocation,
32}
33
34#[derive(Debug, Clone, Serialize)]
35pub struct CommentExpression {
36    pub text: String,
37    pub location: SourceLocation,
38}
39
40/// Generic/unknown expression that we don't need to parse in detail
41/// Used for offsetof, compound literals, etc. that don't affect linting rules
42#[derive(Debug, Clone, Serialize)]
43pub struct GenericExpression {
44    pub text: String,
45    pub location: SourceLocation,
46}