Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
38e02ab
Testing something
lwasylow Mar 9, 2026
461ad5d
Another test
lwasylow Mar 9, 2026
44f5495
Test
lwasylow Mar 9, 2026
b5f2dc7
Thats funny:)
lwasylow Mar 9, 2026
0dd7dba
that is rubbish
lwasylow Mar 9, 2026
4ea0fcb
revert test
lwasylow Mar 9, 2026
17604d8
Small tweaks
lwasylow Mar 9, 2026
5869f32
one at the time
lwasylow Mar 9, 2026
3f8d2cf
Move out outside
lwasylow Mar 9, 2026
37fae24
fix invalid locator
lwasylow Mar 9, 2026
5189955
revert
lwasylow Mar 9, 2026
5a21774
Changing a code to validate by lines instead of clobs for performance.
lwasylow Mar 14, 2026
39f5d64
Fixing loop syntax
lwasylow Mar 14, 2026
93ffb72
Merge branch 'develop' of https://github.com/utPLSQL/utPLSQL into fea…
lwasylow Mar 14, 2026
393cfec
Update code
lwasylow Mar 15, 2026
8d794f0
Update block
lwasylow Mar 15, 2026
a32e09d
Small fixes
lwasylow Mar 15, 2026
b2e914f
Update comment
lwasylow Mar 15, 2026
66de806
Introduce global variable
lwasylow Mar 15, 2026
f82a3b5
Cleanup
lwasylow Mar 15, 2026
934df67
Optimization fiurther
lwasylow Mar 15, 2026
65145c2
Trim spaces
lwasylow Mar 15, 2026
8105179
Added extra tests.
lwasylow Mar 15, 2026
cc491cf
Enhance annotation parser with new tests and source line handling fun…
lwasylow Mar 15, 2026
6717ad3
Add tests for Windows-style newlines and long procedure names in anno…
lwasylow Mar 15, 2026
6c513be
Fix regex extraction for procedure/function names and ensure ordered …
lwasylow Mar 15, 2026
46f3d12
Update tests
lwasylow Mar 15, 2026
81e1752
Refactor annotation parser tests and utility functions
lwasylow Mar 16, 2026
fecbcc1
Remove redundant parse_object_annotations function overloads and upda…
lwasylow Mar 16, 2026
2547b40
Update code to avoid
lwasylow Mar 17, 2026
40eb166
Enhance annotation processing by improving SQL text handling and addi…
lwasylow Mar 17, 2026
1cdeb9c
Refactor annotation processing and enhance line scanning functionalit…
lwasylow Mar 18, 2026
c4d0ab0
Remove redundant exception handling in build_annot_cache_for_sources …
lwasylow Mar 18, 2026
aa3bfe7
Refactor annotation patterns in ut_annotation_parser and remove unuse…
lwasylow Mar 18, 2026
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
Prev Previous commit
Next Next commit
Fixing loop syntax
  • Loading branch information
lwasylow committed Mar 14, 2026
commit 39f5d6474ac57706171cdc395aa0215555962555
27 changes: 14 additions & 13 deletions source/core/ut_utils.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ create or replace package body ut_utils is
end if;

-- Fast pre-scan: check if any /* exists at all if not, nothing to do — return source as-is
<<prescan>>
for i in 1 .. a_source.count loop
if instr(a_source(i), '/*') > 0 then
l_has_ml_comment := true;
Expand All @@ -697,20 +698,21 @@ create or replace package body ut_utils is
<<process_lines>>
for i in 1 .. a_source.count loop
l_line := a_source(i);
-- Fast path: currently inside a multi-line comment

-- Fast path: currently inside a multi-line comment, look only for closing */
if l_in_ml_comment then
l_ml_end := instr(l_line, '*/');
if l_ml_end > 0 then
l_in_ml_comment := false;
l_line := substr(l_line, l_ml_end + 2);
-- fall through to normal scan of remainder
-- fall through to normal scan of remainder of line, in case there are more /* comments on the same line
else
l_result(i) := '';
continue process_lines;
end if;
end if;

-- Fast path: no special tokens on this line at all
-- Fast path: no special tokens on this line at all, just copy it to result and move on
if instr(l_line, '/') = 0
and instr(l_line, '-') = 0
and instr(l_line, '''') = 0
Expand All @@ -719,7 +721,7 @@ create or replace package body ut_utils is
continue process_lines;
end if;

-- Normal scan: consume one token at a time, advance l_remaining
-- Normal scan: consume one token at a time, advance l_remaining until end of line
l_remaining := l_line;
l_line := null;

Expand All @@ -730,23 +732,23 @@ create or replace package body ut_utils is
l_ml_start := instr(l_remaining, '/*');
l_comment_start := instr(l_remaining, '--');
l_text_start := instr(l_remaining, '''');
-- only search for q' if ' was found — q' always contains '
-- only search for q' if ' was found — q' always contains ' and would be misidentified otherwise
l_eq_text_start := case when l_text_start > 0
then instr(l_remaining, 'q''')
else 0
end;

-- count how many tokens are present
-- count how many tokens are present to decide if we can skip LEAST/GREATEST and just use the one that is present
l_token_count := sign(l_ml_start) + sign(l_comment_start)
+ sign(l_text_start) + sign(l_eq_text_start);

-- no special tokens left — consume remainder and stop
-- no special tokens left — consume remainder and stop scanning this line
if l_token_count = 0 then
l_line := l_line || l_remaining;
exit scan_line;
end if;

-- only one token present — skip LEAST, use GREATEST to find it
-- only one token present — skip LEAST, use GREATEST to find it since 0 means not present and any positive value is a valid position
if l_token_count = 1 then
l_pos := greatest(l_ml_start, l_comment_start, l_text_start, l_eq_text_start);
else
Expand Down Expand Up @@ -777,7 +779,7 @@ create or replace package body ut_utils is
exit scan_line;
end if;

-- Multi-line comment: skip it, continue scanning remainder of line after comment end
-- Multi-line comment start: skip it, look for end of comment, continue scanning line after it
elsif l_pos = l_ml_start
and (l_comment_start = 0 or l_ml_start < l_comment_start)
and (l_text_start = 0 or l_ml_start < l_text_start)
Expand All @@ -792,7 +794,7 @@ create or replace package body ut_utils is
exit scan_line;
end if;

-- Single-line comment: keep it, stop scanning this line
-- Single-line comment: keep it, stop scanning this line since everything after -- is comment anyway
elsif l_pos = l_comment_start
and (l_ml_start = 0 or l_comment_start < l_ml_start)
and (l_text_start = 0 or l_comment_start < l_text_start)
Expand All @@ -801,7 +803,7 @@ create or replace package body ut_utils is
l_line := l_line || l_remaining;
exit scan_line;

-- Regular string literal: keep it, continue scanning remainder of line after closing quote
-- Regular string literal start: keep it, scan forward for closing quote, handle '' escaped quotes properly by skipping them and keep scanning
else
-- scan forward continuously to handle '' escaped quotes
l_end := l_text_start + 1;
Expand Down Expand Up @@ -833,7 +835,6 @@ create or replace package body ut_utils is
return l_result;
end replace_multiline_comments;


function replace_multiline_comments(a_source clob) return clob is
Comment thread
lwasylow marked this conversation as resolved.
Outdated
l_result clob;
l_ml_comment_start binary_integer := 1;
Expand Down Expand Up @@ -1201,4 +1202,4 @@ create or replace package body ut_utils is
end;

end ut_utils;
/
/
Loading