Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
tokenize = iter (sep, esc: char, s: string) yields (string)
|
||||
escape: bool := false
|
||||
part: array[char] := array[char]$[]
|
||||
for c: char in string$chars(s) do
|
||||
if escape then
|
||||
escape := false
|
||||
array[char]$addh(part,c)
|
||||
elseif c=esc then
|
||||
escape := true
|
||||
elseif c=sep then
|
||||
yield(string$ac2s(part))
|
||||
part := array[char]$[]
|
||||
else
|
||||
array[char]$addh(part,c)
|
||||
end
|
||||
end
|
||||
yield(string$ac2s(part))
|
||||
end tokenize
|
||||
|
||||
start_up = proc ()
|
||||
po: stream := stream$primary_output()
|
||||
testcase: string := "one^|uno||three^^^^|four^^^|^quatro|"
|
||||
|
||||
for part: string in tokenize('|', '^', testcase) do
|
||||
stream$putl(po, "\"" || part || "\"")
|
||||
end
|
||||
end start_up
|
||||
Loading…
Add table
Add a link
Reference in a new issue