77 lines
1.7 KiB
Plaintext
77 lines
1.7 KiB
Plaintext
==================
|
|
Top-level fields
|
|
==================
|
|
host = String;
|
|
port = Int & > 443 default 8080;
|
|
---
|
|
|
|
(source_file
|
|
(field_definition
|
|
path: (field_path (identifier))
|
|
value: (identifier))
|
|
(field_definition
|
|
path: (field_path (identifier))
|
|
value: (default_expression
|
|
base: (binary_expression
|
|
left: (identifier)
|
|
right: (comparison_constraint
|
|
value: (integer)))
|
|
fallback: (literal (integer)))))
|
|
|
|
==================
|
|
Import and function
|
|
==================
|
|
let
|
|
schema = import "./schema.dcdl";
|
|
mk = (cfg: schema.Service) => cfg;
|
|
in
|
|
mk({ name = "api"; })
|
|
---
|
|
|
|
(source_file
|
|
(let_expression
|
|
(field_definition
|
|
path: (field_path (identifier))
|
|
value: (import_expression
|
|
specifier: (string)))
|
|
(field_definition
|
|
path: (field_path (identifier))
|
|
value: (function_expression
|
|
(parameter
|
|
name: (identifier)
|
|
constraint: (path_expression
|
|
object: (identifier)
|
|
field: (identifier)))
|
|
body: (identifier)))
|
|
body: (call_expression
|
|
function: (identifier)
|
|
(object
|
|
(field_definition
|
|
path: (field_path (identifier))
|
|
value: (literal (string)))))))
|
|
|
|
==================
|
|
Match and patch
|
|
==================
|
|
base // {
|
|
summary = match env {
|
|
"prod": "production";
|
|
_: "other";
|
|
};
|
|
}
|
|
---
|
|
|
|
(source_file
|
|
(binary_expression
|
|
left: (identifier)
|
|
right: (object
|
|
(field_definition
|
|
path: (field_path (identifier))
|
|
value: (match_expression
|
|
scrutinee: (identifier)
|
|
(match_arm
|
|
pattern: (literal (string))
|
|
body: (literal (string)))
|
|
(match_arm
|
|
body: (literal (string))))))))
|