-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aacd452
commit 05d9c1b
Showing
5 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(library | ||
(name text_cleanup)) | ||
|
||
(ocamllex lexer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{} | ||
|
||
let digit = ['0' - '9'] | ||
|
||
let esc = '\027' | ||
|
||
let timestamp = esc "_bk;t=" digit* '\007' | ||
|
||
let color_code = esc '[' (digit | ';') * 'm' | ||
|
||
let to_delete = timestamp | color_code | ||
|
||
rule cleanup buf = parse | ||
| to_delete { cleanup buf lexbuf } | ||
| _ { Buffer.add_string buf (Lexing.lexeme lexbuf); cleanup buf lexbuf } | ||
| eof { () } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
let cleanup string = | ||
let lexbuf = Lexing.from_string string in | ||
let buf = Buffer.create 16 in | ||
Lexer.cleanup buf lexbuf; | ||
Buffer.contents buf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,8 @@ | |
re2 | ||
sexplib0 | ||
uri | ||
yojson) | ||
yojson | ||
text_cleanup) | ||
(preprocess | ||
(pps lwt_ppx))) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters