diff options
author | Marc Coquand <marc@mccd.space> | 2023-12-26 09:25:58 -0600 |
---|---|---|
committer | Marc Coquand <marc@mccd.space> | 2023-12-26 09:57:19 -0600 |
commit | 8ac0e27adc8d14a77427351dede1757999c8c709 (patch) | |
tree | 21136e7f4e467c9441176358ac0af7421e332fdf /lib/lexer.mll | |
parent | cb124a87d8ed1a309b00c9163cde2911ee029251 (diff) | |
download | fixgen-8ac0e27adc8d14a77427351dede1757999c8c709.tar.gz fixgen-8ac0e27adc8d14a77427351dede1757999c8c709.tar.bz2 fixgen-8ac0e27adc8d14a77427351dede1757999c8c709.zip |
Support many newlines
Diffstat (limited to '')
-rw-r--r-- | lib/lexer.mll | 13 |
1 files changed, 7 insertions, 6 deletions
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) } |