Skip to content

Commit

Permalink
Merge pull request #2 from superwall/develop
Browse files Browse the repository at this point in the history
0.1.2
  • Loading branch information
ianrumac authored Aug 26, 2024
2 parents 4831177 + d7e2853 commit 356a3c8
Show file tree
Hide file tree
Showing 8 changed files with 497 additions and 226 deletions.
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cel-eval"
version = "0.1.1"
version = "0.1.2"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmlž
Expand All @@ -14,7 +14,11 @@ cel-parser = "0.7.1"
uniffi = { version = "0.28" }
serde = { version = "1.0", features = ["serde_derive"] }
serde_json = { version = "1.0" }
async-trait = "0.1.81"
smol = "2.0.1"

[dev-dependencies]
tokio = { version = "^1.20", features = ["rt-multi-thread", "macros"] }
[build-dependencies]
uniffi = { version = "0.28", features = [ "build" ] }

Expand Down
4 changes: 2 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fn main(){
fn main() {
uniffi::generate_scaffolding("./src/cel.udl").unwrap();
}
}
102 changes: 102 additions & 0 deletions src/ast.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
## AST example

For convenience, here is a JSON example of an AST that can be evaluated by the library.

```json
{
"type": "And",
"value": [
{
"type": "Relation",
"value": [
{
"type": "Arithmetic",
"value": [
{
"type": "Atom",
"value": {
"type": "Int",
"value": 5
}
},
{
"type": "Add"
},
{
"type": "Atom",
"value": {
"type": "Int",
"value": 3
}
}
]
},
{
"type": "GreaterThan"
},
{
"type": "Atom",
"value": {
"type": "Int",
"value": 7
}
}
]
},
{
"type": "Relation",
"value": [
{
"type": "FunctionCall",
"value": [
{
"type": "Member",
"value": [
{
"type": "Ident",
"value": "name"
},
{
"type": "Attribute",
"value": "length"
}
]
},
null,
[]
]
},
{
"type": "In"
},
{
"type": "List",
"value": [
{
"type": "Atom",
"value": {
"type": "Int",
"value": 5
}
},
{
"type": "Atom",
"value": {
"type": "Int",
"value": 10
}
},
{
"type": "Atom",
"value": {
"type": "Int",
"value": 15
}
}
]
}
]
}
]
}
```
Loading

0 comments on commit 356a3c8

Please sign in to comment.