Skip to content

Commit

Permalink
Fix UniDoc to handle single-line compound expressions. Also fixes bug…
Browse files Browse the repository at this point in the history
… in handleng continued csets and strings.

Signed-off-by: Steve Wampler <[email protected]>
  • Loading branch information
StephenWampler committed Sep 19, 2024
1 parent 776266e commit 5d4e028
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions uni/unidoc/UniFile.icn
Original file line number Diff line number Diff line change
Expand Up @@ -214,29 +214,35 @@ class UniFile : Object (iKeySet, uKeySet, oldTokens, buffer, line, fName,
}
else { # Hard cases, might have continuation

if =";" then { # Not so hard after all
setBuffer(tab(0))
if ="#" then { # Easy
line := buffer
clearBuffer()
return line
}

if ="#" then { # Also easy
line := buffer
if =";" then { # Not too hard
# (We're not going to care about anything
# else on the line...)
clearBuffer()
return line
}
if any('\'') then { l # Hard

if ="'" then { l # Harder
if not (line ||:= matchCSet()) then {
# Must be a continued cset!
setBuffer(buffer[1:-1] | "")
# (We're not going to care about anything
# else on the line...)
clearBuffer()
break
}
}

if any('"') then { # Hard
if ="\"" then { # Harder
if not (line ||:= matchString()) then {
# Must be a continued string!
setBuffer(buffer[1:-1] | "")
# (We're not going to care about anything
# else on the line...)
clearBuffer()
break
}
}
Expand All @@ -251,7 +257,6 @@ class UniFile : Object (iKeySet, uKeySet, oldTokens, buffer, line, fName,
if *buffer > 0 then {
line := buffer
clearBuffer()
line
}

end
Expand Down

0 comments on commit 5d4e028

Please sign in to comment.