-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathmod.rs
77 lines (67 loc) · 1.71 KB
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
mod aggregates;
mod arrays;
mod bitwise;
pub mod comparison;
mod conversions;
mod debugging;
pub mod deprecated;
mod encoding;
pub mod numbers;
mod objects;
pub mod sets;
mod strings;
mod time;
mod tracing;
pub mod types;
mod utils;
use crate::ast::{Expr, Ref};
use crate::lexer::Span;
use crate::value::Value;
use std::collections::HashMap;
use anyhow::Result;
use lazy_static::lazy_static;
pub type BuiltinFcn = (fn(&Span, &[Ref<Expr>], &[Value]) -> Result<Value>, u8);
pub use deprecated::DEPRECATED;
#[rustfmt::skip]
lazy_static! {
pub static ref BUILTINS: HashMap<&'static str, BuiltinFcn> = {
let mut m : HashMap<&'static str, BuiltinFcn> = HashMap::new();
// comparison functions are directly called.
numbers::register(&mut m);
aggregates::register(&mut m);
arrays::register(&mut m);
sets::register(&mut m);
objects::register(&mut m);
strings::register(&mut m);
//regex::register(&mut m);
//glob::register(&mut m);
bitwise::register(&mut m);
conversions::register(&mut m);
//units::register(&mut m);
types::register(&mut m);
encoding::register(&mut m);
//token_signing::register(&mut m);
//token_verification::register(&mut m);
time::register(&mut m);
//cryptography::register(&mut m);
//graphs::register(&mut m);
//graphql::register(&mut m);
//http::register(&mut m);
//net::register(&mut m);
//uuid::register(&mut m);
//semantic_versions::register(&mut m);
//rego::register(&mut m);
//opa::register(&mut m);
debugging::register(&mut m);
tracing::register(&mut m);
m
};
}
pub fn must_cache(path: &str) -> Option<&'static str> {
match path {
"rand.intn" => Some("rand.intn"),
_ => None,
}
}