Closed
Description
If you want an unsupported language added, provide:
-
language name: Nickel
-
file extension(s): ncl
-
method(s) of commenting text:
#
single-line (I don’t see multi-line listed) -
location of sample code: https://nickel-lang.org/user-manual/tutorial
let { UserSchema, .. } = import "users-schema.ncl" in { users | Array UserSchema = [ { name = "Alice", is-admin = true, extra-groups = ["support"], ssh-keys = [ "AAAAAe4QAAAAAB5OLAo1...... alice@nixos", "AAAAA26vx+AqGIPZd/NT...... alice@android", ], }, { name = "Bob", extra-groups = ["pentester"], }, { name = "Mallory" }, { name = "Grace", is-admin = true, extra-groups = ["administrative"], }, ] }
https://raw.githubusercontent.com/nickel-lang/tree-sitter-nickel/main/corpus/examples/gcc.txt
# Validate and normalize gcc flags. They can be either a string `-Wextra` or # a structured value `{flag = "W", arg = "extra"}`. Arguments are not checked. let GccFlag = # We only allow the following flags let available = ["W", "c", "S", "e", "o"] in fun label value => if builtin.is_str value then if string.length value > 0 && array.any (fun x => x == string.substring 0 1 value) available then value else contract.blame_with "unknown flag %{value}" label else if builtin.is_record value then if record.has_field "flag" value && record.has_field "arg" value then if array.any (fun x => x == value.flag) available then #Normalize the tag to a string value.flag ++ value.arg else contract.blame_with "unknown flag %{value.flag}" label else contract.blame_with "bad record structure: missing field `flag` or `arg`" label else contract.blame_with "expected record or string" label in let Path = let pattern = m%"^(.+)/([^/]+)$"% in fun label value => if builtin.is_str value then if string.is_match pattern value then value else contract.blame_with "invalid path" label else contract.blame_with "not a string" label in let SharedObjectFile = fun label value => if builtin.is_str value then if string.is_match m%"\.so$"% value then value else contract.blame_with "not an .so file" label else contract.blame_with "not a string" label in let OptLevel = fun label value => if value == 0 || value == 1 || value == 2 then value else contract.blame label in let Contract = { path_libc | doc "Path to libc." | Path | SharedObjectFile | default = "/lib/x86_64-linux-gnu/libc.so", flags | doc " Additional flags to pass to GCC. Either provide a string without the leading `-`, or a structured value `{flag : Str, arg: Str}`. " | Array GccFlag | default = [], optimization_level | doc " Optimization level. Possible values: - *0*: unoptimized - *1*: normal - *2*: use optimizations " | OptLevel | default = 1, } in { flags = ["Wextra", {flag = "o", arg = "stuff.o"}], optimization_level = 2, } | Contract
Metadata
Assignees
Labels
No labels