refactor(ast): rename value types to Number/Decimal/Text/Boolean
Renamed AST value types for v0.3 naming convention: - Value::Int -> Value::Number - Value::Float -> Value::Decimal - Value::String -> Value::Text - Value::Bool -> Value::Boolean - Expr::IntLit -> Expr::NumberLit - Expr::FloatLit -> Expr::DecimalLit - Expr::StringLit -> Expr::TextLit - Expr::BoolLit -> Expr::BooleanLit Updated all references across parser, resolver, validator, LSP, query engine, tests, and editor.
This commit is contained in:
@@ -158,10 +158,10 @@ pub struct Field {
|
||||
/// Field value types
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Value {
|
||||
Int(i64),
|
||||
Float(f64),
|
||||
String(String),
|
||||
Bool(bool),
|
||||
Number(i64),
|
||||
Decimal(f64),
|
||||
Text(String),
|
||||
Boolean(bool),
|
||||
Range(Box<Value>, Box<Value>), // For templates: 20..40
|
||||
Time(Time),
|
||||
Duration(Duration),
|
||||
@@ -466,10 +466,10 @@ pub enum Condition {
|
||||
/// Expression AST for conditions and queries
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Expr {
|
||||
IntLit(i64),
|
||||
FloatLit(f64),
|
||||
StringLit(String),
|
||||
BoolLit(bool),
|
||||
NumberLit(i64),
|
||||
DecimalLit(f64),
|
||||
TextLit(String),
|
||||
BooleanLit(bool),
|
||||
Identifier(Vec<String>),
|
||||
FieldAccess(Box<Expr>, String),
|
||||
Comparison(Box<Expr>, CompOp, Box<Expr>),
|
||||
|
||||
@@ -244,18 +244,18 @@ Field: Field = {
|
||||
};
|
||||
|
||||
Value: Value = {
|
||||
<NumberLit> => Value::Int(<>),
|
||||
<DecimalLit> => Value::Float(<>),
|
||||
<TextLit> => Value::String(<>),
|
||||
<BoolLit> => Value::Bool(<>),
|
||||
<NumberLit> => Value::Number(<>),
|
||||
<DecimalLit> => Value::Decimal(<>),
|
||||
<TextLit> => Value::Text(<>),
|
||||
<BoolLit> => Value::Boolean(<>),
|
||||
"any" => Value::Any,
|
||||
<lo:NumberLit> ".." <hi:NumberLit> => Value::Range(
|
||||
Box::new(Value::Int(lo)),
|
||||
Box::new(Value::Int(hi))
|
||||
Box::new(Value::Number(lo)),
|
||||
Box::new(Value::Number(hi))
|
||||
),
|
||||
<lo:DecimalLit> ".." <hi:DecimalLit> => Value::Range(
|
||||
Box::new(Value::Float(lo)),
|
||||
Box::new(Value::Float(hi))
|
||||
Box::new(Value::Decimal(lo)),
|
||||
Box::new(Value::Decimal(hi))
|
||||
),
|
||||
<t:Time> => Value::Time(t),
|
||||
<d:Duration> => Value::Duration(d),
|
||||
@@ -949,10 +949,10 @@ InequalityOp: CompOp = {
|
||||
};
|
||||
|
||||
Literal: Expr = {
|
||||
<NumberLit> => Expr::IntLit(<>),
|
||||
<DecimalLit> => Expr::FloatLit(<>),
|
||||
<TextLit> => Expr::StringLit(<>),
|
||||
<BoolLit> => Expr::BoolLit(<>),
|
||||
<NumberLit> => Expr::NumberLit(<>),
|
||||
<DecimalLit> => Expr::DecimalLit(<>),
|
||||
<TextLit> => Expr::TextLit(<>),
|
||||
<BoolLit> => Expr::BooleanLit(<>),
|
||||
};
|
||||
|
||||
// ===== Helpers =====
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// auto-generated: "lalrpop 0.21.0"
|
||||
// sha3: 74aa329f2c008adb120b171834cf36dcc8e33b949ab1a2fe8bd5e54d42b398af
|
||||
// sha3: 18bbe1925e11ceeec53b1eb8484775a415600ddf99220fba53d408b46198a3aa
|
||||
use crate::syntax::{
|
||||
ast::*,
|
||||
lexer::Token,
|
||||
@@ -13528,7 +13528,7 @@ fn __action46((_, pb, _): (usize, ProseBlock, usize)) -> Field {
|
||||
clippy::just_underscores_and_digits
|
||||
)]
|
||||
fn __action47((_, __0, _): (usize, i64, usize)) -> Value {
|
||||
Value::Int(__0)
|
||||
Value::Number(__0)
|
||||
}
|
||||
|
||||
#[allow(
|
||||
@@ -13537,7 +13537,7 @@ fn __action47((_, __0, _): (usize, i64, usize)) -> Value {
|
||||
clippy::just_underscores_and_digits
|
||||
)]
|
||||
fn __action48((_, __0, _): (usize, f64, usize)) -> Value {
|
||||
Value::Float(__0)
|
||||
Value::Decimal(__0)
|
||||
}
|
||||
|
||||
#[allow(
|
||||
@@ -13546,7 +13546,7 @@ fn __action48((_, __0, _): (usize, f64, usize)) -> Value {
|
||||
clippy::just_underscores_and_digits
|
||||
)]
|
||||
fn __action49((_, __0, _): (usize, String, usize)) -> Value {
|
||||
Value::String(__0)
|
||||
Value::Text(__0)
|
||||
}
|
||||
|
||||
#[allow(
|
||||
@@ -13555,7 +13555,7 @@ fn __action49((_, __0, _): (usize, String, usize)) -> Value {
|
||||
clippy::just_underscores_and_digits
|
||||
)]
|
||||
fn __action50((_, __0, _): (usize, bool, usize)) -> Value {
|
||||
Value::Bool(__0)
|
||||
Value::Boolean(__0)
|
||||
}
|
||||
|
||||
#[allow(
|
||||
@@ -13577,7 +13577,7 @@ fn __action52(
|
||||
(_, _, _): (usize, Token, usize),
|
||||
(_, hi, _): (usize, i64, usize),
|
||||
) -> Value {
|
||||
Value::Range(Box::new(Value::Int(lo)), Box::new(Value::Int(hi)))
|
||||
Value::Range(Box::new(Value::Number(lo)), Box::new(Value::Number(hi)))
|
||||
}
|
||||
|
||||
#[allow(
|
||||
@@ -13590,7 +13590,7 @@ fn __action53(
|
||||
(_, _, _): (usize, Token, usize),
|
||||
(_, hi, _): (usize, f64, usize),
|
||||
) -> Value {
|
||||
Value::Range(Box::new(Value::Float(lo)), Box::new(Value::Float(hi)))
|
||||
Value::Range(Box::new(Value::Decimal(lo)), Box::new(Value::Decimal(hi)))
|
||||
}
|
||||
|
||||
#[allow(
|
||||
@@ -15225,7 +15225,7 @@ fn __action161((_, __0, _): (usize, Token, usize)) -> CompOp {
|
||||
clippy::just_underscores_and_digits
|
||||
)]
|
||||
fn __action162((_, __0, _): (usize, i64, usize)) -> Expr {
|
||||
Expr::IntLit(__0)
|
||||
Expr::NumberLit(__0)
|
||||
}
|
||||
|
||||
#[allow(
|
||||
@@ -15234,7 +15234,7 @@ fn __action162((_, __0, _): (usize, i64, usize)) -> Expr {
|
||||
clippy::just_underscores_and_digits
|
||||
)]
|
||||
fn __action163((_, __0, _): (usize, f64, usize)) -> Expr {
|
||||
Expr::FloatLit(__0)
|
||||
Expr::DecimalLit(__0)
|
||||
}
|
||||
|
||||
#[allow(
|
||||
@@ -15243,7 +15243,7 @@ fn __action163((_, __0, _): (usize, f64, usize)) -> Expr {
|
||||
clippy::just_underscores_and_digits
|
||||
)]
|
||||
fn __action164((_, __0, _): (usize, String, usize)) -> Expr {
|
||||
Expr::StringLit(__0)
|
||||
Expr::TextLit(__0)
|
||||
}
|
||||
|
||||
#[allow(
|
||||
@@ -15252,7 +15252,7 @@ fn __action164((_, __0, _): (usize, String, usize)) -> Expr {
|
||||
clippy::just_underscores_and_digits
|
||||
)]
|
||||
fn __action165((_, __0, _): (usize, bool, usize)) -> Expr {
|
||||
Expr::BoolLit(__0)
|
||||
Expr::BooleanLit(__0)
|
||||
}
|
||||
|
||||
#[allow(
|
||||
|
||||
Reference in New Issue
Block a user