package sqlgg

  1. Overview
  2. Docs
SQL Guided (code) Generator

Install

dune-project
 Dependency

Authors

Maintainers

Sources

sqlgg-20260721.tbz
sha256=40d7699187951dd2f17d885c4f4f04124930bf7dc1119d4cca322c5f0cb42d8e
sha512=e7c90683cddcff3ca0ba9de9e40c2c4c69923ea62e2647f1a70083e42ed00b7cab53f8a14d1a965ee4465966bc02fa75fa7cb42e485beae1a9c26bdc252c3665

doc/src/sqlgg.json_path/ast.ml.html

Source file ast.ml

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
type array_index = 
  | Index of int
  | Wildcard
  | Last
  | LastOffset of int

type range = {
  start_idx: array_index;
  end_idx: array_index;
}

type path_leg =
  | Member of string          
  | ArrayAccess of array_index 
  | ArrayRange of range        
  | MemberWildcard            
  | DoubleWildcard            

type t = {
  scope: string;              
  legs: path_leg list;
}

module Syntax = struct
  let root = { scope = "$"; legs = [] }

  let (/) path leg = { path with legs = path.legs @ [leg] }
  let (//) path legs = { path with legs = path.legs @ legs }

  let (~.) name = Member name

  let idx n = ArrayAccess (Index n)                    (* idx 0 *)
  let any = ArrayAccess Wildcard                       (* any *)
  let last = ArrayAccess Last                          (* last *)
  let wildcard = MemberWildcard                        (* wildcard *)
  let range start end_ = ArrayRange { 
    start_idx = Index start; 
    end_idx = Index end_ 
  }
  
end