From f3c5dc866e429c388aa77375d9045698ccfb904e Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Tue, 26 Dec 2023 15:07:20 -0600 Subject: Support underscore names --- lib/lexer.mll | 2 +- test/test_parser.ml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/lexer.mll b/lib/lexer.mll index e2f6469..b4e26d8 100644 --- a/lib/lexer.mll +++ b/lib/lexer.mll @@ -11,7 +11,7 @@ let float = digit* frac? exp? let int = digit+ let white = [' ' '\t']+ let newline = '\r' | '\n' | "\r\n" -let id = ['a'-'z' 'A'-'Z' '-']* +let id = ['a'-'z' 'A'-'Z' '-' '_']* let newline = '\r' | '\n' | "\r\n" let many_newline = newline+ diff --git a/test/test_parser.ml b/test/test_parser.ml index 003086a..5fa9e6a 100644 --- a/test/test_parser.ml +++ b/test/test_parser.ml @@ -18,7 +18,7 @@ let rows_suite = , `Quick , test_parse "user (1): id uuidv4\npurchases (1): id uuidv4" ) ; "Supports names", `Quick, test_parse "purchases (1): name name" - ; "Supports const", `Quick, test_parse "purchases (1): name \"hello\"" + ; "Supports const", `Quick, test_parse "purchases (1): name \"_helloarsent1!@#4\"" ; "Supports ints with min/max", `Quick, test_parse "purchases (1): name int(1,20)" ; ( "Supports a list of potential values" , `Quick @@ -26,6 +26,8 @@ let rows_suite = ; ( "Supports setting amount of fixture to generate" , `Quick , test_parse "purchases (5): name int(1,20)" ) + ; "Supports underscore tables", `Quick, test_parse "purchases_new (5): name int(1,20)" + ; "Supports underscore tables", `Quick, test_parse "purchases_new (5): name int(1,20)" ] -- cgit v1.2.3