aboutsummaryrefslogtreecommitdiff
path: root/lib/parser.mly
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/parser.mly36
1 files changed, 21 insertions, 15 deletions
diff --git a/lib/parser.mly b/lib/parser.mly
index 8a666c6..19fa44e 100644
--- a/lib/parser.mly
+++ b/lib/parser.mly
@@ -22,30 +22,36 @@ prog:
| e = expr; EOF { Some e }
;
+id_or_other:
+ | IDENTIFIER { $1 }
+ | NAME { "name" }
+ | UUIDV4 { "uuidv4" }
+
+
expr:
- | tbl = IDENTIFIER; LBRACE; amount = INT; RBRACE; COLON; r = row; NEWLINE; e = expr { Table (tbl, amount, r, e) }
- | tbl = IDENTIFIER; LBRACE; amount = INT; RBRACE; COLON; r = row; SEMICOLON; e = expr { Table (tbl,amount, r, e) }
- | tbl = IDENTIFIER; LBRACE; amount = INT; RBRACE; COLON; r = row { Table (tbl,amount, r, End) }
+ | tbl = id_or_other; LBRACE; amount = INT; RBRACE; COLON; r = row; NEWLINE; e = expr { Table (tbl, amount, r, e) }
+ | tbl = id_or_other; LBRACE; amount = INT; RBRACE; COLON; r = row; SEMICOLON; e = expr { Table (tbl,amount, r, e) }
+ | tbl = id_or_other; LBRACE; amount = INT; RBRACE; COLON; r = row { Table (tbl,amount, r, End) }
;
row:
- | row_title = IDENTIFIER; parent = IDENTIFIER; DOT; parent_id = IDENTIFIER; COMMA; r = row { Foreign (parent,parent_id,row_title, r) }
- | row_title = IDENTIFIER; parent = IDENTIFIER; DOT; parent_id = IDENTIFIER; { Foreign (parent,parent_id,row_title, End) }
+ | row_title = id_or_other; parent = id_or_other; DOT; parent_id = id_or_other; COMMA; r = row { Foreign (parent,parent_id,row_title, r) }
+ | row_title = id_or_other; parent = id_or_other; DOT; parent_id = id_or_other; { Foreign (parent,parent_id,row_title, End) }
- | row_title = IDENTIFIER; UUIDV4; COMMA; r = row { Uuidv4 (row_title, r) }
- | row_title = IDENTIFIER; UUIDV4 { Uuidv4 (row_title, End) }
+ | row_title = id_or_other; UUIDV4; COMMA; r = row { Uuidv4 (row_title, r) }
+ | row_title = id_or_other; UUIDV4 { Uuidv4 (row_title, End) }
- | row_title = IDENTIFIER; LBRACE; union = union_fields; RBRACE; COMMA; r = row { List (row_title, union, r) }
- | row_title = IDENTIFIER; LBRACE; union = union_fields; RBRACE { List (row_title, union, End) }
+ | row_title = id_or_other; LBRACE; union = union_fields; RBRACE; COMMA; r = row { List (row_title, union, r) }
+ | row_title = id_or_other; LBRACE; union = union_fields; RBRACE { List (row_title, union, End) }
- | row_title = IDENTIFIER; NAME; COMMA; r = row { Name (row_title, r) }
- | row_title = IDENTIFIER; NAME { Name (row_title, End) }
+ | row_title = id_or_other; NAME; COMMA; r = row { Name (row_title, r) }
+ | row_title = id_or_other; NAME { Name (row_title, End) }
- | row_title = IDENTIFIER; const = STRING; COMMA; r = row { Const (row_title, const, r) }
- | row_title = IDENTIFIER; const = STRING { Const (row_title, const, End) }
+ | row_title = id_or_other; const = STRING; COMMA; r = row { Const (row_title, const, r) }
+ | row_title = id_or_other; const = STRING { Const (row_title, const, End) }
- | row_title = IDENTIFIER; INTSYMBOL;LBRACE;min = INT;COMMA;max = INT;RBRACE;COMMA; r = row { Int (row_title,min,max,r) }
- | row_title = IDENTIFIER; INTSYMBOL;LBRACE;min = INT;COMMA;max = INT;RBRACE; { Int (row_title,min,max,End) }
+ | row_title = id_or_other; INTSYMBOL;LBRACE;min = INT;COMMA;max = INT;RBRACE;COMMA; r = row { Int (row_title,min,max,r) }
+ | row_title = id_or_other; INTSYMBOL;LBRACE;min = INT;COMMA;max = INT;RBRACE; { Int (row_title,min,max,End) }
;
union_fields: