https://github.com/swuecho/test_regex_in_ocaml_lexer
https://github.com/swuecho/test_regex_in_ocaml_lexer
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/swuecho/test_regex_in_ocaml_lexer
- Owner: swuecho
- Created: 2018-01-01T02:53:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-04T04:14:24.000Z (over 7 years ago)
- Last Synced: 2025-01-22T15:46:02.325Z (3 months ago)
- Language: OCaml
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Test Ocaml Lexer Regex
# usage
change the *regex pattern* and run *make*. _test.exe_ will output the matchs in _data.txt_
```{ocaml}
{
open Lexing
}let regex = ['0'-'9']+ (* <--- change the regex here)
rule read = parse
| regex { Lexing.lexeme lexbuf |> print_endline; read lexbuf }
| _ { read lexbuf }
| eof { () }
```# demo
```{base}
➜ test_regex_in_ocaml_lexer git:(master) make
jbuilder build test.exe
./_build/default/test.exe data.txt
123
5
6
4
```