#[derive(Debug, PartialEq, PartialOrd)]
pub enum CMakeValue {
ArgumentSpecifier(String),
QuotedString(String),
BracketQuotedString(CMakeBracketLiteral),
StringLiteral(String),
Comment(String),
BracketComment(CMakeBracketLiteral),
Parenthesis(String),
}
#[derive(Debug, PartialEq, PartialOrd)]
pub enum CMakeCondition {
Parentheses {
value: Box<CMakeCondition>,
},
UnaryTest {
operator: String,
value: Box<CMakeCondition>,
},
BinaryTest {
operator: String,
left: Box<CMakeCondition>,
right: Box<CMakeCondition>,
},
UnaryLogicalOperator {
operator: String,
value: Box<CMakeCondition>,
},
BinaryLogicalOperator {
operator: String,
left: Box<CMakeCondition>,
right: Box<CMakeCondition>,
},
Comment {
content: String,
tail: Option<Box<CMakeCondition>>,
},
Value(CMakeValue),
}
#[derive(Debug, PartialEq, PartialOrd)]
pub struct CMakeCommand {
pub name: String,
pub args: Vec<CMakeValue>,
}
#[derive(Debug, PartialEq, PartialOrd)]
pub struct CMakeIfBase {
pub condition: CMakeCondition,
pub body: Vec<CMakeStatement>,
}
#[derive(Debug, PartialEq, PartialOrd)]
pub struct CMakeIfStatement {
pub base: CMakeIfBase,
pub else_ifs: Vec<CMakeIfBase>,
pub else_body: Option<Vec<CMakeStatement>>,
}
#[derive(Debug, PartialEq, PartialOrd)]
pub struct CMakeCommandGroup {
pub clause: Vec<CMakeValue>,
pub body: Vec<CMakeStatement>,
pub end_clause: Vec<CMakeValue>,
}
#[derive(Debug, PartialEq, PartialOrd)]
pub struct CMakeForEachStatement {
pub group: CMakeCommandGroup,
}
#[derive(Debug, PartialEq, PartialOrd)]
pub struct CMakeFunctionStatement {
pub group: CMakeCommandGroup,
}
#[derive(Debug, PartialEq, PartialOrd)]
pub struct CMakeMacroStatement {
pub group: CMakeCommandGroup,
}
#[derive(Debug, PartialEq, PartialOrd)]
pub struct CMakeBlockStatement {
pub group: CMakeCommandGroup,
}
#[derive(Debug, PartialEq, PartialOrd)]
pub struct CMakeBracketLiteral {
pub is_comment: bool,
pub delimiter: String,
pub contents: String,
}
#[derive(Debug, PartialEq, PartialOrd)]
pub enum CMakeStatement {
If(CMakeIfStatement),
For(CMakeForEachStatement),
Function(CMakeFunctionStatement),
Block(CMakeBlockStatement),
Macro(CMakeMacroStatement),
Command(CMakeCommand),
BracketComment(CMakeBracketLiteral),
Comment(String),
Newline,
}
#[derive(Debug, PartialEq, PartialOrd)]
pub struct CMakeDocument {
pub statements: Vec<CMakeStatement>,
}