OCaml: Add a configuration lexer
This commit is contained in:
parent
638f886baf
commit
902734d610
4 changed files with 129 additions and 2 deletions
8
ocaml/lib/utilities/text.ml
Normal file
8
ocaml/lib/utilities/text.ml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
let chars_of_string (string: string): char list =
|
||||
let rec split string index chars =
|
||||
if index = String.length string then chars
|
||||
else split string (index + 1) (string.[index] :: chars)
|
||||
in List.rev (split string 0 [])
|
||||
|
||||
let string_of_chars (chars: char list): string =
|
||||
String.concat "" (List.map (String.make 1) chars)
|
||||
Loading…
Add table
Add a link
Reference in a new issue