Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,20 +0,0 @@
with Ada.Text_IO;
procedure Program is
Comment_Characters : String := "#;";
begin
loop
declare
Line : String := Ada.Text_IO.Get_Line;
begin
exit when Line'Length = 0;
Outer_Loop : for I in Line'Range loop
for J in Comment_Characters'Range loop
if Comment_Characters(J) = Line(I) then
Ada.Text_IO.Put_Line(Line(Line'First .. I - 1));
exit Outer_Loop;
end if;
end loop;
end loop Outer_Loop;
end;
end loop;
end Program;

View file

@ -1,17 +0,0 @@
Dim $Line1 = "apples, pears # and bananas"
Dim $Line2 = "apples, pears ; and bananas"
_StripAtMarker($Line1)
_StripAtMarker($Line2)
Func _StripAtMarker($_Line, $sMarker='# ;')
Local $aMarker = StringSplit($sMarker, ' ')
Local $iPos
For $i = 1 To $aMarker[0]
$iPos = StringInStr($_Line, $aMarker[$i])
If $iPos Then
ConsoleWrite($_Line & @CRLF)
ConsoleWrite( StringStripWS( StringLeft($_Line, $iPos -1), 2) & @CRLF)
EndIf
Next
EndFunc ;==>_StripAtMarker

View file

@ -1,56 +0,0 @@
Dim $aLines[4] = _
[ _
"$a = $b + $c ; Comment line 1", _
"Dim $s1 = 'some text; tiled with semicolon', $s2 = 'another text; also tiled with semicolon' ; Comment line 2 - semicolon as part of assignment", _
"_SomeFunctionCall('string parameter with ;', $anotherParam) ; Comment line 3 - semicolon as part parameter in an function call", _
"Func _AnotherFunction($param1=';', $param2=';', $param3=';') ; Comment line 4 - semicolon as default value in parameter of a function headline" _
]
For $i = 0 To 3
ConsoleWrite('+> Line ' & $i+1 & ' full:' & @CRLF & '+>' & $aLines[$i] & @CRLF)
ConsoleWrite('!> without comment:' & @CRLF & '!>' & _LineStripComment($aLines[$i]) & @CRLF & @CRLF)
Next
Func _LineStripComment($_Line)
; == tile line by all included comment marker
Local $aPartsWithMarker = StringSplit($_Line, ';')
Local $sNoComment
; == if no comment marker: return full line
If $aPartsWithMarker[0] = 0 Then Return $_Line
; == check if string in part, if is'nt: following part(s) are comment
For $i = 1 To $aPartsWithMarker[0]
If Not StringRegExp($aPartsWithMarker[$i], "('|\x22)") Then
If $i = 1 Then
Return StringStripWS($aPartsWithMarker[$i], 2)
Else
Return StringStripWS($sNoComment & $aPartsWithMarker[$i], 2)
EndIf
Else
; == check if next leftside string delimiter has uneven count
Local $iLen = StringLen($aPartsWithMarker[$i])
Local $fDetectDelim = False, $sStringDelim, $iDelimCount, $sCurr
For $j = $iLen To 1 Step -1
$sCurr = StringMid($aPartsWithMarker[$i], $j, 1)
If Not $fDetectDelim Then
If $sCurr = "'" Or $sCurr = '"' Then
$sStringDelim = $sCurr
$iDelimCount += 1
$fDetectDelim = True
EndIf
Else
If $sCurr = $sStringDelim Then $iDelimCount += 1
EndIf
Next
If Mod($iDelimCount, 2) Then
; == uneven count: so it masks the comment marker
$sNoComment &= $aPartsWithMarker[$i] & ';'
Else
; == even count: all following is comment
Return StringStripWS($sNoComment & $aPartsWithMarker[$i], 2)
EndIf
EndIf
Next
EndFunc ;==>_LineStripComment

View file

@ -1,21 +0,0 @@
identification division.
program-id. StripComments.
data division.
working-storage section.
01 line-text pic x(64).
procedure division.
main.
move "apples, pears # and bananas" to line-text
perform show-striped-text
move "apples, pears ; and bananas" to line-text
perform show-striped-text
stop run
.
show-striped-text.
unstring line-text delimited by "#" or ";" into line-text
display quote, function trim(line-text), quote
.

View file

@ -1,5 +0,0 @@
(string-trim (string-trim-right " apples, pears # and bananas" "[#;].+"))
(string-trim (string-trim-right " apples, pears ; and bananas" "[#;].+"))
(string-trim (string-trim-right " apples, pears and bananas " "[#;].+"))

View file

@ -1,11 +0,0 @@
Function strip_comments(s,char)
If InStr(1,s,char) > 0 Then
arr = Split(s,char)
strip_comments = RTrim(arr(0))
Else
strip_comments = s
End If
End Function
WScript.StdOut.WriteLine strip_comments("apples, pears # and bananas","#")
WScript.StdOut.WriteLine strip_comments("apples, pears ; and bananas",";")