Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial cleanup and refactoring of the parser #286

Merged
merged 31 commits into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e436c57
Add some documentation to cryptic Sub functions
shonfeder Sep 3, 2022
3adc1da
Factor out string slice access functions
shonfeder Sep 3, 2022
5955a32
Rename `Sub.tails` to `Sub.drop`
shonfeder Sep 3, 2022
147b7d4
Rename "heads" to "take"
shonfeder Sep 4, 2022
153bd13
Move `Sub` module into strSlice module file
shonfeder Sep 4, 2022
2aaddb3
Add some comments and improve organization
shonfeder Sep 4, 2022
f7bc5b0
Factor out repeated length checks
shonfeder Sep 4, 2022
9b98a62
Define peek_exn via peek
shonfeder Sep 4, 2022
63a3709
Document the parser helpers
shonfeder Sep 5, 2022
ed6f2ae
Clean up sp3
shonfeder Sep 5, 2022
dabd83c
Remove (most) duplicates of ws testing logic
shonfeder Sep 5, 2022
16747cd
Move char preds together
shonfeder Sep 5, 2022
e842b90
Add drop_while and drop_last_while
shonfeder Sep 5, 2022
ec0e52d
Factor out white space trimming
shonfeder Sep 5, 2022
fa6ae6c
Clarify comment
shonfeder Sep 5, 2022
75805d8
Refactor thematic_break parsing
shonfeder Sep 5, 2022
d3535dc
Clean up setext_heading
shonfeder Sep 5, 2022
60f750b
Add stdcmpat dependency
shonfeder Sep 5, 2022
28b38e5
Remove unneeded disabled warning
shonfeder Sep 5, 2022
46ee44c
Add index, split_at, and fold_left
shonfeder Sep 6, 2022
7f88563
Further refactor thematic_break
shonfeder Sep 6, 2022
4a17175
Simplify setext_heading again
shonfeder Sep 6, 2022
4527c6a
Replace custom Compat module with Stdcompat
shonfeder Sep 6, 2022
3cafd16
Fix formatting
shonfeder Sep 6, 2022
d2666ce
Use inline records for Lsetext_heading
shonfeder Sep 8, 2022
6611e25
Remove enusre_chars_remain
shonfeder Sep 8, 2022
ff1799d
Drop use of "Sub" alias for StrSlice
shonfeder Sep 8, 2022
7b1ea60
Add Compat module back
shonfeder Sep 8, 2022
606e2c0
Try to fix name clsah
shonfeder Sep 8, 2022
e1f1f94
remove compat module
tatchi Sep 9, 2022
612f35a
Raise minimum ocaml version to 4.08
shonfeder Sep 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ extension mechanism, and some other features. Note that the opam
package installs both the OMD library and the command line tool `omd`.")
(tags (org:ocamllabs org:mirage))
(depends (ocaml (>= 4.05))
stdcompat
uutf
uucp
uunf
Expand Down
1 change: 1 addition & 0 deletions omd.opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ bug-reports: "https://github.com/ocaml/omd/issues"
depends: [
"dune" {>= "2.7"}
"ocaml" {>= "4.05"}
"stdcompat"
"uutf"
"uucp"
"uunf"
Expand Down
2 changes: 1 addition & 1 deletion src/block.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
open Ast
module Sub = Parser.Sub
module Sub = StrSlice
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure what I should do about this naming. Is Sub a good name for the module? I find it cryptic and inaccurate, under the view that it's not really about substrings, per se, but about slices over a base. But maybe that's more of an implementation detail? Really, it's more like an alternative representation of strings based on the view of a slice...

WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find StrSlice a better name than Parser.Sub.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. I think I do too. I dropped the Sub alias.


module Pre = struct
type container =
Expand Down
52 changes: 0 additions & 52 deletions src/compat.ml

This file was deleted.

3 changes: 1 addition & 2 deletions src/dune
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
(library
(name omd)
(public_name omd)
(libraries uutf uucp uunf)
(flags :standard -w -30))
(libraries uutf uucp uunf stdcompat))

(rule
(with-stdout-to
Expand Down
Loading