Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Scheme! macro to be used from other crates #68

Closed
wants to merge 197 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
d8a499c
FW-1137: add Map type
marmeladema Apr 11, 2019
3cd8a99
Parse map field and add some tests
marmeladema Apr 18, 2019
e276a9a
Hide type::Map internals
marmeladema Apr 19, 2019
18a43e7
Update FFI bindings to be able to handle Map data type
marmeladema May 11, 2019
1a8d3b1
FW-1221: Support Arrays for LhsValue (#32)
May 15, 2019
9255836
Add value_type() method for Array and Map type
marmeladema May 15, 2019
26d4dee
Implement IntoIterator trait for Array type
marmeladema May 15, 2019
269235d
Re-add TryFrom implementation to LhsValue
marmeladema May 15, 2019
67ce901
Rework function argument parsing
marmeladema May 1, 2019
21d2370
Improve error reporting on function argument parsing errors
marmeladema May 15, 2019
202d8cf
Introduce FunctionDefinition trait
marmeladema May 3, 2019
209e8ad
Fix clippy false positives
marmeladema May 7, 2019
35d0804
Simplify function argument parsing
marmeladema May 9, 2019
1160f41
Fusion min_arg_count and max_arg_count methods into arg_count method.
marmeladema May 13, 2019
1688cdb
Replace index by an ExactSizeIterator of already checked parameters i…
marmeladema May 13, 2019
e130aea
Replace GetType trait dependency by new return_type method for Functi…
marmeladema May 13, 2019
8d42d63
Add test for filter generic function example
marmeladema May 15, 2019
13a66d9
Update FFI bindings to be able to handle Array data type
marmeladema May 16, 2019
2052ac5
Return reference to value in get_field_value_unchecked
marmeladema May 14, 2019
a5dc64a
Do not deep copy when accessing an index of a field
marmeladema May 14, 2019
ef4edab
Remove useless calls to as_ref() when compiling FieldExpr
marmeladema May 14, 2019
2013564
Export FunctionDefinition trait (#39)
May 18, 2019
5874619
Introduce CompiledValueExpr and compile function to closure (#38)
marmeladema May 19, 2019
a60b517
Support Push for Array type (#40)
May 21, 2019
a2e132e
Handle missing value from Array and Map
marmeladema May 21, 2019
b44c721
Allow functions to expect multiple types for argument (#44)
marmeladema May 28, 2019
20bc195
Export lex::LexErrorKind to crate (#45)
May 29, 2019
13363f7
Export ParseError::new for assertions in tests (#46)
May 30, 2019
be649b2
Fail to lex comparison of map or array with primitive types
marmeladema Jun 4, 2019
e2fd864
Add various tests for failure of parsing invalid filters
marmeladema Jun 4, 2019
57a0c25
Make logical operators work on array of booleans (#48)
marmeladema Jun 6, 2019
1f8289d
Improve error reporting when parsing functions
marmeladema Jun 6, 2019
2b406c7
Support SimpleExpr as FunctionCallArgExpr
Jun 10, 2019
cbabaf1
Implement map each operator for first function argument
marmeladema May 24, 2019
f8bc377
Implement map each operator for comparison nodes
marmeladema Jun 7, 2019
e6fff9e
Fix serialization of FieldIndex
marmeladema Jun 13, 2019
20505c9
Add missing array type tag WIREFILTER_TYPE_TAG_ARRAY variant
marmeladema Jun 19, 2019
c755c23
Return Array(Bool) when calling get_type for a FieldExpr with map each
marmeladema Jun 19, 2019
0166f44
Parse SimpleExpr before IndexExpr during parsing of FunctionCallArgExpr
marmeladema Jun 19, 2019
6b73121
Fix clippy cyclomatic complexity error
marmeladema Jun 19, 2019
50adce0
FW-1737: remove simple expression from FunctionCallArgExpression
BethKnight1234 Aug 19, 2019
111fa81
Use of vtable without dyn is now a warning in the compiler
Aug 22, 2019
76baabb
FW-1764: Rename confusing Wirefilter structs and enums
Aug 22, 2019
f785803
FW-1765: Fix wirefilter parsing multi-digit array indices
psutherland-cloudflare Aug 22, 2019
4250c88
FW-1764: Rename FieldOp to ComparisonExprOp
Aug 27, 2019
dd8f4a2
Merge pull request #5 in EGS/wirefilter from psutherland/FW-1765 to c…
Aug 27, 2019
76eb3dd
FW-1753: Fix the wee backtracking problem
Aug 28, 2019
b3cb6dc
FW-1750: enable cross-compile for aarch64 architecture
Aug 29, 2019
ed4fa33
FW-1802: add FFI-safe CType wrapper around Type
marmeladema Sep 1, 2019
d2ae56b
Expose this enum as it may be returned by another public function
psutherland-cloudflare Sep 10, 2019
e6f9425
Merge pull request #10 in EGS/wirefilter from psutherland/FW-1774 to …
psutherland-cloudflare Sep 10, 2019
c6b9919
FW-1774: Handle error instead of panicking
psutherland-cloudflare Sep 12, 2019
26b10ea
FW-1878: add json test for comparison as function argument
marmeladema Sep 16, 2019
03a589b
Merge pull request #12 in EGS/wirefilter from elie/FW-1878 to cloudflare
marmeladema Sep 16, 2019
f9f3064
FW-1928: change Map data type key from String to Box<[u8]>
marmeladema Sep 23, 2019
0fc1163
FW-1998: Add support for get_mut method on maps
psutherland-cloudflare Oct 4, 2019
d5b37fa
FW-1998: Indicate the anonymous lifetime for the compiler
psutherland-cloudflare Oct 4, 2019
c45cbd4
FW-2077: add len and is_empty methods to Array and Map data types
marmeladema Nov 1, 2019
5ee29a7
Merge pull request #15 in EGS/wirefilter from elie/FW-2077-len to clo…
marmeladema Nov 1, 2019
cd51d89
FW-1982: Fuzz test byte fields and byte map keys
psutherland-cloudflare Nov 5, 2019
55bbd09
FW-1904: Add wirefilter_serialize_type_to_json function
marmeladema Nov 11, 2019
e77ddf6
Merge pull request #17 in EGS/wirefilter from elie/FW-1904-serialize-…
marmeladema Nov 11, 2019
5bdd230
FW-1939: return a boolean instead of panicking when possible
marmeladema Nov 11, 2019
69238f1
Add conditional compilation for fuzz builds
psutherland-cloudflare Nov 22, 2019
d13846e
Merge pull request #19 in EGS/wirefilter from psutherland/conditional…
psutherland-cloudflare Nov 22, 2019
f8c3251
Implement custom Cow for Array data type
marmeladema Nov 22, 2019
ce88fb0
Implement Cow for value_type of Array data type
marmeladema Nov 22, 2019
f3805f4
Implement custom Cow for Map data type
marmeladema Nov 22, 2019
5a47aa7
Implement Cow for value_type of Map data type
marmeladema Nov 22, 2019
e3339a3
Simplify compiled closure when mapping operator in the only index access
marmeladema Nov 22, 2019
ac16601
Implement zero-copy IntoIter trait for Array data type
marmeladema Nov 23, 2019
d613ae3
Implement zero-copy IntoIter trait for Map data type
marmeladema Nov 24, 2019
f999046
Add extract method for LhsValue
marmeladema Nov 24, 2019
81812d1
Call .extract() instead of .get() in IndexExpr::compile to avoid a de…
marmeladema Nov 24, 2019
24f2e51
Implement From<RhsValue> trait for LhsValue
marmeladema Nov 24, 2019
c9ae805
Use From<RhsValue> trait to replace last call to LhsValue::to_owned
marmeladema Nov 25, 2019
8f1dfba
Remove ability to deep clone LhsValue
marmeladema Nov 25, 2019
386a749
Fix type confusion when using MapEach operator in a function call
marmeladema Dec 3, 2019
c4f0fde
FW-2354: return errors everywhere we can in ffi layer
marmeladema Dec 4, 2019
43fc617
FW-2354: catch panic in parse, uses, compile and match functions
marmeladema Dec 5, 2019
276e07e
Add wirefilter_free_filter_ast function for parity
marmeladema Dec 5, 2019
ed2e63e
Implement custom (de)serialization for ExecutionContext
marmeladema Dec 3, 2019
3da55ed
Expose ExecutionContext serialization through ffi
marmeladema Dec 6, 2019
0979936
FW-2354: allow to enable/disable panic catcher per thread
marmeladema Dec 6, 2019
4268ee3
FW-2354: add panic catcher fallback mode in order to abort when not c…
marmeladema Dec 9, 2019
d527965
FW-2461: implement ability to iterate over fields of a scheme
marmeladema Jan 16, 2020
513817b
Fix clippy errors
marmeladema Jan 16, 2020
7814f3f
Make Filter implicitly Sync + Send
cbranch Jan 17, 2020
03e889b
Merge pull request #31 in EGS/wirefilter from cbranch/sync-filters to…
marmeladema Jan 17, 2020
b93c17f
FW-2488 Fix parsing single digit function args
rsommervilleCF Jan 23, 2020
b980081
Disable panic catcher by default instead of aborting
marmeladema Jan 24, 2020
ace7a59
Allow to configure panic catcher fallback mode independently of its s…
marmeladema Jan 24, 2020
cb34265
FW-2596: move panic catcher code into its own panic module
marmeladema Jan 27, 2020
b1a9167
FW-2596: expose API to start/stop the panic catcher and get backtrace
marmeladema Jan 27, 2020
c23731e
FW-944: fix clippy errors
marmeladema Feb 12, 2020
d98cc82
FW-944: allow to deserialize ExecutionContext from reader
marmeladema Feb 12, 2020
3a19c0b
Use a `Field` instead of a bare name in `ExecutionContext::set_field_…
marmeladema Jan 24, 2020
3dbfbbb
FW-2656: give access to literal value when checking function arguments
marmeladema Feb 14, 2020
b665be1
FW-2656: simplify FunctionDefinition trait by removing default_value …
marmeladema Feb 14, 2020
15ef6bc
FW-2656: add compile method to FunctionDefinition trait
marmeladema Feb 14, 2020
83e72d5
FW-2656: rename Function to SimpleFunctionDefinition
marmeladema Feb 14, 2020
55ae39a
FW-2656: rename FunctionDefinitionArg to FunctionParam
marmeladema Feb 14, 2020
55e8e03
FW-2656: rename FunctionImpl to SimpleFunctionImpl
marmeladema Feb 14, 2020
c28b91f
FW-2656: export FunctionParam
marmeladema Feb 14, 2020
6d92fb2
FW-2656: export FunctionArgInvalidConstantError
marmeladema Feb 17, 2020
53406a2
FW-2656: add FunctionParam::expect_const_value helper function
marmeladema Feb 17, 2020
e563fec
FW-2656: add ability for functions to supply a user-defined context
marmeladema Feb 18, 2020
5d45f21
FW-2656: add user-defined context as argument to FunctionDefinition::…
marmeladema Feb 21, 2020
10d5874
FW-2691: fix parsing of unary expression as function argument
marmeladema Feb 25, 2020
444683c
FW-2688: Clean up declare_types macro to simplify code
psutherland-cloudflare Mar 2, 2020
4fbc2d4
Merge pull request #46 in EGS/wirefilter from psutherland/FW-2688-2 t…
psutherland-cloudflare Mar 3, 2020
5a70f8f
Re-enable Rust 2018 idioms
marmeladema Mar 3, 2020
e2f59af
Move Array and Map type definition into their own file
marmeladema Mar 3, 2020
df0fa32
FW-2688: Implement matching an item in a List
psutherland-cloudflare Mar 2, 2020
d90f548
FW-2688: Implement list matching for arrays (field[*] in $list)
psutherland-cloudflare Mar 3, 2020
650d144
FW-2688: Use better name for get_list_matcher()
psutherland-cloudflare Mar 3, 2020
8c5d2a0
FW-2688: Don't expose ListMatcherWrapper
psutherland-cloudflare Mar 3, 2020
71cd92b
FW-2690: Add new method uses_list
Mar 4, 2020
396e29e
Remove Scheme::get_field_from_index method
marmeladema Jan 26, 2020
bdd813d
Rework how functions are stored in `Scheme`
marmeladema Jan 26, 2020
d7ba09a
Introduce `ValueExpr` trait
marmeladema Apr 1, 2020
5c87949
Introduce compilation framework
marmeladema Mar 3, 2020
43c2a0b
Introduce AST visitor
marmeladema Apr 16, 2020
1641768
Specify rust_2018_idioms lint using #![warn()] instead of compiler flag
marmeladema Apr 21, 2020
08be451
Fix Scheme! macro for nested array/map types
marmeladema Apr 27, 2020
90b6ab4
Fail parsing comparison expr if lhs cannot be coerce to Bool / Array(…
marmeladema Apr 27, 2020
9227434
Fix clippy error after upgrading to rust 1.43.0
marmeladema Apr 27, 2020
4ac0485
Implement generalization of `[*]` operator
marmeladema Apr 24, 2020
afc4d78
FW-3030: Update lifetimes on AST visitor
zakcutner Jun 3, 2020
d87cd81
Merge pull request #59 in EGS/wirefilter from zak/FW-3030-visitor to …
zakcutner Jun 4, 2020
7ce00f0
FW-3071: remove jessie and add buster flavor to cfsetup
marmeladema Jun 11, 2020
de4ae2f
FLPLAT-1186: bump regex crate to speed up large regex compilation
dqminh Apr 15, 2020
80e7678
IndexExr: simplify indexes vec at compile time
marmeladema Jun 19, 2020
a17f13e
IndexExpr: allocate memory lazily in compile_vec_with
marmeladema Jun 19, 2020
7214dbf
IndexExpr: simplify compiled closure for when an `IndexExpr` has no i…
marmeladema Jun 19, 2020
20f5588
IndexExpr: remove default value for `IndexExpr::compile_vec_with`
marmeladema Jun 25, 2020
adf54c3
IndexExpr: do not validate type in `IndexExpr::map_each_count`
marmeladema Jun 25, 2020
17a11d4
Run cargo-sort-ck to sort dependencies in `Cargo.toml` files
marmeladema Jun 27, 2020
5455daf
Replace deprecated failure crate by thiserror
marmeladema Jun 27, 2020
eac0c9c
Implement support for `ListMatcher` serialization
marmeladema Jun 27, 2020
e6d8880
Introduce `ListDefinition` to declare which lists are available in th…
marmeladema Jun 27, 2020
4c57729
Add ability to validate `ListMatcher` for a given `ListDefinition`
marmeladema Jun 27, 2020
7b6e4c8
Serialize lists matcher data in a nested "$lists" object
marmeladema Jun 26, 2020
e507d00
Handle list deserialization
marmeladema Jun 27, 2020
d4a0357
Remove unnecessary `Clone` bound for `ListMatcher`.
marmeladema Jun 27, 2020
358efa0
Allow list deserialization to fail
marmeladema Jun 27, 2020
b30d6a0
IndexExpr: support parsing of standalone `IndexExpr` expression
marmeladema Jul 3, 2020
75bc433
Update some outdated dependencies
marmeladema Jul 10, 2020
d286694
Update criterion to version 0.3.3
marmeladema Jul 10, 2020
7876ed7
Fix wasm build
marmeladema Jul 10, 2020
943ba42
FW-3133: Replace .or_else with .map_err for Clippy lint
zakcutner Jul 20, 2020
4e56582
FW-3133: Use AVX2 search algorithm for contains operator
zakcutner Jul 17, 2020
72b65ef
Do not store function name in `FunctionCallExpr`
marmeladema Jul 28, 2020
a3bd9f7
Do not require `FunctionDefinitionContext` to implement `PartialEq`
marmeladema Jul 28, 2020
ee0f195
FW-3243: Implement Hash for AST nodes
zakcutner Jul 27, 2020
753b9df
Add `LhsValue::into_owned` method
marmeladema Apr 6, 2020
cb93ded
FW-3256: Extend RhsValues to act more like Vec
zakcutner Jul 29, 2020
f63860d
FW-3036: simplify AST visitor
marmeladema Jul 30, 2020
28a989e
Introduce `VisitorMut` in order to apply AST transformations.
marmeladema Jul 30, 2020
253044c
FW-3264: Update walk methods for mutable visitor
zakcutner Aug 3, 2020
820fc68
FW-3264: Expose LogicalOp enum
zakcutner Aug 4, 2020
1664a2a
Remove requirement for ExecutionContext to have the same lifetime as …
inikulin Jan 28, 2020
a9a7bac
Start implementing V2 parser
inikulin May 1, 2020
e7194db
V2 parser: implement int literal parsing
inikulin May 1, 2020
da8503c
V2 parser: impelement expression parsing
inikulin May 1, 2020
36ca6ea
V2 parser: expr
inikulin May 2, 2020
332ae22
V2 parser: add string literal
inikulin May 2, 2020
9bfe5e1
V2 parser: int range
inikulin May 2, 2020
199ab79
V2 parser: string escapes
inikulin May 2, 2020
7c63049
V2 parser: expr
inikulin May 2, 2020
bd2778d
V2 parser: get rid of excessive AST types
inikulin May 3, 2020
b825cf9
V2 parser: Add str_lit to bin expr
inikulin May 3, 2020
ab12e8e
V2 parser: IpAddr
inikulin May 6, 2020
354dfc2
Test error messages
inikulin May 6, 2020
725a2d7
Add regex grammar
inikulin May 9, 2020
f387787
Fix re_lit name in grammar
inikulin May 9, 2020
007be48
Implement regex parsing
inikulin May 18, 2020
03dbf11
Fix parse_re_lit test
marmeladema Jun 27, 2020
178fbeb
FW-3264: Inline walk methods
zakcutner Aug 6, 2020
83ca7c3
Make `InvalidListMatcherError` public
marmeladema Aug 15, 2020
c86ef85
FW-3253: Expose OrderingOp, RhsValue and RhsValues
zakcutner Aug 17, 2020
345dde2
FW-3253: Extend custom compiler to support Expr nodes
zakcutner Aug 17, 2020
c4c966f
FW-3336: expose `Regex` and `RegexError` types
marmeladema Aug 25, 2020
d4a5616
FW-3336: expose `IndexExpr::compile_with`
marmeladema Aug 25, 2020
6ec030c
FW-2747: Make `FunctionDefinitionContext` `Sync`
marmeladema Aug 26, 2020
e583237
FW-2747: Add method to retrieve `Function` from `FunctionCallExpr`
marmeladema Aug 27, 2020
a02fab8
FW-3344: Bump sliceslice crate to 0.2.0
zakcutner Aug 28, 2020
d8f414b
MAGIC-878: Add boxed function to scheme
Aug 20, 2020
e913f53
MAGIC-878: preserve backward compatibility for unboxed functions
Aug 27, 2020
68ff582
FW-3345: derive `Hash` for `FilterAst`
marmeladema Sep 7, 2020
a339713
FW-3253: Add unreachable ContainsOneOf node
zakcutner Sep 8, 2020
be7f909
FW-3253: Add append method to RhsValues
zakcutner Aug 18, 2020
aab5b71
FW-3253: Expose Bytes struct publically
zakcutner Aug 18, 2020
956a854
FW-2747: Rework compiler trait
marmeladema Sep 3, 2020
7051a30
FW-2747: add `ExecutionContext::take_with` method
marmeladema Sep 9, 2020
3cd559d
Fix cfsetup
marmeladema Jun 27, 2020
55d2e8b
Fix Scheme! macro to be used from other crates
Sep 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Do not deep copy when accessing an index of a field
  • Loading branch information
marmeladema committed May 18, 2019
commit a5dc64a0bc57799ec5013db7c9f938cadaa11e51
23 changes: 17 additions & 6 deletions engine/src/ast/index_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,25 @@ impl<'s> IndexExpr<'s> {
}

pub fn execute(&'s self, ctx: &'s ExecutionContext<'s>) -> LhsValue<'_> {
let value = self.lhs.execute(ctx);
if self.indexes.is_empty() {
value
self.lhs.execute(ctx)
} else {
self.indexes
.iter()
.fold(&value, |value, index| value.get(index).unwrap().unwrap())
.to_owned()
match &self.lhs {
LhsFieldExpr::Field(f) => self
.indexes
.iter()
.fold(ctx.get_field_value_unchecked(*f), |value, index| {
value.get(index).unwrap().unwrap()
})
.as_ref(),
LhsFieldExpr::FunctionCallExpr(call) => self
.indexes
.iter()
.fold(&call.execute(ctx), |value, index| {
value.get(index).unwrap().unwrap()
})
.to_owned(),
}
}
}
}
Expand Down