diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-26 15:30:53 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-26 15:30:53 -0300 |
| commit | e32ba6294781691846c3ab19281fe977350b4d0f (patch) | |
| tree | f38e92ba2fc03e966d7263c7ee2e0b5d7983ebae /lib/qualified_name.ml | |
| parent | be375a52da6174dfda5b68617d27e1542cc80499 (diff) | |
| download | Sakura-e32ba6294781691846c3ab19281fe977350b4d0f.tar.gz Sakura-e32ba6294781691846c3ab19281fe977350b4d0f.zip | |
preparation cleanup for RNT integration
Diffstat (limited to 'lib/qualified_name.ml')
| -rw-r--r-- | lib/qualified_name.ml | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/lib/qualified_name.ml b/lib/qualified_name.ml deleted file mode 100644 index a73774e..0000000 --- a/lib/qualified_name.ml +++ /dev/null @@ -1,38 +0,0 @@ -(** Fully qualified relation reference: [mg:rel_name]. - - The first colon separates the multigroup name from the relation name; any - further colons are part of the relation name verbatim. - - Examples: - - ["warehouse:orders"] -> mg=["warehouse"], name=["orders"] - - ["warehouse:public:orders"] -> mg=["warehouse"], name=["public:orders"] - - ["sakura:public:relation"] -> mg=["sakura"], name=["public:relation"] - - A reference with no leading [<mg>:] segment is a parse error — callers must - supply the mg explicitly. *) - -type t = {mg: string; name: string} - -module Error = struct - open Condition - - let unqualified_name name = - condition "unqualified-name" "A qualified name was expected, but an unqualified one was given" - ("name" |=| of_string name) -end - -exception Unqualified of string - -let parse (s : string) : t = - match String.index_opt s ':' with - | None -> raise (Unqualified s) - | Some i -> - let mg = String.sub s 0 i in - let name = String.sub s (i + 1) (String.length s - i - 1) in - if mg = "" || name = "" then raise (Unqualified s) else {mg; name} - -let try_parse (s : string) : (t, Condition.t) result = - try Ok (parse s) with Unqualified s -> Error (Error.unqualified_name s) - -let make ~mg ~name = {mg; name} -let to_string {mg; name} = mg ^ ":" ^ name |
