Skip to content

Commit 9895377

Browse files
authored
Simplify and clarify AUTODOC_PositionElementIfNotAfter (#360)
1 parent 2697fd7 commit 9895377

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

gap/Parser.gi

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,28 +167,24 @@ InstallGlobalFunction( Scan_for_AutoDoc_Part,
167167
return AUTODOC_SplitCommandAndArgument( trimmed );
168168
end );
169169

170-
## Scans a string for <element> after <element_not_before_element> appeared.
170+
## Scans a string for <char> after <not_before_char> appeared.
171171
## This is necessary to scan the filter list for method declarations
172172
## that contain \[\].
173173
BindGlobal( "AUTODOC_PositionElementIfNotAfter",
174-
function( list, element, element_not_before_element )
175-
local current_pos;
176-
if not IsList( list ) then
177-
Error( "<list> must be a list" );
178-
fi;
179-
if Length( list ) > 0 and list[ 1 ] = element then
174+
function( str, char, not_before_char )
175+
local pos;
176+
if Length( str ) > 0 and str[ 1 ] = char then
180177
return 1;
181178
fi;
182179

183-
for current_pos in [ 2 .. Length( list ) ] do
184-
if list[ current_pos ] = element and list[ current_pos - 1 ] <> element_not_before_element then
185-
return current_pos;
180+
for pos in [ 2 .. Length( str ) ] do
181+
if str[ pos ] = char and str[ pos - 1 ] <> not_before_char then
182+
return pos;
186183
fi;
187184
od;
188185
return fail;
189186
end );
190187

191-
192188
##
193189
InstallGlobalFunction( AutoDoc_Type_Of_Item,
194190
function( current_item, type, default_chapter_data )

0 commit comments

Comments
 (0)