diff options
Diffstat (limited to '')
-rw-r--r-- | lib/fixture.ml | 2 | ||||
-rw-r--r-- | lib/lexer.mll | 13 |
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/fixture.ml b/lib/fixture.ml index 31a6e9c..189d2fb 100644 --- a/lib/fixture.ml +++ b/lib/fixture.ml @@ -22,6 +22,8 @@ let names = let random_name () = List.nth names (Random.int (List.length names)) let%test "random_name" = List.mem (random_name ()) names +(* Support arbitrary amount *) +(* Support names *) type t = | Name of string | Uuidv4 of string diff --git a/lib/lexer.mll b/lib/lexer.mll index 41a2abc..769192b 100644 --- a/lib/lexer.mll +++ b/lib/lexer.mll @@ -10,19 +10,20 @@ let exp = ['e' 'E'] ['-' '+']? digit+ let float = digit* frac? exp? 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+ rule read = parse - | white { read lexbuf } | id { IDENTIFIER (Lexing.lexeme lexbuf) } - | "uuidv4" { UUIDV4 } - | "name" { NAME } + | "_uuidv4" { UUIDV4 } + | "_name" { NAME } + | white { read lexbuf } | ":" { COLON } | ";" { SEMICOLON } | "," { COMMA } - | "\n" { NEWLINE } + | many_newline { NEWLINE } | "." { DOT } | eof { EOF } | _ as c { failwith (Printf.sprintf "unexpected character: %C" c) } |