diff --git a/Unix/cloc b/Unix/cloc index f10ae6d1..dc787d1a 100755 --- a/Unix/cloc +++ b/Unix/cloc @@ -10553,17 +10553,16 @@ sub set_constants { # {{{1 'Oracle Forms' => [ [ 'call_regexp_common' , 'C' ], ], 'Oracle Reports' => [ [ 'call_regexp_common' , 'C' ], ], 'Oracle PL/SQL' => [ - [ 'call_regexp_common' , 'PL/SQL' ], + # [ 'call_regexp_common' , 'PL/SQL' ], # bad results + [ 'call_regexp_common' , 'C' ], + [ 'remove_matches' , '^\s*--' ], + [ 'remove_inline' , '--.*$' ], ], 'Pascal' => [ [ 'remove_between_regex', '\{[^$]', '}' ], [ 'remove_between_general', '(*', '*)' ], [ 'remove_matches' , '^\s*//' ], ], -####'Pascal' => [ -#### [ 'call_regexp_common' , 'Pascal' ], -#### [ 'remove_matches' , '^\s*//' ], -#### ], 'Pascal/Puppet' => [ [ 'die' , ], ], # never called 'Puppet' => [ [ 'remove_matches' , '^\s*#' ], diff --git a/Unix/t/00_C.t b/Unix/t/00_C.t index ecfbe2b3..bef89894 100755 --- a/Unix/t/00_C.t +++ b/Unix/t/00_C.t @@ -816,11 +816,19 @@ my @Tests = ( 'ref' => '../tests/outputs/Rounds.scad.yaml', 'args' => '../tests/inputs/Rounds.scad', }, + { - 'name' => 'Oracle PL/SQL', + 'name' => 'Oracle PL/SQL 1', 'ref' => '../tests/outputs/bubs_tak_ard.prc.yaml', 'args' => '../tests/inputs/bubs_tak_ard.prc', }, + + { + 'name' => 'Oracle PL/SQL 2', + 'ref' => '../tests/outputs/issue_875.bdy.yaml', + 'args' => '../tests/inputs/issue_875.bdy', + }, + { 'name' => 'P4', 'ref' => '../tests/outputs/basic.p4.yaml', diff --git a/cloc b/cloc index 4a5df13c..78723864 100755 --- a/cloc +++ b/cloc @@ -10543,17 +10543,16 @@ sub set_constants { # {{{1 'Oracle Forms' => [ [ 'call_regexp_common' , 'C' ], ], 'Oracle Reports' => [ [ 'call_regexp_common' , 'C' ], ], 'Oracle PL/SQL' => [ - [ 'call_regexp_common' , 'PL/SQL' ], + # [ 'call_regexp_common' , 'PL/SQL' ], # bad results + [ 'call_regexp_common' , 'C' ], + [ 'remove_matches' , '^\s*--' ], + [ 'remove_inline' , '--.*$' ], ], 'Pascal' => [ [ 'remove_between_regex', '\{[^$]', '}' ], [ 'remove_between_general', '(*', '*)' ], [ 'remove_matches' , '^\s*//' ], ], -####'Pascal' => [ -#### [ 'call_regexp_common' , 'Pascal' ], -#### [ 'remove_matches' , '^\s*//' ], -#### ], 'Pascal/Puppet' => [ [ 'die' , ], ], # never called 'Puppet' => [ [ 'remove_matches' , '^\s*#' ], diff --git a/tests/inputs/issue_875.bdy b/tests/inputs/issue_875.bdy new file mode 100644 index 00000000..d77f936a --- /dev/null +++ b/tests/inputs/issue_875.bdy @@ -0,0 +1,26 @@ +/* + * bubble sort + */ +DECLARE + TYPE number_array IS VARRAY(100) OF NUMBER; + arr number_array := number_array(64, 34, 25, 12, 22, 11, 90); + n NUMBER := arr.COUNT; + i NUMBER := 0; + j NUMBER := 0; + temp NUMBER; +BEGIN + FOR i IN 1 .. (n - 1) LOOP -- outer + FOR j IN 1 .. (n - i - 1) LOOP -- inner + IF arr(j) > arr(j + 1) THEN + temp := arr(j); + arr(j) := arr(j + 1); + arr(j + 1) := temp; + END IF; + END LOOP; + END LOOP; + -- print + FOR i IN 1 .. n LOOP + DBMS_OUTPUT.PUT_LINE(arr(i)); + END LOOP; +END; +/ diff --git a/tests/outputs/issue_875.bdy.yaml b/tests/outputs/issue_875.bdy.yaml new file mode 100644 index 00000000..89cfc3cf --- /dev/null +++ b/tests/outputs/issue_875.bdy.yaml @@ -0,0 +1,21 @@ +--- +# github.com/AlDanial/cloc +header : + cloc_url : github.com/AlDanial/cloc + cloc_version : 2.03 + elapsed_seconds : 0.00424885749816895 + n_files : 1 + n_lines : 26 + files_per_second : 235.357387352 + lines_per_second : 6119.29207115201 + report_file : ../outputs/issue_875.bdy.yaml +'Oracle PL/SQL' : + nFiles: 1 + blank: 0 + comment: 4 + code: 22 +SUM: + blank: 0 + comment: 4 + code: 22 + nFiles: 1