Skip to content

Commit

Permalink
Merge pull request #480 from StephenWampler/master
Browse files Browse the repository at this point in the history
Fix UniDoc's handling of single-line compound expressions.
  • Loading branch information
Jafaral authored Sep 20, 2024
2 parents 776266e + 5d4e028 commit 999adae
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 999adae

Please sign in to comment.