aboutsummaryrefslogtreecommitdiff
path: root/lib/ast_types.ml
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2023-12-26 10:08:23 -0600
committerMarc Coquand <marc@mccd.space>2023-12-26 10:08:23 -0600
commitd96e1839eb800bf26bcc38272072d98af69f5d83 (patch)
tree1570f7f47ba4e39acf4caebfce6eaf4a6575bc97 /lib/ast_types.ml
parent2bb4215b957d912058d490c16ee64320e3724037 (diff)
downloadfixgen-d96e1839eb800bf26bcc38272072d98af69f5d83.tar.gz
fixgen-d96e1839eb800bf26bcc38272072d98af69f5d83.tar.bz2
fixgen-d96e1839eb800bf26bcc38272072d98af69f5d83.zip
Support const keyword
Diffstat (limited to 'lib/ast_types.ml')
-rw-r--r--lib/ast_types.ml5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ast_types.ml b/lib/ast_types.ml
index b9f4294..c278d59 100644
--- a/lib/ast_types.ml
+++ b/lib/ast_types.ml
@@ -5,6 +5,7 @@ type ast_row =
| Uuidv4 of string * ast_row
| Name of string * ast_row
| Int of string * int * int * ast_row
+ | Const of string * string * ast_row
| Foreign of string * string * string * ast_row
(* parent, row, child_name, row *)
| End
@@ -19,6 +20,9 @@ let rec print_row = function
| Uuidv4 (s, r) ->
printf "UUIDv4(%s)," s;
print_row r
+ | Const (s, v, r) ->
+ printf "Const(%s, %s)," s v;
+ print_row r
| Foreign (p, r, c, next_row) ->
printf "Foreign(%s.%s, %s)," p r c;
print_row next_row
@@ -60,6 +64,7 @@ let rec ast_row_to_fixtures = function
CRow (p, r, fun l -> Fixture.Foreign (c, l)) :: ast_row_to_fixtures next_row
| Name (s, r) -> PRow (Fixture.Name s) :: ast_row_to_fixtures r
| Int (s, min, max, r) -> PRow (Fixture.Int (s, min, max)) :: ast_row_to_fixtures r
+ | Const (s, v, r) -> PRow (Fixture.Const (s, v)) :: ast_row_to_fixtures r
| End -> []