Skip to content

Commit

Permalink
Merge branch 'exp'
Browse files Browse the repository at this point in the history
  • Loading branch information
ShinobuAmasaki committed Aug 23, 2024
2 parents ed21ab2 + 1cc2cf5 commit 223d62d
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 48 deletions.
4 changes: 1 addition & 3 deletions src/forgex_cli/cli_cla_m.f90
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ end subroutine cla__init_find_subc
subroutine cla__init_find_match_subsubc(cla)
implicit none
class(cla_t), intent(inout) :: cla
integer :: idx

allocate(cla%sub_cmd%subc(NUM_SUBSUBC_MATCH))
cla%sub_cmd%subc(1) = ENGINE_LAZY_DFA
Expand Down Expand Up @@ -172,7 +171,6 @@ subroutine cla__do_debug_subc(cla)
use :: forgex_cli_debug_m
implicit none
class(cla_t), intent(inout) :: cla
logical :: is_exactly
integer :: pattern_offset

pattern_offset = 3
Expand Down Expand Up @@ -222,7 +220,7 @@ subroutine cla__do_find_subc(cla)
implicit none
class(cla_t), intent(inout) :: cla
logical :: is_exactly
integer :: i, pattern_offset
integer :: pattern_offset
character(:), allocatable :: text

pattern_offset = 4
Expand Down
20 changes: 11 additions & 9 deletions src/forgex_cli/cli_help_messages_m.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module forgex_cli_help_messages_m
public :: print_help_find_match_forgex_api

integer(int32), parameter :: LINE_SIZ = 128
integer(int32), parameter :: CMD_SIZ = 13
integer(int32), parameter :: CMD_SIZ = 26
integer(int32), parameter :: CMD_DESC_SIZ = 109

contains
Expand Down Expand Up @@ -155,9 +155,9 @@ subroutine print_help_debug_thompson

op(1) = "--verbose"
odesc(1) ="Print more information."
op(2) ="--no-table "
op(2) ="--no-table"
odesc(2) ="Suppresses the output of the property information table."
op(3) ="--table-only "
op(3) ="--table-only"
odesc(3) ="Print the property information table only."

call generate_and_output(header, usage, "OPTIONS", op, odesc)
Expand Down Expand Up @@ -205,18 +205,20 @@ subroutine print_help_find_match_lazy_dfa
implicit none
character(LINE_SIZ) :: header
character(LINE_SIZ) :: usage(2)
character(CMD_SIZ) :: op(3)
character(CMD_DESC_SIZ) :: odesc(3)
character(CMD_SIZ) :: op(4)
character(CMD_DESC_SIZ) :: odesc(4)
header = "Executes a search for matches using a lazy DFA regex engine."
usage(1) = "forgex-cli debug lazy-dfa <pattern> .match. <text>"
usage(2) = "forgex-cli debug lazy-dfa <pattern> .in. <text>"

op(1) = "--verbose"
odesc(1) = "Print more information."
op(2) = "--no-table"
odesc(2) = "Suppresses the output of the property information table."
odesc(2) = "Suppress the output of the property information table."
op(3) = "--table-only"
odesc(3) = "Print the property information table only. "
op(4) = "--disable-literal-optimize"
odesc(4) = "Disable literals search optimization."

call generate_and_output(header, usage, "OPTIONS", op, odesc)
end subroutine print_help_find_match_lazy_dfa
Expand All @@ -227,14 +229,14 @@ subroutine print_help_find_match_dense_dfa
character(LINE_SIZ) :: usage(2)
character(CMD_SIZ) :: op(3)
character(CMD_DESC_SIZ) :: odesc(3)
header = "Executes a search for matches using a fully-compiled DFA regex engine."
header = "Execute a search for matches using a fully-compiled DFA regex engine."
usage(1) = "forgex-cli find match dense <pattern> .match. <text>"
usage(2) = "forgex-cli find match dense <pattern> .in. <text>"

op(1) = "--verbose"
odesc(1) = "Print more information."
op(2) = "--no-table"
odesc(2) = "Suppresses the output of the property information table."
odesc(2) = "Suppress the output of the property information table."
op(3) = "--table-only"
odesc(3) = "Print the property information table only. "

Expand All @@ -252,7 +254,7 @@ subroutine print_help_find_match_forgex_api
usage(2) = "forgex-cli find match forgex <pattern> .in. <text>"

op(1) = "--no-table"
odesc(1) = "Suppresses the output of the property information table."
odesc(1) = "Suppress the output of the property information table."

call generate_and_output(header, usage, "OPTIONS", op, odesc)
end subroutine print_help_find_match_forgex_api
Expand Down
2 changes: 1 addition & 1 deletion src/syntax_tree_graph_m.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
module forgex_syntax_tree_graph_m
use :: forgex_parameters_m
use :: forgex_enums_m
use :: forgex_segment_m,
use :: forgex_segment_m
use :: forgex_syntax_tree_node_m, &
only: tree_node_t, tape_t, terminal, make_atom, make_tree_node, make_repeat_node
implicit none
Expand Down
70 changes: 35 additions & 35 deletions src/test_m.f90
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ module forgex_test_m
public :: is_valid__regex
public :: is_valid__prefix
public :: is_valid__suffix
public :: is_valid__middle
! public :: is_valid__middle
public :: runner_in
public :: runner_match
public :: runner_regex
public :: runner_prefix
public :: runner_suffix
public :: runner_middle
! public :: runner_middle


contains
Expand Down Expand Up @@ -118,26 +118,26 @@ function is_valid__suffix(pattern, expected_suffix) result(res)

end function is_valid__suffix

function is_valid__middle(pattern, expected, middle) result(res)
use :: forgex_syntax_tree_optimize_m
use :: forgex_utf8_m
implicit none
character(*), intent(in) :: pattern, expected
character(:), allocatable :: middle
logical :: res
! function is_valid__middle(pattern, expected, middle) result(res)
! use :: forgex_syntax_tree_optimize_m
! use :: forgex_utf8_m
! implicit none
! character(*), intent(in) :: pattern, expected
! character(:), allocatable :: middle
! logical :: res

character(:), allocatable :: resulting
type(tree_t) :: tree
! call tree%build(pattern)
! resulting = get_middle_literal(tree)
! middle = resulting
! if (len_utf8(expected) == len_utf8(resulting)) then
! res = expected == resulting
! return
! end if
! res = .false.
! ! character(:), allocatable :: resulting
! ! type(tree_t) :: tree
! ! ! call tree%build(pattern)
! ! ! resulting = get_middle_literal(tree)
! ! ! middle = resulting
! ! ! if (len_utf8(expected) == len_utf8(resulting)) then
! ! ! res = expected == resulting
! ! ! return
! ! ! end if
! ! ! res = .false.

end function is_valid__middle
! end function is_valid__middle



Expand Down Expand Up @@ -248,22 +248,22 @@ subroutine runner_suffix(pattern, suffix, result)
end subroutine runner_suffix


subroutine runner_middle(pattern, middle, result)
implicit none
character(*), intent(in) :: pattern, middle
logical, intent(inout) :: result
character(:),allocatable :: resulting
logical :: res
! subroutine runner_middle(pattern, middle, result)
! implicit none
! character(*), intent(in) :: pattern, middle
! logical, intent(inout) :: result
! character(:),allocatable :: resulting
! logical :: res

! res = is_valid__middle(pattern, middle, resulting)
! ! res = is_valid__middle(pattern, middle, resulting)

! if (res) then
! write(error_unit, '(a,a,a)') 'result(middle): Success', ' '//trim(pattern), ' "'//trim(middle)//'"'
! else
! write(error_unit, '(a,a,a a)') 'result(middle): FAILED ', ' '//trim(pattern), ': got "'//resulting//'"', &
! ', "'//trim(middle)//'" is expected.'
! end if
! result = result .and. res
end subroutine runner_middle
! ! if (res) then
! ! write(error_unit, '(a,a,a)') 'result(middle): Success', ' '//trim(pattern), ' "'//trim(middle)//'"'
! ! else
! ! write(error_unit, '(a,a,a a)') 'result(middle): FAILED ', ' '//trim(pattern), ': got "'//resulting//'"', &
! ! ', "'//trim(middle)//'" is expected.'
! ! end if
! ! result = result .and. res
! end subroutine runner_middle

end module forgex_test_m

0 comments on commit 223d62d

Please sign in to comment.