Anton Medvedev
97e061adca
Only allow if on precedence == 0
2025-03-08 12:02:09 +01:00
Anton Medvedev
c146c2fc9b
Add SequenceNode
...
Fixes #717
2025-03-08 09:27:09 +01:00
9dd86858e1
feat: add node budget and memory limits ( #762 )
...
* feat: add node budget and memory limits
Implement compile-time and runtime safeguards against deeply nested expressions:
- Add MaxNodes limit to track and limit AST node count during parsing
- Move MemoryBudget from VM to Config for better configurability
- Add node creation tracking in parser to enforce node budget
- Refactor node creation to check limits before allocation
- Add RunWithConfig to VM for passing memory budget settings
- Set reasonable defaults in Config (10000 nodes, 1M memory)
- Add comprehensive tests for both node and memory limits
This prevents stack overflows from malicious or poorly written expressions
by failing fast with clear error messages during compilation or runtime.
Signed-off-by: Ville Vesilehto <[email protected] >
* Update parser.go
Signed-off-by: Anton Medvedev <[email protected] >
---------
Signed-off-by: Ville Vesilehto <[email protected] >
Signed-off-by: Anton Medvedev <[email protected] >
Co-authored-by: Anton Medvedev <[email protected] >
2025-03-07 14:09:41 +01:00
5000e417f5
Add if-else conditional ( #736 )
...
Co-authored-by: Anton Medvedev <[email protected] >
2025-02-23 14:19:51 +01:00
Anton Medvedev and GitHub
c953d0dde1
Refactor types table ( #667 )
2024-06-04 00:08:01 +02:00
Anton Medvedev
c8b0171f3a
Return tree on parse errors
2024-05-18 23:41:49 +02:00
Anton Medvedev and GitHub
696844a709
Refactor lexer ( #653 )
2024-05-17 18:10:26 +02:00
Anton Medvedev
c5dfe3a811
Make count() predicate optional
2024-04-13 23:38:35 +02:00
Anton Medvedev and GitHub
772eaba1ca
Add predicate to sum() builtin ( #592 )
...
* Add predicate to sum() builtin
* go mod tidy
2024-04-13 15:37:02 +02:00
Ganesan Karuppasamy and GitHub
650a7f5ac1
Fix -1 not in [] expressions ( #590 )
2024-03-04 14:40:33 +01:00
Sergey and GitHub
26bfa591a9
Support chzained comparisonc1 < 2 < 3 ( #581 )
2024-02-27 14:23:49 +01:00
Anton Medvedev and GitHub
b1e82de54a
Refactor groupBy and sortBy ( #562 )
...
* Rearrange opcodes
* Refactor groupBy
* Fix tests
* Super opcodes for GroupBy
* Refactor sortBy builtin
* Fix sortBy bench
2024-02-15 19:53:35 +01:00
Sergey and GitHub
8d2e6b133c
Add optional array access like foo?.[42] ( #550 )
2024-02-08 12:20:20 +01:00
Sergey and GitHub
a0e2fe3664
Fix string literal slicing error ( #543 )
2024-01-31 18:07:26 +01:00
Anton Medvedev
d645265cd1
Fix pipeline and call parsing
2024-01-24 23:49:57 +01:00
Ganesan Karuppasamy and GitHub
9b73bb722e
Remove parents field for optimization ( #527 )
2024-01-16 12:47:46 +01:00
Anton Medvedev and GitHub
e7b1a64b58
Allow to override builtins ( #522 )
...
* Allow to override builtins
* Add :: syntax to access builtin in case of override
2024-01-13 15:56:49 +01:00
591e36fc00
Enhance the number parser to include support for parsing hexadecimal, binary, and octal literals. ( #483 )
...
* Enhance the number parser to include support for parsing hexadecimal, binary, and octal literals.
* added invalid literal test cases
* Refactoring code as per comment
---------
Co-authored-by: Ganesan Karuppasamy <[email protected] >
2023-12-08 18:33:50 +01:00
Anton Medvedev
551d2a7e0f
Use expr-lang/expr
2023-12-03 21:53:01 +01:00
Anton Medvedev
d78a714f19
Add check for int64->int conversion
2023-09-06 09:42:58 +02:00
Anton Medvedev
6d8d2390cf
Remove countBy
2023-08-30 14:55:05 +02:00
Anton Medvedev
5023b3005d
Add reduce()
2023-08-30 13:33:16 +02:00
Anton Medvedev
7f85c0551f
Add countBy()
2023-08-30 12:07:16 +02:00
Anton Medvedev
32f5fde2eb
Replace interface{} with any
2023-08-30 11:25:15 +02:00
Anton Medvedev
3f57b885d4
Add groupBy
2023-08-30 11:14:54 +02:00
Anton Medvedev
4683fbe2bf
Add parsing support for pointer names
2023-08-24 15:27:00 +02:00
Anton Medvedev
166d8b8ce9
Add filter()[-1] optimization
2023-08-24 11:15:43 +02:00
Anton Medvedev
2c139ca36a
Add find() and findIndex()
2023-08-24 11:15:43 +02:00
Anton Medvedev
d237c8ab4e
Forbid to redeclare variables, builtins, functions.
2023-08-22 22:30:07 +02:00
Anton Medvedev
ed5f9bfbcb
Add variables
2023-08-22 22:30:07 +02:00
Anton Medvedev
4ae978d384
Allow to disable builtins
2023-08-19 22:24:42 +02:00
Anton Medvedev
c8b485f6a8
Add String() to nodes
2023-08-17 17:23:18 +02:00
Anton Medvedev
bac96c2c29
Add expr.ExperimentalPipes() config
2023-08-15 15:39:59 +02:00
Anton Medvedev
59cfb8a834
Fix pipe operator parsing
2023-08-15 14:38:48 +02:00
Anton Medvedev
8177d8bd9f
Add OpCallBuiltin opcode to avoid an extra allocation
2023-08-14 11:50:42 +02:00
Anton Medvedev and GitHub
86f7951db2
Add pipe operator ( #400 )
2023-08-13 01:17:49 +02:00
Anton Medvedev
95f8b7ff17
Add nil coalescing operator
2023-02-03 15:53:43 +01:00
Anton Medvedev
16a6690333
Make closure brackets optional
2023-01-29 22:38:21 +01:00
Anton Medvedev
72a4ce18e9
Add len() builtin
2023-01-29 20:34:15 +01:00
Anton Medvedev
54c29bfda2
Simplify "not in" operators
2022-11-06 13:04:35 +01:00
Anton Medvedev
2c402d27db
Fix parser for 0x6E int
2022-11-05 20:40:29 +01:00
Anton Medvedev
371e24c30d
Add ^ as exponent operator
2022-11-05 20:21:48 +01:00
Anton Medvedev
f11639bf0e
Fix exponent operator precedence
...
Now -2^2 == -4
2022-11-05 20:17:11 +01:00
Anton Medvedev
ab621bec0e
Optional chaining
2022-10-15 15:59:39 +02:00
Anton Medvedev
e11960b91f
wip
2022-10-15 13:37:07 +02:00
Anton Medvedev
360e0c27c3
Add ?. in lexer
2022-10-14 16:23:41 +02:00
Anton Medvedev
6a7630dba1
Remove ast nodes
2022-10-10 20:26:59 +02:00
Anton Medvedev
b24419bf76
Remove wrong nil safe implementation
2022-10-09 12:53:30 +02:00
Zach Badgett and GitHub
3eb822d35a
Add nil safe operator ( #173 )
2021-06-07 22:53:12 +03:00
Anton Medvedev
32f1f87d79
Fix parsing of pointers in nested closures
2020-05-15 19:03:50 +03:00