[][src]Module balena_temen::ast

An expression Abstract Syntax Tree

The Elegant Parser is used to parse an expression. Full grammar.

Examples

use balena_temen::ast::*;

let parsed: Expression = "1 + 2".parse().unwrap();
let manual = Expression::new(
    ExpressionValue::Math(
        MathExpression::new(
            Expression::new(ExpressionValue::Integer(1)),
            Expression::new(ExpressionValue::Integer(2)),
            MathOperator::Addition
        )
    )
);
assert_eq!(parsed, manual);

Structs

Expression

An expression

FunctionCall

A function call

Identifier

An identifier

LogicalExpression

Logical expression

MathExpression

Math expression

StringConcat

String concatenation

Enums

ExpressionValue

An expression value

IdentifierValue

An identifier value (component)

LogicalOperator

Logical operator

MathOperator

Math operator