Skip to content

Commit

Permalink
Adjusting action parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenldl committed Nov 5, 2024
1 parent 8723cc5 commit e122a39
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bin/action.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ module Parsers = struct
open Angstrom
open Parser_components

let any_string_trimmed =
any_string >>| String.trim

let p : t' Angstrom.t =
choice [
string "drop" *> skip_spaces *> (
choice [
string "path" *> skip_spaces *>
char ':' *> skip_spaces *>
any_string >>| (fun s -> (`Drop_path s));
any_string_trimmed >>| (fun s -> (`Drop_path s));
string "listed" *> skip_spaces *> return `Drop_listed;
string "unlisted" *> skip_spaces *> return `Drop_unlisted;
]
Expand All @@ -54,10 +57,10 @@ module Parsers = struct
);
string "search" *> skip_spaces *>
char ':' *> skip_spaces *>
any_string >>| (fun s -> (`Search s));
any_string_trimmed >>| (fun s -> (`Search s));
string "filter" *> skip_spaces *>
char ':' *> skip_spaces *>
any_string >>| (fun s -> (`Filter s));
any_string_trimmed >>| (fun s -> (`Filter s));
]
end

Expand Down

0 comments on commit e122a39

Please sign in to comment.