mirror of
https://github.com/comby-tools/comby.git
synced 2024-09-11 13:25:36 +03:00
Use generic matcher on unsupported extensions, and include base string delimiters for it
This commit is contained in:
parent
2a9d98b17b
commit
d2b23cd217
@ -7,7 +7,10 @@ module Syntax = struct
|
||||
; ("[", "]")
|
||||
]
|
||||
|
||||
let escapable_string_literals = []
|
||||
let escapable_string_literals =
|
||||
[ {|"|}
|
||||
; {|'|}
|
||||
]
|
||||
|
||||
let escape_char =
|
||||
'\\'
|
||||
|
@ -368,7 +368,7 @@ let base_command_parameters : (unit -> 'result) Command.Param.t =
|
||||
in
|
||||
|
||||
let matcher =
|
||||
let default = (module Matchers.C : Matchers.Matcher) in
|
||||
let default = (module Matchers.Generic : Matchers.Matcher) in
|
||||
match file_extensions with
|
||||
| None | Some [] -> default
|
||||
| Some (hd::_) ->
|
||||
|
@ -74,6 +74,19 @@ let%expect_test "with_rewrite_rule" =
|
||||
|> print_string;
|
||||
[%expect_exact {|hello|}]
|
||||
|
||||
let%expect_test "generic_matcher" =
|
||||
let source = {|\footnote{\small \url{https://github.com}}|} in
|
||||
let match_template = {|\footnote{\small :[1]}|} in
|
||||
let rewrite_template = {|\footnote{\scriptsize :[1]}|} in
|
||||
let command_args =
|
||||
Format.sprintf "-stdin '%s' '%s' -f .generic" match_template rewrite_template
|
||||
in
|
||||
let command = Format.sprintf "%s %s" binary_path command_args in
|
||||
read_source_from_stdin command source
|
||||
|> print_string;
|
||||
[%expect_exact {|\footnote{\scriptsize \url{https://github.com}}|}]
|
||||
|
||||
|
||||
let%expect_test "json_output_option" =
|
||||
let source = "a X c a Y c" in
|
||||
let match_template = "a :[1] c" in
|
||||
|
Loading…
Reference in New Issue
Block a user