Crate fel_core

Crate fel_core 

Source
Expand description

FEL parser, evaluator, and dependency analysis with base-10 decimal arithmetic.

Uses rust_decimal for base-10 arithmetic per spec S3.4.1 (minimum 18 significant digits).

§Docs

  • Human overview: crate README.md (architecture, pipeline, module map).
  • API reference: cargo doc -p fel-core --no-deps --open.
  • Markdown API export: docs/rustdoc-md/API.md (see crate README).

Re-exports§

pub use ast::Expr;
pub use context_json::formspec_environment_from_json_map;
pub use convert::fel_to_json;
pub use convert::field_map_from_json_str;
pub use convert::json_object_to_field_map;
pub use convert::json_to_fel;
pub use dependencies::Dependencies;
pub use dependencies::dependencies_to_json_value;
pub use dependencies::dependencies_to_json_value_styled;
pub use dependencies::extract_dependencies;
pub use environment::FormspecEnvironment;
pub use environment::MipState;
pub use environment::RepeatContext;
pub use error::Diagnostic;
pub use error::FelError;
pub use error::Severity;
pub use error::reject_undefined_functions;
pub use error::undefined_function_names_from_diagnostics;
pub use evaluator::Environment;
pub use evaluator::EvalResult;
pub use evaluator::Evaluator;
pub use evaluator::MapEnvironment;
pub use evaluator::evaluate;
pub use extensions::BuiltinFunctionCatalogEntry;
pub use extensions::ExtensionError;
pub use extensions::ExtensionRegistry;
pub use extensions::builtin_function_catalog;
pub use extensions::builtin_function_catalog_json_value;
pub use parser::parse;
pub use prepare_host::prepare_fel_expression_for_host;
pub use prepare_host::prepare_fel_expression_owned;
pub use prepare_host::prepare_fel_host_options_from_json_map;
pub use prepare_host::PrepareFelHostInput;
pub use prepare_host::PrepareFelHostOptionsOwned;
pub use printer::print_expr;
pub use types::FelDate;
pub use types::FelMoney;
pub use types::FelValue;
pub use types::parse_date_literal;
pub use types::parse_datetime_literal;
pub use lexer::is_valid_fel_identifier;
pub use lexer::sanitize_fel_identifier;
pub use wire_style::JsonWireStyle;

Modules§

ast
FEL abstract syntax tree node definitions and operators.
context_json
Build FormspecEnvironment from JSON-shaped evaluation context.
convert
Canonical conversion between serde_json::Value and FelValue.
dependencies
Static dependency extraction — field refs, context refs, and MIP dependencies.
environment
FEL evaluation environment with field resolution, repeats, MIP state, and instances.
error
FEL error types and diagnostic messages.
evaluator
FEL tree-walking evaluator with base-10 decimal arithmetic and null propagation.
extensions
FEL extension function registry with null propagation and conflict detection.
lexer
FEL hand-rolled lexer — tokenization with spans and decimal numbers.
parser
FEL hand-rolled recursive descent parser with operator precedence.
prepare_host
FEL source normalization before host evaluation (parity with TS normalizeExpressionForWasmEvaluation).
printer
FEL AST to string serializer for expression rewriting and debugging.
types
FEL runtime value types with base-10 decimal arithmetic.
wire_style
Host JSON key convention shared across FEL dependency wire and Formspec FFI surfaces.

Structs§

Decimal
Decimal represents a 128 bit representation of a fixed-precision decimal number. The finite set of values of type Decimal are of the form m / 10e, where m is an integer such that -296 < m < 296, and e is an integer between 0 and 28 inclusive.
PositionedToken
One lexeme from tokenize for host bindings and tooling (stable type names + source span).

Functions§

eval_with_fields
Parse and evaluate a FEL expression with a flat field map.
fel_diagnostics_to_json_value
Evaluation diagnostics as JSON objects (message, severity wire string).
tokenize
Tokenize FEL source into PositionedTokens (lexical analysis only; no parse).
tokenize_to_json_value
FEL lexer tokens as JSON (camelCase keys) for host bindings.