Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/local/bin/spar
|
||||
pragma annotate( summary, "stripcomment" )
|
||||
@( description, "The task is to remove text that follow any of a set of" )
|
||||
@( description, "comment markers, (in these examples either a hash or a" )
|
||||
@( description, "semicolon) from a string or input line." )
|
||||
@( see_also, "http://rosettacode.org/wiki/Strip_comments_from_a_string" )
|
||||
@( author, "Ken O. Burtch" );
|
||||
pragma license( unrestricted );
|
||||
|
||||
pragma restriction( no_external_commands );
|
||||
|
||||
procedure stripcomment is
|
||||
line : constant string := get_line;
|
||||
eol : natural := 0;
|
||||
ch : character;
|
||||
begin
|
||||
for i in 1..strings.length( line ) loop
|
||||
ch := strings.element( line, i );
|
||||
exit when ch = '#' or ch = ';';
|
||||
eol := i;
|
||||
end loop;
|
||||
if eol > 0 then
|
||||
? strings.trim( strings.slice( line, 1, eol ), trim_end.both );
|
||||
end if;
|
||||
end stripcomment;
|
||||
Loading…
Add table
Add a link
Reference in a new issue