aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2023-12-25 19:17:01 -0600
committerMarc Coquand <marc@mccd.space>2023-12-26 09:57:19 -0600
commit5036848184a912a857c4c1e76ef02985295855eb (patch)
tree477f22604eb55124891a90a221d36c8f607406c9
parentedc71c5d9f4e4f6f889436ddb6134292b80a9d14 (diff)
downloadfixgen-5036848184a912a857c4c1e76ef02985295855eb.tar.gz
fixgen-5036848184a912a857c4c1e76ef02985295855eb.tar.bz2
fixgen-5036848184a912a857c4c1e76ef02985295855eb.zip
Support semicolon as separator
-rw-r--r--lib/lexer.mll1
-rw-r--r--lib/parser.mly2
-rw-r--r--test/test_parser.ml1
3 files changed, 4 insertions, 0 deletions
diff --git a/lib/lexer.mll b/lib/lexer.mll
index e8a7a73..41a2abc 100644
--- a/lib/lexer.mll
+++ b/lib/lexer.mll
@@ -20,6 +20,7 @@ rule read =
| "uuidv4" { UUIDV4 }
| "name" { NAME }
| ":" { COLON }
+ | ";" { SEMICOLON }
| "," { COMMA }
| "\n" { NEWLINE }
| "." { DOT }
diff --git a/lib/parser.mly b/lib/parser.mly
index f2f53fd..3d57961 100644
--- a/lib/parser.mly
+++ b/lib/parser.mly
@@ -5,6 +5,7 @@
%token <string> IDENTIFIER
%token UUIDV4
%token NEWLINE
+%token SEMICOLON
%token NAME
%token COLON
%token DOT
@@ -18,6 +19,7 @@ prog:
expr:
| tbl = IDENTIFIER; COLON; r = row; NEWLINE; e = expr { Table (tbl,r, e) }
+ | tbl = IDENTIFIER; COLON; r = row; SEMICOLON; e = expr { Table (tbl,r, e) }
| tbl = IDENTIFIER; COLON; r = row { Table (tbl,r, End) }
;
diff --git a/test/test_parser.ml b/test/test_parser.ml
index bfc980c..405219e 100644
--- a/test/test_parser.ml
+++ b/test/test_parser.ml
@@ -29,6 +29,7 @@ let relations_suite =
[ ( "Can reference other tables"
, `Quick
, test_parse "user: id uuidv4\npurchases: id uuidv4, user_id user.id" )
+ ; "Can use ; as a separator", `Quick, test_parse "user: id uuidv4; purchases: id uuidv4"
]